Skip to content

Commit a1b8bad

Browse files
authored
Merge pull request #56747 from opayne1/OSDOCS5140
OSDOCS#5140:Adds a step that console supports Operator to specify where to run with CSV suggested namespace
2 parents 50121d4 + eb21e77 commit a1b8bad

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

modules/osdk-csv-manual-annotations.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ The following table lists Operator metadata annotations that can be manually def
2323
|`operatorframework.io/suggested-namespace`
2424
|Set a suggested namespace where the Operator should be deployed.
2525

26+
|`operatorframework.io/suggested-namespace-template`
27+
|Set a manifest for a Namespace object with the namespace default node selector specified.
28+
2629
|`operators.openshift.io/infrastructure-features`
2730
|Infrastructure features supported by the Operator. Users can view and filter by these features when discovering Operators through OperatorHub in the web console. Valid, case-sensitive values:
2831

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * operators/operator_sdk/osdk-generating-csvs.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="osdk-suggested-namespace-default-node_{context}"]
7+
= Setting a suggested namespace with default node selector
8+
9+
Some Operators expect to run only on control plane nodes, which can be done by setting a `nodeSelector` in the `Pod` spec by the Operator itself.
10+
11+
To avoid getting duplicated and potentially conflicting cluster-wide default `nodeSelector`, you can set a default node selector on the namespace where the Operator runs. The default node selector will take precedence over the cluster default so the cluster default will not be applied to the pods in the Operators namespace.
12+
13+
When adding the Operator to a cluster using OperatorHub, the web console auto-populates the suggested namespace for the cluster administrator during the installation process. The suggested namespace is created using the namespace manifest in YAML which is included in the cluster service version (CSV).
14+
15+
.Procedure
16+
17+
* In your CSV, set the `operatorframework.io/suggested-namespace-template` with a manifest for a `Namespace` object. The following sample is a manifest for an example `Namespace` with the namespace default node selector specified:
18+
+
19+
[source,yaml]
20+
----
21+
metadata:
22+
annotations:
23+
operatorframework.io/suggested-namespace-template: <1>
24+
{
25+
"apiVersion": "v1",
26+
"kind": "Namespace",
27+
"metadata": {
28+
"name": "vertical-pod-autoscaler-suggested-template",
29+
"annotations": {
30+
"openshift.io/node-selector": ""
31+
}
32+
}
33+
}
34+
----
35+
<1> Set your suggested namespace.
36+
+
37+
[NOTE]
38+
====
39+
If both `suggested-namespace` and `suggested-namespace-template` annotations are present in the CSV, `suggested-namespace-template` should take precedence.
40+
====

operators/operator_sdk/osdk-generating-csvs.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ include::modules/osdk-csv-manual-annotations.adoc[leveloffset=+2]
3838
* xref:../../operators/operator_sdk/osdk-generating-csvs.adoc#osdk-init-resource_osdk-generating-csvs[Initializing required custom resources
3939
]
4040
* xref:../../operators/operator_sdk/osdk-generating-csvs.adoc#osdk-suggested-namespace_osdk-generating-csvs[Setting a suggested namespace]
41+
* xref:../../operators/operator_sdk/osdk-generating-csvs.adoc#osdk-suggested-namespace-default-node_osdk-generating-csvs[Setting a suggested namespace with default node selector]
4142
* xref:../../operators/operator_sdk/osdk-generating-csvs.adoc#olm-enabling-operator-for-restricted-network_osdk-generating-csvs[Enabling your Operator for restricted network environments] (disconnected mode)
4243
* xref:../../operators/operator_sdk/osdk-generating-csvs.adoc#osdk-hiding-internal-objects_osdk-generating-csvs[Hiding internal objects]
4344
* xref:../../installing/installing-fips.adoc#installing-fips[Support for FIPS crytography]
@@ -53,6 +54,7 @@ include::modules/olm-enabling-operator-for-multi-arch.adoc[leveloffset=+1]
5354
include::modules/olm-arch-os-support.adoc[leveloffset=+2]
5455

5556
include::modules/osdk-suggested-namespace.adoc[leveloffset=+1]
57+
include::modules/osdk-suggested-namespace-node-selector.adoc[leveloffset=+1]
5658
include::modules/osdk-operatorconditions.adoc[leveloffset=+1]
5759

5860
[role="_additional-resources"]

0 commit comments

Comments
 (0)