helm #Chart definition now support secret kubeconfig

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau 2021-09-22 19:11:23 +02:00
parent 1f5a9a9fa9
commit 56083ed3d0
No known key found for this signature in database
GPG Key ID: 3C9847D981AAC1BF

View File

@ -13,47 +13,47 @@ import (
#Chart: { #Chart: {
// Helm deployment name // Helm deployment name
name: string @dagger(input) name: dagger.#Input & {string}
// Helm chart to install from source // Helm chart to install from source
chartSource?: dagger.#Artifact @dagger(input) chartSource: *null | dagger.#Artifact
// Helm chart to install from repository // Helm chart to install from repository
chart?: string @dagger(input) chart: dagger.#Input & {*null | string}
// Helm chart repository // Helm chart repository
repository?: string @dagger(input) repository: dagger.#Input & {string}
// Helm values (either a YAML string or a Cue structure) // Helm values (either a YAML string or a Cue structure)
values?: string @dagger(input) values: dagger.#Input & {string}
// Kubernetes Namespace to deploy to // Kubernetes Namespace to deploy to
namespace: string @dagger(input) namespace: dagger.#Input & {string}
// Helm action to apply // Helm action to apply
action: *"installOrUpgrade" | "install" | "upgrade" @dagger(input) action: dagger.#Input & {*"installOrUpgrade" | "install" | "upgrade"}
// time to wait for any individual Kubernetes operation (like Jobs for hooks) // time to wait for any individual Kubernetes operation (like Jobs for hooks)
timeout: string | *"5m" @dagger(input) timeout: dagger.#Input & {string | *"5m"}
// if set, will wait until all Pods, PVCs, Services, and minimum number of // if set, will wait until all Pods, PVCs, Services, and minimum number of
// Pods of a Deployment, StatefulSet, or ReplicaSet are in a ready state // Pods of a Deployment, StatefulSet, or ReplicaSet are in a ready state
// before marking the release as successful. // before marking the release as successful.
// It will wait for as long as timeout // It will wait for as long as timeout
wait: *true | bool @dagger(input) wait: dagger.#Input & {*true | bool}
// if set, installation process purges chart on fail. // if set, installation process purges chart on fail.
// The wait option will be set automatically if atomic is used // The wait option will be set automatically if atomic is used
atomic: *true | bool @dagger(input) atomic: dagger.#Input & {*true | bool}
// Kube config file // Kube config file
kubeconfig: string @dagger(input) kubeconfig: dagger.#Input & {string | dagger.#Secret}
// Helm version // Helm version
version: *"3.5.2" | string @dagger(input) version: dagger.#Input & {*"3.5.2" | string}
// Kubectl version // Kubectl version
kubectlVersion: *"v1.19.9" | string @dagger(input) kubectlVersion: dagger.#Input & {*"v1.19.9" | string}
#up: [ #up: [
op.#Load & { op.#Load & {
@ -86,11 +86,15 @@ import (
dest: "/entrypoint.sh" dest: "/entrypoint.sh"
content: #code content: #code
}, },
op.#WriteFile & {
dest: "/kubeconfig" if (kubeconfig & string) != _|_ {
content: kubeconfig op.#WriteFile & {
mode: 0o600 dest: "/kubeconfig"
content: kubeconfig
mode: 0o600
}
}, },
if chart != _|_ { if chart != _|_ {
op.#WriteFile & { op.#WriteFile & {
dest: "/helm/chart" dest: "/helm/chart"
@ -130,6 +134,9 @@ import (
if chartSource != _|_ && chart == _|_ { if chartSource != _|_ && chart == _|_ {
"/helm/chart": from: chartSource "/helm/chart": from: chartSource
} }
if (kubeconfig & dagger.#Secret) != _|_ {
"/kubeconfig": secret: kubeconfig
}
} }
}, },
] ]