-
Notifications
You must be signed in to change notification settings - Fork 584
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
OSASINFRA-3089 - Add loadBalancerType to Infrastructure API object #1391
OSASINFRA-3089 - Add loadBalancerType to Infrastructure API object #1391
Conversation
Hello @EmilienM! Some important instructions when contributing to openshift/api: For merging purposes, this repository follows the no-Feature-Freeze process which means that in addition to the standard
OR
Who should apply these qe/docs/px labels?
|
/uncc derekwaynecarr mfojtik |
/cc JoelSpeed jcpowermac cybertron |
/cc pierreprinetti mdbooth |
/assigh JoelSpeed |
c1bc951
to
f7c9828
Compare
config/v1/types_infrastructure.go
Outdated
@@ -123,6 +123,20 @@ const ( | |||
ExternalTopologyMode TopologyMode = "External" | |||
) | |||
|
|||
// PlatformLoadBalancerType defines the type of load balancer used by the cluster. | |||
// +kubebuilder:validation:Enum:="";"Internal";"External" |
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.
If you are keeping omitempty
, you don't need ""
in this enum. You should be able to add an integration test to check these validations work as expected, you can add tests in https://github.com/openshift/api/blob/master/config/v1/stable.infrastructure.testsuite.yaml based on the docs https://github.com/openshift/api/tree/master/tests#testing-status
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.
you can add tests
ack but before working on tests I want to make this is a valid API so I don't spend too much time in case this needs a major change.
f7c9828
to
403c5da
Compare
05f9b80
to
072a8d0
Compare
/assign @deads2k Hi David, please take a look at this and our enhancement, as we need this for 4.13 TP. Thanks |
@@ -12,3 +12,137 @@ tests: | |||
apiVersion: config.openshift.io/v1 | |||
kind: Infrastructure | |||
spec: {} | |||
onUpdate: |
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.
Can you add a test case that checks, from an initial
with the UserManaged
case, what happens if I try to remove the loadBalancer
and it's subkeys from the object? I suspect right now that will be accepted and we will need an additional validation to make sure the field cannot be unset (will need the same for the type within the load balancer as well)
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.
I added this test and... it worked 🤔
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.
To the struct, you'll need to add a validation along the lines of !has(oldSelf.loadBalancer) && !has(self.loadBalancer) || has(oldSelf.loadBalancer) && has(self.loadBalancer)
with a message of loadBalancer may only be configured during installation
This means that when the baremetal platform is added for the first time, if it has loadbalancers, great, that's ok, if it doesn't, that's also ok, but once it exists, this validation will run and you won't be able to add loadBalancers to an existing install, and won't be able to remove it (test cases for both of those would be great 🙏 )
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.
I've addressed the comment on the validation. However I think the testsuite is ok, unless I missed something?
084a41e
to
f439128
Compare
/label qe-approved
(without setting loadBalancer section) haproxy and keepalived are correctly deployed in master nodes and the API is fully functional |
ee72e48
to
9734f98
Compare
config/v1/types_infrastructure.go
Outdated
// BareMetalPlatformSpec holds the desired state of the BareMetal infrastructure provider. | ||
// This only includes fields that can be modified in the cluster. | ||
type BareMetalPlatformSpec struct{} | ||
|
||
// BareMetalPlatformStatus holds the current status of the BareMetal infrastructure provider. | ||
// For more information about the network architecture used with the BareMetal platform type, see: | ||
// https://github.com/openshift/installer/blob/master/docs/design/baremetal/networking-infrastructure.md | ||
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.loadBalancer) && !has(self.loadBalancer) || has(oldSelf.loadBalancer) && has(self.loadBalancer)",message="loadBalancer may only be configured during installation" |
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.
So reviewing the test cases, I think this may not actually be needed, it seems the defaulting is happening before the validation, so if you remove the entire loadBalancer struct, it then causes the default to kick in, which then is passing validation, that's a little irritating as it means if the value is the default, and someone tries to unset loadBalancer
, we can't error and tell them no, you can't do that, the only reason it works is because the default is the same
Can you try a test case with the default value, and unsetting that, what happens? If it passes, and doesn't error, then I can't see a way for this validation to actually be hit, so we may as well remove it
9734f98
to
8594d9f
Compare
8594d9f
to
045880c
Compare
/lgtm Please get someone from QE to add the qe-approved label /label docs-approved |
This will add support for Tech Preview external LB in OpenShift API in the PlatformStatus, for all on-prem platforms which already have fields for API & Ingress VIPs in PlatformStatus. See openshift/enhancements#1322
045880c
to
a660f60
Compare
@EmilienM: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: EmilienM, JoelSpeed The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This will add support for external LB in OpenShift API in
the PlatformStatus, for all on-prem platforms which already have
fields for API & Ingress VIPs in PlatformStatus.
See openshift/enhancements#1322