Skip to content

Commit

Permalink
RBAC: revert the scope of operator to clusterwide
Browse files Browse the repository at this point in the history
This commit defaults the operator to run clusterwide by default. This
makes the operation of the operator to default as it was before the
RBAC was added.

Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
  • Loading branch information
surajssd committed Sep 14, 2018
1 parent bf94c75 commit be078eb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
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

0 comments on commit be078eb

Please sign in to comment.