Fix secret placeholder in zxp installer#372
Conversation
| @$(YQ) -i '(select(.kind == "ConfigMap" and .metadata.name == "devzero-zxporter-env-config") | .data.DAKR_URL) = "{{ .api_url }}/dakr"' $(DIST_BACKEND_INSTALL_BUNDLE) | ||
| @$(YQ) -i '(select(.kind == "Deployment") | .spec.template.spec.containers[]? | select(.image == "ttl.sh/zxporter:latest")).image = "docker.io/devzeroinc/zxporter:latest"' $(DIST_BACKEND_INSTALL_BUNDLE) | ||
| @$(YQ) -i '(select(.kind == "Secret" and .metadata.name == "devzero-zxporter-token") | .stringData.CLUSTER_TOKEN) = "{{ .cluster_token }}"' $(DIST_BACKEND_INSTALL_BUNDLE) | ||
| @$(YQ) -i '(select(.kind == "Namespace" and .metadata.labels."app.kubernetes.io/managed-by" == "kustomize") | .metadata.name) = "{{.zxporter_namespace}}"' $(DIST_BACKEND_INSTALL_BUNDLE) |
There was a problem hiding this comment.
⚠️ Bug: Inconsistent Go-template placeholder spacing may break rendering
The new namespace placeholder on line 324 uses {{.zxporter_namespace}} (no spaces inside braces), while every other placeholder in the same target uses {{ .placeholder }} (with spaces). Although Go templates accept both forms, if the consuming template engine or string-replacement logic expects a consistent format (e.g., a regex like {{ \.\w+ }}), the no-space variant will silently fail to be substituted at install time, leaving a literal {{.zxporter_namespace}} in the rendered YAML.
Please verify the template engine consuming these placeholders. If it's standard Go text/template, both forms work. If it's a custom regex-based replacer, this will break.
Suggested fix:
@$(YQ) -i '(select(.kind == "Namespace" and .metadata.labels."app.kubernetes.io/managed-by" == "kustomize") | .metadata.name) = "{{ .zxporter_namespace }}"' $(DIST_BACKEND_INSTALL_BUNDLE)
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
Code Review
|
Fix secret placeholder in zxp installer
📚 Description of Changes
Provide an overview of your changes and why they’re needed. Link to any related issues (e.g., "Fixes #123"). If your PR fixes a bug, resolves a feature request, or updates documentation, please explain how.
What Changed:
(Describe the modifications, additions, or removals.)
Why This Change:
(Explain the problem this PR addresses or the improvement it provides.)
Affected Components:
(Which component does this change affect? - put x for all components)
Compose
K8s
Other (please specify)
❓ Motivation and Context
Why is this change required? What problem does it solve?
Context:
(Provide background information or link to related discussions/issues.)
Relevant Tasks/Issues:
(e.g., Fixes: #GitHub Issue)
🔍 Types of Changes
Indicate which type of changes your code introduces (check all that apply):
🔬 QA / Verification Steps
Describe the steps a reviewer should take to verify your changes:
make testto verify all tests pass.")make create-kind && make deploy.")✅ Global Checklist
Please check all boxes that apply:
Summary by Gitar
Makefileto dynamically inject thezxporter_namespaceinto the installer bundle usingyq.This will update automatically on new commits.