Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
internal/third_party/yaml: improve yaml positining
Browse files Browse the repository at this point in the history
- retain more of the original spacing into the conversion
- store original absolute positions

Change-Id: Id1edbefe1050e1f2dcec3ceb2f8877018b0b5876
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2562
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Jul 14, 2019
1 parent 99e7b6d commit 4697b78
Show file tree
Hide file tree
Showing 33 changed files with 343 additions and 157 deletions.
Expand Up @@ -2,5 +2,6 @@ package kube

deployment bartender spec template spec containers: [{
image: "gcr.io/myproj/bartender:v0.1.34"
args: []
args: [
]
}]
Expand Up @@ -2,5 +2,8 @@ package kube

deployment breaddispatcher spec template spec containers: [{
image: "gcr.io/myproj/breaddispatcher:v0.3.24"
args: ["-etcd=etcd:2379", "-event-server=events:7788"]
args: [
"-etcd=etcd:2379",
"-event-server=events:7788",
]
}]
Expand Up @@ -4,6 +4,7 @@ deployment host spec: {
replicas: 2
template spec containers: [{
image: "gcr.io/myproj/host:v0.1.10"
args: []
args: [
]
}]
}
Expand Up @@ -2,5 +2,6 @@ package kube

deployment maitred spec template spec containers: [{
image: "gcr.io/myproj/maitred:v0.0.4"
args: []
args: [
]
}]
Expand Up @@ -8,5 +8,8 @@ deployment valeter spec template spec containers: [{
ports: [{
containerPort: 8080
}]
args: ["-http=:8080", "-etcd=etcd:2379"]
args: [
"-http=:8080",
"-etcd=etcd:2379",
]
}]
Expand Up @@ -5,5 +5,8 @@ service waterdispatcher spec ports: [{
}]
deployment waterdispatcher spec template spec containers: [{
image: "gcr.io/myproj/waterdispatcher:v0.0.48"
args: ["-http=:8080", "-etcd=etcd:2379"]
args: [
"-http=:8080",
"-etcd=etcd:2379",
]
}]
Expand Up @@ -2,7 +2,5 @@ package kube

deployment download spec template spec containers: [{
image: "gcr.io/myproj/download:v0.0.2"
ports: [{
containerPort: 7080
}]
ports: [{containerPort: 7080}]
}]
22 changes: 20 additions & 2 deletions doc/tutorial/kubernetes/quick/services/infra/etcd/kube.cue
Expand Up @@ -20,7 +20,9 @@ statefulSet etcd spec: {
labelSelector matchExpressions: [{
key: "app"
operator: "In"
values: ["etcd"]
values: [
"etcd",
]
}]
topologyKey: "kubernetes.io/hostname"
}]
Expand Down Expand Up @@ -59,12 +61,28 @@ statefulSet etcd spec: {
valueFrom fieldRef fieldPath: "status.podIP"
}]
command: ["/usr/local/bin/etcd"]
args: ["-name", "$(NAME)", "-data-dir", "/data/etcd3", "-initial-advertise-peer-urls", "http://$(IP):2380", "-listen-peer-urls", "http://$(IP):2380", "-listen-client-urls", "http://$(IP):2379,http://127.0.0.1:2379", "-advertise-client-urls", "http://$(IP):2379", "-discovery", "https://discovery.etcd.io/xxxxxx"]
args: [
"-name",
"$(NAME)",
"-data-dir",
"/data/etcd3",
"-initial-advertise-peer-urls",
"http://$(IP):2380",
"-listen-peer-urls",
"http://$(IP):2380",
"-listen-client-urls",
"http://$(IP):2379,http://127.0.0.1:2379",
"-advertise-client-urls",
"http://$(IP):2379",
"-discovery",
"https://discovery.etcd.io/xxxxxx",
]
}]
}
}
// bootstrap
// "-initial-cluster-token", "etcd-prod-events2",

