Skip to content
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
4 changes: 2 additions & 2 deletions charts/health-check-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: health-check-operator
description: A Helm chart for deploying the Health Check Operator.
type: application
version: 0.4.1
appVersion: "0.4.1"
version: 0.4.2
appVersion: "0.4.2"
11 changes: 11 additions & 0 deletions charts/health-check-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ Metrics service name. Keep this short enough for Kubernetes' 63-character DNS la
{{- printf "%s-metrics" (include "health-check-operator.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Suffix for cluster-scoped RBAC resources. Namespace-scoped releases share the
cluster with other releases of this chart, so the release namespace is appended
to keep the cluster-wide names unique per installation.
*/}}
{{- define "health-check-operator.clusterRBACSuffix" -}}
{{- if not .Values.clusterScoped -}}
{{- printf "-%s" .Release.Namespace -}}
{{- end -}}
{{- end -}}

{{/*
Container port derived from the health probe bind address, so the two cannot drift apart.
*/}}
Expand Down
10 changes: 6 additions & 4 deletions charts/health-check-operator/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ subjects:
name: {{ include "health-check-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- if and .Values.metrics.enabled .Values.metrics.secure .Values.rbac.metricsAuth.enabled }}
{{- /* TokenReview/SubjectAccessReview and nonResourceURLs only exist cluster-scoped,
so these stay ClusterRoles even for namespace-scoped releases. */}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "health-check-operator.fullname" . }}-metrics-auth-role
name: {{ include "health-check-operator.fullname" . }}-metrics-auth-role{{ include "health-check-operator.clusterRBACSuffix" . }}
labels:
{{- include "health-check-operator.labels" . | nindent 4 }}
rules:
Expand All @@ -160,13 +162,13 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "health-check-operator.fullname" . }}-metrics-auth-rolebinding
name: {{ include "health-check-operator.fullname" . }}-metrics-auth-rolebinding{{ include "health-check-operator.clusterRBACSuffix" . }}
labels:
{{- include "health-check-operator.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "health-check-operator.fullname" . }}-metrics-auth-role
name: {{ include "health-check-operator.fullname" . }}-metrics-auth-role{{ include "health-check-operator.clusterRBACSuffix" . }}
subjects:
- kind: ServiceAccount
name: {{ include "health-check-operator.serviceAccountName" . }}
Expand All @@ -175,7 +177,7 @@ subjects:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "health-check-operator.fullname" . }}-metrics-reader
name: {{ include "health-check-operator.fullname" . }}-metrics-reader{{ include "health-check-operator.clusterRBACSuffix" . }}
labels:
{{- include "health-check-operator.labels" . | nindent 4 }}
rules:
Expand Down
6 changes: 4 additions & 2 deletions charts/health-check-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ crds:

# When false (default), the operator only watches its own namespace: the
# Deployment sets WATCH_NAMESPACE to the release namespace and RBAC is rendered
# as a namespace-scoped Role/RoleBinding. Set to true to watch all namespaces,
# which renders a ClusterRole/ClusterRoleBinding instead.
# as a namespace-scoped Role/RoleBinding. The metrics RBAC objects must stay
# cluster-scoped, so their names get the release namespace appended to keep
# multiple installations on one cluster from colliding. Set to true to watch
# all namespaces, which renders a ClusterRole/ClusterRoleBinding instead.
clusterScoped: false

serviceAccount:
Expand Down
Loading