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

viewer controller is now namespaced so no need for cluster role #1623

Merged
merged 2 commits into from
Jul 16, 2019
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
6 changes: 3 additions & 3 deletions backend/src/crd/controller/viewer/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (r *Reconciler) Reconcile(req reconcile.Request) (reconcile.Result, error)
}

// Check and maybe delete the oldest viewer before creating the next one.
if err := r.maybeDeleteOldestViewer(view.Spec.Type); err != nil {
if err := r.maybeDeleteOldestViewer(view.Spec.Type, view.Namespace); err != nil {
// Couldn't delete. Requeue.
return reconcile.Result{Requeue: true}, err
}
Expand Down Expand Up @@ -254,10 +254,10 @@ func serviceFrom(v *viewerV1beta1.Viewer, deploymentName string) *corev1.Service
}
}

func (r *Reconciler) maybeDeleteOldestViewer(t viewerV1beta1.ViewerType) error {
func (r *Reconciler) maybeDeleteOldestViewer(t viewerV1beta1.ViewerType, namespace string) error {
list := &viewerV1beta1.ViewerList{}

if err := r.Client.List(context.Background(), &client.ListOptions{}, list); err != nil {
if err := r.Client.List(context.Background(), &client.ListOptions{Namespace: namespace}, list); err != nil {
return fmt.Errorf("failed to list viewers: %v", err)
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/base/pipeline/ml-pipeline-viewer-crd-role.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
kind: Role
metadata:
name: ml-pipeline-viewer-controller-role
rules:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
kind: RoleBinding
metadata:
name: ml-pipeline-viewer-crd-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
kind: Role
name: ml-pipeline-viewer-controller-role
subjects:
- kind: ServiceAccount
Expand Down
8 changes: 5 additions & 3 deletions manifests/namespaced-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,10 @@ rules:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
kind: Role
metadata:
name: ml-pipeline-viewer-controller-role
namespace: kubeflow
rules:
- apiGroups:
- '*'
Expand Down Expand Up @@ -495,12 +496,13 @@ subjects:
namespace: kubeflow
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
kind: RoleBinding
metadata:
name: ml-pipeline-viewer-crd-binding
namespace: kubeflow
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
kind: Role
name: ml-pipeline-viewer-controller-role
subjects:
- kind: ServiceAccount
Expand Down