This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/stdlib/.dagger/env/kubernetes-deployment/plan/kubernetes.cue
Tom Chauveau 2e9a0d6509 Add test to universe
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-06-18 18:33:02 +02:00

45 lines
828 B
CUE

package main
import (
"encoding/yaml"
"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/
TestKubeconfig: string @dagger(input)
TestKubeApply: {
suffix: random.#String & {
seed: ""
}
// Pod spec
kubeSrc: {
apiVersion: "v1"
kind: "Pod"
metadata: name: "kube-test-\(suffix.out)"
spec: {
restartPolicy: "Never"
containers: [{
name: "test"
image: "hello-world"
}]
}
}
// Apply deployment
apply: kubernetes.#Resources & {
kubeconfig: TestKubeconfig
namespace: "dagger-test"
manifest: yaml.Marshal(kubeSrc)
}
// Verify deployment
verify: #VerifyApply & {
podname: kubeSrc.metadata.name
namespace: apply.namespace
}
}