annotate next/create_all.py @ 55:24f4ec319f98

yaml to py
author drewp@bigasterisk.com
date Fri, 26 Apr 2024 15:55:25 -0700
parents
children a72c47973aa4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
55
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
1 import json
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
2 from pathlib import Path
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
3
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
4
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
5 def toJson(d):
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
6 return json.dumps(d, sort_keys=True, indent=2)
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
7
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
8
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
9 build = Path('build')
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
10 (build / 'vmagent_deploy.yaml').write_text(
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
11 toJson({
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
12 "apiVersion": "apps/v1",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
13 "kind": "Deployment",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
14 "metadata": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
15 "name": "next-victoriametrics-vmagent"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
16 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
17 "spec": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
18 "replicas": 1,
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
19 "strategy": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
20 "type": "Recreate"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
21 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
22 "selector": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
23 "matchLabels": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
24 "app": "next-victoriametrics-vmagent"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
25 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
26 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
27 "template": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
28 "metadata": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
29 "labels": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
30 "app": "next-victoriametrics-vmagent"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
31 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
32 "annotations": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
33 "prometheus.io/scrape": "true",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
34 "prometheus.io/path": "/m/metrics",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
35 "prometheus.io/port": "80"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
36 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
37 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
38 "spec": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
39 "volumes": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
40 "name": "config",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
41 "configMap": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
42 "name": "victoriametrics-config"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
43 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
44 }],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
45 "serviceAccountName":
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
46 "victoriametrics",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
47 "containers": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
48 "name": "vmagent",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
49 "image": "docker.io/victoriametrics/vmagent:v1.100.1",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
50 "imagePullPolicy": "IfNotPresent",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
51 "args": ["-http.pathPrefix=/m/next/vmagent/", "-loggerTimezone=America/Los_Angeles", "-promscrape.config=/local/config/scrape_main", "-promscrape.configCheckInterval=5s", "-sortLabels", "-remoteWrite.url=http://next-victoriametrics-vminsert/m/next/vminsert/insert/0/prometheus/api/v1/write", "-remoteWrite.showURL"],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
52 "ports": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
53 "containerPort": 8429
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
54 }],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
55 "volumeMounts": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
56 "name": "config",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
57 "mountPath": "/local/config"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
58 }]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
59 }]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
60 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
61 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
62 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
63 }))
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
64 (build / 'vmagent_svc.yaml').write_text(toJson({"apiVersion": "v1", "kind": "Service", "metadata": {"name": "next-victoriametrics-vmagent"}, "spec": {"ports": [{"port": 80, "targetPort": 8429}], "selector": {"app": "next-victoriametrics-vmagent"}}}))
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
65
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
66 (build / 'vminsert_deploy.yaml').write_text(
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
67 toJson({
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
68 "apiVersion": "apps/v1",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
69 "kind": "Deployment",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
70 "metadata": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
71 "name": "next-victoriametrics-vminsert"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
72 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
73 "spec": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
74 "replicas": 1,
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
75 "strategy": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
76 "type": "Recreate"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
77 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
78 "selector": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
79 "matchLabels": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
80 "app": "next-victoriametrics-vminsert"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
81 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
82 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
83 "template": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
84 "metadata": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
85 "labels": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
86 "app": "next-victoriametrics-vminsert"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
87 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
88 "annotations": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
89 "prometheus.io/scrape": "true",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
90 "prometheus.io/path": "/m/metrics",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
91 "prometheus.io/port": "80"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
92 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
93 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
94 "spec": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
95 "serviceAccountName": "victoriametrics",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
96 "containers": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
97 "name": "vminsert",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
98 "image": "docker.io/victoriametrics/vminsert:v1.100.1-cluster",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
99 "imagePullPolicy": "IfNotPresent",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
100 "args": ["-http.pathPrefix=/m/next/vminsert/", "-loggerTimezone=America/Los_Angeles", "-storageNode=next-victoriametrics-vmstorage"],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
101 "ports": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
102 "containerPort": 8480
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
103 }]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
104 }]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
105 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
106 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
107 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
108 }))
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
109 (build / 'vminsert_svc.yaml').write_text(toJson({"apiVersion": "v1", "kind": "Service", "metadata": {"name": "next-victoriametrics-vminsert"}, "spec": {"ports": [{"port": 80, "targetPort": 8480}], "selector": {"app": "next-victoriametrics-vminsert"}}}))
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
110
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
111 (build / 'vmstorage_pv.yaml').write_text(
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
112 toJson({
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
113 "apiVersion": "v1",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
114 "kind": "PersistentVolume",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
115 "metadata": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
116 "name": "next-victoriametrics",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
117 "labels": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
118 "type": "local"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
119 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
120 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
121 "spec": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
122 "storageClassName": "manual",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
123 "hostPath": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
124 "path": "/opt/next-victoriametrics"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
125 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
126 "capacity": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
127 "storage": "50Gi"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
128 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
129 "accessModes": ["ReadWriteMany"],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
130 "persistentVolumeReclaimPolicy": "Retain",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
131 "claimRef": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
132 "namespace": "default",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
133 "name": "next-victoriametrics"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
134 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
135 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
136 }))
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
137 (build / 'vmstorage_pvc.yaml').write_text(toJson({"apiVersion": "v1", "kind": "PersistentVolumeClaim", "metadata": {"name": "next-victoriametrics"}, "spec": {"storageClassName": "", "volumeName": "next-victoriametrics", "accessModes": ["ReadWriteMany"], "resources": {"requests": {"storage": "50Gi"}}}}))
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
138
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
139 (build / 'vmstorage_deploy.yaml').write_text(
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
140 toJson({
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
141 "apiVersion": "apps/v1",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
142 "kind": "Deployment",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
143 "metadata": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
144 "name": "next-victoriametrics-vmstorage"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
145 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
146 "spec": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
147 "replicas": 1,
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
148 "strategy": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
149 "type": "Recreate"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
150 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
151 "selector": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
152 "matchLabels": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
153 "app": "next-victoriametrics-vmstorage"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
154 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
155 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
156 "template": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
157 "metadata": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
158 "labels": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
159 "app": "next-victoriametrics-vmstorage"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
160 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
161 "annotations": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
162 "prometheus.io/scrape": "true",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
163 "prometheus.io/path": "/m/vmstorage/metrics",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
164 "prometheus.io/port": "80"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
165 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
166 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
167 "spec": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
168 "volumes": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
169 "name": "data",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
170 "persistentVolumeClaim": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
171 "claimName": "next-victoriametrics"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
172 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
173 }],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
174 "serviceAccountName": "victoriametrics",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
175 "containers": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
176 "name": "vmstorage",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
177 "image": "docker.io/victoriametrics/vmstorage:v1.100.1-cluster",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
178 "imagePullPolicy": "IfNotPresent",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
179 "args": ["-http.pathPrefix=/m/next/vmstorage/", "-loggerTimezone=America/Los_Angeles", "-retentionPeriod=100y", "-storageDataPath=/data/100y"],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
180 "ports": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
181 "containerPort": 8482,
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
182 "name": "http"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
183 }, {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
184 "containerPort": 8400,
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
185 "name": "vminsert"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
186 }, {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
187 "containerPort": 8401,
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
188 "name": "vmselect"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
189 }],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
190 "volumeMounts": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
191 "name": "data",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
192 "mountPath": "/data"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
193 }]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
194 }],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
195 "affinity": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
196 "nodeAffinity": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
197 "requiredDuringSchedulingIgnoredDuringExecution": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
198 "nodeSelectorTerms": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
199 "matchExpressions": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
200 "key": "kubernetes.io/hostname",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
201 "operator": "In",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
202 "values": ["ditto"]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
203 }]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
204 }]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
205 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
206 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
207 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
208 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
209 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
210 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
211 }))
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
212 (build / 'vmstorage_svc.yaml').write_text(toJson({"apiVersion": "v1", "kind": "Service", "metadata": {"name": "next-victoriametrics-vmstorage"}, "spec": {"ports": [{"port": 80, "targetPort": "http", "name": "http"}, {"port": 8400, "targetPort": "vminsert", "name": "vminsert"}, {"port": 8401, "targetPort": "vmselect", "name": "vmselect"}], "selector": {"app": "next-victoriametrics-vmstorage"}}}))
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
213
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
214 (build / 'vmselect_deploy.yaml').write_text(
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
215 toJson({
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
216 "apiVersion": "apps/v1",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
217 "kind": "Deployment",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
218 "metadata": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
219 "name": "next-victoriametrics-vmselect"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
220 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
221 "spec": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
222 "replicas": 1,
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
223 "strategy": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
224 "type": "Recreate"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
225 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
226 "selector": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
227 "matchLabels": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
228 "app": "next-victoriametrics-vmselect"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
229 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
230 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
231 "template": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
232 "metadata": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
233 "labels": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
234 "app": "next-victoriametrics-vmselect"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
235 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
236 "annotations": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
237 "prometheus.io/scrape": "true",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
238 "prometheus.io/path": "/m/metrics",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
239 "prometheus.io/port": "80"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
240 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
241 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
242 "spec": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
243 "serviceAccountName": "victoriametrics",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
244 "containers": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
245 "name": "vmselect",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
246 "image": "docker.io/victoriametrics/vmselect:v1.100.1-cluster",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
247 "imagePullPolicy": "IfNotPresent",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
248 "args": ["-http.pathPrefix=/m/next/vmselect/", "-loggerTimezone=America/Los_Angeles", "-storageNode=next-victoriametrics-vmstorage"],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
249 "ports": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
250 "containerPort": 8481
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
251 }]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
252 }]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
253 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
254 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
255 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
256 }))
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
257 (build / 'vmselect_svc.yaml').write_text(toJson({
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
258 "apiVersion": "v1",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
259 "kind": "Service",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
260 "metadata": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
261 "name": "next-victoriametrics-vmselect"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
262 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
263 "spec": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
264 "ports": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
265 "port": 80,
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
266 "targetPort": 8481
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
267 }],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
268 "selector": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
269 "app": "next-victoriametrics-vmselect"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
270 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
271 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
272 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
273 # in vmui, set server url to
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
274 # https://bigasterisk.com/m/next/vmselect/select/0/prometheus
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
275 ))
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
276
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
277 (build / 'vmselect_svc.yaml').write_text(
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
278 toJson({
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
279 "apiVersion": "networking.k8s.io/v1",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
280 "kind": "Ingress",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
281 "metadata": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
282 "name": "next-victoriametrics",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
283 "annotations": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
284 "cert-manager.io/cluster-issuer": "letsencrypt-prod",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
285 "ingress.pomerium.io/allow_public_unauthenticated_access": "false",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
286 "ingress.pomerium.io/pass_identity_headers": "true",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
287 "ingress.pomerium.io/preserve_host_header": "true",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
288 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
289 },
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
290 "spec": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
291 "ingressClassName": "pomerium",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
292 "rules": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
293 "host": "bigasterisk.com",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
294 "http": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
295 "paths": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
296 "pathType": "Prefix",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
297 "path": "/m/next/vmselect/",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
298 "backend": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
299 "service": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
300 "name": "next-victoriametrics-vmselect",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
301 "port": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
302 "number": 80
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
303 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
304 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
305 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
306 }, {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
307 "pathType": "Prefix",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
308 "path": "/m/next/vmagent/",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
309 "backend": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
310 "service": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
311 "name": "next-victoriametrics-vmagent",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
312 "port": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
313 "number": 80
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
314 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
315 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
316 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
317 }, {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
318 "pathType": "Prefix",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
319 "path": "/m/next/vmselect/",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
320 "backend": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
321 "service": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
322 "name": "next-victoriametrics-vmselect",
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
323 "port": {
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
324 "number": 80
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
325 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
326 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
327 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
328 }]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
329 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
330 }],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
331 "tls": [{
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
332 "hosts": ["bigasterisk.com"],
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
333 "secretName": "bigasterisk.com-tls"
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
334 }]
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
335 }
24f4ec319f98 yaml to py
drewp@bigasterisk.com
parents:
diff changeset
336 }))