Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/controller/common/featuregates.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ func IsBootImageControllerRequired(ctx *ControllerContext) bool {
// Current platform support:
// - GCP: FeatureGateManagedBootImages (opt-out), CPMS supported
// - AWS: FeatureGateManagedBootImagesAWS (opt-out), CPMS supported
// - vSphere: FeatureGateManagedBootImagesvSphere (opt-in), CPMS not supported
// - Azure: FeatureGateManagedBootImagesAzure (opt-in), CPMS supported (except AzureStackCloud)
// - vSphere: FeatureGateManagedBootImagesvSphere (opt-out), CPMS not supported
// - Azure: FeatureGateManagedBootImagesAzure (opt-out), CPMS supported (except AzureStackCloud)
//
// Returns:
// - supported: whether the platform supports boot image updates on machinesets
Expand All @@ -171,15 +171,15 @@ func CheckBootImagePlatform(infra *configv1.Infrastructure, fgHandler FeatureGat
case configv1.GCPPlatformType:
return fgHandler.Enabled(features.FeatureGateManagedBootImages), true, true
case configv1.VSpherePlatformType:
return fgHandler.Enabled(features.FeatureGateManagedBootImagesvSphere), false, false
return fgHandler.Enabled(features.FeatureGateManagedBootImagesvSphere), false, true
case configv1.AzurePlatformType:
// Special variant check for Azure platforms; AzureStackCloud boot images are defined at install time
// See: https://github.com/openshift/installer/blob/bc941c822f06c10a95ddd080ae6345c25968baf4/pkg/asset/installconfig/azure/validation.go#L743-L749
if infra.Status.PlatformStatus.Azure != nil && infra.Status.PlatformStatus.Azure.CloudName == configv1.AzureStackCloud {
klog.Infof(" %s is not supported for boot image updates; disabling boot image controller", configv1.AzureStackCloud)
return false, false, false
}
return fgHandler.Enabled(features.FeatureGateManagedBootImagesAzure), true, false
return fgHandler.Enabled(features.FeatureGateManagedBootImagesAzure), true, true
}
return false, false, false
}
36 changes: 18 additions & 18 deletions pkg/operator/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,30 +407,30 @@ func TestSyncMachineConfiguration(t *testing.T) {
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusManualWithOCPVersion("4.18.0"),
},
{
name: "Azure platform, no existing config, no opt-in expected",
name: "Azure platform, no existing config, opt-in expected",
infra: buildInfra(withPlatformType(configv1.AzurePlatformType)),
mcop: buildMachineConfigurationWithNoBootImageConfiguration(),
clusterVersion: buildClusterVersion("4.18.0"),
annotationExpected: false,
annotationExpected: true,
expectedManagedBootImagesStatus: opv1.ManagedBootImages{
MachineManagers: []opv1.MachineManager{
{Resource: opv1.MachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.None}},
{Resource: opv1.MachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.All}},
},
},
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusManualWithOCPVersion("4.18.0"),
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusAutomaticWithOCPVersion("4.18.0"),
},
{
name: "vsphere platform, no existing config, no opt-in expected",
name: "vsphere platform, no existing config, opt-in expected",
infra: buildInfra(withPlatformType(configv1.VSpherePlatformType)),
mcop: buildMachineConfigurationWithNoBootImageConfiguration(),
clusterVersion: buildClusterVersion("4.18.0"),
annotationExpected: false,
annotationExpected: true,
expectedManagedBootImagesStatus: opv1.ManagedBootImages{
MachineManagers: []opv1.MachineManager{
{Resource: opv1.MachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.None}},
{Resource: opv1.MachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.All}},
},
},
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusManualWithOCPVersion("4.18.0"),
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusAutomaticWithOCPVersion("4.18.0"),
},
{
name: "bare metal platform, unsupported platform, no configuration expected",
Expand Down Expand Up @@ -488,15 +488,15 @@ func TestSyncMachineConfiguration(t *testing.T) {
infra: buildInfra(withPlatformType(configv1.AzurePlatformType)),
mcop: buildMachineConfigurationWithNoBootImageConfiguration(),
clusterVersion: buildClusterVersion("4.18.0"),
annotationExpected: false,
annotationExpected: true,
enableCPMSFeatureGate: true,
expectedManagedBootImagesStatus: opv1.ManagedBootImages{
MachineManagers: []opv1.MachineManager{
{Resource: opv1.MachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.None}},
{Resource: opv1.MachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.All}},
{Resource: opv1.ControlPlaneMachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.None}},
},
},
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusManualWithOCPVersion("4.18.0"),
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusAutomaticWithOCPVersion("4.18.0"),
},
{
name: "AWS platform, CPMS enabled in spec, MachineSets should still follow platform default (All)",
Expand All @@ -514,19 +514,19 @@ func TestSyncMachineConfiguration(t *testing.T) {
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusAutomaticWithOCPVersion("4.18.0"),
},
{
name: "Azure platform, CPMS enabled in spec, MachineSets should still follow platform default (None)",
name: "Azure platform, CPMS enabled in spec, MachineSets should still follow platform default (All)",
infra: buildInfra(withPlatformType(configv1.AzurePlatformType)),
mcop: buildMachineConfigurationWithCPMSEnabled(),
clusterVersion: buildClusterVersion("4.18.0"),
annotationExpected: false,
annotationExpected: true,
enableCPMSFeatureGate: true,
expectedManagedBootImagesStatus: opv1.ManagedBootImages{
MachineManagers: []opv1.MachineManager{
{Resource: opv1.MachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.None}},
{Resource: opv1.MachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.All}},
{Resource: opv1.ControlPlaneMachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.All}},
},
},
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusManualWithOCPVersion("4.18.0"),
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusAutomaticWithOCPVersion("4.18.0"),
},
{
name: "AWS platform, MachineSets enabled in spec, CPMS should remain disabled (no opinion)",
Expand Down Expand Up @@ -618,14 +618,14 @@ func TestSyncMachineConfiguration(t *testing.T) {
infra: buildInfra(withPlatformType(configv1.VSpherePlatformType)),
mcop: buildMachineConfigurationWithNoBootImageConfiguration(),
clusterVersion: buildClusterVersion("4.19.0"),
annotationExpected: false,
annotationExpected: true,
enableCPMSFeatureGate: true,
expectedManagedBootImagesStatus: opv1.ManagedBootImages{
MachineManagers: []opv1.MachineManager{
{Resource: opv1.MachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.None}},
{Resource: opv1.MachineSets, APIGroup: opv1.MachineAPI, Selection: opv1.MachineManagerSelector{Mode: opv1.All}},
},
},
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusManualWithOCPVersion("4.19.0"),
expectedSkewEnforcementStatus: apihelpers.GetSkewEnforcementStatusAutomaticWithOCPVersion("4.19.0"),
},
// Skew enforcement test cases
{
Expand Down
8 changes: 4 additions & 4 deletions test/extended-priv/mco_bootimages.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati

})

g.It("[PolarionID:81403][OTP] In BootImages Machineset should update by default", g.Label("Platform:aws", "Platform:gcp"), func() {
g.It("[PolarionID:81403][OTP] In BootImages Machineset should update by default", g.Label("Platform:aws", "Platform:gcp", "Platform:vsphere", "Platform:azure"), func() {

// Not supported in Vsphere
skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AWSPlatform)
skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AWSPlatform, VspherePlatform, AzurePlatform)

var (
duplicatedMachinesetName = fmt.Sprintf("cloned-tc-%s", GetCurrentTestPolarionIDNumber())
Expand Down Expand Up @@ -471,10 +471,10 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati
testUserDataUpdateFailure(oc, clonedMSName, clonedSecretName, expectedFailedMessageRegexp, setWrongIgnitionVersion)
})

g.It("[PolarionID:81395][OTP] Verify in boot-image by default update is opt-in", g.Label("Platform:aws", "Platform:gcp"), func() {
g.It("[PolarionID:81395][OTP] Verify in boot-image by default update is opt-in", g.Label("Platform:aws", "Platform:gcp", "Platform:vsphere", "Platform:azure"), func() {

// Not supported in Vsphere
skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AWSPlatform)
skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AWSPlatform, VspherePlatform, AzurePlatform)

exutil.By("To check the default opt-in in machieconfiguration")
if !strings.Contains(machineConfiguration.GetSpecOrFail(), "managedBootImages") {
Expand Down
8 changes: 4 additions & 4 deletions test/extended-priv/mco_bootimages_skew.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/disruptive
})

g.It("Verify Automatic mode and Upgradeable (Happy Case) [apigroup:machineconfiguration.openshift.io]", func() {
// only applicable on GCP, AWS clusters
skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AWSPlatform)
// only applicable on clusters where we support automatic updates: GCP, AWS, Azure and vSphere
skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AWSPlatform, AzurePlatform, VspherePlatform)

// No opinion on skew enforcement for these platforms will result in Automatic mode
o.Expect(machineConfiguration.RemoveSkew()).To(o.Succeed())
Expand Down Expand Up @@ -124,8 +124,8 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/disruptive
})

