AGENT-1303: Allow InfraEnv registration to use late binding#8059
AGENT-1303: Allow InfraEnv registration to use late binding#8059openshift-merge-bot[bot] merged 3 commits intoopenshift:masterfrom
Conversation
The 'register' command has long since been split into separate 'registerCluster' and 'registerInfraEnv' phases, so the duplicate code can be removed.
A failure to do a ListClusters call is different from successfully doing the call and finding that there are no clusters registered. Handle the two cases separately.
If there is no Cluster object present when registering an InfraEnv, register it without a Cluster reference to allow for late binding. There is no need to pass the openshiftVersion because an InfraEnv without a version specified will always use the latest available OS image (of which we only register one anyway).
|
@zaneb: This pull request references AGENT-1303 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.21.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zaneb The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8059 +/- ##
==========================================
+ Coverage 73.68% 74.90% +1.22%
==========================================
Files 400 403 +3
Lines 68657 73029 +4372
==========================================
+ Hits 50587 54706 +4119
- Misses 15356 15479 +123
- Partials 2714 2844 +130
🚀 New features to boost your workflow:
|
|
/retest-required |
1 similar comment
|
/retest-required |
| if modelsCluster != nil { | ||
| log.Infof("Reference to cluster id: %s", modelsCluster.ID.String()) | ||
| } else { | ||
| log.Info("No Cluster found, registering InfraEnv for late binding") |
There was a problem hiding this comment.
I tried a POC including this PR and openshift/installer#9960 This works fine such that now first the infra-env is created and cluster object is only attempted to be created when in case of OVE, user enters details such as name, basedomain, pull-secret etc from the first page and hits next button. At that time, assisted service does throw an error here because the infra-env was already created. -
Sep 30 19:04:47 localhost.localdomain service[3731]: time="2025-09-30T19:04:47Z"
level=error msg="failed to create infraenv"
func="github.com/openshift/assisted-service/internal/bminventory.(*bareMetalInventory).RegisterInfraEnvInternal.func1"
file="/src/internal/bminventory/inventory.go:4983" cluster_id=f7861ee0-b07d-428a-b1c3-020c84ff3651
error="ERROR: duplicate key value violates unique constraint \"infra_envs_pkey\" (SQLSTATE 23505)"
go-id=324 pkg=Inventory request_id=16e21b82-9d86-424e-8a41-86c7ce3bd108
Sep 30 19:04:47 localhost.localdomain service[3731]: time="2025-09-30T19:04:47Z"
level=error msg="Failed to register InfraEnv mycluster_infra-env with id f7861ee0-b07d-428a-b1c3-020c84ff3651.
Error: ERROR: duplicate key value violates unique constraint \"infra_envs_pkey\" (SQLSTATE 23505)"
func="github.com/openshift/assisted-service/internal/bminventory.(*bareMetalInventory).RegisterInfraEnvInternal"
file="/src/internal/bminventory/inventory.go:4993"
cluster_id=f7861ee0-b07d-428a-b1c3-020c84ff3651 go-id=324 pkg=Inventory request_id=16e21b82-9d86-424e-8a41-86c7ce3bd108
There was a problem hiding this comment.
In this case, it should first check if infra-env is already created
There was a problem hiding this comment.
agent-register-infraenv.service
Sep 30 18:51:47 localhost.localdomain agent-register-infraenv[4018]: time="2025-09-30T18:51:47Z" level=info msg="No Cluster found, registering InfraEnv for late binding"
Sep 30 18:51:47 localhost.localdomain agent-register-infraenv[4018]: time="2025-09-30T18:51:47Z" level=info msg="Registering infraenv"
Sep 30 18:51:47 localhost.localdomain podman[4001]: time="2025-09-30T18:51:47Z" level=info msg="No Cluster found, registering InfraEnv for late binding"
Sep 30 18:51:47 localhost.localdomain podman[4001]: time="2025-09-30T18:51:47Z" level=info msg="Registering infraenv"
Sep 30 18:51:47 localhost.localdomain podman[4001]: time="2025-09-30T18:51:47Z" level=info msg="Registered infraenv with id: f7861ee0-b07d-428a-b1c3-020c84ff3651"
Sep 30 18:51:47 localhost.localdomain agent-register-infraenv[4018]: time="2025-09-30T18:51:47Z" level=info msg="Registered infraenv with id: f7861ee0-b07d-428a-b1c3-020c84ff3651"```
There was a problem hiding this comment.
This is expected with the current UI implementation, because in ABI we define the InfraEnv UUID at ISO generation time (it's passed as an env var to assisted-service). That shouldn't block merging of this PR because this one has no effect in practice by itself.
However, before merging openshift/installer#9960 we will need to update the UI to cope with this flow. To start with, having the UI check for the existence of an InfraEnv before creating a new one would allow you to get a bit further with the PoC.
There was a problem hiding this comment.
@pawanpinjarkar the main goal of the PoC is to support designing a solution for https://issues.redhat.com/browse/AGENT-1294, and thus identify a gap list - to prepare a breakdown for the epic. I also didn't expect that the UI worked out-of-the-box, and the good thing is that the PoC confirmed that - so another point for the gap list.
A quick hack to proceed with the exploration in the PoC is to disable the UI and manually simulate its behavior by directly interacting with AS after the agent-register-infraenv service (with the basic idea of supporting just one workflow, where instead of running the start-cluster-installation service then the agent-start-ui is executed (when requested)
|
/lgtm |
|
@zaneb: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
181d75e
into
openshift:master
In ABI, if no Cluster is present when registering the InfraEnv, register it without a cluster reference and allow it to be used for late-binding agents.
In practice the Cluster is always registered before the InfraEnv in the regular ABI flow. This change allows the InfraEnv registration to be used without the Cluster registration when the latter is expected to be performed by the UI.