Skip to content

Commit

Permalink
Option to disable the default creation of RBAC resources
Browse files Browse the repository at this point in the history
  • Loading branch information
savitaashture committed Sep 28, 2021
1 parent b925224 commit f0e81ec
Show file tree
Hide file tree
Showing 6 changed files with 350 additions and 19 deletions.
4 changes: 2 additions & 2 deletions pkg/apis/operator/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func (c *CommonSpec) GetTargetNamespace() string {

// Param declares an string value to use for the parameter called name.
type Param struct {
Name string `json:"name"`
Value string `json:"value"`
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
}

// ParamValue defines a default value and possible values for a param
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/operator/v1alpha1/tektonconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ type TektonConfigSpec struct {
// Dashboard holds the customizable options for dashboards component
// +optional
Dashboard Dashboard `json:"dashboard,omitempty"`
// Params is the list of params passed for all platforms
// +optional
Params []Param `json:"params,omitempty"`
}

// TektonConfigStatus defines the observed state of TektonConfig
Expand All @@ -97,6 +100,10 @@ type TektonConfigStatus struct {
// The version of the installed release
// +optional
Version string `json:"version,omitempty"`

// The current installer set name
// +optional
TektonInstallerSet map[string]string `json:"tektonInstallerSet,omitempty"`
}

// TektonConfigList contains a list of TektonConfig
Expand Down
12 changes: 12 additions & 0 deletions pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions pkg/reconciler/openshift/tektonconfig/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ func (oe openshiftExtension) PreReconcile(ctx context.Context, tc v1alpha1.Tekto
}

r := rbac{
kubeClientSet: oe.kubeClientSet,
operatorClientSet: oe.operatorClientSet,
ownerRef: configOwnerRef(tc),
version: os.Getenv(versionKey),
kubeClientSet: oe.kubeClientSet,
operatorClientSet: oe.operatorClientSet,
version: os.Getenv(versionKey),
disableRbacResourcesForOpenshift: config.Spec.Params,
tektonConfig: config,
}
return r.createResources(ctx)
}
Expand Down Expand Up @@ -103,6 +104,6 @@ func (oe openshiftExtension) Finalize(ctx context.Context, comp v1alpha1.TektonC
}

// configOwnerRef returns owner reference pointing to passed instance
func configOwnerRef(tc v1alpha1.TektonComponent) metav1.OwnerReference {
return *metav1.NewControllerRef(tc, tc.GroupVersionKind())
func configOwnerRef(tc v1alpha1.TektonInstallerSet) metav1.OwnerReference {
return *metav1.NewControllerRef(&tc, tc.GetGroupVersionKind())
}
Loading

0 comments on commit f0e81ec

Please sign in to comment.