@@ -20,6 +20,9 @@ local defaults = {
2020 logLevel: 'info' ,
2121 resources: {},
2222 serviceMonitor: false ,
23+ ports: {
24+ http: 9090 ,
25+ },
2326
2427 commonLabels:: {
2528 'app.kubernetes.io/name' : 'thanos-query-frontend' ,
@@ -57,7 +60,17 @@ function(params) {
5760 },
5861 spec: {
5962 selector: tqf.config.podLabelSelector,
60- ports: [{ name: 'http' , targetPort: 'http' , port: 9090 }],
63+ ports: [
64+ {
65+ assert std.isString (name),
66+ assert std.isNumber (tqf.config.ports[name]),
67+
68+ name: name,
69+ port: tqf.config.ports[name],
70+ targetPort: tqf.config.ports[name],
71+ }
72+ for name in std.objectFields (tqf.config.ports)
73+ ],
6174 },
6275 },
6376
@@ -68,7 +81,7 @@ function(params) {
6881 args: [
6982 'query-frontend' ,
7083 '--query-frontend.compress-responses' ,
71- '--http-address=0.0.0.0:%d' % tqf.service.spec. ports[ 0 ].port ,
84+ '--http-address=0.0.0.0:%d' % tqf.config. ports.http ,
7285 '--query-frontend.downstream-url=%s' % tqf.config.downstreamURL,
7386 '--query-range.split-interval=%s' % tqf.config.splitInterval,
7487 '--query-range.max-retries-per-request=%d' % tqf.config.maxRetries,
@@ -81,15 +94,18 @@ function(params) {
8194 }),
8295 ] else []
8396 ),
84- ports: [{ name: 'http' , containerPort: tqf.service.spec.ports[0 ].port }],
97+ ports: [
98+ { name: name, containerPort: tqf.config.ports[name] }
99+ for name in std.objectFields (tqf.config.ports)
100+ ],
85101 livenessProbe: { failureThreshold: 4 , periodSeconds: 30 , httpGet: {
86102 scheme: 'HTTP' ,
87- port: tqf.service.spec. ports[ 0 ].port ,
103+ port: tqf.config. ports.http ,
88104 path: '/-/healthy' ,
89105 } },
90106 readinessProbe: { failureThreshold: 20 , periodSeconds: 5 , httpGet: {
91107 scheme: 'HTTP' ,
92- port: tqf.service.spec. ports[ 0 ].port ,
108+ port: tqf.config. ports.http ,
93109 path: '/-/ready' ,
94110 } },
95111 resources: if tqf.config.resources != {} then tqf.config.resources else {},
0 commit comments