Skip to content

Commit

Permalink
Back port SDN live migration feature to 4.14
Browse files Browse the repository at this point in the history
Signed-off-by: Peng Liu <pliu@redhat.com>
  • Loading branch information
pliurh committed Sep 12, 2024
1 parent 5d963dc commit 9d5be0c
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 1 deletion.
47 changes: 47 additions & 0 deletions config/v1/0000_10_config-operator_01_network.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,53 @@ spec:
clusterNetworkMTU:
description: ClusterNetworkMTU is the MTU for inter-pod networking.
type: integer
conditions:
description: 'conditions represents the observations of a network.config current state. Known .status.conditions.type are: "NetworkTypeMigrationInProgress", "NetworkTypeMigrationMTUReady", "NetworkTypeMigrationTargetCNIAvailable", "NetworkTypeMigrationTargetCNIInUse" and "NetworkTypeMigrationOriginalCNIPurged"'
type: array
items:
description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, \n type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
type: object
required:
- lastTransitionTime
- message
- reason
- status
- type
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
type: string
format: date-time
message:
description: message is a human readable message indicating details about the transition. This may be an empty string.
type: string
maxLength: 32768
observedGeneration:
description: observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
type: integer
format: int64
minimum: 0
reason:
description: reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
type: string
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
status:
description: status of the condition, one of True, False, Unknown.
type: string
enum:
- "True"
- "False"
- Unknown
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
migration:
description: Migration contains the cluster network migration configuration.
type: object
Expand Down
10 changes: 10 additions & 0 deletions config/v1/feature_gates.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ var (
OwningProduct: ocpSpecific,
}

FeatureGateNetworkLiveMigration = FeatureGateName("NetworkLiveMigration")
sdnLiveMigration = FeatureGateDescription{
FeatureGateAttributes: FeatureGateAttributes{
Name: FeatureGateNetworkLiveMigration,
},
OwningJiraComponent: "Networking/ovn-kubernetes",
ResponsiblePerson: "pliu",
OwningProduct: ocpSpecific,
}

