Skip to content

Commit 5661d9c

Browse files
authored
OCPBUGS-1482: Don't override schedulableMasters unnecessarily (#4414)
When generating the Ignition files, the installer already sets schdulableMasters to true when there are no worker nodes (i.e. in the SNO and compact cluster topologies. (See openshift/installer#2004) Therefore it is unnecessary to override it here (though it may be preferred to avoid a warning log from the installer). Since openshift/installer#6247, attempting to override the schedulableMasters setting causes installation to fail, because there are two manifests of the same type and name that conflict. Since we don't need to set this override when the installer would already do it, avoid doing so and triggering the error when the value is determined by the number of hosts rather than explicitly set by the user. The conflict still needs to be resolved so that the user can enable schedulableMasters, but this at least allows the SNO and compact topologies to install OpenShift 4.12 again. This partially reverts commit c45f369.
1 parent 7312ee7 commit 5661d9c

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

internal/common/common.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,14 @@ func IsImportedCluster(cluster *Cluster) bool {
120120
}
121121

122122
func AreMastersSchedulable(cluster *Cluster) bool {
123-
return swag.BoolValue(cluster.SchedulableMastersForcedTrue) || swag.BoolValue(cluster.SchedulableMasters)
123+
// If the topology forces schedulable masters (i.e. there are no workers),
124+
// SchedulableMastersForcedTrue will be true, but also it will be enabled
125+
// by default in the installer. Since overriding it currently causes a
126+
// failure due to a conflict starting with 4.12, we prefer to avoid it. We
127+
// only need to override the installer when the user has set
128+
// SchedulableMasters explicitly and that is not already the default in the
129+
// installer.
130+
return !swag.BoolValue(cluster.SchedulableMastersForcedTrue) && swag.BoolValue(cluster.SchedulableMasters)
124131
}
125132

126133
func GetEffectiveRole(host *models.Host) models.HostRole {

internal/common/common_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ var _ = Describe("Test AreMastersSchedulable", func() {
253253
}{
254254
{schedulableMastersForcedTrue: false, schedulableMasters: false, expectedSchedulableMasters: false},
255255
{schedulableMastersForcedTrue: false, schedulableMasters: true, expectedSchedulableMasters: true},
256-
{schedulableMastersForcedTrue: true, schedulableMasters: false, expectedSchedulableMasters: true},
257-
{schedulableMastersForcedTrue: true, schedulableMasters: true, expectedSchedulableMasters: true},
256+
{schedulableMastersForcedTrue: true, schedulableMasters: false, expectedSchedulableMasters: false}, // Handled by installer
257+
{schedulableMastersForcedTrue: true, schedulableMasters: true, expectedSchedulableMasters: false}, // Handled by installer
258258
} {
259259
test := test
260260
It(fmt.Sprintf("schedulableMastersForcedTrue=%v schedulableMasters=%v AreMastersSchedulable? %v", test.schedulableMastersForcedTrue, test.schedulableMasters, test.expectedSchedulableMasters), func() {

0 commit comments

Comments
 (0)