Skip to content

Commit

Permalink
Move operator to a separate deployment to run without promxy secret (#41
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gmlexx authored Jan 23, 2025
1 parent 3b5da26 commit f3520f7
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 46 deletions.
84 changes: 84 additions & 0 deletions charts/kof-mothership/templates/promxy/operator-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{{- if .Values.promxy.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "chart.fullname" . }}-promxy-operator
namespace: {{ .Release.Namespace }}
labels:
{{- include "chart.labels" . | nindent 4 }}
{{- if .Values.promxy.operator.extraLabels}}
{{ toYaml .Values.promxy.operator.extraLabels | nindent 4 }}
{{- end}}
{{- with .Values.promxy.operator.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.promxy.operator.replicaCount }}
{{- if (.Values.promxy.operator.deployment | default dict).strategy }}
strategy:
{{- toYaml .Values.promxy.operator.deployment.strategy | nindent 4 }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}-operator
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}-operator
{{- if .Values.promxy.operator.extraLabels}}
{{ toYaml .Values.promxy.operator.extraLabels | nindent 8 }}
{{- end}}
spec:
{{- with .Values.promxy.operator.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "chart.serviceAccountName" . }}
{{- if .Values.promxy.operator.nodeSelector }}
nodeSelector:
{{- toYaml .Values.promxy.operator.nodeSelector | nindent 8 }}
{{- end }}
{{- with .Values.promxy.operator.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.promxy.operator.affinity }}
affinity:
{{- toYaml .Values.promxy.operator.affinity | nindent 8 }}
{{- end }}
containers:
- name: operator
command:
- "/manager"
env:
- name: "PROMXY_RELOAD_ENDPOINT"
value: "http://{{ .Release.Name }}-promxy:{{ .Values.promxy.service.servicePort }}/-/reload"
image: "{{ .Values.promxy.operator.image.repository }}:{{ .Values.promxy.operator.image.tag }}"
imagePullPolicy: {{ .Values.promxy.operator.image.pullPolicy }}
livenessProbe:
failureThreshold: 6
httpGet:
path: /healthz
port: http
scheme: HTTP
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 3
readinessProbe:
failureThreshold: 120
httpGet:
path: /readyz
port: http
scheme: HTTP
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 3
ports:
- containerPort: 8081
name: http
resources:
{{- toYaml .Values.promxy.operator.resources | nindent 12 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,6 @@ spec:
{{ toYaml .Values.promxy.affinity | indent 8 }}
{{- end }}
containers:
- name: operator
command:
- "/manager"
image: "{{ .Values.promxy.operator.image.repository }}:{{ .Values.promxy.operator.image.tag }}"
imagePullPolicy: {{ .Values.promxy.operator.image.pullPolicy }}
livenessProbe:
failureThreshold: 6
httpGet:
path: /healthz
port: operator-http
scheme: HTTP
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 3
readinessProbe:
failureThreshold: 120
httpGet:
path: /readyz
port: operator-http
scheme: HTTP
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 3
ports:
- containerPort: 8081
name: operator-http
resources:
{{- toYaml .Values.promxy.operator.resources | nindent 12 }}
- name: promxy
args:
- "--config=/etc/promxy/config.yaml"
Expand Down
18 changes: 0 additions & 18 deletions charts/kof-mothership/templates/promxy/secret.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions promxy-operator/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func main() {
opts.BindFlags(flag.CommandLine)
flag.Parse()

if endpoint, ok := os.LookupEnv("PROMXY_RELOAD_ENDPOINT"); ok {
promxyReloadEnpoint = endpoint
}

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

// if the enable-http2 flag is false (the default), http/2 should be disabled
Expand Down

0 comments on commit f3520f7

Please sign in to comment.