example: added kubernetes example with Helm

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba
2021-03-22 12:08:42 -07:00
parent cbb4f325bf
commit 2daff0ee74
12 changed files with 377 additions and 33 deletions

View File

@@ -1,25 +1,25 @@
package main
import (
"encoding/yaml"
"dagger.io/aws"
"dagger.io/aws/eks"
"dagger.io/kubernetes"
"encoding/yaml"
"dagger.io/dagger"
"dagger.io/aws"
"dagger.io/aws/eks"
"dagger.io/kubernetes"
"dagger.io/kubernetes/helm"
)
kubeSrc: {
apiVersion: "v1"
kind: "Pod"
metadata: {
name: "kube-test"
}
spec: {
restartPolicy: "Never"
containers: [{
name: "test"
image: "hello-world"
}]
}
apiVersion: "v1"
kind: "Pod"
metadata: name: "kube-test"
spec: {
restartPolicy: "Never"
containers: [{
name: "test"
image: "hello-world"
}]
}
}
// Fill using:
@@ -29,13 +29,25 @@ awsConfig: aws.#Config & {
region: *"us-east-2" | string
}
// Take the kubeconfig from the EKS cluster
cluster: eks.#KubeConfig & {
config: awsConfig
clusterName: *"dagger-example-eks-cluster" | string
}
apply: kubernetes.#Apply & {
source: yaml.Marshal(kubeSrc)
namespace: "test"
kubeconfig: cluster.kubeconfig
// Example of a simple `kubectl apply` using a simple config
kubeApply: kubernetes.#Apply & {
source: yaml.Marshal(kubeSrc)
namespace: "test"
kubeconfig: cluster.kubeconfig
}
// Example of a `helm install` using a local chart
// Fill using:
// --input-dir helmChart.chart=./testdata/mychart
helmChart: helm.#Chart & {
name: "test-helm"
namespace: "test"
kubeconfig: cluster.kubeconfig
chart: dagger.#Artifact
}