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

CORS-3842: Add API Updates for GCP Custom API Endpoints #2150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

barbacbd
Copy link
Contributor

** Add the Tech preview and No upgrade tags for the new feature GCP API Custom Endpoints.
** Add the ServiceEndpoint Structure that includes the api name and endpoint.
** Add the Service Endpoints to the GCP Spec and Status structs.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 15, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 15, 2025

@barbacbd: This pull request references CORS-3842 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.19.0" version, but no target version was set.

In response to this:

** Add the Tech preview and No upgrade tags for the new feature GCP API Custom Endpoints.
** Add the ServiceEndpoint Structure that includes the api name and endpoint.
** Add the Service Endpoints to the GCP Spec and Status structs.

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 openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor

openshift-ci bot commented Jan 15, 2025

Hello @barbacbd! 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.

@barbacbd
Copy link
Contributor Author

/cc @patrickdillon

@openshift-ci openshift-ci bot requested a review from patrickdillon January 15, 2025 20:04
@openshift-ci openshift-ci bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jan 15, 2025
@openshift-ci openshift-ci bot requested review from bparees and sinnykumari January 15, 2025 20:04
@barbacbd
Copy link
Contributor Author

/cc @JoelSpeed
/cc @zaneb

@barbacbd
Copy link
Contributor Author

/retest

@barbacbd
Copy link
Contributor Author

/retest-required

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
config/v1/types_infrastructure.go Outdated Show resolved Hide resolved
@barbacbd
Copy link
Contributor Author

/retest

@barbacbd barbacbd requested a review from everettraven January 22, 2025 12:35
Copy link

@everettraven everettraven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spotted a few more things. It would also be beneficial to add tests where possible to ensure any validations you are putting in place are acting as expected. https://github.com/openshift/api?tab=readme-ov-file#defining-api-validation-tests should be helpful in getting you started on the right track for adding any necessary tests.

config/v1/types_infrastructure.go 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
config/v1/types_infrastructure.go 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
Copy link

@everettraven everettraven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more things. Other than these I think this is shaping up well. After this round of comments is addressed I'll rope @JoelSpeed in to do a pass since he is the one with approval authority.

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 Show resolved Hide resolved
config/v1/types_infrastructure.go Outdated Show resolved Hide resolved
config/v1/Makefile Outdated Show resolved Hide resolved
@barbacbd barbacbd force-pushed the CORS-3842 branch 2 times, most recently from 04681c3 to ea88b6c Compare January 28, 2025 12:43
Copy link

@everettraven everettraven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me.

Tagging in @JoelSpeed for a review.

@barbacbd
Copy link
Contributor Author

/retest

@everettraven
Copy link

@JoelSpeed - it looks like the verify-crd-schema check is flagging fields untouched by this PR. Do these need to be addressed while touching this API?

@barbacbd
Copy link
Contributor Author

/label acknowledge-critical-fixes-only

@openshift-ci openshift-ci bot added the acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. label Jan 31, 2025
Copy link

@everettraven everettraven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 31, 2025
Copy link
Contributor

openshift-ci bot commented Jan 31, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: barbacbd, everettraven
Once this PR has been reviewed and has the lgtm label, please assign knobunc for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@everettraven
Copy link

After chatting with Joel the verify-crd-schema check is failing because this is technically introducing a net new feature-gated CRD. Looks to be safe to ignore.

/override verify-crd-schema

Copy link
Contributor

openshift-ci bot commented Jan 31, 2025

@everettraven: everettraven unauthorized: /override is restricted to Repo administrators, approvers in top level OWNERS file, and the following github teams:openshift: openshift-release-oversight openshift-staff-engineers.

In response to this:

After chatting with Joel the verify-crd-schema check is failing because this is technically introducing a net new feature-gated CRD. Looks to be safe to ignore.

/override verify-crd-schema

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-sigs/prow repository.

Copy link
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have both spec and status versions here. What will validate the spec, and then update the status? Are we ok with allowing these values to be changed on day 2, or do we want these to be immutable once the cluster is installed?

Other platforms have them mutable, but I want to make sure this makes sense on GCP specifically

// serviceEndpoints is optional.
// Only 1 endpoint override is permitted for each GCP service.
// The maximum number of endpoint overrides allowed is 9.
// +listType=atomic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why atomic, and not map with the map key as the Name?

// The maximum number of endpoint overrides allowed is 9.
// +listType=atomic
// +kubebuilder:validation:MaxItems=9
// +kubebuilder:validation:XValidation:rule="self.all(x, self.exists_one(y, x.name == y.name))",message="only 1 endpoint override is permitted for a GCP service"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe be explicit that it's the name that's unique?

Suggested change
// +kubebuilder:validation:XValidation:rule="self.all(x, self.exists_one(y, x.name == y.name))",message="only 1 endpoint override is permitted for a GCP service"
// +kubebuilder:validation:XValidation:rule="self.all(x, self.exists_one(y, x.name == y.name))",message="only 1 endpoint override is permitted per GCP service name"


// serviceEndpoints specifies endpoints that override the default endpoints
// used when creating clients to interact with GCP services.
// serviceEndpoints is optional.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When not specified, the behaviour is to use the default endpoints for the region that the cluster is deployed to? Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. The setup would end up looking something like https://github.com/barbacbd/k8s-cluster-api-provider-gcp/blob/main/cloud/scope/clients.go#L153. That way the option is just not set when it is not present.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So would it be fair to say

Suggested change
// serviceEndpoints is optional.
// When not specified, the default endpoints for the GCP region will be used.

@barbacbd
Copy link
Contributor Author

We have both spec and status versions here. What will validate the spec, and then update the status? Are we ok with allowing these values to be changed on day 2, or do we want these to be immutable once the cluster is installed?

Other platforms have them mutable, but I want to make sure this makes sense on GCP specifically

@JoelSpeed I would probably make them immutable. I don't think we should change what values are there. I wasn't sure if we needed the status as that would indicate that something changed or could change. Can you think of a case where someone would want a different "custom" or default endpoint in one place and not in another? I would think we want to use the same endpoint anytime that the cluster components are supposed to access that service.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 31, 2025
Copy link
Contributor

openshift-ci bot commented Jan 31, 2025

New changes are detected. LGTM label has been removed.

@JoelSpeed
Copy link
Contributor

@JoelSpeed I would probably make them immutable. I don't think we should change what values are there. I wasn't sure if we needed the status as that would indicate that something changed or could change. Can you think of a case where someone would want a different "custom" or default endpoint in one place and not in another? I would think we want to use the same endpoint anytime that the cluster components are supposed to access that service.

Typically for configuration like this that is provided at install time, we put the data into the status, and then the various components (CSI, CCM etc) consume the values from the status.

Later, if a user wants to change the endpoints (which we have seen use cases for on IBM, but you may not need here), then we have added spec fields, and then added a control loop that watches updates to the spec field, validates the new endpoints, and then copies the validated endpoints to the status only once it's certain they are valid. The consumers then pick up the new value from status.

If the request for this feature doesn't warrant the ability to change these endpoints on day 2, and you don't have a plan to create a control loop to validate the spec and copy it to status, then I'd suggest for now we move forward with adding only a status version of this API which the installer would populate from the install config

** Add the Tech preview and No upgrade tags for the new feature GCP API Custom Endpoints.

** Add the ServiceEndpoint Structure that includes the api name and endpoint.
** Add the Service Endpoints to the GCP Spec and Status structs.
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:XValidation:rule="isURL(self)",message="must be a valid URL"
// +kubebuilder:validation:XValidation:rule="isURL(self) ? (url(self).getScheme() == \"https\") : true",message="scheme must be https"
URL string `json:"url"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of interest, do we know if a URL here can have a path? Or should have a path? In other examples they required the path to have a specific prefix


// serviceEndpoints specifies endpoints that override the default endpoints
// used when creating clients to interact with GCP services.
// serviceEndpoints is optional.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So would it be fair to say

Suggested change
// serviceEndpoints is optional.
// When not specified, the default endpoints for the GCP region will be used.

Copy link
Contributor

openshift-ci bot commented Feb 3, 2025

@barbacbd: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/verify-crd-schema 80bb33c link true /test verify-crd-schema
ci/prow/integration 80bb33c link true /test integration
ci/prow/okd-scos-e2e-aws-ovn 80bb33c link false /test okd-scos-e2e-aws-ovn
ci/prow/e2e-aws-serial-techpreview 80bb33c link true /test e2e-aws-serial-techpreview
ci/prow/e2e-gcp 80bb33c link false /test e2e-gcp
ci/prow/e2e-aws-ovn-hypershift 80bb33c link true /test e2e-aws-ovn-hypershift

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-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants