From e86a615d6211d67cf497714d8aeea33a6ea13249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Ortu=C3=B1o?= Date: Wed, 1 Jun 2022 11:58:35 +0200 Subject: [PATCH] helm: support for cloud lb (#237) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Ángel Ortuño --- .../{configmap-jackal.yaml => cm-jackal.yaml} | 0 ...-script.yaml => cm-pgsql-init-script.yaml} | 0 ...deployment-jackal.yaml => dep-jackal.yaml} | 45 +++---------------- .../{deployment-redis.yaml => dep-redis.yaml} | 0 ...internal.yaml => svc-jackal-internal.yaml} | 0 helm/templates/svc-jackal.yaml | 24 ++++++++++ .../{service-redis.yaml => svc-redis.yaml} | 0 helm/values.yaml | 3 ++ 8 files changed, 33 insertions(+), 39 deletions(-) rename helm/templates/{configmap-jackal.yaml => cm-jackal.yaml} (100%) rename helm/templates/{configmap-pgsql-init-script.yaml => cm-pgsql-init-script.yaml} (100%) rename helm/templates/{deployment-jackal.yaml => dep-jackal.yaml} (75%) rename helm/templates/{deployment-redis.yaml => dep-redis.yaml} (100%) rename helm/templates/{service-jackal-internal.yaml => svc-jackal-internal.yaml} (100%) create mode 100644 helm/templates/svc-jackal.yaml rename helm/templates/{service-redis.yaml => svc-redis.yaml} (100%) diff --git a/helm/templates/configmap-jackal.yaml b/helm/templates/cm-jackal.yaml similarity index 100% rename from helm/templates/configmap-jackal.yaml rename to helm/templates/cm-jackal.yaml diff --git a/helm/templates/configmap-pgsql-init-script.yaml b/helm/templates/cm-pgsql-init-script.yaml similarity index 100% rename from helm/templates/configmap-pgsql-init-script.yaml rename to helm/templates/cm-pgsql-init-script.yaml diff --git a/helm/templates/deployment-jackal.yaml b/helm/templates/dep-jackal.yaml similarity index 75% rename from helm/templates/deployment-jackal.yaml rename to helm/templates/dep-jackal.yaml index 537f320eb..c51dfb689 100644 --- a/helm/templates/deployment-jackal.yaml +++ b/helm/templates/dep-jackal.yaml @@ -1,56 +1,24 @@ -{{- $replicasCount := int .Values.jackal.replicasCount -}} -{{- $baseNodePort := 30000 -}} -{{- range $i := until $replicasCount }} ---- -apiVersion: v1 -kind: Service -metadata: - name: jackal-{{ $i }} - namespace: {{ $.Release.Namespace }} - labels: - app: jackal-{{ $i }} -spec: - type: NodePort - selector: - app: jackal-{{ $i }} - ports: - {{- range $j, $ln := $.Values.jackal.config.c2s.listeners }} - - port: {{ $ln.port }} - name: c2s-{{ $j }} - targetPort: {{ $ln.port }} - nodePort: {{ $baseNodePort }} - {{- $baseNodePort = add1 $baseNodePort -}} - {{- end }} - {{- range $j, $ln := $.Values.jackal.config.s2s.listeners }} - - port: {{ $ln.port }} - name: s2s-{{ $j }} - targetPort: {{ $ln.port }} - nodePort: {{ $baseNodePort }} - {{- $baseNodePort = add1 $baseNodePort -}} - {{- end }} ---- apiVersion: apps/v1 kind: Deployment metadata: - name: jackal-{{ $i }} + name: jackal namespace: {{ $.Release.Namespace }} labels: - app: jackal-{{ $i }} + app: jackal heritage: {{ $.Release.Service }} release: {{ $.Release.Name }} spec: - replicas: 1 + replicas: {{ .Values.jackal.replicasCount }} selector: matchLabels: - app: jackal-{{ $i }} + app: jackal strategy: {} template: metadata: annotations: rollme: {{ randAlphaNum 5 | quote }} labels: - app: jackal-{{ $i }} - component: jackal + app: jackal spec: nodeSelector: {{- toYaml $.Values.jackal.nodeSelector | nindent 8 }} @@ -81,7 +49,7 @@ spec: - "-lapp=redis" containers: - - name: jackal-{{ $i }} + - name: jackal args: - ./jackal - -config=/etc/jackal/config.yaml @@ -143,4 +111,3 @@ spec: - name: config-volume configMap: name: jackal-config -{{- end }} diff --git a/helm/templates/deployment-redis.yaml b/helm/templates/dep-redis.yaml similarity index 100% rename from helm/templates/deployment-redis.yaml rename to helm/templates/dep-redis.yaml diff --git a/helm/templates/service-jackal-internal.yaml b/helm/templates/svc-jackal-internal.yaml similarity index 100% rename from helm/templates/service-jackal-internal.yaml rename to helm/templates/svc-jackal-internal.yaml diff --git a/helm/templates/svc-jackal.yaml b/helm/templates/svc-jackal.yaml new file mode 100644 index 000000000..6444a7797 --- /dev/null +++ b/helm/templates/svc-jackal.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + name: jackal + namespace: {{ $.Release.Namespace }} + annotations: + {{- toYaml $.Values.jackal.loadBalancer.extraAnnotations | nindent 4 }} + labels: + app: jackal +spec: + type: LoadBalancer + selector: + app: jackal + ports: + {{- range $j, $ln := $.Values.jackal.config.c2s.listeners }} + - port: {{ $ln.port }} + name: c2s-{{ $j }} + targetPort: {{ $ln.port }} + {{- end }} + {{- range $j, $ln := $.Values.jackal.config.s2s.listeners }} + - port: {{ $ln.port }} + name: s2s-{{ $j }} + targetPort: {{ $ln.port }} + {{- end }} diff --git a/helm/templates/service-redis.yaml b/helm/templates/svc-redis.yaml similarity index 100% rename from helm/templates/service-redis.yaml rename to helm/templates/svc-redis.yaml diff --git a/helm/values.yaml b/helm/values.yaml index d7e27172e..6f7cf57c4 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -25,6 +25,9 @@ jackal: cpu: 120m memory: 64Mi + loadBalancer: + extraAnnotations: {} + config: logger: level: debug