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
3 changes: 1 addition & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ dockers:
image_templates:
- "ghcr.io/chainloop-dev/chainloop/control-plane:{{ .Tag }}"
- "ghcr.io/chainloop-dev/chainloop/control-plane:latest"
# Container image meant to perform migrations on the database at deployment time
- dockerfile: app/controlplane/Dockerfile.migrations
ids:
- control-plane
extra_files:
- app/controlplane/internal/data/ent/migrate/migrations
image_templates:
Expand Down
4 changes: 2 additions & 2 deletions deployment/chainloop/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ description: Chainloop is an open source software supply chain control plane, a

type: application
# Bump the patch (not minor, not major) version on each change in the Chart Source code
version: 1.7.0
version: 1.8.0
# Do not update appVersion, this is handled automatically by the release process
appVersion: v0.12.0
appVersion: v0.13.0

dependencies:
- name: common
Expand Down
18 changes: 17 additions & 1 deletion deployment/chainloop/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ Chainloop Controlplane Chart fullname
{{- define "chainloop.controlplane.name" -}}
{{- printf "%s-%s" (include "common.names.name" .) "controlplane" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*

{{/*
Common labels
*/}}
{{- define "chainloop.controlplane.labels" -}}
Expand All @@ -136,6 +136,15 @@ app.kubernetes.io/part-of: chainloop
app.kubernetes.io/component: controlplane
{{- end }}

{{/*
Migration labels
*/}}
{{- define "chainloop.controlplane.migration.labels" -}}
{{- include "common.labels.standard" . }}
app.kubernetes.io/part-of: chainloop
app.kubernetes.io/component: controlplane-migration
{{- end }}

{{/*
Selector labels
*/}}
Expand All @@ -162,6 +171,13 @@ Return the Postgresql connection string
{{- printf "postgresql://%s:%s@%s:%s/%s" (include "controlplane.database.user" .) (include "controlplane.database.escapedPassword" .) (include "controlplane.database.host" .) (include "controlplane.database.port" .) (include "controlplane.database.name" .) }}
{{- end -}}

{{/*
Return the Postgresql connection string for Atlas migration
*/}}
{{- define "controlplane.database.atlas_connection_string" -}}
{{- printf "postgres://%s:%s@%s:%s/%s?sslmode=disable" (include "controlplane.database.user" .) (include "controlplane.database.escapedPassword" .) (include "controlplane.database.host" .) (include "controlplane.database.port" .) (include "controlplane.database.name" .) }}
{{- end -}}

{{/*
Return the Postgresql hostname
*/}}
Expand Down
34 changes: 34 additions & 0 deletions deployment/chainloop/templates/controlplane/migrate-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "chainloop.controlplane.fullname" . }}-migrate
labels:
{{- include "chainloop.controlplane.migration.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": post-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
spec:
template:
metadata:
labels:
{{- include "chainloop.controlplane.migration.labels" . | nindent 8 }}
spec:
{{- with .Values.controlplane.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
restartPolicy: OnFailure
serviceAccountName: {{ include "controlplane.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.controlplane.podSecurityContext | nindent 8 }}
containers:
- name: migrate
image: "{{ .Values.controlplane.migration.image.repository }}:{{ .Values.controlplane.migration.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.controlplane.image.pullPolicy }}
args:
- migrate
- apply
- --url
- "{{include "controlplane.database.atlas_connection_string" . }}"
- --dir
- file:///migrations
8 changes: 8 additions & 0 deletions deployment/chainloop/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ controlplane:
# Overrides the image tag whose default is the chart appVersion.
# tag: latest

# Database migration
## @skip controlplane.migration
migration:
image:
repository: ghcr.io/chainloop-dev/chainloop/control-plane-migrations
# Overrides the image tag whose default is the chart appVersion.
# tag: latest

## @skip controlplane.serviceAccount
serviceAccount:
# Specifies whether a service account should be created
Expand Down