volumeClaimTemplates: [{
metadata: {
name: "etcd3"
Expand Down
11 changes: 9 additions & 2 deletions doc/tutorial/kubernetes/quick/services/infra/events/kube.cue
Expand Up @@ -15,7 +15,9 @@ deployment events spec: {
labelSelector matchExpressions: [{
key: "app"
operator: "In"
values: ["events"]
values: [
"events",
]
}]
topologyKey: "kubernetes.io/hostname"
}]
Expand All @@ -30,7 +32,12 @@ deployment events spec: {
}, {
containerPort: 7788
}]
args: ["-cert=/etc/ssl/server.pem", "-key=/etc/ssl/server.key", "-grpc=:7788"]
args: [
"-cert=/etc/ssl/server.pem",
"-key=/etc/ssl/server.key",
"-grpc=:7788",
]

volumeMounts: [{
mountPath: "/etc/ssl"
name: "secret-volume"
Expand Down
Expand Up @@ -2,8 +2,7 @@ package kube

service tasks spec: {
type: "LoadBalancer"
loadBalancerIP: "1.2.3.4"
// static ip
loadBalancerIP: "1.2.3.4" // static ip
ports: [{
port: 443
name: "http"
Expand Down
Expand Up @@ -11,9 +11,12 @@ deployment updater spec template spec: {
mountPath: "/etc/certs"
name: "secret-updater"
}]

ports: [{
containerPort: 8080
}]
args: ["-key=/etc/certs/updater.pem"]
args: [
"-key=/etc/certs/updater.pem",
]
}]
}
Expand Up @@ -2,8 +2,7 @@ package kube

service watcher spec: {
type: "LoadBalancer"
loadBalancerIP: "1.2.3.4."
// static ip
loadBalancerIP: "1.2.3.4." // static ip
ports: [{
name: "http"
}]
Expand Down
10 changes: 9 additions & 1 deletion doc/tutorial/kubernetes/quick/services/kitchen/caller/kube.cue
Expand Up @@ -24,7 +24,15 @@ deployment caller spec: {
name: "secret-ssh-key"
readOnly: true
}]
args: ["-env=prod", "-key=/etc/certs/client.key", "-cert=/etc/certs/client.pem", "-ca=/etc/certs/servfx.ca", "-ssh-tunnel-key=/sslcerts/tunnel-private.pem", "-logdir=/logs", "-event-server=events:7788"]
args: [
"-env=prod",
"-key=/etc/certs/client.key",
"-cert=/etc/certs/client.pem",
"-ca=/etc/certs/servfx.ca",
"-ssh-tunnel-key=/sslcerts/tunnel-private.pem",
"-logdir=/logs",
"-event-server=events:7788",
]
}]
}
}
Expand Up @@ -19,7 +19,12 @@ deployment dishwasher spec: {
name: "secret-ssh-key"
readOnly: true
}]
args: ["-env=prod", "-ssh-tunnel-key=/etc/certs/tunnel-private.pem", "-logdir=/logs", "-event-server=events:7788"]
args: [
"-env=prod",
"-ssh-tunnel-key=/etc/certs/tunnel-private.pem",
"-logdir=/logs",
"-event-server=events:7788",
]
}]
}
}
Expand Up @@ -2,5 +2,10 @@ package kube

deployment expiditer spec template spec containers: [{
image: "gcr.io/myproj/expiditer:v0.5.34"
args: ["-env=prod", "-ssh-tunnel-key=/etc/certs/tunnel-private.pem", "-logdir=/logs", "-event-server=events:7788"]
args: [
"-env=prod",
"-ssh-tunnel-key=/etc/certs/tunnel-private.pem",
"-logdir=/logs",
"-event-server=events:7788",
]
}]
Expand Up @@ -6,5 +6,9 @@ deployment headchef spec template spec containers: [{
}, {
mountPath: "/sslcerts"
}]
args: ["-env=prod", "-logdir=/logs", "-event-server=events:7788"]
args: [
"-env=prod",
"-logdir=/logs",
"-event-server=events:7788",
]
}]
13 changes: 12 additions & 1 deletion doc/tutorial/kubernetes/quick/services/kitchen/linecook/kube.cue
Expand Up @@ -12,6 +12,17 @@ deployment linecook spec template spec: {
}, {
name: "secret-kitchen"
}]
args: ["-name=linecook", "-env=prod", "-logdir=/logs", "-event-server=events:7788", "-etcd", "etcd:2379", "-reconnect-delay", "1h", "-recovery-overlap", "100000"]
args: [
"-name=linecook",
"-env=prod",
"-logdir=/logs",
"-event-server=events:7788",
"-etcd",
"etcd:2379",
"-reconnect-delay",
"1h",
"-recovery-overlap",
"100000",
]
}]
}
Expand Up @@ -12,6 +12,14 @@ deployment pastrychef spec template spec: {
}, {
name: "secret-ssh-key"
}]
args: ["-env=prod", "-ssh-tunnel-key=/etc/certs/tunnel-private.pem", "-logdir=/logs", "-event-server=events:7788", "-reconnect-delay=1m", "-etcd=etcd:2379", "-recovery-overlap=10000"]
args: [
"-env=prod",
"-ssh-tunnel-key=/etc/certs/tunnel-private.pem",
"-logdir=/logs",
"-event-server=events:7788",
"-reconnect-delay=1m",
"-etcd=etcd:2379",
"-recovery-overlap=10000",
]
}]
}
Expand Up @@ -21,9 +21,11 @@ configMap alertmanager: {
send_resolved: true
}]
}]

// The root route on which each incoming alert enters.
route: {
receiver: "pager"

// The labels by which incoming alerts are grouped together. For example,
// multiple alerts coming in for cluster=A and alertname=LatencyHigh would
// be batched into a single group.
Expand Down
Expand Up @@ -22,7 +22,11 @@ deployment alertmanager spec: {
spec: {
containers: [{
image: "prom/alertmanager:v0.15.2"
args: ["--config.file=/etc/alertmanager/alerts.yaml", "--storage.path=/alertmanager", "--web.external-url=https://alertmanager.example.com"]
args: [
"--config.file=/etc/alertmanager/alerts.yaml",
"--storage.path=/alertmanager",
"--web.external-url=https://alertmanager.example.com",
]
ports: [{
name: "alertmanager"
containerPort: 9093
Expand All @@ -40,8 +44,7 @@ deployment alertmanager spec: {
configMap name: "alertmanager"
}, {
name: "alertmanager"
emptyDir: {
}
emptyDir: {}
}]
}
}
Expand Down
Expand Up @@ -17,7 +17,10 @@ daemonSet "node-exporter" spec template: {
hostPID: true
containers: [{
image: "quay.io/prometheus/node-exporter:v0.16.0"
args: ["--path.procfs=/host/proc", "--path.sysfs=/host/sys"]
args: [
"--path.procfs=/host/proc",
"--path.sysfs=/host/sys",
]
ports: [{
containerPort: 9100
hostPort: 9100
Expand Down

0 comments on commit 4697b78

Please sign in to comment.