diff --git a/class/defaults.yml b/class/defaults.yml index f69f1ea..f62dfbf 100644 --- a/class/defaults.yml +++ b/class/defaults.yml @@ -3,6 +3,7 @@ parameters: =_metadata: multi_instance: true namespace: syn-${_instance} + namespaceMetadata: {} host_service_cidr: null diff --git a/component/main.jsonnet b/component/main.jsonnet index 5c12f7a..5cebe13 100644 --- a/component/main.jsonnet +++ b/component/main.jsonnet @@ -10,6 +10,8 @@ local instance = inv.parameters._instance; // Define outputs below { - '00_namespace': kube.Namespace(params.namespace), + '00_namespace': kube.Namespace(params.namespace) { + metadata+: com.makeMergeable(params.namespaceMetadata), + }, '10_cluster': cluster.Cluster(instance, params), } diff --git a/docs/modules/ROOT/pages/references/parameters.adoc b/docs/modules/ROOT/pages/references/parameters.adoc index a767ca0..4e7aaf6 100644 --- a/docs/modules/ROOT/pages/references/parameters.adoc +++ b/docs/modules/ROOT/pages/references/parameters.adoc @@ -14,6 +14,24 @@ The namespace in which to deploy this component. Deploying multiple vclusters in the same namespace isn't supported. + +== `namespaceMetadata` + +[horizontal] +type:: dictionary +default:: `{}` +example:: ++ +[source,yaml] +---- +namespace: + annotations: + prometheus: infra +---- + +Additional metadata for the namespace. + + == `host_service_cidr` [horizontal] diff --git a/tests/golden/openshift/openshift/openshift/00_namespace.yaml b/tests/golden/openshift/openshift/openshift/00_namespace.yaml index e6958f6..7529faa 100644 --- a/tests/golden/openshift/openshift/openshift/00_namespace.yaml +++ b/tests/golden/openshift/openshift/openshift/00_namespace.yaml @@ -1,7 +1,8 @@ apiVersion: v1 kind: Namespace metadata: - annotations: {} + annotations: + openshift.io/cluster-monitoring: 'true' labels: name: syn-openshift name: syn-openshift diff --git a/tests/openshift.yml b/tests/openshift.yml index 31578dc..8991947 100644 --- a/tests/openshift.yml +++ b/tests/openshift.yml @@ -3,6 +3,9 @@ parameters: host_service_cidr: 172.30.0.0/16 ocp_route: host: test.apps.local + namespaceMetadata: + annotations: + openshift.io/cluster-monitoring: "true" facts: distribution: openshift4