Open suzuki-shunsuke opened 3 years ago
$ cue export --out yaml input.cue
まずは deployment を簡単にラップしたい。
$ kubectl create deploy --dry-run=client -o yaml --image=nginx --replicas=3 app > deployment.yaml
timestamp とかを消す
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: app
name: app
spec:
replicas: 3
selector:
matchLabels:
app: app
template:
metadata:
labels:
app: app
spec:
containers:
- image: nginx
name: nginx
cue に変換する
$ cue import deployment.yaml
deployment.cue が生成される
apiVersion: "apps/v1"
kind: "Deployment"
metadata: {
labels: app: "app"
name: "app"
}
spec: {
replicas: 3
selector: matchLabels: app: "app"
template: {
metadata: labels: app: "app"
spec: containers: [{
image: "nginx"
name: "nginx"
}]
}
}
cue から yaml を生成する
$ cue export --out yaml deployment.cue
ここから deployment.cue を書き換えていく。
Data Validation: https://cuelang.org/docs/usecases/validation/