From 5e00179b109d7290eb05a2b9705839fcf666d29a Mon Sep 17 00:00:00 2001 From: alvgarvilla Date: Thu, 25 Oct 2018 14:30:20 +0100 Subject: [PATCH] [stable/magic-namespace] Adding annotations and labels to namespaces (#8324) * Adding annotations and labels to namespaces Signed-off-by: Garcia De La Villa, Alvaro * Reverting namespace object and adding namespaceAttributes Signed-off-by: Garcia De La Villa, Alvaro * Commenting namespace value and deleting unused attributes Signed-off-by: Garcia De La Villa, Alvaro --- stable/magic-namespace/Chart.yaml | 2 +- stable/magic-namespace/README.md | 8 +++++--- stable/magic-namespace/templates/namespace.yaml | 5 ++++- stable/magic-namespace/templates/tiller-rolebinding.yaml | 2 +- stable/magic-namespace/values.yaml | 8 ++++++++ 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/stable/magic-namespace/Chart.yaml b/stable/magic-namespace/Chart.yaml index 65999c76cd..4505215fc6 100644 --- a/stable/magic-namespace/Chart.yaml +++ b/stable/magic-namespace/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: magic-namespace -version: 0.2.0 +version: 0.3.0 appVersion: 2.8.1 home: https://github.com/kubernetes/charts/tree/master/stable/magic-namespace description: Elegantly enables a Tiller per namespace in RBAC-enabled clusters diff --git a/stable/magic-namespace/README.md b/stable/magic-namespace/README.md index 0ecc67a684..d01827eeeb 100644 --- a/stable/magic-namespace/README.md +++ b/stable/magic-namespace/README.md @@ -50,7 +50,7 @@ accounts and role bindings for use within the namespace. _Typically, it would be a good idea to define at least one role binding that grants a user or group administrative privileges in the namespace._ Absent this, the namespace's own Tiller will function, but no user (other than the cluster operator) will be -capable of interacting with it via Helm. +capable of interacting with it via Helm. ## Prerequisites @@ -104,13 +104,13 @@ $ helm install stable/magic-namespace \ ## Uninstalling the Chart -Deleting a release of a Magic Namespace will _not_ delete the namespace, +Deleting a release of a Magic Namespace will _not_ delete the namespace, unless you have used the optional ```namespace``` setting. It will only delete the Tiller, service accounts, role bindings, etc. from that namespace. This is actually desirable behavior, as anything the team has deployed within that namespace is likely to be unaffected, though further deployments to and management of that namespace will not be possible by anyone -other than the cluster operator. +other than the cluster operator. If you have used the ```namespace``` setting, deleting the release will cleanup all releases deployed with the tiller in the Magic Namespace, along with the @@ -147,3 +147,5 @@ reference the default `values.yaml` to understand further options. | `roleBindings[n].subject.kind` | Identify the kind of subject (`User`, `Group`, or `ServiceAccount` ) to be used in the role binding | | | `roleBindings[n].subject.name` | Identify the name of the subject to be used in the role binding | | | `namespace` | Specify a namespace to be created and used, overriding the one on the command line | | +| `namespaceAttributes.annotations` | Specify annotations to be attached to the namespace | | +| `namespaceAttributes.lables` | Specify labels to be attached to the namespace | | diff --git a/stable/magic-namespace/templates/namespace.yaml b/stable/magic-namespace/templates/namespace.yaml index a825dddc2c..01ba6ab714 100644 --- a/stable/magic-namespace/templates/namespace.yaml +++ b/stable/magic-namespace/templates/namespace.yaml @@ -3,4 +3,7 @@ apiVersion: v1 kind: Namespace metadata: name: {{ .Values.namespace }} -{{- end }} \ No newline at end of file + {{- if hasKey .Values "namespaceAttributes" }} +{{ toYaml .Values.namespaceAttributes | indent 2 }} + {{ end -}} +{{- end }} diff --git a/stable/magic-namespace/templates/tiller-rolebinding.yaml b/stable/magic-namespace/templates/tiller-rolebinding.yaml index 437a9c8f3e..6fb597120e 100644 --- a/stable/magic-namespace/templates/tiller-rolebinding.yaml +++ b/stable/magic-namespace/templates/tiller-rolebinding.yaml @@ -24,5 +24,5 @@ subjects: {{- else }} namespace: {{ .Release.Namespace }} {{- end }} - + {{- end }} diff --git a/stable/magic-namespace/values.yaml b/stable/magic-namespace/values.yaml index 319b578ff5..71d53f73d0 100644 --- a/stable/magic-namespace/values.yaml +++ b/stable/magic-namespace/values.yaml @@ -3,6 +3,14 @@ # Uncomment and set to override the namespace that will be created. # namespace: default +# Extra namespace attributes +# namespaceAttributes: + # Labels to be added to the namespace definition + # labels: {} + + # Annotations to be added to the namespace definition + # annotations: {} + tiller: enabled: true