Skip to content

Workaround kustomize bug in pulsar cluster init - #166

Merged
michaeljmarshall merged 2 commits into
apache:masterfrom
matejhasul:mhs-pulsar-kustomize-workaround
Jan 4, 2022
Merged

michaeljmarshall merged 2 commits into
apache:masterfrom
matejhasul:mhs-pulsar-kustomize-workaround

Conversation

@matejhasul

Copy link
Copy Markdown
Contributor

Motivation

Due to bug in kustomize kubernetes-sigs/kustomize#4201 we cannot deploy pulsar helm chart via fluxcd which uses kustomize as post-renderer (as desribed in fluxcd/flux2#1968). Pulsar cluster initialization fails, because jobs responsible for initialization is missing some arguments due extra newline:

$ kubectl -n pulsar get job pulsar-pulsar-init -o yaml | grep initialize-cluster-metadata -B3 -A3
      - args:
        - |2

          bin/pulsar initialize-cluster-metadata \

            --cluster pulsar \
            --zookeeper pulsar-zookeeper:2181 \

There are also other places where this bug is hit, but extra generated newline is not significant and does no break anything.

Modifications

Replace folding block with multiline string to workaround kubernetes-sigs/kustomize#4201

Verifying this change

  • Make sure that the change passes the CI checks.
  1. Prepare kustomization file:
cat <<EOT >./kustomization.yaml
resources:
- pulsar-init.yaml
EOT
  1. Run helm to generate k8s manifests for pulsar init jobs:
$ helm template . -s templates/pulsar-cluster-initialize.yaml --set initialize=true > pulsar-init.yaml
  1. Run kustomize:
kustomize build . > pulsar-init-kustomized.yaml
  1. Check that there is no extra newline in arguments of pulsar cluster initialization job:
$ grep initialize-cluster-metadata -B3 -A3 pulsar-init-kustomized.yaml

Replace folding block with multiline string to workaround kubernetes-sigs/kustomize#4201

There are also other places where this bug is hit, but extra generated newline is not significant.
@matejhasul

Copy link
Copy Markdown
Contributor Author

Is anyone willing to review this?

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your thorough explanation @matejhasul!

@michaeljmarshall
michaeljmarshall merged commit 706c8c2 into apache:master Jan 4, 2022
pgier pushed a commit to pgier/pulsar-helm-chart that referenced this pull request Apr 22, 2022
lhotari added a commit to lhotari/pulsar-helm-chart that referenced this pull request Feb 19, 2025
lhotari added a commit that referenced this pull request Feb 19, 2025
…572)

* Fix pulsar-cluster-initialize / pulsar-init rendering with kustomize

- reapply #166 changes that were reverted by #544 changes

* Add validation for kustomize output in CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants