Skip to content

Commit

Permalink
Add option to define namespace labels and annotations
Browse files Browse the repository at this point in the history
This gives us some flexibilty and can be helpful in multiple situations.
The main usecase currently is that we can schedule crossplane on infra
nodes on OpenShift using the annotation `openshift.io/node-selector`
  • Loading branch information
glrf committed Jun 30, 2023
1 parent f969b53 commit ed1a91c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
3 changes: 3 additions & 0 deletions class/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
parameters:
crossplane:
namespace: syn-crossplane
namespaceLabels: {}
namespaceAnnotations: {}

charts:
crossplane: 1.11.0
images:
Expand Down
7 changes: 6 additions & 1 deletion component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 16 additions & 0 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion tests/openshift4.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
parameters:
facts:
distribution: openshift4
crossplane: {}
crossplane:
namespaceLabels:
foo: bar
namespaceAnnotations:
openshift.io/node-selector: node-role.kubernetes.io/infra=

0 comments on commit ed1a91c

Please sign in to comment.