Skip to content

Commit

Permalink
Allow ServiceAccounts to be passed in to the chart (#1396)
Browse files Browse the repository at this point in the history
  • Loading branch information
evankanderson authored Nov 2, 2023
1 parent 8907c4d commit 2547b53
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deployment/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
annotations:
{{ include "common.annotations.pods" (dict "customAnnotationsPods" .Values.commonAnnotationsPods "context" $ ) | nindent 8 }}
spec:
serviceAccountName: mediator
serviceAccountName: {{ .Values.serviceAccounts.server | default "mediator" }}
containers:
- name: mediator
# restricted security context:
Expand Down
4 changes: 3 additions & 1 deletion deployment/helm/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# We need a separate service account for the db-update job, because
# it runs as a helm pre-install hook, and the mediator service account
# won't have been installed at that point.
{{ if eq .Values.serviceAccounts.migrate "" }}
apiVersion: v1
kind: ServiceAccount
metadata:
Expand All @@ -27,6 +28,7 @@ metadata:
{{ include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
imagePullSecrets:
- name: mediator-pull-secret
{{ end }}
---
apiVersion: v1
kind: ConfigMap
Expand Down Expand Up @@ -69,7 +71,7 @@ spec:
labels:
app: db-init
spec:
serviceAccountName: db-update
serviceAccountName: {{ .Values.serviceAccounts.migrate | default "db-update" }}
restartPolicy: Never
containers:
- name: mediator-dbinit
Expand Down
2 changes: 2 additions & 0 deletions deployment/helm/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{ if eq .Values.serviceAccounts.server "" }}
apiVersion: v1
kind: ServiceAccount
metadata:
Expand All @@ -22,3 +23,4 @@ metadata:
eks.amazonaws.com/role-arn: "arn:aws:iam::{{ .Values.aws.accountID }}:role/{{ .Values.aws.server.iamRole }}"
imagePullSecrets:
- name: mediator-pull-secret
{{ end }}
7 changes: 7 additions & 0 deletions deployment/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ hostname: "mediator.example.com"
db:
host: "postgres.postgres"

# NOTE: we are migrating from AWS-specific annotations to a "pre-create the service account" model.
# If serviceAccounts.migrate or serviceAccount.server are set, these values will be ignored.
aws:
accountID: "123456789012"
migrate:
iamRole: "mediator_migrate_role"
server:
iamRole: "mediator_server_role"

serviceAccounts:
# If non-empty, mediator will use the named ServiceAccount resources rather than creating a ServiceAccount
migrate: ""
server: ""

migrationSettings:
image: ko://github.com/stacklok/mediator/cmd/server
imagePullPolicy: "IfNotPresent"
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/understand/providers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Minder providers
sidebar_position: 20
sidebar_position: 10
---

# Providers in Minder
Expand Down

0 comments on commit 2547b53

Please sign in to comment.