-
Notifications
You must be signed in to change notification settings - Fork 591
OPNET-351: Extend infra CR to store VIPs and MachineNetwork #1593
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -691,7 +691,48 @@ type BareMetalPlatformLoadBalancer struct { | |
|
|
||
| // BareMetalPlatformSpec holds the desired state of the BareMetal infrastructure provider. | ||
| // This only includes fields that can be modified in the cluster. | ||
| type BareMetalPlatformSpec struct{} | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.apiServerInternalIPs) || has(self.apiServerInternalIPs)",message="apiServerInternalIPs list is required once set" | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.ingressIPs) || has(self.ingressIPs)",message="ingressIPs list is required once set" | ||
| type BareMetalPlatformSpec struct { | ||
| // apiServerInternalIPs are the IP addresses to contact the Kubernetes API | ||
| // server that can be used by components inside the cluster, like kubelets | ||
| // using the infrastructure rather than Kubernetes networking. These are the | ||
| // IPs for a self-hosted load balancer in front of the API servers. | ||
| // In dual stack clusters this list contains two IP addresses, one from IPv4 | ||
| // family and one from IPv6. | ||
| // In single stack clusters a single IP address is expected. | ||
| // When omitted, values from the status.apiServerInternalIPs will be used. | ||
| // Once set, the list cannot be completely removed (but its second entry can). | ||
| // | ||
| // +kubebuilder:validation:MaxItems=2 | ||
| // +kubebuilder:validation:XValidation:rule="size(self) == 2 ? self.exists_one(x, x.contains(':')) : true",message="apiServerInternalIPs must contain at most one IPv4 address and at most one IPv6 address" | ||
| // +listType=set | ||
| // +optional | ||
| APIServerInternalIPs []IP `json:"apiServerInternalIPs"` | ||
|
|
||
| // ingressIPs are the external IPs which route to the default ingress | ||
| // controller. The IPs are suitable targets of a wildcard DNS record used to | ||
| // resolve default route host names. | ||
| // In dual stack clusters this list contains two IP addresses, one from IPv4 | ||
| // family and one from IPv6. | ||
| // In single stack clusters a single IP address is expected. | ||
| // When omitted, values from the status.ingressIPs will be used. | ||
| // Once set, the list cannot be completely removed (but its second entry can). | ||
| // | ||
| // +kubebuilder:validation:MaxItems=2 | ||
| // +kubebuilder:validation:XValidation:rule="size(self) == 2 ? self.exists_one(x, x.contains(':')) : true",message="ingressIPs must contain at most one IPv4 address and at most one IPv6 address" | ||
| // +listType=set | ||
| // +optional | ||
| IngressIPs []IP `json:"ingressIPs"` | ||
|
|
||
| // machineNetworks are IP networks used to connect all the OpenShift cluster | ||
| // nodes. Each network is provided in the CIDR format and should be IPv4 or IPv6, | ||
| // for example "10.0.0.0/8" or "fd00::/8". | ||
| // +listType=set | ||
| // +kubebuilder:validation:MaxItems=32 | ||
| // +optional | ||
| MachineNetworks []CIDR `json:"machineNetworks"` | ||
| } | ||
|
|
||
| // BareMetalPlatformStatus holds the current status of the BareMetal infrastructure provider. | ||
| // For more information about the network architecture used with the BareMetal platform type, see: | ||
|
|
@@ -744,6 +785,12 @@ type BareMetalPlatformStatus struct { | |
| // +openshift:enable:FeatureSets=CustomNoUpgrade;TechPreviewNoUpgrade | ||
| // +optional | ||
| LoadBalancer *BareMetalPlatformLoadBalancer `json:"loadBalancer,omitempty"` | ||
|
|
||
| // machineNetworks are IP networks used to connect all the OpenShift cluster nodes. | ||
| // +listType=set | ||
| // +kubebuilder:validation:MaxItems=32 | ||
| // +optional | ||
| MachineNetworks []CIDR `json:"machineNetworks"` | ||
| } | ||
|
|
||
| // OpenStackPlatformLoadBalancer defines the load balancer used by the cluster on OpenStack platform. | ||
|
|
@@ -769,7 +816,48 @@ type OpenStackPlatformLoadBalancer struct { | |
|
|
||
| // OpenStackPlatformSpec holds the desired state of the OpenStack infrastructure provider. | ||
| // This only includes fields that can be modified in the cluster. | ||
| type OpenStackPlatformSpec struct{} | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.apiServerInternalIPs) || has(self.apiServerInternalIPs)",message="apiServerInternalIPs list is required once set" | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.ingressIPs) || has(self.ingressIPs)",message="ingressIPs list is required once set" | ||
| type OpenStackPlatformSpec struct { | ||
| // apiServerInternalIPs are the IP addresses to contact the Kubernetes API | ||
| // server that can be used by components inside the cluster, like kubelets | ||
| // using the infrastructure rather than Kubernetes networking. These are the | ||
| // IPs for a self-hosted load balancer in front of the API servers. | ||
| // In dual stack clusters this list contains two IP addresses, one from IPv4 | ||
| // family and one from IPv6. | ||
| // In single stack clusters a single IP address is expected. | ||
| // When omitted, values from the status.apiServerInternalIPs will be used. | ||
| // Once set, the list cannot be completely removed (but its second entry can). | ||
| // | ||
| // +kubebuilder:validation:MaxItems=2 | ||
| // +kubebuilder:validation:XValidation:rule="size(self) == 2 ? self.exists_one(x, x.contains(':')) : true",message="apiServerInternalIPs must contain at most one IPv4 address and at most one IPv6 address" | ||
| // +listType=set | ||
| // +optional | ||
| APIServerInternalIPs []IP `json:"apiServerInternalIPs"` | ||
|
|
||
| // ingressIPs are the external IPs which route to the default ingress | ||
| // controller. The IPs are suitable targets of a wildcard DNS record used to | ||
| // resolve default route host names. | ||
| // In dual stack clusters this list contains two IP addresses, one from IPv4 | ||
| // family and one from IPv6. | ||
| // In single stack clusters a single IP address is expected. | ||
| // When omitted, values from the status.ingressIPs will be used. | ||
| // Once set, the list cannot be completely removed (but its second entry can). | ||
| // | ||
| // +kubebuilder:validation:MaxItems=2 | ||
| // +kubebuilder:validation:XValidation:rule="size(self) == 2 ? self.exists_one(x, x.contains(':')) : true",message="ingressIPs must contain at most one IPv4 address and at most one IPv6 address" | ||
| // +listType=set | ||
| // +optional | ||
| IngressIPs []IP `json:"ingressIPs"` | ||
|
|
||
| // machineNetworks are IP networks used to connect all the OpenShift cluster | ||
| // nodes. Each network is provided in the CIDR format and should be IPv4 or IPv6, | ||
| // for example "10.0.0.0/8" or "fd00::/8". | ||
| // +listType=set | ||
| // +kubebuilder:validation:MaxItems=32 | ||
| // +optional | ||
| MachineNetworks []CIDR `json:"machineNetworks"` | ||
| } | ||
|
|
||
| // OpenStackPlatformStatus holds the current status of the OpenStack infrastructure provider. | ||
| type OpenStackPlatformStatus struct { | ||
|
|
@@ -823,6 +911,12 @@ type OpenStackPlatformStatus struct { | |
| // +kubebuilder:default={"type": "OpenShiftManagedDefault"} | ||
| // +optional | ||
| LoadBalancer *OpenStackPlatformLoadBalancer `json:"loadBalancer,omitempty"` | ||
|
|
||
| // machineNetworks are IP networks used to connect all the OpenShift cluster nodes. | ||
| // +listType=set | ||
| // +kubebuilder:validation:MaxItems=32 | ||
| // +optional | ||
| MachineNetworks []CIDR `json:"machineNetworks"` | ||
| } | ||
|
|
||
| // OvirtPlatformLoadBalancer defines the load balancer used by the cluster on Ovirt platform. | ||
|
|
@@ -1102,6 +1196,8 @@ type VSpherePlatformNodeNetworking struct { | |
| // VSpherePlatformSpec holds the desired state of the vSphere infrastructure provider. | ||
| // In the future the cloud provider operator, storage operator and machine operator will | ||
| // use these fields for configuration. | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.apiServerInternalIPs) || has(self.apiServerInternalIPs)",message="apiServerInternalIPs list is required once set" | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.ingressIPs) || has(self.ingressIPs)",message="ingressIPs list is required once set" | ||
| type VSpherePlatformSpec struct { | ||
| // vcenters holds the connection details for services to communicate with vCenter. | ||
| // Currently, only a single vCenter is supported. | ||
|
|
@@ -1125,6 +1221,45 @@ type VSpherePlatformSpec struct { | |
| // return the first one found. | ||
| // +optional | ||
| NodeNetworking VSpherePlatformNodeNetworking `json:"nodeNetworking,omitempty"` | ||
|
|
||
| // apiServerInternalIPs are the IP addresses to contact the Kubernetes API | ||
| // server that can be used by components inside the cluster, like kubelets | ||
| // using the infrastructure rather than Kubernetes networking. These are the | ||
| // IPs for a self-hosted load balancer in front of the API servers. | ||
| // In dual stack clusters this list contains two IP addresses, one from IPv4 | ||
| // family and one from IPv6. | ||
| // In single stack clusters a single IP address is expected. | ||
| // When omitted, values from the status.apiServerInternalIPs will be used. | ||
| // Once set, the list cannot be completely removed (but its second entry can). | ||
| // | ||
| // +kubebuilder:validation:MaxItems=2 | ||
| // +kubebuilder:validation:XValidation:rule="size(self) == 2 ? self.exists_one(x, x.contains(':')) : true",message="apiServerInternalIPs must contain at most one IPv4 address and at most one IPv6 address" | ||
| // +listType=set | ||
| // +optional | ||
| APIServerInternalIPs []IP `json:"apiServerInternalIPs"` | ||
|
|
||
| // ingressIPs are the external IPs which route to the default ingress | ||
| // controller. The IPs are suitable targets of a wildcard DNS record used to | ||
| // resolve default route host names. | ||
| // In dual stack clusters this list contains two IP addresses, one from IPv4 | ||
| // family and one from IPv6. | ||
| // In single stack clusters a single IP address is expected. | ||
| // When omitted, values from the status.ingressIPs will be used. | ||
| // Once set, the list cannot be completely removed (but its second entry can). | ||
| // | ||
mkowalski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // +kubebuilder:validation:MaxItems=2 | ||
| // +kubebuilder:validation:XValidation:rule="size(self) == 2 ? self.exists_one(x, x.contains(':')) : true",message="ingressIPs must contain at most one IPv4 address and at most one IPv6 address" | ||
| // +listType=set | ||
| // +optional | ||
| IngressIPs []IP `json:"ingressIPs"` | ||
|
|
||
| // machineNetworks are IP networks used to connect all the OpenShift cluster | ||
| // nodes. Each network is provided in the CIDR format and should be IPv4 or IPv6, | ||
| // for example "10.0.0.0/8" or "fd00::/8". | ||
| // +listType=set | ||
| // +kubebuilder:validation:MaxItems=32 | ||
| // +optional | ||
| MachineNetworks []CIDR `json:"machineNetworks"` | ||
| } | ||
|
|
||
| // VSpherePlatformStatus holds the current status of the vSphere infrastructure provider. | ||
|
|
@@ -1176,6 +1311,12 @@ type VSpherePlatformStatus struct { | |
| // +openshift:enable:FeatureSets=CustomNoUpgrade;TechPreviewNoUpgrade | ||
| // +optional | ||
| LoadBalancer *VSpherePlatformLoadBalancer `json:"loadBalancer,omitempty"` | ||
|
|
||
| // machineNetworks are IP networks used to connect all the OpenShift cluster nodes. | ||
|
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. How many networks are supported? We should add a limit to the length of this list and explain that limit in the godoc Can we add a comment inline that explains that the values in the list should be either of ipv4 or ipv6 CIDR notation
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. There is no limit on machine networks supported today. There are no rules as for the order of IP stacks in the list of machine networks today. This one field already in install-config.yaml is a bit of wild west, mainly for the reason that it's not used anywhere for real We have a comment explaining notation added to the Spec. In Status I am not doing this because it's read only and no one should modify it
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. Ok. so while I appreciate it's currently wild west, what do you think users are actually using? Do you think we could justify limiting this to 32 networks? This new API will only affect new clusters anyway right?
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. I am okay with limiting to 32 right now but we need to be aware there may be incoming request to increase this. Let me explain the use case... We have this thingy called "remote worker nodes". While in the most basic setup it means you have masters in 1st subnet and workers in 2nd (separate) subnet, I can easily imagine a customer deploying cluster with 100 workers where each of them lives in its own subnet. I believe it's only a matter of time, but again, today limit of 32 should be okay and in the worst case we receive a bugzilla to increase it.
Yes, this is correct. The new MachineNetwork fields will remain empty for already existing clusters (even those that are upgraded to 4.15) because we don't have today any means to backfill it
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. I'm gonna wager we won't get that request any time soon, but you may tell me you told me so if we do. It would be relaxing the API validation so is a compatible change given that we control the consumers of the field.
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. Yep, it will be a very easy change to do shall we ever need it |
||
| // +listType=set | ||
| // +kubebuilder:validation:MaxItems=32 | ||
| // +optional | ||
| MachineNetworks []CIDR `json:"machineNetworks"` | ||
| } | ||
|
|
||
| // IBMCloudServiceEndpoint stores the configuration of a custom url to | ||
|
|
@@ -1508,3 +1649,19 @@ type InfrastructureList struct { | |
|
|
||
| Items []Infrastructure `json:"items"` | ||
| } | ||
|
|
||
| // CIDR is an IP address range in CIDR notation (for example, "10.0.0.0/8" or "fd00::/8"). | ||
| // +kubebuilder:validation:Pattern=`(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(3[0-2]|[1-2][0-9]|[0-9]))$)|(^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/(12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))$)` | ||
| // + --- | ||
| // + The regex for the IPv4 and IPv6 CIDR range was taken from | ||
| // + https://blog.markhatton.co.uk/2011/03/15/regular-expressions-for-ip-addresses-cidr-ranges-and-hostnames/ | ||
| // + The resulting regex is an OR of both regexes. | ||
| type CIDR string | ||
|
|
||
| // IP is an IP address (for example, "10.0.0.0" or "fd00::"). | ||
| // +kubebuilder:validation:Pattern=`(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$)|(^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*)` | ||
| // + --- | ||
| // + The regex for the IPv4 and IPv6 address was taken from | ||
| // + https://blog.markhatton.co.uk/2011/03/15/regular-expressions-for-ip-addresses-cidr-ranges-and-hostnames/ | ||
| // + The resulting regex is an OR of both regexes. | ||
| type IP string | ||
Uh oh!
There was an error while loading. Please reload this page.