Skip to content

Commit 44f40a1

Browse files
committed
feat: allow to change the operator listening port and the operator Service port
1 parent 39359ba commit 44f40a1

8 files changed

Lines changed: 66 additions & 3 deletions

File tree

stackgres-k8s/install/helm/stackgres-operator/templates/mutating-webhook-configuration.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ webhooks:
2525
namespace: {{ .Release.Namespace }}
2626
name: {{ .Release.Name }}
2727
path: '/stackgres/mutation/sgcluster'
28+
port: {{ .Values.operator.port }}
2829
admissionReviewVersions: ["v1"]
2930
{{- if .Values.allowedNamespaces }}
3031
namespaceSelector:
@@ -48,6 +49,7 @@ webhooks:
4849
namespace: {{ .Release.Namespace }}
4950
name: {{ .Release.Name }}
5051
path: '/stackgres/mutation/sgpgconfig'
52+
port: {{ .Values.operator.port }}
5153
admissionReviewVersions: ["v1"]
5254
{{- if .Values.allowedNamespaces }}
5355
namespaceSelector:
@@ -71,6 +73,7 @@ webhooks:
7173
namespace: {{ .Release.Namespace }}
7274
name: {{ .Release.Name }}
7375
path: '/stackgres/mutation/sgpoolconfig'
76+
port: {{ .Values.operator.port }}
7477
admissionReviewVersions: ["v1"]
7578
{{- if .Values.allowedNamespaces }}
7679
namespaceSelector:
@@ -94,6 +97,7 @@ webhooks:
9497
namespace: {{ .Release.Namespace }}
9598
name: {{ .Release.Name }}
9699
path: '/stackgres/mutation/sginstanceprofile'
100+
port: {{ .Values.operator.port }}
97101
admissionReviewVersions: ["v1"]
98102
{{- if .Values.allowedNamespaces }}
99103
namespaceSelector:
@@ -117,6 +121,7 @@ webhooks:
117121
namespace: {{ .Release.Namespace }}
118122
name: {{ .Release.Name }}
119123
path: '/stackgres/mutation/sgbackup'
124+
port: {{ .Values.operator.port }}
120125
admissionReviewVersions: ["v1"]
121126
{{- if .Values.allowedNamespaces }}
122127
namespaceSelector:
@@ -140,6 +145,7 @@ webhooks:
140145
namespace: {{ .Release.Namespace }}
141146
name: {{ .Release.Name }}
142147
path: '/stackgres/mutation/sgdistributedlogs'
148+
port: {{ .Values.operator.port }}
143149
admissionReviewVersions: ["v1"]
144150
{{- if .Values.allowedNamespaces }}
145151
namespaceSelector:
@@ -163,6 +169,7 @@ webhooks:
163169
namespace: {{ .Release.Namespace }}
164170
name: {{ .Release.Name }}
165171
path: '/stackgres/mutation/sgdbops'
172+
port: {{ .Values.operator.port }}
166173
admissionReviewVersions: ["v1"]
167174
{{- if .Values.allowedNamespaces }}
168175
namespaceSelector:
@@ -186,6 +193,7 @@ webhooks:
186193
namespace: {{ .Release.Namespace }}
187194
name: {{ .Release.Name }}
188195
path: '/stackgres/mutation/sgobjectstorage'
196+
port: {{ .Values.operator.port }}
189197
admissionReviewVersions: ["v1"]
190198
{{- if .Values.allowedNamespaces }}
191199
namespaceSelector:
@@ -209,6 +217,7 @@ webhooks:
209217
namespace: {{ .Release.Namespace }}
210218
name: {{ .Release.Name }}
211219
path: '/stackgres/mutation/sgscript'
220+
port: {{ .Values.operator.port }}
212221
admissionReviewVersions: ["v1"]
213222
{{- if .Values.allowedNamespaces }}
214223
namespaceSelector:
@@ -232,6 +241,7 @@ webhooks:
232241
namespace: {{ .Release.Namespace }}
233242
name: {{ .Release.Name }}
234243
path: '/stackgres/mutation/sgshardedcluster'
244+
port: {{ .Values.operator.port }}
235245
admissionReviewVersions: ["v1"]
236246
{{- if .Values.allowedNamespaces }}
237247
namespaceSelector:
@@ -255,6 +265,7 @@ webhooks:
255265
namespace: {{ .Release.Namespace }}
256266
name: {{ .Release.Name }}
257267
path: '/stackgres/mutation/sgshardedbackup'
268+
port: {{ .Values.operator.port }}
258269
admissionReviewVersions: ["v1"]
259270
{{- if .Values.allowedNamespaces }}
260271
namespaceSelector:
@@ -278,6 +289,7 @@ webhooks:
278289
namespace: {{ .Release.Namespace }}
279290
name: {{ .Release.Name }}
280291
path: '/stackgres/mutation/sgshardeddbops'
292+
port: {{ .Values.operator.port }}
281293
admissionReviewVersions: ["v1"]
282294
{{- if .Values.allowedNamespaces }}
283295
namespaceSelector:
@@ -301,6 +313,7 @@ webhooks:
301313
namespace: {{ .Release.Namespace }}
302314
name: {{ .Release.Name }}
303315
path: '/stackgres/mutation/sgstream'
316+
port: {{ .Values.operator.port }}
304317
admissionReviewVersions: ["v1"]
305318
{{- if .Values.allowedNamespaces }}
306319
namespaceSelector:

stackgres-k8s/install/helm/stackgres-operator/templates/operator-deployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ spec:
144144
- name: DEBUG_OPERATOR_SUSPEND
145145
value: "{{ .Values.developer.enableJvmDebugSuspend }}"
146146
{{- end }}
147+
{{- with .Values.operator.internalHttpPort }}
148+
- name: OPERATOR_HTTP_PORT
149+
value: {{ . }}
150+
{{- end }}
151+
{{- with .Values.operator.internalHttpsPort }}
152+
- name: OPERATOR_HTTPS_PORT
153+
value: {{ . }}
154+
{{- end }}
147155
- name: OPERATOR_SERVICE_ACCOUNT
148156
valueFrom:
149157
fieldRef:

stackgres-k8s/install/helm/stackgres-operator/templates/operator-service.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
ports:
1616
- name: https
1717
protocol: TCP
18-
port: 443
18+
port: {{ .Values.operator.port }}
1919
targetPort: https
2020
{{ else }}
2121
apiVersion: v1
@@ -25,7 +25,7 @@ metadata:
2525
name: {{ .Release.Name }}
2626
spec:
2727
ports:
28-
- port: 443
28+
- port: {{ .Values.operator.port }}
2929
targetPort: {{ .Values.developer.externalOperatorPort }}
3030
---
3131
kind: Endpoints

stackgres-k8s/install/helm/stackgres-operator/templates/validating-webhook-configuration.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ webhooks:
2525
namespace: {{ .Release.Namespace }}
2626
name: {{ .Release.Name }}
2727
path: '/stackgres/validation/sgcluster'
28+
port: {{ .Values.operator.port }}
2829
admissionReviewVersions: ["v1"]
2930
{{- if .Values.allowedNamespaces }}
3031
namespaceSelector:
@@ -48,6 +49,7 @@ webhooks:
4849
namespace: {{ .Release.Namespace }}
4950
name: {{ .Release.Name }}
5051
path: '/stackgres/validation/sgpgconfig'
52+
port: {{ .Values.operator.port }}
5153
admissionReviewVersions: ["v1"]
5254
{{- if .Values.allowedNamespaces }}
5355
namespaceSelector:
@@ -71,6 +73,7 @@ webhooks:
7173
namespace: {{ .Release.Namespace }}
7274
name: {{ .Release.Name }}
7375
path: '/stackgres/validation/sgpoolconfig'
76+
port: {{ .Values.operator.port }}
7477
admissionReviewVersions: ["v1"]
7578
{{- if .Values.allowedNamespaces }}
7679
namespaceSelector:
@@ -94,6 +97,7 @@ webhooks:
9497
namespace: {{ .Release.Namespace }}
9598
name: {{ .Release.Name }}
9699
path: '/stackgres/validation/sginstanceprofile'
100+
port: {{ .Values.operator.port }}
97101
admissionReviewVersions: ["v1"]
98102
{{- if .Values.allowedNamespaces }}
99103
namespaceSelector:
@@ -117,6 +121,7 @@ webhooks:
117121
namespace: {{ .Release.Namespace }}
118122
name: {{ .Release.Name }}
119123
path: '/stackgres/validation/sgbackup'
124+
port: {{ .Values.operator.port }}
120125
admissionReviewVersions: ["v1"]
121126
{{- if .Values.allowedNamespaces }}
122127
namespaceSelector:
@@ -140,6 +145,7 @@ webhooks:
140145
namespace: {{ .Release.Namespace }}
141146
name: {{ .Release.Name }}
142147
path: '/stackgres/validation/sgdistributedlogs'
148+
port: {{ .Values.operator.port }}
143149
admissionReviewVersions: ["v1"]
144150
{{- if .Values.allowedNamespaces }}
145151
namespaceSelector:
@@ -163,6 +169,7 @@ webhooks:
163169
namespace: {{ .Release.Namespace }}
164170
name: {{ .Release.Name }}
165171
path: '/stackgres/validation/sgdbops'
172+
port: {{ .Values.operator.port }}
166173
admissionReviewVersions: ["v1"]
167174
{{- if .Values.allowedNamespaces }}
168175
namespaceSelector:
@@ -186,6 +193,7 @@ webhooks:
186193
namespace: {{ .Release.Namespace }}
187194
name: {{ .Release.Name }}
188195
path: '/stackgres/validation/sgobjectstorage'
196+
port: {{ .Values.operator.port }}
189197
admissionReviewVersions: ["v1"]
190198
{{- if .Values.allowedNamespaces }}
191199
namespaceSelector:
@@ -209,6 +217,7 @@ webhooks:
209217
namespace: {{ .Release.Namespace }}
210218
name: {{ .Release.Name }}
211219
path: '/stackgres/validation/sgscript'
220+
port: {{ .Values.operator.port }}
212221
admissionReviewVersions: ["v1"]
213222
{{- if .Values.allowedNamespaces }}
214223
namespaceSelector:
@@ -232,6 +241,7 @@ webhooks:
232241
namespace: {{ .Release.Namespace }}
233242
name: {{ .Release.Name }}
234243
path: '/stackgres/validation/sgshardedcluster'
244+
port: {{ .Values.operator.port }}
235245
admissionReviewVersions: ["v1"]
236246
{{- if .Values.allowedNamespaces }}
237247
namespaceSelector:
@@ -255,6 +265,7 @@ webhooks:
255265
namespace: {{ .Release.Namespace }}
256266
name: {{ .Release.Name }}
257267
path: '/stackgres/validation/sgshardedbackup'
268+
port: {{ .Values.operator.port }}
258269
admissionReviewVersions: ["v1"]
259270
{{- if .Values.allowedNamespaces }}
260271
namespaceSelector:
@@ -278,6 +289,7 @@ webhooks:
278289
namespace: {{ .Release.Namespace }}
279290
name: {{ .Release.Name }}
280291
path: '/stackgres/validation/sgshardeddbops'
292+
port: {{ .Values.operator.port }}
281293
admissionReviewVersions: ["v1"]
282294
{{- if .Values.allowedNamespaces }}
283295
namespaceSelector:
@@ -301,6 +313,7 @@ webhooks:
301313
namespace: {{ .Release.Namespace }}
302314
name: {{ .Release.Name }}
303315
path: '/stackgres/validation/sgstream'
316+
port: {{ .Values.operator.port }}
304317
admissionReviewVersions: ["v1"]
305318
{{- if .Values.allowedNamespaces }}
306319
namespaceSelector:

