diff --git a/docs/learn/1007-kubernetes.md b/docs/learn/1007-kubernetes.md index f30583cd..fc63e01f 100644 --- a/docs/learn/1007-kubernetes.md +++ b/docs/learn/1007-kubernetes.md @@ -159,23 +159,7 @@ kubectl delete -f k8s/ Create a file named `todoapp.cue` and add the following configuration to it. -```cue title="todoapp/kube/todoapp.cue" -package main - -import ( - "alpha.dagger.io/dagger" - "alpha.dagger.io/kubernetes" -) - -// input: kubernetes objects directory to deploy to -// set with `dagger input dir manifest ./k8s -e kube` -manifest: dagger.#Artifact & dagger.#Input - -// Deploy the manifest to a kubernetes cluster -todoApp: kubernetes.#Resources & { - "kubeconfig": kubeconfig - source: manifest -} +```cue file=tests/kube-kind/basic/todoapp.cue title="todoapp/kube/todoapp.cue" ``` This defines a `todoApp` variable containing the Kubernetes objects used to create a todoapp deployment. It also @@ -193,15 +177,7 @@ The following `config.cue` defines: - `kubeconfig` a generic value created to embed this string `kubeconfig` value -```cue title="todoapp/kube/config.cue" -package main - -import ( - "alpha.dagger.io/dagger" -) - -// set with `dagger input text kubeconfig -f "$HOME"/.kube/config -e kube` -kubeconfig: string & dagger.#Input +```cue file=tests/kube-kind/config.cue title="todoapp/kube/config.cue" ``` diff --git a/docs/learn/tests/kube-kind/basic/todoapp.cue b/docs/learn/tests/kube-kind/basic/todoapp.cue new file mode 100644 index 00000000..878f3f85 --- /dev/null +++ b/docs/learn/tests/kube-kind/basic/todoapp.cue @@ -0,0 +1,16 @@ +package main + +import ( + "alpha.dagger.io/dagger" + "alpha.dagger.io/kubernetes" +) + +// input: kubernetes objects directory to deploy to +// set with `dagger input dir manifest ./k8s -e kube` +manifest: dagger.#Artifact & dagger.#Input + +// Deploy the manifest to a kubernetes cluster +todoApp: kubernetes.#Resources & { + "kubeconfig": kubeconfig + source: manifest +} diff --git a/docs/learn/tests/kube-kind/config.cue b/docs/learn/tests/kube-kind/config.cue new file mode 100644 index 00000000..9169451d --- /dev/null +++ b/docs/learn/tests/kube-kind/config.cue @@ -0,0 +1,8 @@ +package main + +import ( + "alpha.dagger.io/dagger" +) + +// set with `dagger input text kubeconfig -f "$HOME"/.kube/config -e kube` +kubeconfig: string & dagger.#Input