Skip to content

Commit

Permalink
Remove namespace create/delete privileges from Operator (#445)
Browse files Browse the repository at this point in the history
Also do not automatically create namespaces in
Operator plugin.

Fixes #441
  • Loading branch information
nitisht authored Feb 2, 2021
1 parent 20552ba commit 48ccec0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
6 changes: 0 additions & 6 deletions kubectl-minio/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,6 @@ func (o *deleteCmd) run() error {
if err := deleteConsoleResources(o.operatorOpts, extclient, dynclient, consoleResources); err != nil {
return err
}
// if the namespace is the default, we'll delete the namespace
if o.operatorOpts.Namespace == helpers.DefaultNamespace {
if err = client.CoreV1().Namespaces().Delete(context.Background(), o.operatorOpts.Namespace, metav1.DeleteOptions{}); err != nil {
return err
}
}
return nil
}

Expand Down
8 changes: 0 additions & 8 deletions kubectl-minio/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@ func (o *operatorInitCmd) run() error {
if err != nil {
return err
}
// if the namespace is the default, we'll create the namespace
if o.operatorOpts.Namespace == helpers.DefaultNamespace {
ns := corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: o.operatorOpts.Namespace}}
if _, err = client.CoreV1().Namespaces().Create(context.Background(), &ns, metav1.CreateOptions{}); err != nil {
return err
}
}

if err = createCRD(extclient, crdObj); err != nil {
return err
}
Expand Down
7 changes: 7 additions & 0 deletions operator-kustomize/cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ rules:
- ""
resources:
- namespaces
verbs:
- get
- watch
- list
- apiGroups:
- ""
resources:
- pods
- services
- events
Expand Down

0 comments on commit 48ccec0

Please sign in to comment.