From 9ccb59d24260a2d232565a5cd0f0ded0f9ab0eeb Mon Sep 17 00:00:00 2001 From: Sebastian Florek Date: Thu, 23 Jan 2025 14:02:15 +0100 Subject: [PATCH] update osartifact chart --- .github/workflows/osbuilder-chart.yml | 2 +- charts/osartifact/Chart.yaml | 2 +- charts/osartifact/templates/osartifact.yaml | 34 ++++++++------------- charts/osartifact/templates/secret.yaml | 19 +++++++++++- charts/osartifact/values.yaml | 26 ++++++++++++++-- 5 files changed, 55 insertions(+), 28 deletions(-) diff --git a/.github/workflows/osbuilder-chart.yml b/.github/workflows/osbuilder-chart.yml index f37cc23..29b8072 100644 --- a/.github/workflows/osbuilder-chart.yml +++ b/.github/workflows/osbuilder-chart.yml @@ -1,7 +1,7 @@ name: Publish OS Builder Chart on: - workflow_dispatch: + workflow_dispatch: push: paths: - charts/osbuilder diff --git a/charts/osartifact/Chart.yaml b/charts/osartifact/Chart.yaml index 1b2698f..6ad1f7e 100644 --- a/charts/osartifact/Chart.yaml +++ b/charts/osartifact/Chart.yaml @@ -5,4 +5,4 @@ maintainers: - name: Plural email: support@plural.sh type: application -version: 0.3.0 \ No newline at end of file +version: 0.4.0 \ No newline at end of file diff --git a/charts/osartifact/templates/osartifact.yaml b/charts/osartifact/templates/osartifact.yaml index 956973c..ac54eeb 100644 --- a/charts/osartifact/templates/osartifact.yaml +++ b/charts/osartifact/templates/osartifact.yaml @@ -1,7 +1,8 @@ apiVersion: build.kairos.io/v1alpha2 kind: OSArtifact metadata: - name: '{{ include "osartifact.fullname" . }}' + name: {{ include "osartifact.fullname" . }} + namespace: {{ .Release.Namespace }} spec: imageName: {{ .Values.image }} iso: true @@ -19,24 +20,13 @@ spec: {{ $key }}: {{ $value }} {{- end }} cloudConfigRef: - name: '{{ include "osartifact.fullname" . }}-cloud-config' - key: 'cloud-config.yaml' - exporters: - - template: - spec: - restartPolicy: Never - containers: - - name: upload - image: quay.io/curl/curl - command: - - /bin/sh - args: - - -c - - | - for f in $(ls /artifacts) - do - curl -T /artifacts/$f http://osartifactbuilder-operator-osbuilder-nginx/upload/$f - done - volumeMounts: - - name: artifacts - mountPath: /artifacts + name: {{ include "osartifact.fullname" . }}-config + key: cloud-config.yaml + outputImage: + registry: {{ .Values.exporter.registry }} + repository: {{ .Values.exporter.repository }} + tag: {{ .Values.exporter.tag }} + username: {{ .Values.exporter.username }} + passwordSecretKeyRef: + name: {{ .Values.exporter.configSecret.name | default (printf "%s-%s" (include "osartifact.fullname" .) "config") }} + key: {{ .Values.exporter.configSecret.key }} diff --git a/charts/osartifact/templates/secret.yaml b/charts/osartifact/templates/secret.yaml index 1dfee54..f6436c6 100644 --- a/charts/osartifact/templates/secret.yaml +++ b/charts/osartifact/templates/secret.yaml @@ -5,11 +5,18 @@ {{ $token := index $tokenSecret.data .Values.tokenSecret.key | b64dec }} {{ $password := index $passwordSecret.data .Values.passwordSecret.key | b64dec }} +{{ $dockerUserPassword := "" }} + +{{- if .Values.exporter.passwordSecret.name }} + {{ $dockerUserPasswordSecret := (lookup "v1" "Secret" .Release.Namespace .Values.exporter.passwordSecret.name )}} + {{ $dockerUserPassword = index $passwordSecret.data .Values.exporter.passwordSecret.key | b64dec }} +{{- end }} kind: Secret apiVersion: v1 metadata: - name: '{{ include "osartifact.fullname" . }}-cloud-config' + name: {{ include "osartifact.fullname" . }}-config + namespace: {{ .Release.Namespace }} stringData: cloud-config.yaml: | #cloud-config @@ -80,4 +87,14 @@ stringData: {{ .Values.extraCloudConfig | toYaml | nindent 4 }} {{- end }} + {{- if $dockerUserPassword }} + config.json: | + { + "auths": { + "{{ .Values.exporter.registry }}": { + "auth": {{ printf "%s:%s" .Values.exporter.username $dockerUserPassword | b64enc }} + } + } + } + {{- end }} {{- end}} \ No newline at end of file diff --git a/charts/osartifact/values.yaml b/charts/osartifact/values.yaml index 423e1c1..8d6b094 100644 --- a/charts/osartifact/values.yaml +++ b/charts/osartifact/values.yaml @@ -24,10 +24,9 @@ project: default # Console URL that will be used by the device to join the fleet, i.e. console.plrl-xyz.onplural.sh url: ~ +# Secret that holds bootstrap token used to register the cluster within Plural tokenSecret: - # Name of the secret that holds the bootstrap token name: ~ - # Key in the secret that holds the bootstrap token key: token # A list of our required bundles that should be added to the result ISO image. @@ -62,4 +61,25 @@ extraUserCloudConfig: ~ # authorized_keys: # kairos: # - github:myusername -extraCloudConfig: ~ \ No newline at end of file +extraCloudConfig: ~ + +# Export configuration for the final ISO images +exporter: + # Docker registry DNS name where we should export packed ISO images + registry: ~ + # Name of the repository where images should be stored + repository: plural-edge + # Image tag that should be used when pushing to the registry + tag: latest + # Repository username used for basic auth + username: ~ + # Secret that stores just the password for the docker registry user. + # One of 'passwordSecret' or 'configSecret' must be provided. + passwordSecret: + name: ~ + key: password + # Secret configuration that stores the docker config.json file with the auth information. + # It is in the default docker format. + configSecret: + name: ~ + key: config.json \ No newline at end of file