g.It("Verify Automatic mode and Upgradeable (Sad Case) [apigroup:machineconfiguration.openshift.io]", func(_ context.Context) {
// only applicable on GCP, AWS clusters
skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AWSPlatform)
// only applicable on clusters where we support automatic updates: GCP, AWS, Azure and vSphere
skipTestIfSupportedPlatformNotMatched(oc, GCPPlatform, AWSPlatform, AzurePlatform, VspherePlatform)

// No opinion on skew enforcement for these platforms will result in Automatic mode
o.Expect(machineConfiguration.RemoveSkew()).To(o.Succeed())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: skewenforcement-none
objects:
- apiVersion: operator.openshift.io/v1
kind: MachineConfiguration
metadata:
name: cluster
namespace: openshift-machine-config-operator
spec:
logLevel: Normal
operatorLogLevel: Normal
bootImageSkewEnforcement:
mode: None
11 changes: 7 additions & 4 deletions test/extended/boot_image_update_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ import (
var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/disruptive][Serial][OCPFeatureGate:ManagedBootImagesAzure]", g.Label("Platform:azure"), g.Ordered, func() {
defer g.GinkgoRecover()
var (
AllMachineSetFixture = filepath.Join("machineconfigurations", "managedbootimages-all.yaml")
NoneMachineSetFixture = filepath.Join("machineconfigurations", "managedbootimages-none.yaml")
PartialMachineSetFixture = filepath.Join("machineconfigurations", "managedbootimages-partial.yaml")
EmptyMachineSetFixture = filepath.Join("machineconfigurations", "managedbootimages-empty.yaml")
AllMachineSetFixture = filepath.Join("machineconfigurations", "managedbootimages-all.yaml")
NoneMachineSetFixture = filepath.Join("machineconfigurations", "managedbootimages-none.yaml")
PartialMachineSetFixture = filepath.Join("machineconfigurations", "managedbootimages-partial.yaml")
EmptyMachineSetFixture = filepath.Join("machineconfigurations", "managedbootimages-empty.yaml")
SkewEnforcementDisabledFixture = filepath.Join("machineconfigurations", "skewenforcement-disabled.yaml")

oc = exutil.NewCLI("mco-bootimage", exutil.KubeConfigPath()).AsAdmin()
)
Expand All @@ -36,6 +37,8 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/disruptive
skipUnlessFunctionalMachineAPI(oc)
// Skip this test on single node platforms
exutil.SkipOnSingleNodeTopology(oc)
// Disable boot image skew enforcement
applyMachineConfigurationFixture(oc, SkewEnforcementDisabledFixture)
})

g.AfterEach(func() {
Expand Down