Skip to content
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

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

EmilienM
Copy link
Member

@EmilienM EmilienM commented Jan 26, 2023

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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 26, 2023

Hello @EmilienM! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

For merging purposes, this repository follows the no-Feature-Freeze process which means that in addition to the standard lgtm and approved labels this repository requires either:

bugzilla/valid-bug - applied if your PR references a valid bugzilla bug

OR

qe-approved, docs-approved, and px-approved - these labels can be applied by anyone in the openshift org via the /label <labelname> command.

Who should apply these qe/docs/px labels?

  • For a no-Feature-Freeze team who is merging a feature before code freeze, they need to get those labels applied to their api repo PR by the appropriate teams (i.e. qe, docs, px)
  • For a Feature Freeze (traditional) team who is merging a feature before FF, they can self-apply the labels (via /label commands), they are basically irrelevant for those teams
  • For a Feature Freeze team who is merging a feature after FF, the PR should be rejected barring an exception

@EmilienM
Copy link
Member Author

/uncc derekwaynecarr mfojtik

@EmilienM
Copy link
Member Author

/cc JoelSpeed jcpowermac cybertron

@EmilienM
Copy link
Member Author

/cc pierreprinetti mdbooth

@EmilienM
Copy link
Member Author

/assigh JoelSpeed

config/v1/types_infrastructure.go Outdated Show resolved Hide resolved
config/v1/types_infrastructure.go Outdated Show resolved Hide resolved
@@ -123,6 +123,20 @@ const (
ExternalTopologyMode TopologyMode = "External"
)

// PlatformLoadBalancerType defines the type of load balancer used by the cluster.
// +kubebuilder:validation:Enum:="";"Internal";"External"
Copy link
Contributor

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

Copy link
Member Author

@EmilienM EmilienM Jan 26, 2023

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.

config/v1/types_infrastructure.go Outdated Show resolved Hide resolved
config/v1/types_infrastructure.go Outdated Show resolved Hide resolved
config/v1/types_infrastructure.go Outdated Show resolved Hide resolved
config/v1/types_infrastructure.go Outdated Show resolved Hide resolved
@EmilienM EmilienM force-pushed the osp-external-lb branch 4 times, most recently from 05f9b80 to 072a8d0 Compare January 30, 2023 20:14
@EmilienM
Copy link
Member Author

/assign @deads2k

Hi David, please take a look at this and our enhancement, as we need this for 4.13 TP.

Thanks

config/v1/types_infrastructure.go Outdated Show resolved Hide resolved
config/v1/types_infrastructure.go Outdated Show resolved Hide resolved
config/v1/types_infrastructure.go Show resolved Hide resolved
config/v1/types_infrastructure.go Show resolved Hide resolved
@@ -12,3 +12,137 @@ tests:
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
onUpdate:
Copy link
Contributor

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)

Copy link
Member Author

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 🤔

Copy link
Contributor

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 🙏 )

Copy link
Member Author

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?

@EmilienM EmilienM force-pushed the osp-external-lb branch 2 times, most recently from 084a41e to f439128 Compare February 8, 2023 13:59
@eurijon
Copy link

eurijon commented Feb 8, 2023

/label qe-approved
Checked with @EmilienM that the change is backward compatible by using this install-config:

...
platform:
  openstack:
    cloud: --
    machinesSubnet: --
    apiVIPs:
    - yy
    ingressVIPs:
    - xx
featureSet: TechPreviewNoUpgrade
...

(without setting loadBalancer section)

haproxy and keepalived are correctly deployed in master nodes and the API is fully functional

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 8, 2023
@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Feb 8, 2023
@EmilienM EmilienM force-pushed the osp-external-lb branch 2 times, most recently from ee72e48 to 9734f98 Compare February 8, 2023 17:10
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 8, 2023
// 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"
Copy link
Contributor

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

@JoelSpeed
Copy link
Contributor

/lgtm

Please get someone from QE to add the qe-approved label

/label docs-approved
/label px-approved

@openshift-ci openshift-ci bot added docs-approved Signifies that Docs has signed off on this PR px-approved Signifies that Product Support has signed off on this PR labels Feb 8, 2023
@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 8, 2023
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
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 8, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 8, 2023

@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.

@JoelSpeed
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 8, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 8, 2023

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. docs-approved Signifies that Docs has signed off on this PR lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants