Bug 2116904

Summary: [Agent]: Improvement in error message for mismatching metadata name in case of agent and install config
Product: OpenShift Container Platform Reporter: Manoj Hans <mhans>
Component: InstallerAssignee: Antoni Segura Puimedon <asegurap>
Installer sub component: Agent based installation QA Contact: Manoj Hans <mhans>
Status: RELEASE_PENDING --- Docs Contact:
Severity: medium    
Priority: medium CC: zbitter
Version: 4.12   
Target Milestone: ---   
Target Release: 4.12.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Manoj Hans 2022-08-09 14:09:00 UTC
Description: Improvement in error message for mismatching metadata name in case of agent and install config

Here is the content of the files.
agent-config.yaml 
--------------------------------------------
kind: AgentConfig
metadata:
  name: sno-cluster
-------------------------------------------- 
install-config.yaml
--------------------------------------------
apiVersion: v1
baseDomain: test.example.com
compute:
- architecture: amd64
  hyperthreading: Enabled
  name: worker
  replicas: 0
controlPlane:
  architecture: amd64
  hyperthreading: Enabled
  name: master
  replicas: 1
metadata:
  name: sno-mismatch
-------------------------------------------- 

How reproducible:

always

Repro Steps: 

1) Get the latest agent-installer and build

git clone -b agent-installer https://github.com/openshift/installer.git
cd installer/
hack/build.sh

2) Create agent.iso using agent-config and install-config by providing a mismatch of metadata names.


Expected: Error message should be thrown something like agentConfig.metadata.name should be same as installConfig.metadata.name

Actual: Spec.NMStateConfigLabelSelector.MatchLabels: Required value: infraEnv and mhans-sno-0.NMStateConfig labels do not match. Expected: map[infraenvs.agent-install.openshift.io:sno-mismatch] Found: map[infraenvs.agent-install.openshift.io:sno-cluster]

Comment 1 Zane Bitter 2022-08-17 02:16:15 UTC
Even better would be if we could find a way to ensure that the name of the agent-config is irrelevant (i.e. that when generating the NMStateConfig we use the same cluster name used by the other resources). We shouldn't really have to specify a name for the agent-config at all, since it doesn't actually get installed in a cluster.

The dependency graph makes this tricky to do without causing the NMStateConfig to get overwritten when the other cluster-manifests files are different. But we could at least depend on the install-config and use the name from that if it exists, only falling back to the agent-config if it doesn't?

Comment 3 Manoj Hans 2022-09-30 10:29:01 UTC
Bug has been verified with 4.12.0-0.nightly-2022-09-28-204419 release. It's working fine. Now there is no need to specify "name" in the agent-config file as it is picking from the install-config.