Merge pull request #667 from grouville/revert_kubernetes/help_to_str

Revert kubernetes/helm packages and tests from secret to str type
This commit is contained in:
Sam Alba 2021-06-17 11:49:47 +02:00 committed by GitHub
commit 4dd7a37b07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 30 additions and 15 deletions

View File

@ -32,7 +32,7 @@ Apply Kubernetes resources
| ------------- |:-------------: |:-------------: |
|*namespace* | `*"default" \| string` |Kubernetes Namespace to deploy to |
|*version* | `*"v1.19.9" \| string` |Version of kubectl client |
|*kubeconfig* | `dagger.#Secret` |Kube config file |
|*kubeconfig* | `string` |Kube config file |
### kubernetes.#Resources Outputs

View File

@ -24,7 +24,7 @@ Install a Helm chart
|*timeout* | `*"5m" \| string` |time to wait for any individual Kubernetes operation (like Jobs for hooks) |
|*wait* | `*true \| bool` |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 before marking the release as successful. It will wait for as long as timeout |
|*atomic* | `*true \| bool` |if set, installation process purges chart on fail. The wait option will be set automatically if atomic is used |
|*kubeconfig* | `dagger.#Secret` |Kube config file |
|*kubeconfig* | `string` |Kube config file |
|*version* | `*"3.5.2" \| string` |Helm version |
|*kubectlVersion* | `*"v1.19.9" \| string` |Kubectl version |

View File

@ -47,7 +47,7 @@ import (
atomic: *true | bool @dagger(input)
// Kube config file
kubeconfig: dagger.#Secret @dagger(input)
kubeconfig: string @dagger(input)
// Helm version
version: *"3.5.2" | string @dagger(input)
@ -86,6 +86,11 @@ import (
dest: "/entrypoint.sh"
content: #code
},
op.#WriteFile & {
dest: "/kubeconfig"
content: kubeconfig
mode: 0o600
},
if chart != _|_ {
op.#WriteFile & {
dest: "/helm/chart"
@ -125,7 +130,6 @@ import (
if chartSource != _|_ && chart == _|_ {
"/helm/chart": from: chartSource
}
"/kubeconfig": secret: kubeconfig
}
},
]

View File

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

View File

@ -18,7 +18,7 @@ setup() {
"$DAGGER" init
dagger_new_with_plan kubernetes "$TESTDIR"/stdlib/kubernetes/
run "$DAGGER" input -e "kubernetes" secret kubeconfig -f ~/.kube/config
run "$DAGGER" input -e "kubernetes" text kubeconfig -f ~/.kube/config
assert_success
run "$DAGGER" up -e "kubernetes"
@ -40,7 +40,7 @@ setup() {
"$DAGGER" init
dagger_new_with_plan helm "$TESTDIR"/stdlib/kubernetes/helm
run "$DAGGER" input -e "helm" secret kubeconfig -f ~/.kube/config
run "$DAGGER" input -e "helm" text kubeconfig -f ~/.kube/config
assert_success
cp -R "$TESTDIR"/stdlib/kubernetes/helm/testdata/mychart "$DAGGER_WORKSPACE"/testdata

View File

@ -8,7 +8,7 @@ import (
// We assume that a kinD cluster is running locally
// To deploy a local KinD cluster, follow this link : https://kind.sigs.k8s.io/docs/user/quick-start/
kubeconfig: dagger.#Secret @dagger(input)
kubeconfig: string @dagger(input)
// Deploy user local chart
TestHelmSimpleChart: {

View File

@ -26,6 +26,12 @@ import (
content: #getHelmPods
},
op.#WriteFile & {
dest: "/kubeconfig"
content: kubeconfig
mode: 0o600
},
op.#Exec & {
always: true
args: [
@ -40,7 +46,6 @@ import (
KUBECONFIG: "/kubeconfig"
KUBE_NAMESPACE: namespace
}
mount: "/kubeconfig": secret: kubeconfig
},
]
}

View File

@ -2,14 +2,13 @@ package main
import (
"encoding/yaml"
"dagger.io/dagger"
"dagger.io/kubernetes"
"dagger.io/random"
)
// We assume that a kinD cluster is running locally
// To deploy a local KinD cluster, follow this link : https://kind.sigs.k8s.io/docs/user/quick-start/
kubeconfig: dagger.#Secret @dagger(input)
kubeconfig: string @dagger(input)
TestKubeApply: {
suffix: random.#String & {

View File

@ -27,6 +27,12 @@ import (
from: kubernetes.#Kubectl
},
op.#WriteFile & {
dest: "/kubeconfig"
content: kubeconfig
mode: 0o600
},
op.#WriteFile & {
dest: "/getPods.sh"
content: #GetPods
@ -47,7 +53,6 @@ import (
KUBECONFIG: "/kubeconfig"
KUBE_NAMESPACE: namespace
}
mount: "/kubeconfig": secret: kubeconfig
},
op.#WriteFile & {
@ -69,7 +74,6 @@ import (
KUBECONFIG: "/kubeconfig"
KUBE_NAMESPACE: namespace
}
mount: "/kubeconfig": secret: kubeconfig
},
]
}