Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RBAC: revert the scope of operator to clusterwide #360

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helm/habitat-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Parameter | Description | Default
`nodeSelector` | Node labels for pod assignment | `{}`
`rbacEnable` | If true, create & use RBAC resources | `true`
`resources` | Pod resource requests & limits | `{}`
`operatorNamespaced` | If this operator should run scoped to Single namespace | `true`
`operatorNamespaced` | If this operator should run scoped to Single namespace | `false`
`namespace` | Namespace this operator should run inside | `habitat-operator`

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
Expand Down
2 changes: 1 addition & 1 deletion helm/habitat-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ nodeSelector: {}
rbacEnable: true

## Decide if habitat-operator runs at cluster or namespaced scope
operatorNamespaced: true
operatorNamespaced: false
namespace: habitat-operator

## Habitat-operator resource limits & requests
Expand Down
6 changes: 3 additions & 3 deletions test/sync/rbac/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ func extractRulesFromHelm(path string, isItClusterRole bool) ([]rbacv1.PolicyRul
return nil, errors.Wrapf(err, "loading chart %s failed", path)
}

// make sure that the ClusterRole is generated
if isItClusterRole {
chart.Values.Raw = strings.Replace(chart.Values.Raw, "operatorNamespaced: true", "operatorNamespaced: false", 1)
// If it is Role then we need to replace the value of `operatorNamespaced` to true
if !isItClusterRole {
chart.Values.Raw = strings.Replace(chart.Values.Raw, "operatorNamespaced: false", "operatorNamespaced: true", 1)
}

renderedFiles, err := renderutil.Render(chart, chart.Values, renderutil.Options{})
Expand Down