kubernetes #Resources 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:03:58 +02:00
parent 7497b116ea
commit 1f5a9a9fa9
No known key found for this signature in database
GPG Key ID: 3C9847D981AAC1BF

View File

@ -65,7 +65,7 @@ import (
version: dagger.#Input & {*"v1.19.9" | string}
// Kube config file
kubeconfig: dagger.#Input & {string}
kubeconfig: dagger.#Input & {string | dagger.#Secret}
#code: #"""
kubectl create namespace "$KUBE_NAMESPACE" > /dev/null 2>&1 || true
@ -89,11 +89,15 @@ import (
dest: "/entrypoint.sh"
content: #code
},
if (kubeconfig & string) != _|_ {
op.#WriteFile & {
dest: "/kubeconfig"
content: kubeconfig
mode: 0o600
},
},
if manifest != null {
op.#WriteFile & {
dest: "/source"
@ -120,6 +124,9 @@ import (
if manifest == null && source != null {
mount: "/source": from: source
}
if (kubeconfig & dagger.#Secret) != _|_ {
mount: "/kubeconfig": secret: kubeconfig
}
},
]
}