adapt spawner to just retrieve a key if needed

This commit is contained in:
Stavros kois
2022-12-12 15:42:11 +02:00
parent 0bf8627cc3
commit 284eb049bb
2 changed files with 23 additions and 3 deletions

View File

@@ -2,9 +2,11 @@
{{- $secretName := include "ix.v1.common.names.fullname" . -}}
{{- $root := .root -}}
{{- $certName := "TODO: Get the certName" -}}
{{- if (include "ix.v1.common.certificate.exists" (dict "root" $root "certName" $certName)) }}
{{- $certName := .certName -}}
{{- if (include "ix.v1.common.certificate.exists" (dict "root" $root "certName" $certName)) -}}
{{- if .key -}}
{{- include "ix.v1.common.certificate.get" (dict "root" $root "certName" $certName "key" "certificate") -}}
{{- else }}
---
apiVersion: {{ include "ix.v1.common.capabilities.secret.apiVersion" . }}
kind: Secret

View File

@@ -0,0 +1,18 @@
{{/*
Call this from anywhere to create a Secret/k8s.tls
Pass a "root" object and the "certName"
(certName comes from Scale's GUI definitions)
If you also pass a "key" when calling this spawner,
instead of creating a secret it will return you the value
of that key (if exists)
*/}}
{{- define "ix.v1.common.spawner.certificate" -}}
{{- $certName := .certName -}}
{{- $root := .root -}}
{{- if .key -}}
{{- include "ix.v1.common.class.certificate" (dict "root" $root "key" .key "certName" .certName) -}}
{{- else -}}
{{- include "ix.v1.common.class.certificate" (dict "root" $root "certName" .certName) -}}
{{- end -}}
{{- end -}}