Skip to content

Commit

Permalink
feat: support multiple Steadybit agents within a single Kubernetes cl…
Browse files Browse the repository at this point in the history
…uster connected to different Steadybit platforms
  • Loading branch information
Ben Blackmore committed Jul 20, 2022
1 parent 236604c commit 40b0505
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/steadybit-agent/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: steadybit-agent
description: steadybit Agent Helm chart for Kubernetes.
version: 0.6.5
version: 0.7.0
appVersion: latest
home: https://www.steadybit.com/
icon: https://steadybit-website-assets.s3.amazonaws.com/logo-symbol-transparent.png
Expand Down
13 changes: 13 additions & 0 deletions charts/steadybit-agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ Create the name of the service account to use.
{{- end -}}
{{- end -}}

{{/*
Create the name of the cluster role to use.
We cannot scope the cluster role natively via namespaces. So have have to do this by including the namespace name
within the cluster role's name. This in turn is necessary to support multiple steadybit agents per Kubernetes
cluster.
Also see https://stackoverflow.com/questions/64871199/kubernetes-clusterrole-with-namespace-is-allowed
*/}}
{{- define "steadybit-agent.clusterRoleName" -}}
{{- printf "%s-in-%s" (include "steadybit-agent.fullname" .) .Release.Namespace -}}
{{- end -}}
{{/*
Create PodSecurityPolicy to be used.
*/}}
Expand Down
2 changes: 1 addition & 1 deletion charts/steadybit-agent/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "steadybit-agent.fullname" . }}
name: {{ template "steadybit-agent.clusterRoleName" . }}
labels:
{{- include "steadybit-agent.commonLabels" . | nindent 4 }}
{{- range $key, $value := .Values.agent.extraLabels }}
Expand Down
4 changes: 2 additions & 2 deletions charts/steadybit-agent/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "steadybit-agent.fullname" . }}
name: {{ template "steadybit-agent.clusterRoleName" . }}
labels:
{{- include "steadybit-agent.commonLabels" . | nindent 4 }}
{{- range $key, $value := .Values.agent.extraLabels }}
Expand All @@ -14,6 +14,6 @@ subjects:
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ template "steadybit-agent.fullname" . }}
name: {{ template "steadybit-agent.clusterRoleName" . }}
apiGroup: rbac.authorization.k8s.io
{{- end -}}
1 change: 1 addition & 0 deletions charts/steadybit-agent/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "steadybit-agent.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "steadybit-agent.commonLabels" . | nindent 4 }}
{{- range $key, $value := .Values.agent.extraLabels }}
Expand Down

0 comments on commit 40b0505

Please sign in to comment.