FeatureGateAutomatedEtcdBackup = FeatureGateName("AutomatedEtcdBackup")
automatedEtcdBackup = FeatureGateDescription{
FeatureGateAttributes: FeatureGateAttributes{
Expand Down
23 changes: 23 additions & 0 deletions config/v1/stable.network.testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,26 @@ tests:
apiVersion: config.openshift.io/v1
kind: Network
spec: {}
- name: Should be able to set status conditions
initial: |
apiVersion: config.openshift.io/v1
kind: Network
spec: {} # No spec is required for a Network
status:
conditions:
- type: NetworkTypeMigrationInProgress
status: "False"
reason: "Reason"
message: "Message"
lastTransitionTime: "2023-10-25T12:00:00Z"
expected: |
apiVersion: config.openshift.io/v1
kind: Network
spec: {}
status:
conditions:
- type: NetworkTypeMigrationInProgress
status: "False"
reason: "Reason"
message: "Message"
lastTransitionTime: "2023-10-25T12:00:00Z"
1 change: 1 addition & 0 deletions config/v1/types_feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ var defaultFeatures = &FeatureGateEnabledDisabled{
externalCloudProviderExternal,
privateHostedZoneAWS,
buildCSIVolumes,
sdnLiveMigration,
},
Disabled: []FeatureGateDescription{
retroactiveDefaultStorageClass,
Expand Down
11 changes: 11 additions & 0 deletions config/v1/types_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ type NetworkStatus struct {

// Migration contains the cluster network migration configuration.
Migration *NetworkMigration `json:"migration,omitempty"`

// conditions represents the observations of a network.config current state.
// Known .status.conditions.type are: "NetworkTypeMigrationInProgress", "NetworkTypeMigrationMTUReady",
// "NetworkTypeMigrationTargetCNIAvailable", "NetworkTypeMigrationTargetCNIInUse"
// and "NetworkTypeMigrationOriginalCNIPurged"
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}

// ClusterNetworkEntry is a contiguous block of IP addresses from which pod IPs
Expand Down
7 changes: 7 additions & 0 deletions config/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 33 additions & 1 deletion openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7892,6 +7892,20 @@
"type": "integer",
"format": "int32"
},
"conditions": {
"description": "conditions represents the observations of a network.config current state. Known .status.conditions.type are: \"NetworkTypeMigrationInProgress\", \"NetworkTypeMigrationMTUReady\", \"NetworkTypeMigrationTargetCNIAvailable\", \"NetworkTypeMigrationTargetCNIInUse\" and \"NetworkTypeMigrationOriginalCNIPurged\"",
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Condition"
},
"x-kubernetes-list-map-keys": [
"type"
],
"x-kubernetes-list-type": "map",
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"migration": {
"description": "Migration contains the cluster network migration configuration.",
"$ref": "#/definitions/com.github.openshift.api.config.v1.NetworkMigration"
Expand Down Expand Up @@ -27155,6 +27169,11 @@
"description": "features contains the features migration configuration. Set this to migrate feature configuration when changing the cluster default network provider. if unset, the default operation is to migrate all the configuration of supported features.",
"$ref": "#/definitions/com.github.openshift.api.operator.v1.FeaturesMigration"
},
"mode": {
"description": "mode indicates the mode of network migration. The supported values are \"Live\", \"Offline\" and omitted. A \"Live\" migration operation will not cause service interruption by migrating the CNI of each node one by one. The cluster network will work as normal during the network migration. An \"Offline\" migration operation will cause service interruption. During an \"Offline\" migration, two rounds of node reboots are required. The cluster network will be malfunctioning during the network migration. When omitted, this means no opinion and the platform is left to choose a reasonable default which is subject to change over time. The current default value is \"Offline\".",
"type": "string",
"default": ""
},
"mtu": {
"description": "mtu contains the MTU migration configuration. Set this to allow changing the MTU values for the default network. If unset, the operation of changing the MTU for the default network will be rejected.",
"$ref": "#/definitions/com.github.openshift.api.operator.v1.MTUMigration"
Expand Down
7 changes: 7 additions & 0 deletions operator/v1/0000_70_cluster-network-operator_01.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,13 @@ spec:
description: multicast specifies whether or not the multicast configuration is migrated automatically when changing the cluster default network provider. If unset, this property defaults to 'true' and multicast configure is migrated.
type: boolean
default: true
mode:
description: mode indicates the mode of network migration. The supported values are "Live", "Offline" and omitted. A "Live" migration operation will not cause service interruption by migrating the CNI of each node one by one. The cluster network will work as normal during the network migration. An "Offline" migration operation will cause service interruption. During an "Offline" migration, two rounds of node reboots are required. The cluster network will be malfunctioning during the network migration. When omitted, this means no opinion and the platform is left to choose a reasonable default which is subject to change over time. The current default value is "Offline".
type: string
enum:
- Live
- Offline
- ""
mtu:
description: mtu contains the MTU migration configuration. Set this to allow changing the MTU values for the default network. If unset, the operation of changing the MTU for the default network will be rejected.
type: object
Expand Down
22 changes: 22 additions & 0 deletions operator/v1/types_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,20 @@ type NetworkSpec struct {
Migration *NetworkMigration `json:"migration,omitempty"`
}

// NetworkMigrationMode is an enumeration of the possible mode of the network migration
// Valid values are "Live", "Offline" and omitted.
// +kubebuilder:validation:Enum:=Live;Offline;""
type NetworkMigrationMode string

const (
// A "Live" migration operation will not cause service interruption by migrating the CNI of each node one by one. The cluster network will work as normal during the network migration.
LiveNetworkMigrationMode NetworkMigrationMode = "Live"
// An "Offline" migration operation will cause service interruption. During an "Offline" migration, two rounds of node reboots are required. The cluster network will be malfunctioning during the network migration.
OfflineNetworkMigrationMode NetworkMigrationMode = "Offline"
)

// NetworkMigration represents the cluster network configuration.
// +openshift:validation:FeatureSetAwareXValidation:featureSet=CustomNoUpgrade;TechPreviewNoUpgrade,rule="!has(self.mtu) || !has(self.networkType) || self.networkType == '' || has(self.mode) && self.mode == 'Live'",message="networkType migration in mode other than 'Live' may not be configured at the same time as mtu migration"
type NetworkMigration struct {
// networkType is the target type of network migration. Set this to the
// target network type to allow changing the default network. If unset, the
Expand All @@ -137,6 +150,15 @@ type NetworkMigration struct {
// supported features.
// +optional
Features *FeaturesMigration `json:"features,omitempty"`

// mode indicates the mode of network migration.
// The supported values are "Live", "Offline" and omitted.
// A "Live" migration operation will not cause service interruption by migrating the CNI of each node one by one. The cluster network will work as normal during the network migration.
// An "Offline" migration operation will cause service interruption. During an "Offline" migration, two rounds of node reboots are required. The cluster network will be malfunctioning during the network migration.
// When omitted, this means no opinion and the platform is left to choose a reasonable default which is subject to change over time.
// The current default value is "Offline".
// +optional
Mode NetworkMigrationMode `json:"mode"`
}

type FeaturesMigration struct {
Expand Down
1 change: 1 addition & 0 deletions operator/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9d5be0c

Please sign in to comment.