diff --git a/class/defaults.yml b/class/defaults.yml index 45edae9..4f4bdef 100644 --- a/class/defaults.yml +++ b/class/defaults.yml @@ -1,6 +1,9 @@ parameters: crossplane: namespace: syn-crossplane + namespaceLabels: {} + namespaceAnnotations: {} + charts: crossplane: 1.11.0 images: diff --git a/component/main.jsonnet b/component/main.jsonnet index 79d3020..c9e1036 100644 --- a/component/main.jsonnet +++ b/component/main.jsonnet @@ -112,7 +112,12 @@ local namespace = ; { - '00_namespace': namespace, + '00_namespace': namespace { + metadata+: { + labels+: params.namespaceLabels, + annotations+: params.namespaceAnnotations, + }, + }, '01_rbac_finalizer_clusterrole': rbacFinalizerRole, '01_rbac_finalizer_clusterrolebinding': rbacFinalizerRoleBinding, [if std.length(providers) > 0 then '10_providers']: providers, diff --git a/docs/modules/ROOT/pages/references/parameters.adoc b/docs/modules/ROOT/pages/references/parameters.adoc index be3854c..b93555b 100644 --- a/docs/modules/ROOT/pages/references/parameters.adoc +++ b/docs/modules/ROOT/pages/references/parameters.adoc @@ -10,6 +10,22 @@ default:: `syn-crossplane` The namespace in which to deploy Crossplane. +== `namespaceLabels` + +[horizontal] +type:: dict +default:: `{}` + +Additional labels to add to the created namespace. + +== `namespaceAnnotations` + +[horizontal] +type:: dict +default:: `{}` + +Additional annotations to add to the created namespace. + == `providers` [horizontal] diff --git a/tests/golden/openshift4/crossplane/crossplane/00_namespace.yaml b/tests/golden/openshift4/crossplane/crossplane/00_namespace.yaml index b2bb7b8..7ff9f5f 100644 --- a/tests/golden/openshift4/crossplane/crossplane/00_namespace.yaml +++ b/tests/golden/openshift4/crossplane/crossplane/00_namespace.yaml @@ -1,7 +1,9 @@ apiVersion: v1 kind: Namespace metadata: - annotations: {} + annotations: + openshift.io/node-selector: node-role.kubernetes.io/infra= labels: + foo: bar name: syn-crossplane name: syn-crossplane diff --git a/tests/openshift4.yml b/tests/openshift4.yml index adaf146..a2b635c 100644 --- a/tests/openshift4.yml +++ b/tests/openshift4.yml @@ -1,4 +1,8 @@ parameters: facts: distribution: openshift4 - crossplane: {} + crossplane: + namespaceLabels: + foo: bar + namespaceAnnotations: + openshift.io/node-selector: node-role.kubernetes.io/infra=