-
Notifications
You must be signed in to change notification settings - Fork 794
OPNET-780: Add BGPBasedVIPManagement feature gate and BGP VIP management fields #2923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this | ||
| name: "BGPBasedVIPManagement Infrastructure" | ||
| crdName: infrastructures.config.openshift.io | ||
| featureGates: | ||
| - BGPBasedVIPManagement | ||
| tests: | ||
| onUpdate: | ||
| - name: Should allow setting vipManagement to BGP on BareMetal | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Infrastructure | ||
| spec: | ||
| platformSpec: | ||
| baremetal: {} | ||
| type: BareMetal | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Infrastructure | ||
| spec: | ||
| platformSpec: | ||
| baremetal: {} | ||
| type: BareMetal | ||
| status: | ||
| platform: BareMetal | ||
| platformStatus: | ||
| baremetal: | ||
| vipManagement: BGP | ||
| type: BareMetal | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Infrastructure | ||
| spec: | ||
| platformSpec: | ||
| baremetal: {} | ||
| type: BareMetal | ||
| status: | ||
| platform: BareMetal | ||
| platformStatus: | ||
| baremetal: | ||
| vipManagement: BGP | ||
| loadBalancer: | ||
| type: OpenShiftManagedDefault | ||
| type: BareMetal | ||
| cpuPartitioning: None | ||
| infrastructureTopology: HighlyAvailable | ||
| controlPlaneTopology: HighlyAvailable | ||
| - name: Should reject changing vipManagement from BGP to Keepalived | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Infrastructure | ||
| spec: | ||
| platformSpec: | ||
| baremetal: {} | ||
| type: BareMetal | ||
| status: | ||
| platform: BareMetal | ||
| platformStatus: | ||
| baremetal: | ||
| vipManagement: BGP | ||
| type: BareMetal | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Infrastructure | ||
| spec: | ||
| platformSpec: | ||
| baremetal: {} | ||
| type: BareMetal | ||
| status: | ||
| platform: BareMetal | ||
| platformStatus: | ||
| baremetal: | ||
| vipManagement: Keepalived | ||
| type: BareMetal | ||
| expectedStatusError: 'platformStatus.baremetal.vipManagement: Invalid value: "string": vipManagement is immutable once set' | ||
| - name: Should reject changing vipManagement from Keepalived to BGP | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Infrastructure | ||
| spec: | ||
| platformSpec: | ||
| baremetal: {} | ||
| type: BareMetal | ||
| status: | ||
| platform: BareMetal | ||
| platformStatus: | ||
| baremetal: | ||
| vipManagement: Keepalived | ||
| type: BareMetal | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Infrastructure | ||
| spec: | ||
| platformSpec: | ||
| baremetal: {} | ||
| type: BareMetal | ||
| status: | ||
| platform: BareMetal | ||
| platformStatus: | ||
| baremetal: | ||
| vipManagement: BGP | ||
| type: BareMetal | ||
| expectedStatusError: 'platformStatus.baremetal.vipManagement: Invalid value: "string": vipManagement is immutable once set' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -210,6 +210,21 @@ const ( | |
| DNSRecordsTypeInternal DNSRecordsType = "Internal" | ||
| ) | ||
|
|
||
| // VIPManagementType defines which mechanism manages the API and Ingress | ||
| // VIPs on an on-premise cluster. | ||
| // +kubebuilder:validation:Enum=Keepalived;BGP | ||
| // +enum | ||
| type VIPManagementType string | ||
|
|
||
| const ( | ||
| // VIPManagementTypeKeepalived means the VIPs are managed by the default | ||
| // keepalived/VRRP mechanism. | ||
| VIPManagementTypeKeepalived VIPManagementType = "Keepalived" | ||
| // VIPManagementTypeBGP means the VIPs are advertised via BGP by kube-vip | ||
| // (Routing Table Mode) and frr-k8s running as static pods. | ||
| VIPManagementTypeBGP VIPManagementType = "BGP" | ||
| ) | ||
|
|
||
| // PlatformType is a specific supported infrastructure provider. | ||
| // +kubebuilder:validation:Enum="";AWS;Azure;BareMetal;GCP;Libvirt;OpenStack;None;VSphere;oVirt;IBMCloud;KubeVirt;EquinixMetal;PowerVS;AlibabaCloud;Nutanix;External | ||
| type PlatformType string | ||
|
|
@@ -1074,6 +1089,21 @@ type BareMetalPlatformStatus struct { | |
| // +optional | ||
| LoadBalancer *BareMetalPlatformLoadBalancer `json:"loadBalancer,omitempty"` | ||
|
|
||
| // vipManagement indicates which VIP management mechanism is active | ||
| // on this cluster. | ||
| // Allowed values are `Keepalived`, `BGP`, and omitted. | ||
| // Once set to a non-empty value, this field is immutable. | ||
| // When set to `BGP`, kube-vip (Routing Table Mode) and frr-k8s are | ||
| // deployed as static pods to advertise VIPs via BGP, replacing the | ||
| // default keepalived/VRRP mechanism. | ||
| // When set to `Keepalived`, the default keepalived-based VIP | ||
| // management is used. | ||
| // When omitted, the default keepalived-based VIP management is used. | ||
| // +kubebuilder:validation:XValidation:rule="oldSelf == '' || self == oldSelf",message="vipManagement is immutable once set" | ||
| // +openshift:enable:FeatureGate=BGPBasedVIPManagement | ||
| // +optional | ||
| VIPManagement VIPManagementType `json:"vipManagement,omitempty"` | ||
|
JoelSpeed marked this conversation as resolved.
Comment on lines
+1092
to
+1105
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The documentation for BGP suggests that Keepalived to BGP is an acceptable transition? If I set this to keepalived explicitly, can I not later move it to BGP?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will do transition from Keepalived to BGP in the future but not in DevPreview
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIUC, setting BGP day 2 is effectively doing Keepalived to BGP already no? So we allow and have to test that path already right? Or is there something I'm missing, what extra work do you need to do to verify that an explicit Keepalived migration to explicit BGP is safe? |
||
|
|
||
| // dnsRecordsType determines whether records for api, api-int, and ingress | ||
| // are provided by the internal DNS service or externally. | ||
| // Allowed values are `Internal`, `External`, and omitted. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These validations are testing the enum value behaves as expected, I think we trust enum values. Probably better to save integration tests for validation like the immutability written in CEL, I'm much more interested in checking that works personally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair, added test for CEL immutability and removed testing enums