Skip to content

Commit

Permalink
Deprecate Namespace Resource in Helm Chart in favour of helms --creat…
Browse files Browse the repository at this point in the history
…e-namespace
  • Loading branch information
christophebeling committed Aug 14, 2024
1 parent 995320b commit a947fd2
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 8 deletions.
3 changes: 2 additions & 1 deletion manifests/helm/build/templates/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace: >-
{{ .Values.namespace }}
{{ if not .Values.createNamespace }}{{.Release.Namespace}}{{else}}{{.Values.namespace}}{{end}}
bases:
- ../../../install/all/operator
Expand All @@ -13,3 +13,4 @@ images:
patchesStrategicMerge:
- overlays/deployment.yaml
- overlays/namespace.yaml
8 changes: 8 additions & 0 deletions manifests/helm/build/templates/overlays/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$patch: delete
kind: Namespace
apiVersion: v1
metadata:
name: contrast-agent-operator
labels:
app.kubernetes.io/part-of: contrast-agent-operator

6 changes: 5 additions & 1 deletion manifests/helm/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{{ .Chart.Name }} chart version {{ .Chart.Version }} deployed!

{{ if .Values.createNamespace }}
⚠️ WARNING: Creating Namespaces via Helm Chart is deprecated and will be removed in a future release.
Pls use helm --create-namespace flag instead.️ {{ end }}

{{- if .Values.agentInjectors.enabled }}
✅ {{ len .Values.agentInjectors.injectors }} {{ len .Values.agentInjectors.injectors | plural "injector" "injectors" }} {{ len .Values.agentInjectors.injectors | plural "has" "have" }} been deployed to {{ len .Values.agentInjectors.namespaces | plural "namespace" "namespaces" }}: {{ join ", " .Values.agentInjectors.namespaces}}
To use with your workloads:
Expand Down Expand Up @@ -50,4 +54,4 @@

📄 More documentation: https://docs.contrastsecurity.com/en/agent-operator.html

🙋 Get support: https://support.contrastsecurity.com / [email protected]
🙋 Get support: https://support.contrastsecurity.com / [email protected]
6 changes: 3 additions & 3 deletions manifests/helm/templates/cluster-defaults.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: ClusterAgentConfiguration
metadata:
name: default-agent-configuration
namespace: >-
{{ .Values.namespace }}
{{ if not .Values.createNamespace }}{{.Release.Namespace}}{{else}}{{.Values.namespace}}{{end}}
spec:
template:
spec:
Expand All @@ -16,7 +16,7 @@ kind: ClusterAgentConnection
metadata:
name: default-agent-connection
namespace: >-
{{ .Values.namespace }}
{{ if not .Values.createNamespace }}{{.Release.Namespace}}{{else}}{{.Values.namespace}}{{end}}
spec:
template:
spec:
Expand All @@ -38,7 +38,7 @@ kind: Secret
metadata:
name: default-agent-connection-secret
namespace: >-
{{ .Values.namespace }}
{{ if not .Values.createNamespace }}{{.Release.Namespace}}{{else}}{{.Values.namespace}}{{end}}
type: Opaque
stringData:
apiKey: >-
Expand Down
2 changes: 1 addition & 1 deletion manifests/helm/templates/image-pull-secrets.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ kind: Secret
metadata:
name: {{ .Values.imageCredentials.pullSecretName }}
namespace: >-
{{ .Values.namespace }}
{{ if not .Values.createNamespace }}{{.Release.Namespace}}{{else}}{{.Values.Namespace}}{{end}}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: {{ template "imagePullSecret" . }}
Expand Down
10 changes: 10 additions & 0 deletions manifests/helm/templates/namespace.depricated.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## This resource is deprecated and will be removed in a future release.
## Pls use helm --create-namespace flag instead.
{{- if .Values.createNamespace }}
kind: Namespace
apiVersion: v1
metadata:
name: {{ .Values.namespace }}
labels:
app.kubernetes.io/part-of: contrast-agent-operator
{{- end -}}
5 changes: 3 additions & 2 deletions manifests/helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Release.Namespace is ignored. The operator must be created in a separate namespace.
# Specifing a namespace here is depricated and will be removed in a future release. Please use helm --namespace / --create-namespace instead.
namespace: contrast-agent-operator
createNamespace: true
image:
registry: contrast
repository: agent-operator
Expand Down Expand Up @@ -62,7 +63,7 @@ clusterDefaults:
# Name of a secret to retrieve the cluster-wide connection details from.
# The secret should contain keys named apiKey, serviceKey and userName.
# Leave blank if you want the chart to create a secret using the subsequent apiKeyValue, serviceKeyValue and userNameValue values.
existingSecret:
existingSecret:
# Required if existingSecret is not set. The API Key from the Contrast UI.
apiKeyValue:
# Required if existingSecret is not set. The Service Key from the Contrast UI.
Expand Down

0 comments on commit a947fd2

Please sign in to comment.