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

✨ kustomize: remove extraneous labels and rules, include editor/viewer roles #639

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
7 changes: 0 additions & 7 deletions config/e2e/manager_e2e_coverage_copy_pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ apiVersion: v1
kind: Pod
metadata:
name: e2e-coverage-copy-pod
labels:
app.kubernetes.io/name: e2e-coverage-copy-pod
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/component: e2e-coverage
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
spec:
restartPolicy: Never
securityContext:
Expand Down
14 changes: 1 addition & 13 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ kind: Namespace
metadata:
labels:
control-plane: controller-manager
app.kubernetes.io/name: namespace
app.kubernetes.io/instance: system
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/enforce-version: latest
name: system
Expand All @@ -22,12 +16,6 @@ metadata:
kubectl.kubernetes.io/default-logs-container: manager
labels:
control-plane: controller-manager
app.kubernetes.io/name: deployment
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
spec:
selector:
matchLabels:
Expand Down Expand Up @@ -102,4 +90,4 @@ spec:
terminationGracePeriodSeconds: 10
volumes:
- name: cache
emptyDir: {}
emptyDir: {}
6 changes: 0 additions & 6 deletions config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ kind: ServiceMonitor
metadata:
labels:
control-plane: controller-manager
app.kubernetes.io/name: servicemonitor
app.kubernetes.io/instance: controller-manager-metrics-monitor
app.kubernetes.io/component: metrics
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
name: controller-manager-metrics-monitor
namespace: system
spec:
Expand Down
7 changes: 0 additions & 7 deletions config/rbac/auth_proxy_client_clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: metrics-reader
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
name: metrics-reader
rules:
- nonResourceURLs:
Expand Down
7 changes: 0 additions & 7 deletions config/rbac/auth_proxy_role.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: proxy-role
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
name: proxy-role
rules:
- apiGroups:
Expand Down
7 changes: 0 additions & 7 deletions config/rbac/auth_proxy_role_binding.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/name: clusterrolebinding
app.kubernetes.io/instance: proxy-rolebinding
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
name: proxy-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
6 changes: 0 additions & 6 deletions config/rbac/auth_proxy_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ kind: Service
metadata:
labels:
control-plane: controller-manager
app.kubernetes.io/name: service
app.kubernetes.io/instance: controller-manager-metrics-service
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
name: controller-manager-metrics-service
namespace: system
spec:
Expand Down
13 changes: 0 additions & 13 deletions config/rbac/clusterextension_editor_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: clusterextension-editor-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
name: clusterextension-editor-role
rules:
- apiGroups:
Expand All @@ -23,9 +16,3 @@ rules:
- patch
- update
- watch
- apiGroups:
- olm.operatorframework.io
resources:
- clusterextensions/status
verbs:
- get
13 changes: 0 additions & 13 deletions config/rbac/clusterextension_viewer_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: clusterextension-viewer-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
name: clusterextension-viewer-role
rules:
- apiGroups:
Expand All @@ -19,9 +12,3 @@ rules:
- get
- list
- watch
- apiGroups:
- olm.operatorframework.io
resources:
- clusterextensions/status
verbs:
- get
8 changes: 8 additions & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ resources:
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml

# The following resources are pre-defined roles for editors and viewers
# of APIs provided by this project.
- clusterextension_editor_role.yaml
- clusterextension_viewer_role.yaml
- extension_editor_role.yaml
- extension_viewer_role.yaml

# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
Expand Down
7 changes: 0 additions & 7 deletions config/rbac/leader_election_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/name: role
app.kubernetes.io/instance: leader-election-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
name: leader-election-role
rules:
- apiGroups:
Expand Down
7 changes: 0 additions & 7 deletions config/rbac/leader_election_role_binding.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/name: rolebinding
app.kubernetes.io/instance: leader-election-rolebinding
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
name: leader-election-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
2 changes: 0 additions & 2 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ rules:
resources:
- clusterextensions/status
verbs:
- get
- patch
- update
- apiGroups:
Expand All @@ -74,6 +73,5 @@ rules:
resources:
- extensions/status
verbs:
- get
- patch
- update
7 changes: 0 additions & 7 deletions config/rbac/role_binding.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/name: clusterrolebinding
app.kubernetes.io/instance: manager-rolebinding
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
name: manager-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
Expand Down
7 changes: 0 additions & 7 deletions config/rbac/service_account.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: serviceaccount
app.kubernetes.io/instance: controller-manager-sa
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: operator-controller
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
name: controller-manager
namespace: system
6 changes: 0 additions & 6 deletions config/samples/olm_v1alpha1_clusterextension.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
apiVersion: olm.operatorframework.io/v1alpha1
kind: ClusterExtension
metadata:
labels:
app.kubernetes.io/name: clusterextension
app.kubernetes.io/instance: clusterextension-sample
app.kubernetes.io/part-of: operator-controller
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: operator-controller
name: clusterextension-sample
spec:
packageName: argocd-operator
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/clusterextension_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type ClusterExtensionReconciler struct {
}

//+kubebuilder:rbac:groups=olm.operatorframework.io,resources=clusterextensions,verbs=get;list;watch
//+kubebuilder:rbac:groups=olm.operatorframework.io,resources=clusterextensions/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=olm.operatorframework.io,resources=clusterextensions/status,verbs=update;patch
//+kubebuilder:rbac:groups=olm.operatorframework.io,resources=clusterextensions/finalizers,verbs=update

//+kubebuilder:rbac:groups=core.rukpak.io,resources=bundledeployments,verbs=get;list;watch;create;update;patch
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/extension_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type ExtensionReconciler struct {
}

//+kubebuilder:rbac:groups=olm.operatorframework.io,resources=extensions,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=olm.operatorframework.io,resources=extensions/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=olm.operatorframework.io,resources=extensions/status,verbs=update;patch
//+kubebuilder:rbac:groups=olm.operatorframework.io,resources=extensions/finalizers,verbs=update

// Reconcile is part of the main kubernetes reconciliation loop which aims to
Expand Down
Loading