From f03018d230416f74a0017794f333859edf659bf7 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Mon, 22 Mar 2021 09:53:10 -0700 Subject: [PATCH] example: added simple kubernetes example Signed-off-by: Sam Alba --- examples/kubernetes/main.cue | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 examples/kubernetes/main.cue diff --git a/examples/kubernetes/main.cue b/examples/kubernetes/main.cue new file mode 100644 index 00000000..8f49f599 --- /dev/null +++ b/examples/kubernetes/main.cue @@ -0,0 +1,41 @@ +package main + +import ( + "encoding/yaml" + "dagger.io/aws" + "dagger.io/aws/eks" + "dagger.io/kubernetes" +) + +kubeSrc: { + apiVersion: "v1" + kind: "Pod" + metadata: { + name: "kube-test" + } + spec: { + restartPolicy: "Never" + containers: [{ + name: "test" + image: "hello-world" + }] + } +} + +// Fill using: +// --input-string awsConfig.accessKey=XXX +// --input-string awsConfig.secretKey=XXX +awsConfig: aws.#Config & { + region: *"us-east-2" | string +} + +cluster: eks.#KubeConfig & { + config: awsConfig + clusterName: *"dagger-example-eks-cluster" | string +} + +apply: kubernetes.#Apply & { + source: yaml.Marshal(kubeSrc) + namespace: "test" + kubeconfig: cluster.kubeconfig +}