@@ -46,6 +46,7 @@ import (
46
46
iputil "github.com/openshift/cluster-network-operator/pkg/util/ip"
47
47
"github.com/openshift/cluster-network-operator/pkg/util/k8s"
48
48
mcutil "github.com/openshift/cluster-network-operator/pkg/util/machineconfig"
49
+ "github.com/openshift/cluster-network-operator/pkg/version"
49
50
)
50
51
51
52
const CLUSTER_CONFIG_NAME = "cluster-config-v1"
@@ -598,6 +599,34 @@ func shouldRenderIPsec(conf *operv1.OVNKubernetesConfig, bootstrapResult *bootst
598
599
// with the the IPsec MachineConfig extensions active, the containerized
599
600
// daemonset is dormant and the host daemonset is active. When the upgrade
600
601
// finishes, the containerized daemonset is then not rendered.
602
+ //
603
+ // The upgrade from 4.14 is handled very carefully to correctly migrate
604
+ // from containerized ipsec deployment to the host ipsec deployment.
605
+ // 1. OCP 4.14 with container ipsec deployment is active using libreswan
606
+ // 4.6.3; and host ipsec deployment is dormant.
607
+ // 2. Start the 4.15 upgrade.
608
+ // 3. CNO upgrades to 4.15.
609
+ // 4. CNO renders 4.15 versions of the container ipsec deployment and
610
+ // host ipsec deployment with no state change. However the host ipsec
611
+ // deployment mounts to top system level directories for the host ipsec
612
+ // path for this upgrade scenario. It fixes two problems.
613
+ // a) version mismatch between libreswan installed on the host and
614
+ // host ipsec deployment pod container.
615
+ // b) host ipsec deployment pod goes into pending state if we mount the
616
+ // binaries directly and libreswan has not been installed yet
617
+ // installed on the host by IPsec machine configs.
618
+ // 5. CNO waits until MCO is upgraded to 4.15 and then deploys CNO ipsec
619
+ // machine configs that will install and run libreswan 4.6.3 on the
620
+ // host. Otherwise, without waiting for MCO 4.15, libreswan 4.9 may
621
+ // be installed from 4.14 MCO which has all known stability problems
622
+ // found from the bugs.
623
+ // https://issues.redhat.com/browse/OCPBUGS-41823
624
+ // https://issues.redhat.com/browse/OCPBUGS-42952
625
+ // 6. Host ipsec deployment becomes active using libreswan 4.6.3 from the
626
+ // container which can successfully run against libreswan 4.6.3 running
627
+ // on the host.
628
+ // 7. At the same time as step 6, containerized ipsec deployment becomes
629
+ // dormant, and eventually gets removed when the upgrade is done.
601
630
602
631
isHypershiftHostedCluster := bootstrapResult .Infra .HostedControlPlane != nil
603
632
isOVNIPsecActiveOrRollingOut := bootstrapResult .OVN .IPsecUpdateStatus != nil && bootstrapResult .OVN .IPsecUpdateStatus .IsOVNIPsecActiveOrRollingOut
@@ -1486,10 +1515,10 @@ func shouldUpdateOVNKonUpgrade(ovn bootstrap.OVNBootstrapResult, releaseVersion
1486
1515
1487
1516
// compute version delta
1488
1517
// versionUpgrade means the existing daemonSet needs an upgrade.
1489
- controlPlaneDelta := compareVersions (controlPlaneVersion , releaseVersion )
1490
- nodeDelta := compareVersions (nodeVersion , releaseVersion )
1518
+ controlPlaneDelta := version . CompareVersions (controlPlaneVersion , releaseVersion )
1519
+ nodeDelta := version . CompareVersions (nodeVersion , releaseVersion )
1491
1520
1492
- if controlPlaneDelta == versionUnknown || nodeDelta == versionUnknown {
1521
+ if controlPlaneDelta == version . VersionUnknown || nodeDelta == version . VersionUnknown {
1493
1522
klog .Warningf ("could not determine ovn-kubernetes daemonset update directions; node: %s, control-plane: %s, release: %s" ,
1494
1523
nodeVersion , controlPlaneVersion , releaseVersion )
1495
1524
return true , true
@@ -1513,14 +1542,14 @@ func shouldUpdateOVNKonUpgrade(ovn bootstrap.OVNBootstrapResult, releaseVersion
1513
1542
1514
1543
// both older (than CNO)
1515
1544
// Update node only.
1516
- if controlPlaneDelta == versionUpgrade && nodeDelta == versionUpgrade {
1545
+ if controlPlaneDelta == version . VersionUpgrade && nodeDelta == version . VersionUpgrade {
1517
1546
klog .V (2 ).Infof ("Upgrading OVN-Kubernetes node before control-plane" )
1518
1547
return true , false
1519
1548
}
1520
1549
1521
1550
// control plane older, node updated
1522
1551
// update control plane if node is rolled out
1523
- if controlPlaneDelta == versionUpgrade && nodeDelta == versionSame {
1552
+ if controlPlaneDelta == version . VersionUpgrade && nodeDelta == version . VersionSame {
1524
1553
if ovn .NodeUpdateStatus .Progressing {
1525
1554
klog .V (2 ).Infof ("Waiting for OVN-Kubernetes node update to roll out before updating control-plane" )
1526
1555
return true , false
@@ -1531,14 +1560,14 @@ func shouldUpdateOVNKonUpgrade(ovn bootstrap.OVNBootstrapResult, releaseVersion
1531
1560
1532
1561
// both newer
1533
1562
// downgrade control plane before node
1534
- if controlPlaneDelta == versionDowngrade && nodeDelta == versionDowngrade {
1563
+ if controlPlaneDelta == version . VersionDowngrade && nodeDelta == version . VersionDowngrade {
1535
1564
klog .V (2 ).Infof ("Downgrading OVN-Kubernetes control-plane before node" )
1536
1565
return false , true
1537
1566
}
1538
1567
1539
1568
// control plane same, node needs downgrade
1540
1569
// wait for control plane rollout
1541
- if controlPlaneDelta == versionSame && nodeDelta == versionDowngrade {
1570
+ if controlPlaneDelta == version . VersionSame && nodeDelta == version . VersionDowngrade {
1542
1571
if ovn .ControlPlaneUpdateStatus .Progressing {
1543
1572
klog .V (2 ).Infof ("Waiting for OVN-Kubernetes control-plane downgrade to roll out before downgrading node" )
1544
1573
return false , true
@@ -1548,7 +1577,7 @@ func shouldUpdateOVNKonUpgrade(ovn bootstrap.OVNBootstrapResult, releaseVersion
1548
1577
}
1549
1578
1550
1579
// unlikely, should be caught above
1551
- if controlPlaneDelta == versionSame && nodeDelta == versionSame {
1580
+ if controlPlaneDelta == version . VersionSame && nodeDelta == version . VersionSame {
1552
1581
return true , true
1553
1582
}
1554
1583
@@ -1701,7 +1730,7 @@ func isOVNIPsecNotActiveInDaemonSet(ds *appsv1.DaemonSet) bool {
1701
1730
return false
1702
1731
}
1703
1732
// If IPsec is running with older version and ipsec=true is found from nbdb container, then return false.
1704
- if ! isVersionGreaterThanOrEqualTo (annotations ["release.openshift.io/version" ], 4 , 15 ) &&
1733
+ if ! version . IsVersionGreaterThanOrEqualTo (annotations ["release.openshift.io/version" ], 4 , 15 ) &&
1705
1734
isIPSecEnabledInPod (ds .Spec .Template , util .OVN_NBDB ) {
1706
1735
return false
1707
1736
}
0 commit comments