Description of problem: In OpenShift operator for our product we want users to be able to set affinity: - nodeAffinity - podAffinity - podAntiAffinity We are using the x-descriptors for that in our CSV: urn:alm:descriptor:com.tectonic.ui:nodeAffinity urn:alm:descriptor:com.tectonic.ui:podAffinity urn:alm:descriptor:com.tectonic.ui:podAntiAffinity as described here: https://github.com/openshift/console/blob/master/frontend/packages/operator-lifecycle-manager/src/components/descriptors/reference/reference.md#11-nodeaffinity The problem is that while setting affinity values in the form view in OpenShift console, the mapping we see in YAML view is incorrect. Filling up a single key-value for nodeAffinity results in the following lines in the YAML view: node_affinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: some_key operator: In value: some_value While the correct version would be: node_affinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: some_key operator: In values: - some_value as described in: https://docs.openshift.com/container-platform/4.9/nodes/scheduling/nodes-scheduler-node-affinity.html With this wrong YAML we then get the following error on an attempt to create a deployment: failed to install release: unable to build kubernetes objects from release manifest: error validating "": error validating data: [ValidationError(Deployment.spec.template.spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].preference.matchExpressions[0]): unknown field "value" in io.k8s.api.core.v1.NodeSelectorRequirement, ValidationError(Deployment.spec.template.spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0]): unknown field "value" in io.k8s.api.core.v1.NodeSelectorRequirement] The exact same thing has been reported on GitHub some time ago: https://github.com/openshift/console/issues/9802 Version-Release number of selected component (if applicable): How reproducible: Easy Steps to Reproduce: 1. Create a pod affinity definition on cluster 2. Access the YAML definition from OCP console. Actual results: - key: some_key operator: In value: some_value Expected results: - key: some_key operator: In value: - some_value Additional info:
This bug has been verified on payload 4.12.0-0.nightly-2022-08-10-200611 Verification Step: 1. Prepare a mock file (CSD, CSV, attached sample file) with affinity, which is as same as customer said in the description - nodeAffinity - podAffinity - podAntiAffinity 2. Fill in the data on Form view, and switch to YAML view 3. Check the format on YAML file 4. Check if the file can be created successfully Result: 3. The data on YAML file will follow the format below (Attached: result) nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: test operator: In values: - test1 - test2 - test3 - matchExpressions: - key: testnodeaffinity operator: In values: - testnodeaffinity1 - testnodeaffinity2 - testnodeaffinity3 4. The Resource can be created with YAML view and without any error message
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: OpenShift Container Platform 4.12.0 bug fix and security update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:7399