Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "node-data-broker.fullname" . }}
{{- if ne .Release.Namespace "default" }}
namespace: {{ .Release.Namespace }}
{{- end}}
labels:
{{- include "node-data-broker.labels" . | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "node-data-broker.serviceAccountName" . }}
{{- if ne .Release.Namespace "default" }}
namespace: {{ .Release.Namespace }}
{{- end}}
labels:
{{- include "node-data-broker.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "node-observer.fullname" . }}
{{- if ne .Release.Namespace "default" }}
namespace: {{ .Release.Namespace }}
{{- end}}
labels:
{{- include "node-observer.labels" . | nindent 4 }}
data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "node-observer.fullname" . }}
{{- if ne .Release.Namespace "default" }}
namespace: {{ .Release.Namespace }}
{{- end}}
labels:
{{- include "node-observer.labels" . | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "node-observer.serviceAccountName" . }}
{{- if ne .Release.Namespace "default" }}
namespace: {{ .Release.Namespace }}
{{- end}}
labels:
{{- include "node-observer.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
Expand Down
3 changes: 3 additions & 0 deletions charts/topograph/templates/configmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "topograph.fullname" . }}
{{- if ne .Release.Namespace "default" }}
namespace: {{ .Release.Namespace }}
{{- end}}
labels:
{{- include "topograph.labels" . | nindent 4 }}
data:
Expand Down
3 changes: 3 additions & 0 deletions charts/topograph/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "topograph.fullname" . }}
{{- if ne .Release.Namespace "default" }}
namespace: {{ .Release.Namespace }}
{{- end}}
Comment on lines +8 to +10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Non-standard conditional omits namespace for default

Every changed template guards the namespace field with {{- if ne .Release.Namespace "default" }}, which means rendering with --namespace default (or no --namespace flag) produces manifests without an explicit namespace: field. When those manifests are applied through a GitOps tool such as ArgoCD or Flux, the resource is placed into whatever the cluster's contextual default namespace is rather than default — recreating the very bug (#344) this PR intends to fix, just scoped to that one namespace.

The Helm-recommended pattern is to emit the namespace unconditionally: namespace: {{ .Release.Namespace }}. The same conditional appears in all 11 files changed by this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was to retain compatibility with how helm template functioned before.

If user specifies namespace=default or omits it, they are free to kubectl apply to any namespace they choose.

If namespace: default is in the manifest, it must be applied to the default namespace.

Can remove the conditional if we are fine with changing the default behavior.

labels:
{{- include "topograph.labels" . | nindent 4 }}
spec:
Expand Down
3 changes: 3 additions & 0 deletions charts/topograph/templates/httproute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ $fullName }}
{{- if ne .Release.Namespace "default" }}
namespace: {{ .Release.Namespace }}
{{- end}}
labels:
{{- include "topograph.labels" . | nindent 4 }}
{{- with .Values.gatewayAPI.annotations }}
Expand Down
3 changes: 3 additions & 0 deletions charts/topograph/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
{{- if ne .Release.Namespace "default" }}
namespace: {{ .Release.Namespace }}
{{- end}}
labels:
{{- include "topograph.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
Expand Down
3 changes: 3 additions & 0 deletions charts/topograph/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "topograph.fullname" . }}
{{- if ne .Release.Namespace "default" }}
namespace: {{ .Release.Namespace }}
{{- end}}
labels:
{{- include "topograph.labels" . | nindent 4 }}
spec:
Expand Down
3 changes: 3 additions & 0 deletions charts/topograph/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "topograph.serviceAccountName" . }}
{{- if ne .Release.Namespace "default" }}
namespace: {{ .Release.Namespace }}
{{- end}}
labels:
{{- include "topograph.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
Expand Down