From a120f3fdefdf8c93a559f766d5e0562dc0fe4d7f Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Mon, 26 Jun 2023 14:51:54 +0200 Subject: [PATCH] Example diff for running with custom namespace --- redpanda.minimal.values.yaml | 2 + .../minimal/redpanda/templates/configmap.yaml | 8 +- .../templates/poddisruptionbudget.yaml | 2 +- .../minimal/redpanda/templates/secrets.yaml | 4 +- .../redpanda/templates/service.internal.yaml | 2 +- .../redpanda/templates/statefulset.yaml | 16 +- .../templates/tests/test-api-status.yaml | 4 +- .../tests/test-kafka-produce-consume.yaml | 4 +- .../tests/test-pandaproxy-status.yaml | 2 +- .../tests/test-schemaregistry-status.yaml | 14 +- .../minimal/unhelm-namespace-placeholder.txt | 151 ------------------ 11 files changed, 30 insertions(+), 179 deletions(-) delete mode 100644 redpanda/minimal/unhelm-namespace-placeholder.txt diff --git a/redpanda.minimal.values.yaml b/redpanda.minimal.values.yaml index 63cc58a..123edb5 100644 --- a/redpanda.minimal.values.yaml +++ b/redpanda.minimal.values.yaml @@ -1,5 +1,7 @@ # yaml-language-server: $schema=https://github.com/redpanda-data/helm-charts/raw/redpanda-4.0.32/charts/redpanda/values.schema.json # unhelm-template-repo: https://charts.redpanda.com +# unhelm-namespace: kafka + image: repository: docker.redpanda.com/redpandadata/redpanda # sha256 is disallowed here by the json schema diff --git a/redpanda/minimal/redpanda/templates/configmap.yaml b/redpanda/minimal/redpanda/templates/configmap.yaml index 24fcd9e..5c82664 100644 --- a/redpanda/minimal/redpanda/templates/configmap.yaml +++ b/redpanda/minimal/redpanda/templates/configmap.yaml @@ -4,7 +4,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: redpanda - namespace: "unhelm-namespace-placeholder" + namespace: "kafka" labels: app.kubernetes.io/component: redpanda app.kubernetes.io/instance: redpanda @@ -64,13 +64,13 @@ data: port: 33145 seed_servers: - host: - address: redpanda-0.redpanda.unhelm-namespace-placeholder.svc.cluster.local. + address: redpanda-0.redpanda.kafka.svc.cluster.local. port: 33145 - host: - address: redpanda-1.redpanda.unhelm-namespace-placeholder.svc.cluster.local. + address: redpanda-1.redpanda.kafka.svc.cluster.local. port: 33145 - host: - address: redpanda-2.redpanda.unhelm-namespace-placeholder.svc.cluster.local. + address: redpanda-2.redpanda.kafka.svc.cluster.local. port: 33145 schema_registry: schema_registry_api: diff --git a/redpanda/minimal/redpanda/templates/poddisruptionbudget.yaml b/redpanda/minimal/redpanda/templates/poddisruptionbudget.yaml index 0342d59..a2d6b5d 100644 --- a/redpanda/minimal/redpanda/templates/poddisruptionbudget.yaml +++ b/redpanda/minimal/redpanda/templates/poddisruptionbudget.yaml @@ -4,7 +4,7 @@ apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: redpanda - namespace: unhelm-namespace-placeholder + namespace: kafka labels: app.kubernetes.io/component: redpanda app.kubernetes.io/instance: redpanda diff --git a/redpanda/minimal/redpanda/templates/secrets.yaml b/redpanda/minimal/redpanda/templates/secrets.yaml index 2a8eba1..78d706b 100644 --- a/redpanda/minimal/redpanda/templates/secrets.yaml +++ b/redpanda/minimal/redpanda/templates/secrets.yaml @@ -4,7 +4,7 @@ apiVersion: v1 kind: Secret metadata: name: redpanda-sts-lifecycle - namespace: "unhelm-namespace-placeholder" + namespace: "kafka" labels: app.kubernetes.io/component: redpanda app.kubernetes.io/instance: redpanda @@ -17,7 +17,7 @@ stringData: #!/usr/bin/env bash # the SERVICE_NAME comes from the metadata.name of the pod, essentially the POD_NAME - CURL_URL="http://${SERVICE_NAME}.redpanda.unhelm-namespace-placeholder.svc.cluster.local:9644" + CURL_URL="http://${SERVICE_NAME}.redpanda.kafka.svc.cluster.local:9644" # commands used throughout CURL_NODE_ID_CMD="curl --silent --fail ${CURL_URL}/v1/node_config" diff --git a/redpanda/minimal/redpanda/templates/service.internal.yaml b/redpanda/minimal/redpanda/templates/service.internal.yaml index 86c2542..d32fbac 100644 --- a/redpanda/minimal/redpanda/templates/service.internal.yaml +++ b/redpanda/minimal/redpanda/templates/service.internal.yaml @@ -7,7 +7,7 @@ apiVersion: v1 kind: Service metadata: name: redpanda - namespace: "unhelm-namespace-placeholder" + namespace: "kafka" labels: monitoring.redpanda.com/enabled: "false" app.kubernetes.io/component: redpanda diff --git a/redpanda/minimal/redpanda/templates/statefulset.yaml b/redpanda/minimal/redpanda/templates/statefulset.yaml index e4cea6b..b13d430 100644 --- a/redpanda/minimal/redpanda/templates/statefulset.yaml +++ b/redpanda/minimal/redpanda/templates/statefulset.yaml @@ -29,7 +29,7 @@ spec: app.kubernetes.io/component: redpanda-statefulset redpanda.com/poddisruptionbudget: redpanda annotations: - checksum/config: 3d72e1348bc6b82ebfb04ace04181c2f1e0b6105339fc4b9cdb9e02fd494c817 + checksum/config: 1ea38287095928598ef2a1a2ee5d4cfc96ddc3a21b5d1e62e047bb6a0818777a spec: terminationGracePeriodSeconds: 90 securityContext: @@ -52,9 +52,9 @@ spec: fieldRef: fieldPath: metadata.name - name: ADVERTISED_KAFKA_ADDRESSES - value: '{"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":9093};{"address":"$(SERVICE_NAME)","name":"default","port":31092} {"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":9093};{"address":"$(SERVICE_NAME)","name":"default","port":31092} {"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":9093};{"address":"$(SERVICE_NAME)","name":"default","port":31092}' + value: '{"address":"$(SERVICE_NAME).redpanda.kafka.svc.cluster.local.","name":"internal","port":9093};{"address":"$(SERVICE_NAME)","name":"default","port":31092} {"address":"$(SERVICE_NAME).redpanda.kafka.svc.cluster.local.","name":"internal","port":9093};{"address":"$(SERVICE_NAME)","name":"default","port":31092} {"address":"$(SERVICE_NAME).redpanda.kafka.svc.cluster.local.","name":"internal","port":9093};{"address":"$(SERVICE_NAME)","name":"default","port":31092}' - name: ADVERTISED_HTTP_ADDRESSES - value: '{"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":8082};{"address":"$(SERVICE_NAME)","name":"default","port":30082} {"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":8082};{"address":"$(SERVICE_NAME)","name":"default","port":30082} {"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":8082};{"address":"$(SERVICE_NAME)","name":"default","port":30082}' + value: '{"address":"$(SERVICE_NAME).redpanda.kafka.svc.cluster.local.","name":"internal","port":8082};{"address":"$(SERVICE_NAME)","name":"default","port":30082} {"address":"$(SERVICE_NAME).redpanda.kafka.svc.cluster.local.","name":"internal","port":8082};{"address":"$(SERVICE_NAME)","name":"default","port":30082} {"address":"$(SERVICE_NAME).redpanda.kafka.svc.cluster.local.","name":"internal","port":8082};{"address":"$(SERVICE_NAME)","name":"default","port":30082}' - name: KUBERNETES_NODE_NAME valueFrom: fieldRef: @@ -126,7 +126,7 @@ spec: - -c - | set -e - RESULT=$(curl --silent --fail -k "http://${SERVICE_NAME}.redpanda.unhelm-namespace-placeholder.svc.cluster.local.:9644/v1/status/ready") + RESULT=$(curl --silent --fail -k "http://${SERVICE_NAME}.redpanda.kafka.svc.cluster.local.:9644/v1/status/ready") echo $RESULT echo $RESULT | grep ready initialDelaySeconds: 1 @@ -138,7 +138,7 @@ spec: command: - /bin/sh - -c - - curl --silent --fail -k "http://${SERVICE_NAME}.redpanda.unhelm-namespace-placeholder.svc.cluster.local.:9644/v1/status/ready" + - curl --silent --fail -k "http://${SERVICE_NAME}.redpanda.kafka.svc.cluster.local.:9644/v1/status/ready" initialDelaySeconds: 10 failureThreshold: 3 periodSeconds: 10 @@ -153,8 +153,8 @@ spec: - -c - | set -x - rpk cluster health --api-urls ${SERVICE_NAME}.redpanda.unhelm-namespace-placeholder.svc.cluster.local.:9644 - rpk cluster health --api-urls ${SERVICE_NAME}.redpanda.unhelm-namespace-placeholder.svc.cluster.local.:9644 | grep 'Healthy:.*true' + rpk cluster health --api-urls ${SERVICE_NAME}.redpanda.kafka.svc.cluster.local.:9644 + rpk cluster health --api-urls ${SERVICE_NAME}.redpanda.kafka.svc.cluster.local.:9644 | grep 'Healthy:.*true' initialDelaySeconds: 1 failureThreshold: 3 periodSeconds: 10 @@ -167,7 +167,7 @@ spec: - --memory=2048M - --reserve-memory=205M - --default-log-level=info - - --advertise-rpc-addr=$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.:33145 + - --advertise-rpc-addr=$(SERVICE_NAME).redpanda.kafka.svc.cluster.local.:33145 - --overprovisioned ports: - name: admin diff --git a/redpanda/minimal/redpanda/templates/tests/test-api-status.yaml b/redpanda/minimal/redpanda/templates/tests/test-api-status.yaml index 093559a..f7b0029 100644 --- a/redpanda/minimal/redpanda/templates/tests/test-api-status.yaml +++ b/redpanda/minimal/redpanda/templates/tests/test-api-status.yaml @@ -4,7 +4,7 @@ apiVersion: v1 kind: Pod metadata: name: "redpanda-test-api-status" - namespace: "unhelm-namespace-placeholder" + namespace: "kafka" labels: app.kubernetes.io/component: redpanda app.kubernetes.io/instance: redpanda @@ -29,7 +29,7 @@ spec: - -c - | until rpk cluster info \ - --brokers redpanda-0.redpanda.unhelm-namespace-placeholder.svc.cluster.local.:9093 + --brokers redpanda-0.redpanda.kafka.svc.cluster.local.:9093 do sleep 2 done volumeMounts: diff --git a/redpanda/minimal/redpanda/templates/tests/test-kafka-produce-consume.yaml b/redpanda/minimal/redpanda/templates/tests/test-kafka-produce-consume.yaml index 09782cb..6fa00bb 100644 --- a/redpanda/minimal/redpanda/templates/tests/test-kafka-produce-consume.yaml +++ b/redpanda/minimal/redpanda/templates/tests/test-kafka-produce-consume.yaml @@ -4,7 +4,7 @@ apiVersion: v1 kind: Pod metadata: name: redpanda-test-kafka-produce-consume - namespace: "unhelm-namespace-placeholder" + namespace: "kafka" labels: app.kubernetes.io/component: redpanda app.kubernetes.io/instance: redpanda @@ -24,7 +24,7 @@ spec: image: docker.redpanda.com/redpandadata/redpanda:v23.1.13 env: - name: REDPANDA_BROKERS - value: "redpanda.unhelm-namespace-placeholder.svc.cluster.local:9093" + value: "redpanda.kafka.svc.cluster.local:9093" - name: POD_NAME valueFrom: fieldRef: diff --git a/redpanda/minimal/redpanda/templates/tests/test-pandaproxy-status.yaml b/redpanda/minimal/redpanda/templates/tests/test-pandaproxy-status.yaml index 6601cdd..1e622de 100644 --- a/redpanda/minimal/redpanda/templates/tests/test-pandaproxy-status.yaml +++ b/redpanda/minimal/redpanda/templates/tests/test-pandaproxy-status.yaml @@ -4,7 +4,7 @@ apiVersion: v1 kind: Pod metadata: name: "redpanda-test-pandaproxy-status" - namespace: "unhelm-namespace-placeholder" + namespace: "kafka" labels: app.kubernetes.io/component: redpanda app.kubernetes.io/instance: redpanda diff --git a/redpanda/minimal/redpanda/templates/tests/test-schemaregistry-status.yaml b/redpanda/minimal/redpanda/templates/tests/test-schemaregistry-status.yaml index e1fe596..82eef63 100644 --- a/redpanda/minimal/redpanda/templates/tests/test-schemaregistry-status.yaml +++ b/redpanda/minimal/redpanda/templates/tests/test-schemaregistry-status.yaml @@ -4,7 +4,7 @@ apiVersion: v1 kind: Pod metadata: name: "redpanda-test-schemaregistry-status" - namespace: "unhelm-namespace-placeholder" + namespace: "kafka" labels: app.kubernetes.io/component: redpanda app.kubernetes.io/instance: redpanda @@ -31,21 +31,21 @@ spec: $* } - schemaCurl http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/schemas/types + schemaCurl http://redpanda.kafka.svc.cluster.local.:8081/schemas/types curl -svm3 --fail --retry "120" --retry-max-time "120" --retry-all-errors \ -X POST -H 'Content-Type:application/vnd.schemaregistry.v1+json' \ -d '{"schema":"{\"type\":\"record\",\"name\":\"sensor_sample\",\"fields\":[{\"name\":\"timestamp\",\"type\":\"long\",\"logicalType\":\"timestamp-millis\"},{\"name\":\"identifier\",\"type\":\"string\",\"logicalType\":\"uuid\"},{\"name\":\"value\",\"type\":\"long\"}]}"}' \ - http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/subjects/sensor-value/versions + http://redpanda.kafka.svc.cluster.local.:8081/subjects/sensor-value/versions - schemaCurl http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/schemas/ids/1 + schemaCurl http://redpanda.kafka.svc.cluster.local.:8081/schemas/ids/1 - schemaCurl http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/subjects + schemaCurl http://redpanda.kafka.svc.cluster.local.:8081/subjects schemaCurl -X DELETE \ - http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/subjects/sensor-value/versions/1 + http://redpanda.kafka.svc.cluster.local.:8081/subjects/sensor-value/versions/1 schemaCurl -X DELETE \ - http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/subjects/sensor-value/versions/1?permanent=true + http://redpanda.kafka.svc.cluster.local.:8081/subjects/sensor-value/versions/1?permanent=true volumeMounts: volumes: diff --git a/redpanda/minimal/unhelm-namespace-placeholder.txt b/redpanda/minimal/unhelm-namespace-placeholder.txt deleted file mode 100644 index 8bdc7a6..0000000 --- a/redpanda/minimal/unhelm-namespace-placeholder.txt +++ /dev/null @@ -1,151 +0,0 @@ - -Note the following instances of namespace strings that Kustomize won't replace -============================================================================= - - rpc_server: - address: 0.0.0.0 - port: 33145 - seed_servers: - - host: - address: redpanda-0.redpanda.unhelm-namespace-placeholder.svc.cluster.local. - port: 33145 - - host: - address: redpanda-1.redpanda.unhelm-namespace-placeholder.svc.cluster.local. - port: 33145 - - host: - address: redpanda-2.redpanda.unhelm-namespace-placeholder.svc.cluster.local. - port: 33145 - schema_registry: - schema_registry_api: - - name: internal - address: 0.0.0.0 --- -stringData: - common.sh: |- - #!/usr/bin/env bash - - # the SERVICE_NAME comes from the metadata.name of the pod, essentially the POD_NAME - CURL_URL="http://${SERVICE_NAME}.redpanda.unhelm-namespace-placeholder.svc.cluster.local:9644" - - # commands used throughout - CURL_NODE_ID_CMD="curl --silent --fail ${CURL_URL}/v1/node_config" - - CURL_MAINTENANCE_DELETE_CMD_PREFIX='curl -X DELETE --silent -o /dev/null -w "%{http_code}"' --- - - start - - --smp=1 - - --memory=2048M - - --reserve-memory=205M - - --default-log-level=info - - --advertise-rpc-addr=$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.:33145 - - --overprovisioned - env: - - name: SERVICE_NAME - valueFrom: - fieldRef: --- - livenessProbe: - exec: - command: - - /bin/sh - - -c - - curl --silent --fail -k "http://${SERVICE_NAME}.redpanda.unhelm-namespace-placeholder.svc.cluster.local.:9644/v1/status/ready" - failureThreshold: 3 - initialDelaySeconds: 10 - periodSeconds: 10 - name: redpanda - ports: --- - command: - - /bin/sh - - -c - - | - set -x - rpk cluster health --api-urls ${SERVICE_NAME}.redpanda.unhelm-namespace-placeholder.svc.cluster.local.:9644 - rpk cluster health --api-urls ${SERVICE_NAME}.redpanda.unhelm-namespace-placeholder.svc.cluster.local.:9644 | grep 'Healthy:.*true' - failureThreshold: 3 - initialDelaySeconds: 1 - periodSeconds: 10 - successThreshold: 1 - resources: --- - command: - - /bin/sh - - -c - - | - set -e - RESULT=$(curl --silent --fail -k "http://${SERVICE_NAME}.redpanda.unhelm-namespace-placeholder.svc.cluster.local.:9644/v1/status/ready") - echo $RESULT - echo $RESULT | grep ready - failureThreshold: 120 - initialDelaySeconds: 1 - periodSeconds: 10 --- - - name: SERVICE_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: ADVERTISED_KAFKA_ADDRESSES - value: '{"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":9093};{"address":"$(SERVICE_NAME)","name":"default","port":31092} - {"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":9093};{"address":"$(SERVICE_NAME)","name":"default","port":31092} - {"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":9093};{"address":"$(SERVICE_NAME)","name":"default","port":31092}' - - name: ADVERTISED_HTTP_ADDRESSES - value: '{"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":8082};{"address":"$(SERVICE_NAME)","name":"default","port":30082} - {"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":8082};{"address":"$(SERVICE_NAME)","name":"default","port":30082} - {"address":"$(SERVICE_NAME).redpanda.unhelm-namespace-placeholder.svc.cluster.local.","name":"internal","port":8082};{"address":"$(SERVICE_NAME)","name":"default","port":30082}' - - name: KUBERNETES_NODE_NAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - image: docker.redpanda.com/redpandadata/redpanda:v23.1.13 --- - - "120" - - bash - - -c - - | - until rpk cluster info \ - --brokers redpanda-0.redpanda.unhelm-namespace-placeholder.svc.cluster.local.:9093 - do sleep 2 - done - image: docker.redpanda.com/redpandadata/redpanda:v23.1.13 - name: redpanda - volumeMounts: --- - - -c - - | - set -e - env: - - name: REDPANDA_BROKERS - value: redpanda.unhelm-namespace-placeholder.svc.cluster.local:9093 - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - image: docker.redpanda.com/redpandadata/redpanda:v23.1.13 --- - schemaCurl () { - curl -svm3 --fail --retry "120" --retry-max-time "120" --retry-all-errors \ - $* - } - - schemaCurl http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/schemas/types - - curl -svm3 --fail --retry "120" --retry-max-time "120" --retry-all-errors \ - -X POST -H 'Content-Type:application/vnd.schemaregistry.v1+json' \ - -d '{"schema":"{\"type\":\"record\",\"name\":\"sensor_sample\",\"fields\":[{\"name\":\"timestamp\",\"type\":\"long\",\"logicalType\":\"timestamp-millis\"},{\"name\":\"identifier\",\"type\":\"string\",\"logicalType\":\"uuid\"},{\"name\":\"value\",\"type\":\"long\"}]}"}' \ - http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/subjects/sensor-value/versions - - schemaCurl http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/schemas/ids/1 - - schemaCurl http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/subjects - - schemaCurl -X DELETE \ - http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/subjects/sensor-value/versions/1 - - schemaCurl -X DELETE \ - http://redpanda.unhelm-namespace-placeholder.svc.cluster.local.:8081/subjects/sensor-value/versions/1?permanent=true - command: - - /bin/bash - - -c - image: docker.redpanda.com/redpandadata/redpanda:v23.1.13 - name: redpanda