Skip to content
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

[release-4.12] OCPBUGS-30630: baremetal: populate customDeploy in advance #8144

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/asset/machines/baremetal/hosts.go
Expand Up @@ -143,6 +143,12 @@ func Hosts(config *types.InstallConfig, machines []machineapi.Machine) (*HostSet
// with a machine without triggering provisioning. We only
// want to do that for control plane hosts.
newHost.Spec.ExternallyProvisioned = true
// Setting CustomDeploy early ensures that the
// corresponding Ironic node gets correctly configured
// from the beginning.
newHost.Spec.CustomDeploy = &baremetalhost.CustomDeploy{
Method: "install_coreos",
}
// Pause reconciliation until we can annotate with the initial
// status containing the HardwareDetails
newHost.ObjectMeta.Annotations = map[string]string{"baremetalhost.metal3.io/paused": ""}
Expand Down
56 changes: 32 additions & 24 deletions pkg/asset/machines/baremetal/hosts_test.go
Expand Up @@ -62,7 +62,7 @@ routes:

ExpectedSetting: settings().
secrets(secret("master-0-bmc-secret").creds("usr0", "pwd0")).
hosts(host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned()).build(),
hosts(host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy()).build(),
},
{
Scenario: "default-norole",
Expand All @@ -71,7 +71,7 @@ routes:

ExpectedSetting: settings().
secrets(secret("master-0-bmc-secret").creds("usr0", "pwd0")).
hosts(host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned()).build(),
hosts(host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy()).build(),
},
{
Scenario: "network-config",
Expand All @@ -89,7 +89,8 @@ routes:
consumerRef("machine-0").
annotation("baremetalhost.metal3.io/paused", "").
preprovisioningNetworkDataName("master-0-network-config-secret").
externallyProvisioned()).build(),
externallyProvisioned().
customDeploy()).build(),
},
{
Scenario: "3-hosts-3-machines-norole-all",
Expand All @@ -108,9 +109,9 @@ routes:
secret("master-1-bmc-secret").creds("usr1", "pwd1"),
secret("master-2-bmc-secret").creds("usr2", "pwd2")).
hosts(
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned()).build(),
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy()).build(),
},
{
Scenario: "4-hosts-3-machines",
Expand All @@ -131,9 +132,9 @@ routes:
secret("master-2-bmc-secret").creds("usr2", "pwd2"),
secret("master-3-bmc-secret").creds("usr3", "pwd3")).
hosts(
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-3")).build(),
},
{
Expand All @@ -155,9 +156,9 @@ routes:
secret("master-2-bmc-secret").creds("usr2", "pwd2"),
secret("worker-0-bmc-secret").creds("wrk0", "pwd0")).
hosts(
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("worker-0")).build(),
},
{
Expand All @@ -181,9 +182,9 @@ routes:
secret("worker-0-bmc-secret").creds("wrk0", "pwd0"),
secret("worker-1-bmc-secret").creds("wrk1", "pwd1")).
hosts(
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("worker-0"),
host("worker-1")).build(),
},
Expand All @@ -208,11 +209,11 @@ routes:
secret("master-0-bmc-secret").creds("usr0", "pwd0"),
secret("master-2-bmc-secret").creds("usr2", "pwd2")).
hosts(
host("master-1").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-1").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("worker-0"),
host("worker-1"),
host("master-0").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned()).build(),
host("master-0").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy()).build(),
},
{
Scenario: "4-hosts-3-machines-norole-master",
Expand All @@ -234,9 +235,9 @@ routes:
secret("master-2-bmc-secret").creds("usr2", "pwd2")).
hosts(
host("worker-0"),
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned()).build(),
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy()).build(),
},
{
Scenario: "4-hosts-3-machines-norole-worker",
Expand All @@ -257,9 +258,9 @@ routes:
secret("master-2-bmc-secret").creds("usr2", "pwd2"),
secret("worker-0-bmc-secret").creds("wrk0", "pwd0")).
hosts(
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned(),
host("master-0").consumerRef("machine-0").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-1").consumerRef("machine-1").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("master-2").consumerRef("machine-2").annotation("baremetalhost.metal3.io/paused", "").externallyProvisioned().customDeploy(),
host("worker-0")).build(),
},
}
Expand Down Expand Up @@ -431,6 +432,13 @@ func (hb *hostBuilder) externallyProvisioned() *hostBuilder {
return hb
}

func (hb *hostBuilder) customDeploy() *hostBuilder {
hb.Spec.CustomDeploy = &baremetalhost.CustomDeploy{
Method: "install_coreos",
}
return hb
}

func (hb *hostBuilder) annotation(key, value string) *hostBuilder {
if hb.Annotations == nil {
hb.Annotations = map[string]string{}
Expand Down