diff --git a/charts/posthog/templates/clickhouse-operator/clusterrole.yaml b/charts/posthog/templates/clickhouse-operator/role.yaml similarity index 97% rename from charts/posthog/templates/clickhouse-operator/clusterrole.yaml rename to charts/posthog/templates/clickhouse-operator/role.yaml index e59a9eeb7..7be247599 100644 --- a/charts/posthog/templates/clickhouse-operator/clusterrole.yaml +++ b/charts/posthog/templates/clickhouse-operator/role.yaml @@ -3,13 +3,13 @@ # # NAMESPACE={{ .Values.clickhouse.namespace | default .Release.Namespace }} # COMMENT=# -# ROLE_KIND=ClusterRole +# ROLE_KIND=Role # ROLE_NAME=clickhouse-operator-{{ .Values.clickhouse.namespace | default .Release.Namespace }} -# ROLE_BINDING_KIND=ClusterRoleBinding +# ROLE_BINDING_KIND=RoleBinding # ROLE_BINDING_NAME=clickhouse-operator-{{ .Values.clickhouse.namespace | default .Release.Namespace }} # apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole +kind: Role metadata: name: clickhouse-operator-{{ .Values.clickhouse.namespace | default .Release.Namespace }} namespace: {{ .Values.clickhouse.namespace | default .Release.Namespace }} diff --git a/charts/posthog/templates/clickhouse-operator/clusterrolebinding.yaml b/charts/posthog/templates/clickhouse-operator/rolebinding.yaml similarity index 77% rename from charts/posthog/templates/clickhouse-operator/clusterrolebinding.yaml rename to charts/posthog/templates/clickhouse-operator/rolebinding.yaml index b8586d209..b1d9ddf79 100644 --- a/charts/posthog/templates/clickhouse-operator/clusterrolebinding.yaml +++ b/charts/posthog/templates/clickhouse-operator/rolebinding.yaml @@ -1,8 +1,7 @@ {{- if .Values.clickhouse.enabled }} -# Setup ClusterRoleBinding between ClusterRole and ServiceAccount. -# ClusterRoleBinding is namespace-less and must have unique name +# Setup RoleBinding between Role and ServiceAccount. apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding +kind: RoleBinding metadata: name: clickhouse-operator-{{ .Values.clickhouse.namespace | default .Release.Namespace }} namespace: {{ .Values.clickhouse.namespace | default .Release.Namespace }} @@ -10,7 +9,7 @@ metadata: clickhouse.altinity.com/chop: 0.18.4 roleRef: apiGroup: rbac.authorization.k8s.io - kind: ClusterRole + kind: Role name: clickhouse-operator-{{ .Values.clickhouse.namespace | default .Release.Namespace }} subjects: - kind: ServiceAccount diff --git a/charts/posthog/tests/clickhouse-operator/__snapshot__/clusterrole.yaml.snap b/charts/posthog/tests/clickhouse-operator/__snapshot__/role.yaml.snap similarity index 99% rename from charts/posthog/tests/clickhouse-operator/__snapshot__/clusterrole.yaml.snap rename to charts/posthog/tests/clickhouse-operator/__snapshot__/role.yaml.snap index 460cef6e0..54c586e80 100644 --- a/charts/posthog/tests/clickhouse-operator/__snapshot__/clusterrole.yaml.snap +++ b/charts/posthog/tests/clickhouse-operator/__snapshot__/role.yaml.snap @@ -1,7 +1,7 @@ the manifest should match the snapshot when using default values: 1: | apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRole + kind: Role metadata: labels: clickhouse.altinity.com/chop: 0.18.4 diff --git a/charts/posthog/tests/clickhouse-operator/__snapshot__/clusterrolebinding.yaml.snap b/charts/posthog/tests/clickhouse-operator/__snapshot__/rolebinding.yaml.snap similarity index 89% rename from charts/posthog/tests/clickhouse-operator/__snapshot__/clusterrolebinding.yaml.snap rename to charts/posthog/tests/clickhouse-operator/__snapshot__/rolebinding.yaml.snap index 47377c592..f31714037 100644 --- a/charts/posthog/tests/clickhouse-operator/__snapshot__/clusterrolebinding.yaml.snap +++ b/charts/posthog/tests/clickhouse-operator/__snapshot__/rolebinding.yaml.snap @@ -1,7 +1,7 @@ the manifest should match the snapshot when using default values: 1: | apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRoleBinding + kind: RoleBinding metadata: labels: clickhouse.altinity.com/chop: 0.18.4 @@ -9,7 +9,7 @@ the manifest should match the snapshot when using default values: namespace: NAMESPACE roleRef: apiGroup: rbac.authorization.k8s.io - kind: ClusterRole + kind: Role name: clickhouse-operator-NAMESPACE subjects: - kind: ServiceAccount diff --git a/charts/posthog/tests/clickhouse-operator/clusterrole.yaml b/charts/posthog/tests/clickhouse-operator/role.yaml similarity index 71% rename from charts/posthog/tests/clickhouse-operator/clusterrole.yaml rename to charts/posthog/tests/clickhouse-operator/role.yaml index 9c96a080f..e3c7e9516 100644 --- a/charts/posthog/tests/clickhouse-operator/clusterrole.yaml +++ b/charts/posthog/tests/clickhouse-operator/role.yaml @@ -1,6 +1,6 @@ -suite: ClickHouse cluster role definition +suite: ClickHouse role definition templates: - - templates/clickhouse-operator/clusterrole.yaml + - templates/clickhouse-operator/role.yaml tests: - it: should be empty if clickhouse.enabled is set to false @@ -16,7 +16,7 @@ tests: count: 1 - matchSnapshot: {} - - it: ClusterRole/clickhouse-operator-posthog metadata.namespace override via clickhouse.namespace should work + - it: Role/clickhouse-operator-posthog metadata.namespace override via clickhouse.namespace should work set: clickhouse.namespace: "custom-namespace" documentIndex: 0 @@ -27,7 +27,7 @@ tests: path: metadata.namespace value: custom-namespace - - it: ClusterRole/clickhouse-operator-posthog metadata.namespace override via Release.Namespace should work + - it: Role/clickhouse-operator-posthog metadata.namespace override via Release.Namespace should work release: namespace: custom-namespace-from-release documentIndex: 0 diff --git a/charts/posthog/tests/clickhouse-operator/clusterrolebinding.yaml b/charts/posthog/tests/clickhouse-operator/rolebinding.yaml similarity index 67% rename from charts/posthog/tests/clickhouse-operator/clusterrolebinding.yaml rename to charts/posthog/tests/clickhouse-operator/rolebinding.yaml index b16908c2d..ee7ce5b79 100644 --- a/charts/posthog/tests/clickhouse-operator/clusterrolebinding.yaml +++ b/charts/posthog/tests/clickhouse-operator/rolebinding.yaml @@ -1,6 +1,6 @@ -suite: ClickHouse cluster role binding definition +suite: ClickHouse role binding definition templates: - - templates/clickhouse-operator/clusterrolebinding.yaml + - templates/clickhouse-operator/rolebinding.yaml tests: - it: should be empty if clickhouse.enabled is set to false @@ -16,7 +16,7 @@ tests: count: 1 - matchSnapshot: {} - - it: ClusterRoleBinding/clickhouse-operator-posthog metadata.namespace override via clickhouse.namespace should work + - it: RoleBinding/clickhouse-operator-posthog metadata.namespace override via clickhouse.namespace should work set: clickhouse.namespace: "custom-namespace" documentIndex: 0 @@ -27,7 +27,7 @@ tests: path: metadata.namespace value: custom-namespace - - it: ClusterRoleBinding/clickhouse-operator-posthog metadata.namespace override via Release.Namespace should work + - it: RoleBinding/clickhouse-operator-posthog metadata.namespace override via Release.Namespace should work release: namespace: custom-namespace-from-release documentIndex: 0 @@ -38,7 +38,7 @@ tests: path: metadata.namespace value: custom-namespace-from-release - - it: ClusterRoleBinding/clickhouse-operator-posthog subjects[0].namespace override via clickhouse.namespace should work + - it: RoleBinding/clickhouse-operator-posthog subjects[0].namespace override via clickhouse.namespace should work set: clickhouse.namespace: "custom-namespace" documentIndex: 0 @@ -49,7 +49,7 @@ tests: path: subjects[0].namespace value: custom-namespace - - it: ClusterRoleBinding/clickhouse-operator-posthog subjects[0].namespace override via Release.Namespace should work + - it: RoleBinding/clickhouse-operator-posthog subjects[0].namespace override via Release.Namespace should work release: namespace: custom-namespace-from-release documentIndex: 0