From f2d65aa8dbcae4b123df910f5da42039025cd649 Mon Sep 17 00:00:00 2001 From: Andrei Nesterov Date: Sun, 12 Jun 2022 01:08:50 +0300 Subject: [PATCH] Update ports --- chart/templates/{sts.yaml => app.yaml} | 29 +++++++++++++++++-- .../templates/{configmap.yaml => config.yaml} | 18 ++++++++++-- chart/templates/env.yaml | 11 ------- .../{servicemonitor.yaml => monitoring.yaml} | 0 .../{ingress.yaml => networking.yaml} | 26 +++++++++++++++++ chart/templates/pdb.yaml | 11 ------- chart/templates/services.yaml | 25 ---------------- chart/values.yaml | 2 +- 8 files changed, 70 insertions(+), 52 deletions(-) rename chart/templates/{sts.yaml => app.yaml} (92%) rename chart/templates/{configmap.yaml => config.yaml} (90%) delete mode 100644 chart/templates/env.yaml rename chart/templates/{servicemonitor.yaml => monitoring.yaml} (100%) rename chart/templates/{ingress.yaml => networking.yaml} (52%) delete mode 100644 chart/templates/pdb.yaml delete mode 100644 chart/templates/services.yaml diff --git a/chart/templates/sts.yaml b/chart/templates/app.yaml similarity index 92% rename from chart/templates/sts.yaml rename to chart/templates/app.yaml index 49654c1f..36cbadae 100644 --- a/chart/templates/sts.yaml +++ b/chart/templates/app.yaml @@ -6,14 +6,14 @@ metadata: {{- include "event.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount | default 2 }} - serviceName: {{ include "event.name" . }}-headless + serviceName: {{ include "event.name" . }}-headless-service selector: matchLabels: {{- include "event.selectorLabels" . | nindent 6 }} template: metadata: annotations: - checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} @@ -183,3 +183,28 @@ spec: secretName: {{ $secret }} {{- end }} {{- end }} + +--- + +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }}-headless-service +spec: + selector: + {{- include "event.selectorLabels" . | nindent 4 }} + clusterIP: None + +--- + +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ include "event.name" . }}-pdb + labels: + {{- include "event.labels" . | nindent 4 }} +spec: + minAvailable: 1 + selector: + matchLabels: + {{- include "event.selectorLabels" . | nindent 6 }} diff --git a/chart/templates/configmap.yaml b/chart/templates/config.yaml similarity index 90% rename from chart/templates/configmap.yaml rename to chart/templates/config.yaml index 570c2098..d85a4b56 100644 --- a/chart/templates/configmap.yaml +++ b/chart/templates/config.yaml @@ -12,7 +12,7 @@ data: {{- $broker_id := list "mqtt-gateway" (include "event.shortNamespace" .) .Values.svc.audience | compact | join "." }} broker_id = {{ $broker_id | quote }} - http_addr = "0.0.0.0:{{ .Values.service.ports.http }}" + http_addr = "0.0.0.0:8080" [constraint] payload_size = {{ .Values.constraint.payload_size }} @@ -37,7 +37,7 @@ data: id = {{ $kruonis_id | quote }} [metrics.http] - bind_address = "0.0.0.0:{{ .Values.service.ports.metrics }}" + bind_address = "0.0.0.0:8888" ## ## ULMS @@ -102,3 +102,17 @@ data: {{- end }} {{- println "" }} {{- end }} + +--- + +apiVersion: v1 +kind: ConfigMap +metadata: + annotations: {} + labels: + {{- include "event.labels" . | nindent 4 }} + name: {{ include "event.name" . }}-environment +data: + {{- range $key, $value := .Values.env }} + {{ $key }}: {{ $value | quote }} + {{- end }} diff --git a/chart/templates/env.yaml b/chart/templates/env.yaml deleted file mode 100644 index eda2986d..00000000 --- a/chart/templates/env.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - annotations: {} - labels: - {{- include "event.labels" . | nindent 4 }} - name: {{ include "event.name" . }}-environment -data: - {{- range $key, $value := .Values.env }} - {{ $key }}: {{ $value | quote }} - {{- end }} diff --git a/chart/templates/servicemonitor.yaml b/chart/templates/monitoring.yaml similarity index 100% rename from chart/templates/servicemonitor.yaml rename to chart/templates/monitoring.yaml diff --git a/chart/templates/ingress.yaml b/chart/templates/networking.yaml similarity index 52% rename from chart/templates/ingress.yaml rename to chart/templates/networking.yaml index 04cdf1e9..8067ce2e 100644 --- a/chart/templates/ingress.yaml +++ b/chart/templates/networking.yaml @@ -1,3 +1,29 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "event.serviceName" . }} + labels: + {{- include "event.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + {{- if .Values.service.ports.http }} + - name: http + port: {{ .Values.service.ports.http }} + targetPort: 8080 + protocol: TCP + {{- end }} + {{- if .Values.service.ports.metrics }} + - name: metrics + port: {{ .Values.service.ports.metrics }} + targetPort: 8888 + protocol: TCP + {{- end }} + selector: + {{- include "event.selectorLabels" . | nindent 4 }} + +--- + apiVersion: extensions/v1beta1 kind: Ingress metadata: diff --git a/chart/templates/pdb.yaml b/chart/templates/pdb.yaml deleted file mode 100644 index c86126d1..00000000 --- a/chart/templates/pdb.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: policy/v1beta1 -kind: PodDisruptionBudget -metadata: - name: {{ include "event.name" . }}-pdb - labels: - {{- include "event.labels" . | nindent 4 }} -spec: - minAvailable: 1 - selector: - matchLabels: - {{- include "event.selectorLabels" . | nindent 6 }} diff --git a/chart/templates/services.yaml b/chart/templates/services.yaml deleted file mode 100644 index e6d9ad55..00000000 --- a/chart/templates/services.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ .Chart.Name }}-headless -spec: - selector: - {{- include "event.selectorLabels" . | nindent 4 }} - clusterIP: None ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ include "event.serviceName" . }} - labels: - {{- include "event.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - {{- range $name, $port := .Values.service.ports }} - - port: {{ $port }} - protocol: TCP - name: {{ $name }} - {{- end }} - selector: - {{- include "event.selectorLabels" . | nindent 4 }} diff --git a/chart/values.yaml b/chart/values.yaml index dc3d4133..1ea54565 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -64,7 +64,7 @@ service: type: ClusterIP ports: http: 8080 - metrics: 8081 + metrics: 8888 ingress: host: example.org