Skip to content

Commit 6667244

Browse files
Merge pull request #9661 from jaypoulz/jaypoulz-OCPEDGE-1749-bm-tnf-validation
OCPEDGE-1749: [TNF] Updated bare-metal init sequence to detach control-plane nodes in Two Node OpenShift.
2 parents 2d3f2c5 + 1a19bef commit 6667244

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

data/data/bootstrap/baremetal/files/usr/local/bin/master-bmh-update.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ while [ "$(oc get bmh -n openshift-machine-api -l installer.openshift.io/role=co
1717
sleep 20
1818
done
1919

20+
# Pause control-plane management via ironic for Two-Node OpenShift with Fencing (TNF), since this conflicts with how TNF achieves HA
21+
TNF_TOPOLOGY="DualReplica"
22+
23+
echo "Looking up control-plane topology"
24+
CONTROL_PLANE_TOPOLOGY=$(oc get infrastructures.config.openshift.io cluster -o json | jq -r '.status.controlPlaneTopology')
25+
if [ -z "${CONTROL_PLANE_TOPOLOGY}" ]; then
26+
echo "Error: couldn't lookup control-plane topology" >&2
27+
exit 1
28+
elif [ "${CONTROL_PLANE_TOPOLOGY}" = "${TNF_TOPOLOGY}" ]; then
29+
echo "Control-plane topology set to '${TNF_TOPOLOGY}'; setting the control-plane hosts to detached"
30+
while ! oc annotate --overwrite bmh -n openshift-machine-api -l installer.openshift.io/role=control-plane baremetalhost.metal3.io/detached="" ; do
31+
sleep 5
32+
echo "Setting control-plane nodes to detached failed, retrying"
33+
done
34+
else
35+
echo "Control-plane topology set to '${CONTROL_PLANE_TOPOLOGY}'; no further actions required"
36+
fi
37+
2038
# Shut down ironic containers so that the API VIP can fail over to the control
2139
# plane.
2240
echo "Stopping provisioning services..."

pkg/types/validation/installconfig.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,11 +1600,8 @@ func validateFencingCredentials(installConfig *types.InstallConfig) (errors fiel
16001600
func validateFencingForPlatform(config *types.InstallConfig, fldPath *field.Path) field.ErrorList {
16011601
errs := field.ErrorList{}
16021602
switch {
1603-
case config.None != nil, config.External != nil:
1604-
case config.BareMetal != nil:
1605-
if len(config.Platform.BareMetal.Hosts) > 0 {
1606-
errs = append(errs, field.Forbidden(fldPath, "fencing is mutually exclusive with hosts, please remove either of them"))
1607-
}
1603+
case config.None != nil, config.External != nil, config.BareMetal != nil:
1604+
// Allowed platforms
16081605
default:
16091606
errs = append(errs, field.Forbidden(fldPath, fmt.Sprintf("fencing is only supported on baremetal, external or none platforms, instead %s platform was found", config.Platform.Name())))
16101607
}

pkg/types/validation/installconfig_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,6 +2814,7 @@ func TestValidateTNF(t *testing.T) {
28142814
},
28152815
{
28162816
config: installConfig().
2817+
PlatformBMWithHosts().
28172818
MachinePoolCP(machinePool().
28182819
Credential(c1(), c2())).
28192820
CpReplicas(2).
@@ -2831,6 +2832,7 @@ func TestValidateTNF(t *testing.T) {
28312832
},
28322833
{
28332834
config: installConfig().
2835+
PlatformBMWithHosts().
28342836
MachinePoolArbiter(machinePool()).
28352837
MachinePoolCP(machinePool().Credential(c1(), c2())).
28362838
ArbiterReplicas(1).
@@ -2840,6 +2842,7 @@ func TestValidateTNF(t *testing.T) {
28402842
},
28412843
{
28422844
config: installConfig().
2845+
PlatformBMWithHosts().
28432846
MachinePoolArbiter(machinePool()).
28442847
MachinePoolCP(machinePool().Credential(c1(), c2(), c3())).
28452848
ArbiterReplicas(1).
@@ -2920,8 +2923,8 @@ func TestValidateTNF(t *testing.T) {
29202923
Credential(c1(), c2())).
29212924
CpReplicas(2).
29222925
build(),
2923-
name: "fencing_hosts_mutually_exclusive",
2924-
expected: "controlPlane.fencing: Forbidden: fencing is mutually exclusive with hosts, please remove either of them",
2926+
name: "tnf_supported_platforms",
2927+
expected: "",
29252928
},
29262929
{
29272930
config: installConfig().
@@ -2930,7 +2933,7 @@ func TestValidateTNF(t *testing.T) {
29302933
Credential(c1(), c2())).
29312934
CpReplicas(2).
29322935
build(),
2933-
name: "supported_platforms",
2936+
name: "tnf_unsupported_platform",
29342937
expected: "controlPlane.fencing: Forbidden: fencing is only supported on baremetal, external or none platforms, instead aws platform was found",
29352938
},
29362939
}
@@ -3060,10 +3063,8 @@ type installConfigBuilder struct {
30603063
}
30613064

30623065
func installConfig() *installConfigBuilder {
3063-
bmPlatform := validBareMetalPlatform()
3064-
bmPlatform.Hosts = nil
30653066
return &installConfigBuilder{
3066-
InstallConfig: types.InstallConfig{Platform: types.Platform{BareMetal: bmPlatform}},
3067+
InstallConfig: types.InstallConfig{},
30673068
}
30683069
}
30693070

0 commit comments

Comments
 (0)