Skip to content

Commit

Permalink
Merge pull request #3967 from Azure/ARO-12232
Browse files Browse the repository at this point in the history
Update NetworkType in cluster doc if cluster has migrated from SDN to OVN
  • Loading branch information
fahlmant authored Nov 21, 2024
2 parents 1737087 + f101ba0 commit 589166d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/cluster/adminupdate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func TestAdminUpdateSteps(t *testing.T) {
"[Action rotateACRTokenPassword]",
"[Action populateRegistryStorageAccountName]",
"[Action ensureMTUSize]",
"[Action reconcileSoftwareDefinedNetwork]",
}

certificateRenewalSteps := []string{
Expand Down
2 changes: 2 additions & 0 deletions pkg/cluster/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func (m *manager) getGeneralFixesSteps() []steps.Step {

steps.Action(m.populateRegistryStorageAccountName),
steps.Action(m.ensureMTUSize),
steps.Action(m.reconcileSoftwareDefinedNetwork),
}
return utilgenerics.ConcatMultipleSlices(
stepsThatDontNeedAPIServer,
Expand Down Expand Up @@ -251,6 +252,7 @@ func (m *manager) Update(ctx context.Context) error {
steps.Action(m.renewMDSDCertificate),
steps.Action(m.fixUserAdminKubeconfig),
steps.Action(m.reconcileLoadBalancerProfile),
steps.Action(m.reconcileSoftwareDefinedNetwork),
)

if m.doc.OpenShiftCluster.UsesWorkloadIdentity() {
Expand Down
23 changes: 23 additions & 0 deletions pkg/cluster/networkprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@ import (
"github.com/Azure/ARO-RP/pkg/util/feature"
)

func (m *manager) reconcileSoftwareDefinedNetwork(ctx context.Context) error {
// Clusters that are using SDN will need to migrate to OVN before upgrading to OpenShift 4.17.z
// This checks any cluster that is still marked as using SDN in its cluster doc, and updates it
// if the on-cluster networkType has been updated to use OVN
if m.doc.OpenShiftCluster.Properties.NetworkProfile.SoftwareDefinedNetwork == api.SoftwareDefinedNetworkOpenShiftSDN {
network, err := m.configcli.ConfigV1().Networks().Get(ctx, "cluster", metav1.GetOptions{})
if err != nil {
return err
}
if network.Spec.NetworkType == string(api.SoftwareDefinedNetworkOVNKubernetes) {
m.doc, err = m.db.PatchWithLease(ctx, m.doc.Key, func(doc *api.OpenShiftClusterDocument) error {
doc.OpenShiftCluster.Properties.NetworkProfile.SoftwareDefinedNetwork = api.SoftwareDefinedNetworkOVNKubernetes
return nil
})
if err != nil {
return err
}
}
}

return nil
}

// populateMTUSize ensures that every new cluster object has the MTUSize field defined
func (m *manager) populateMTUSize(ctx context.Context) error {
// Get appropriate MTU size
Expand Down

0 comments on commit 589166d

Please sign in to comment.