From 5b10f48f5b271a15c000239042c507c33da16fe9 Mon Sep 17 00:00:00 2001 From: Frank Kelly <62910985+frankjkelly@users.noreply.github.com> Date: Thu, 9 Sep 2021 20:56:16 -0400 Subject: [PATCH] Fix #152 Add Helm chart support for Istio port naming (attempt 2) (#162) Fixes #152 ### Motivation Support prefix in front of port names to abide by Istio protocol rules https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/#explicit-protocol-selection ### Modifications Support adding a prefix - pulsar -> tcp-pulsar - pulsarssl --> tls-pulsarssl etc --- charts/pulsar/Chart.yaml | 2 +- charts/pulsar/templates/bookkeeper-statefulset.yaml | 2 +- charts/pulsar/templates/broker-service.yaml | 4 ++-- charts/pulsar/templates/broker-statefulset.yaml | 4 ++-- charts/pulsar/templates/proxy-service.yaml | 4 ++-- charts/pulsar/templates/proxy-statefulset.yaml | 4 ++-- charts/pulsar/templates/zookeeper-service.yaml | 8 ++++---- charts/pulsar/values.yaml | 9 +++++++++ 8 files changed, 23 insertions(+), 14 deletions(-) diff --git a/charts/pulsar/Chart.yaml b/charts/pulsar/Chart.yaml index 16fc4d3..f8bb972 100644 --- a/charts/pulsar/Chart.yaml +++ b/charts/pulsar/Chart.yaml @@ -21,7 +21,7 @@ apiVersion: v1 appVersion: "2.7.2" description: Apache Pulsar Helm chart for Kubernetes name: pulsar -version: 2.7.2 +version: 2.7.3 home: https://pulsar.apache.org sources: - https://github.com/apache/pulsar diff --git a/charts/pulsar/templates/bookkeeper-statefulset.yaml b/charts/pulsar/templates/bookkeeper-statefulset.yaml index f338d4f..c2b2f64 100644 --- a/charts/pulsar/templates/bookkeeper-statefulset.yaml +++ b/charts/pulsar/templates/bookkeeper-statefulset.yaml @@ -170,7 +170,7 @@ spec: readOnlyRootFilesystem: false {{- end}} ports: - - name: bookie + - name: "{{ .Values.tcpPrefix }}bookie" containerPort: {{ .Values.bookkeeper.ports.bookie }} - name: http containerPort: {{ .Values.bookkeeper.ports.http }} diff --git a/charts/pulsar/templates/broker-service.yaml b/charts/pulsar/templates/broker-service.yaml index 84b1b5e..c31d74e 100644 --- a/charts/pulsar/templates/broker-service.yaml +++ b/charts/pulsar/templates/broker-service.yaml @@ -34,13 +34,13 @@ spec: - name: http port: {{ .Values.broker.ports.http }} {{- if or (not .Values.tls.enabled) (not .Values.tls.broker.enabled) }} - - name: pulsar + - name: "{{ .Values.tcpPrefix }}pulsar" port: {{ .Values.broker.ports.pulsar }} {{- end }} {{- if and .Values.tls.enabled .Values.tls.broker.enabled }} - name: https port: {{ .Values.broker.ports.https }} - - name: pulsarssl + - name: "{{ .Values.tlsPrefix }}pulsarssl" port: {{ .Values.broker.ports.pulsarssl }} {{- end }} clusterIP: None diff --git a/charts/pulsar/templates/broker-statefulset.yaml b/charts/pulsar/templates/broker-statefulset.yaml index 16db645..e49ef96 100644 --- a/charts/pulsar/templates/broker-statefulset.yaml +++ b/charts/pulsar/templates/broker-statefulset.yaml @@ -212,13 +212,13 @@ spec: - name: http containerPort: {{ .Values.broker.ports.http }} {{- if or (not .Values.tls.enabled) (not .Values.tls.broker.enabled) }} - - name: pulsar + - name: "{{ .Values.tcpPrefix }}pulsar" containerPort: {{ .Values.broker.ports.pulsar }} {{- end }} {{- if and .Values.tls.enabled .Values.tls.broker.enabled }} - name: https containerPort: {{ .Values.broker.ports.https }} - - name: pulsarssl + - name: "{{ .Values.tlsPrefix }}pulsarssl" containerPort: {{ .Values.broker.ports.pulsarssl }} {{- end }} envFrom: diff --git a/charts/pulsar/templates/proxy-service.yaml b/charts/pulsar/templates/proxy-service.yaml index 62683e7..b9678f5 100644 --- a/charts/pulsar/templates/proxy-service.yaml +++ b/charts/pulsar/templates/proxy-service.yaml @@ -37,7 +37,7 @@ spec: - name: http port: {{ .Values.proxy.ports.http }} protocol: TCP - - name: pulsar + - name: "{{ .Values.tcpPrefix }}pulsar" port: {{ .Values.proxy.ports.pulsar }} protocol: TCP {{- end }} @@ -45,7 +45,7 @@ spec: - name: https port: {{ .Values.proxy.ports.https }} protocol: TCP - - name: pulsarssl + - name: "{{ .Values.tlsPrefix }}pulsarssl" port: {{ .Values.proxy.ports.pulsarssl }} protocol: TCP {{- end }} diff --git a/charts/pulsar/templates/proxy-statefulset.yaml b/charts/pulsar/templates/proxy-statefulset.yaml index 0433d1b..2d0d7d6 100644 --- a/charts/pulsar/templates/proxy-statefulset.yaml +++ b/charts/pulsar/templates/proxy-statefulset.yaml @@ -183,13 +183,13 @@ spec: - name: http containerPort: {{ .Values.proxy.ports.http }} {{- if or (not .Values.tls.enabled) (not .Values.tls.proxy.enabled) }} - - name: pulsar + - name: "{{ .Values.tcpPrefix }}pulsar" containerPort: {{ .Values.proxy.ports.pulsar }} {{- end }} {{- if and (.Values.tls.enabled) (.Values.tls.proxy.enabled) }} - name: https containerPort: {{ .Values.proxy.ports.https }} - - name: pulsarssl + - name: "{{ .Values.tlsPrefix }}pulsarssl" containerPort: {{ .Values.proxy.ports.pulsarssl }} {{- end }} {{- if and .Values.rbac.enabled .Values.rbac.psp }} diff --git a/charts/pulsar/templates/zookeeper-service.yaml b/charts/pulsar/templates/zookeeper-service.yaml index a71849b..83cb604 100644 --- a/charts/pulsar/templates/zookeeper-service.yaml +++ b/charts/pulsar/templates/zookeeper-service.yaml @@ -34,14 +34,14 @@ spec: # prometheus needs to access /metrics endpoint - name: http port: {{ .Values.zookeeper.ports.http }} - - name: follower + - name: "{{ .Values.tcpPrefix }}follower" port: {{ .Values.zookeeper.ports.follower }} - - name: leader-election + - name: "{{ .Values.tcpPrefix }}leader-election" port: {{ .Values.zookeeper.ports.leaderElection }} - - name: client + - name: "{{ .Values.tcpPrefix }}client" port: {{ .Values.zookeeper.ports.client }} {{- if and .Values.tls.enabled .Values.tls.zookeeper.enabled }} - - name: client-tls + - name: "{{ .Values.tlsPrefix }}client-tls" port: {{ .Values.zookeeper.ports.clientTls }} {{- end }} clusterIP: None diff --git a/charts/pulsar/values.yaml b/charts/pulsar/values.yaml index 8a218a8..bed9b89 100644 --- a/charts/pulsar/values.yaml +++ b/charts/pulsar/values.yaml @@ -48,6 +48,15 @@ initialize: false ## be stored under the provided path metadataPrefix: "" +## Port name prefix +## +## Used for Istio support which depends on a standard naming of ports +## See https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/#explicit-protocol-selection +## Prefixes are disabled by default + +tcpPrefix: "" # For Istio this will be "tcp-" +tlsPrefix: "" # For Istio this will be "tls-" + ## Persistence ## ## If persistence is enabled, components that have state will