Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ final-installer:
@$(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)
Comment on lines 321 to +324
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ 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

@$(MAKE) installer-without-configmap
@if [ -d "$(DAKR_DIR)/services/dakr_installers" ]; then \
cp $(DIST_BACKEND_INSTALL_BUNDLE) $(DAKR_DIR)/services/dakr_installers/install.yaml; \
Expand All @@ -331,7 +332,7 @@ final-installer:
.PHONY: installer-without-configmap
installer-without-configmap:
@cp $(DIST_BACKEND_INSTALL_BUNDLE) $(DIST_DIR)/installer_updater.yaml
@$(YQ) -i 'select(.kind != "ConfigMap" or .metadata.name != "devzero-zxporter-env-config")' $(DIST_DIR)/installer_updater.yaml
@$(YQ) -i 'select((.kind != "ConfigMap" or .metadata.name != "devzero-zxporter-env-config") and (.kind != "Secret" or .metadata.name != "devzero-zxporter-token"))' $(DIST_DIR)/installer_updater.yaml

.PHONY: build-installer
build-installer: manifests generate kustomize yq ## Generate a consolidated YAML with deployment.
Expand Down Expand Up @@ -385,7 +386,9 @@ build-installer: manifests generate kustomize yq ## Generate a consolidated YAML

@$(KUSTOMIZE) build config/default > $(DIST_ZXPORTER_BUNDLE)
@echo "[INFO] Patching cluster token into generated bundle"
@sed "s|CLUSTER_TOKEN: '{{ .cluster_token }}'|CLUSTER_TOKEN: \"$(CLUSTER_TOKEN)\"|g" $(DIST_ZXPORTER_BUNDLE) > $(DIST_ZXPORTER_BUNDLE).tmp && mv $(DIST_ZXPORTER_BUNDLE).tmp $(DIST_ZXPORTER_BUNDLE)
@if [ -n "$(CLUSTER_TOKEN)" ]; then \
sed "s|CLUSTER_TOKEN: '{{ .cluster_token }}'|CLUSTER_TOKEN: \"$(CLUSTER_TOKEN)\"|g" $(DIST_ZXPORTER_BUNDLE) > $(DIST_ZXPORTER_BUNDLE).tmp && mv $(DIST_ZXPORTER_BUNDLE).tmp $(DIST_ZXPORTER_BUNDLE); \
fi
Comment thread
gitar-bot[bot] marked this conversation as resolved.
@cat $(DIST_ZXPORTER_BUNDLE) >> $(DIST_INSTALL_BUNDLE)

@echo "[INFO] Building backend installer"
Expand Down
4 changes: 2 additions & 2 deletions dist/backend-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ metadata:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: devzero-zxporter
control-plane: controller-manager
name: devzero-system
name: '{{.zxporter_namespace}}'
---
apiVersion: v1
kind: ServiceAccount
Expand Down Expand Up @@ -1430,7 +1430,7 @@ metadata:
name: devzero-zxporter-token
namespace: devzero-system
stringData:
CLUSTER_TOKEN: "{{ .cluster_token }}"
CLUSTER_TOKEN: '{{ .cluster_token }}'
type: Opaque
---
apiVersion: v1
Expand Down
2 changes: 1 addition & 1 deletion dist/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ metadata:
name: devzero-zxporter-token
namespace: devzero-system
stringData:
CLUSTER_TOKEN: ""
CLUSTER_TOKEN: '{{ .cluster_token }}'
type: Opaque
---
apiVersion: v1
Expand Down
11 changes: 1 addition & 10 deletions dist/installer_updater.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ metadata:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: devzero-zxporter
control-plane: controller-manager
name: devzero-system
name: '{{.zxporter_namespace}}'
---
apiVersion: v1
kind: ServiceAccount
Expand Down Expand Up @@ -1369,15 +1369,6 @@ subjects:
namespace: devzero-system
---
apiVersion: v1
kind: Secret
metadata:
name: devzero-zxporter-token
namespace: devzero-system
stringData:
CLUSTER_TOKEN: "{{ .cluster_token }}"
type: Opaque
---
apiVersion: v1
kind: Service
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion dist/zxporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ metadata:
name: devzero-zxporter-token
namespace: devzero-system
stringData:
CLUSTER_TOKEN: ""
CLUSTER_TOKEN: '{{ .cluster_token }}'
type: Opaque
---
apiVersion: v1
Expand Down
Loading