Skip to content

Commit

Permalink
Only configure default node affinity to infra nodes for OCP
Browse files Browse the repository at this point in the history
  • Loading branch information
simu committed May 15, 2024
1 parent ca702ed commit 306ab33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/references/component-library.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This function creates a `subscriptions.operators.coreos.com` resource in a names

The result of this function can be used in the same way as resources created by `kube.libjsonnet`.

By default the components sets the nodeAffinity to infra nodes, this can be overwritten.
By default, if `facts.distribution` is set to `openshift4`, the component sets the nodeAffinity to infra nodes, this can be overwritten.
See https://docs.openshift.com/container-platform/latest/nodes/scheduling/nodes-scheduler-node-affinity.html#nodes-scheduler-node-affinity-configuring-required_nodes-scheduler-node-affinity[Official Documentation]

--
Expand Down
5 changes: 4 additions & 1 deletion lib/openshift4-operators.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ local instanceParams(instance) =

local apigroup = 'operators.coreos.com';

local is_ocp =
std.get(inv.parameters.facts, 'distribution', '') == 'openshift4';

/**
* \brief Validate instance
*
Expand Down Expand Up @@ -66,7 +69,7 @@ local subscription(name) =
kube._Object(apigroup + '/v1alpha1', 'Subscription', name) {
spec: {
name: name,
config: {
[if is_ocp then 'config']: {
affinity: {
nodeAffinity: {
requiredDuringSchedulingIgnoredDuringExecution: {
Expand Down

0 comments on commit 306ab33

Please sign in to comment.