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

add the option to add labels to mirrord user roles #124

Merged
merged 3 commits into from
Nov 22, 2024
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 mirrord-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.10.6
version: 1.11.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
6 changes: 6 additions & 0 deletions mirrord-operator/templates/cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ metadata:
name: mirrord-operator-user
labels:
{{- include "mirrord-operator.labels" . | nindent 4 }}
{{- if index .Values.clusterRole "mirrord-operator-user" "labels" }}
{{- toYaml (index .Values.clusterRole "mirrord-operator-user" "labels") | nindent 4 }}
{{- end }}
rules:
{{- include "mirrord-operator.rules" . | nindent 0 }}
{{- include "mirrord-operator.clusterRules" . | nindent 0 }}
Expand All @@ -166,5 +169,8 @@ metadata:
name: mirrord-operator-user-basic
labels:
{{- include "mirrord-operator.labels" . | nindent 4 }}
{{- if index .Values.clusterRole "mirrord-operator-user-basic" "labels" }}
{{- toYaml (index .Values.clusterRole "mirrord-operator-user-basic" "labels") | nindent 4 }}
{{- end }}
rules:
{{- include "mirrord-operator.clusterRules" . | nindent 0 }}
3 changes: 3 additions & 0 deletions mirrord-operator/templates/namespaced-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
namespace: {{.}}
labels:
{{- include "mirrord-operator.labels" $ | nindent 4 }}
{{- if index .Values.role "mirrord-operator-user" "labels" }}
{{- toYaml (index .Values.role "mirrord-operator-user" "labels") | nindent 4 }}
{{- end }}
rules:
{{- include "mirrord-operator.rules" . | nindent 0 }}
---
Expand Down
14 changes: 14 additions & 0 deletions mirrord-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ createNamespace: true
## and it can be bound via rolebinding (That you need to create yourself).
roleNamespaces: []

role:
# Note there's a cluster role version of it below.
mirrord-operator-user:
# add labels to the role, for i.e aggregate RBAC
labels: {}

clusterRole:
mirrord-operator-user-basic:
# add labels to the role, for i.e aggregate RBAC
labels: {}
mirrord-operator-user:
# add labels to the role, for i.e aggregate RBAC
labels: {}

operator:
image: ghcr.io/metalbear-co/operator
podAnnotations: {}
Expand Down
25 changes: 25 additions & 0 deletions test_values/operator_role_labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
license:
file:
secret: mirrord-operator-license
data:
license.pem: "DOESN'TNEEDTOBOOTSOITCANBEINVALID"

role:
# Note there's a cluster role version of it below.
mirrord-operator-user:
# add labels to the role, for i.e aggregate RBAC
labels:
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"

clusterRole:
mirrord-operator-user-basic:
# add labels to the role, for i.e aggregate RBAC
labels:
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
mirrord-operator-user:
# add labels to the role, for i.e aggregate RBAC
labels:
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"