stackgres-k8s/install/helm/stackgres-operator/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ operator:
4343
service:
4444
# -- Section to configure Operator Service annotations
4545
annotations: {}
46+
# Section to configure Operator port
47+
# port: 443
48+
# internalHttpPort: 8080
49+
# internalHttpsPort: 8443
4650

4751
# Section to configure REST API Pod
4852
restapi:

stackgres-k8s/src/common/src/main/resources/crds/SGConfig.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,27 @@ spec:
244244
Section to configure Operator Service annotations
245245
246246
> This value can only be set in operator helm chart.
247+
port:
248+
type: integer
249+
description: |
250+
The port that will be exposed by the operator Service for HTTPS
251+
252+
> This value can only be set in operator helm chart.
253+
default: 443
254+
internalHttpPort:
255+
type: integer
256+
description: |
257+
The port that the operator will use to listen for HTTP
258+
259+
> This value can only be set in operator helm chart or with the environment variable `OPERATOR_HTTP_PORT`.
260+
default: 8080
261+
internalHttpsPort:
262+
type: integer
263+
description: |
264+
The port that the operator will use to listen for HTTPS
265+
266+
> This value can only be set in operator helm chart or with the environment variable `OPERATOR_HTTPS_PORT`.
267+
default: 8443
247268
restapi:
248269
type: object
249270
description: Section to configure REST API Pod

stackgres-k8s/src/operator/src/main/docker/stackgres-operator.jvm.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ exec java \
7171
[ -z "$OPERATOR_CERT_FILE" ] || printf ' %s' "-Dquarkus.http.ssl.certificate.files=$OPERATOR_CERT_FILE"
7272
[ -z "$OPERATOR_KEY_FILE" ] || printf ' %s' "-Dquarkus.http.ssl.certificate.key-files=$OPERATOR_KEY_FILE"
7373
) \
74-
$JAVA_OPTS $DEBUG_JAVA_OPTS -jar "$APP_PATH"/quarkus-run.jar \
7574
-Dquarkus.http.host=0.0.0.0 \
75+
-Dquarkus.http.port="${OPERATOR_HTTP_PORT:-8080}" \
76+
-Dquarkus.http.ssl-port="${OPERATOR_HTTPS_PORT:-8443}" \
77+
$JAVA_OPTS $DEBUG_JAVA_OPTS -jar "$APP_PATH"/quarkus-run.jar \
7678
$APP_OPTS

stackgres-k8s/src/operator/src/main/docker/stackgres-operator.native.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ then
1414
fi
1515
exec /app/stackgres-operator \
1616
-Dquarkus.http.host=0.0.0.0 \
17+
-Dquarkus.http.port="${OPERATOR_HTTP_PORT:-8080}" \
18+
-Dquarkus.http.ssl-port="${OPERATOR_HTTPS_PORT:-8443}" \
1719
-Djava.util.logging.manager=org.jboss.logmanager.LogManager \
1820
$(
1921
[ -z "$OPERATOR_CERT_FILE" ] || printf ' %s' "-Dquarkus.http.ssl.certificate.files=$OPERATOR_CERT_FILE"

0 commit comments

Comments
 (0)