-
Notifications
You must be signed in to change notification settings - Fork 247
[WIP] OCPBUGS-63472: Include --copy-network for all ABI installations #8155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,25 +165,33 @@ func RegisterInfraEnv(ctx context.Context, log *log.Logger, bmInventory *client. | |
| clusterID = modelsCluster.ID | ||
| } | ||
| infraEnvParams := controllers.CreateInfraEnvParams(&infraEnv, models.ImageType(imageTypeISO), pullSecret, clusterID, "") | ||
|
|
||
| var nmStateConfig aiv1beta1.NMStateConfig | ||
|
|
||
| fileInfo, _ := os.Stat(nmStateConfigPath) | ||
| if fileInfo != nil { | ||
| if nmStateErr := getFileData(nmStateConfigPath, &nmStateConfig); nmStateErr != nil { | ||
| return nil, nmStateErr | ||
| } | ||
|
|
||
| staticNetworkConfig, processErr := processNMStateConfig(log, infraEnv, nmStateConfig) | ||
| if processErr != nil { | ||
| return nil, processErr | ||
| } | ||
|
|
||
| if len(staticNetworkConfig) > 0 { | ||
| log.Infof("Added %d nmstateconfigs", len(staticNetworkConfig)) | ||
| infraEnvParams.InfraenvCreateParams.StaticNetworkConfig = staticNetworkConfig | ||
| } | ||
| } | ||
| // In ABI, the --copy-network flag should always be included in the installer args. | ||
| // The flag is added if the infraenv is found to have static networking configured. | ||
| // See https://github.com/openshift/assisted-service/blob/f026180842bb99cc97d5597fd1bfaa483a55828b/internal/host/hostcommands/install_cmd.go#L368 | ||
| // Here we add a dummy static network config to force the --copy-network flag | ||
| // to be added. The dummy network config is not applied to the hosts. | ||
| netYaml := `interfaces: | ||
| - ipv4: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the idea of a dummy network config, but I'd expect something simpler or more "dummy", ie something like: Right now it's just evaluated later by AS (and in case of ABI never applied), but anyhow I'd prefer to have a really simple definition |
||
| address: | ||
| - ip: 192.0.2.1 | ||
| prefix-length: 24 | ||
| dhcp: false | ||
| enabled: true | ||
| name: dummy | ||
| state: up | ||
| type: ethernet` | ||
| dummyStaticNetworkConfig := []*models.HostStaticNetworkConfig{ | ||
| { | ||
| NetworkYaml: netYaml, | ||
| MacInterfaceMap: []*models.MacInterfaceMapItems0{ | ||
| { | ||
| LogicalNicName: "dummy", | ||
| MacAddress: "52:54:00:09:de:93", | ||
| }, | ||
| }, | ||
| }, | ||
| } | ||
| infraEnvParams.InfraenvCreateParams.StaticNetworkConfig = dummyStaticNetworkConfig | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general this solution may work from 4.21+, where we have in plan to enable the infraenv late binding. But I don't think it will work for 4.20, where currently the |
||
|
|
||
| clientInfraEnvParams := &installer.RegisterInfraEnvParams{ | ||
| InfraenvCreateParams: infraEnvParams.InfraenvCreateParams, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on our previous discussion, I think that a slightly safer implementation could be the check the presence of any keyfile in the live environment to conditionally decide to set the
infraEnvParams.InfraenvCreateParams.StaticNetworkConfig: that should cover both the case when the user defines some static network configuration via install-config/agent-config file, either when it's just added via agent TUI (ignoring instead when it's not set all).