Migrating NMState configuration files that use the slaves parameter

Solution Verified - Updated -

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4.13+

Issue

OPNET-468

Resolution

When you attempt to migrate upstream NMState configuration files to the OpenShift Container Platform, your OpenShift cluster experiences a network issue because the cluster cannot parse the configuration files.

OpenShift Container Platform did not and does not support the slaves parameter.

Common NMState configuration files that might list the slaves parameter are as follows:

  • NodeNetworkConfigurationPolicies (NNCP)
  • Network configurations handled by the Cluster Baremetal Operator (CBO)

If you cannot determine what network configurations specify the slaves parameter, you can run scripts that replace the slaves parameter with the port parameter.

IMPORTANT: You must run these scripts before you migrate the configuration files to the OpenShift Container Platform.

Prerequisites

  • You set the KUBECONFIG environment variable to the path of a kubeconfig configuration file that allows access to modify custom resources for the OpenShift Container Platform cluster.

Procedure

Depending on the file type, create one of the following scripts and then run it on your local terminal:

  • For configuration files with a networkConfig section, create a Bash shell script file that contains the following configuration:
#!/bin/bash
set -ex
for secret in $(oc get bmh -A -o yaml | grep preprovisioningNetworkDataName | cut -d : -f 2)
do
    original=$(oc get secret -n openshift-machine-api "$secret" -o yaml | grep nmstate: | cut -d : -f 2)
    replaced=$(echo $original | base64 -d | sed 's/slaves:/port:/' | base64 -w 0)
    echo $replaced
    oc patch secret -n openshift-machine-api "$secret" -p "{\"data\": {\"nmstate\": \"$replaced\"}}"
done
  • For NNCP configuration files, create a Bash shell script file that contains the following configuration:
#!/bin/bash
for nncp in $(oc get nncp --no-headers=true | cut -d ' ' -f 1)
do
    oc get nncp "$nncp" -o yaml | sed 's/slaves:/port:/' | oc replace -f -
done

Root Cause

A NMState configuration on the OpenShift Container Platform contains the slaves parameter, which is an unsupported parameter on OpenShift. If you specify the parameter in an NMState configuration, your OpenShift cluster experiences network issues because it cannot parse the file.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments