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

Allow overriding image names and make migrations role creation optional #306

Merged
merged 2 commits into from
Aug 26, 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
4 changes: 2 additions & 2 deletions deploy/deduplication-db-migrations/chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ description: |
A Helm chart for Kubernetes containing the dracon migrations needed for the deduplication component to run.
Please check the documentation for more information here: https://github.com/ocurity/dracon/blob/main/docs/migrations.md
type: application
version: 0.23.0
appVersion: v0.23.0
version: 0.34.0
appVersion: v0.34.0
14 changes: 14 additions & 0 deletions deploy/deduplication-db-migrations/chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,17 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}


{{/*
Create the name of the service account to use
*/}}

{{- define "deduplication_db_migrations.imageName" -}}
{{- if .Values.deduplication_db_migrations.image.repository }}
ptzianos marked this conversation as resolved.
Show resolved Hide resolved
{{- printf "%s:%s" .Values.deduplication_db_migrations.image.repository (.Values.image.tag | default .Chart.AppVersion )}}
{{- else }}
{{- printf "%s/%s:%s" (.Values.image.registry | default "ghcr.io/ocurity/dracon") "draconctl" (.Values.image.tag | default .Chart.AppVersion )}}
{{- end }}
{{- end }}

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
containers:
- name: deduplication-db-migrations
# image.tag is set because you can't do helm upgrade and set the chart AppVersion manually
image: "{{ default "ghcr.io/ocurity/dracon" .Values.image.registry }}/draconctl:{{ default .Chart.AppVersion .Values.image.tag }}"
image: "{{ include "deduplication_db_migrations.imageName" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: DRACONCTL_MIGRATIONS_PATH
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.create_role }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
Expand All @@ -14,3 +15,4 @@ rules:
- create
- delete
- update
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.create_role }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
Expand All @@ -9,3 +10,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ include "deduplication_db_migrations.fullname" . }}
{{ end }}
6 changes: 5 additions & 1 deletion deploy/deduplication-db-migrations/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@

# image to use for applying the migrations
image:
# registry to use for all
# registry to use for all
registry: ""
pullPolicy: Always

# repository is an alternative to image, it overrides both the registry and the name of the image
repository: ""

serviceAccount:
create: false

create_role: true
enabled: true
resources: {}