From 6a442fae6c0ea6fe3ef4f050d2c9078b2c2b5155 Mon Sep 17 00:00:00 2001 From: Tom Chauveau Date: Fri, 13 Aug 2021 16:34:02 +0200 Subject: [PATCH] Update kubernetes documentation to directly use cue files Previously, we were embedding cue files directly in the doc, now we display it from real cue file that we also use to test our doc. I've add the first step of the kubernetes documentation adapted for kind Signed-off-by: Tom Chauveau --- docs/learn/1007-kubernetes.md | 28 ++------------------ docs/learn/tests/kube-kind/basic/todoapp.cue | 16 +++++++++++ docs/learn/tests/kube-kind/config.cue | 8 ++++++ 3 files changed, 26 insertions(+), 26 deletions(-) create mode 100644 docs/learn/tests/kube-kind/basic/todoapp.cue create mode 100644 docs/learn/tests/kube-kind/config.cue 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