Skip to content

Conversation

@bfournie
Copy link
Contributor

@bfournie bfournie commented Apr 11, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

Provides the ability to override the API server instance group name to allow compatibility when using the Openshift Machine API.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1194

Special notes for your reviewer:

Note that a new LoadBalancerSpec field has been added to GCPClusterSpec. Although this only contains one field it will be populated in the future with additional fields in order to support a LoadBalancer for private clusters.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

A new LoadBalancerSpec field containing the APIServerInstanceGroupTagOverride has been added to GCPClusterSpec.

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 11, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 11, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @bfournie. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 11, 2024
@netlify
Copy link

netlify bot commented Apr 11, 2024

Deploy Preview for kubernetes-sigs-cluster-api-gcp ready!

Name Link
🔨 Latest commit 318600d
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-gcp/deploys/662257e9fc1b39000838309d
😎 Deploy Preview https://deploy-preview-1207--kubernetes-sigs-cluster-api-gcp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 11, 2024
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 11, 2024
@bfournie bfournie force-pushed the api-server-name-override branch from f05d645 to 141c227 Compare April 14, 2024 20:57
name: "instanceGroup name is overridden (should create instanceGroup)",
scope: func() Scope {
tagOverride := "master"
clusterScope.GCPCluster.Spec.LoadBalancer = infrav1.LoadBalancerSpec{
Copy link

Choose a reason for hiding this comment

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

Isn't this changing a variable in a shared scope? If the tests are run in a random order, couldn't this set clusterScope.GCPCluster.Spec.LoadBalancer for the rest of the suite?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Changed to use a separate scope to avoid overwriting.

Copy link

Choose a reason for hiding this comment

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

Thanks! That'll work.

Another pattern I've seen in tests for other providers is for the function to take in the "golden" one as an argument and return a new copy with the modifications.

Something like

scope: func(s Scope) Scope {
  s.GCPCluster.Spec.LoadBalancer = infrav1.LoadBalancerSpec{....}
  return s
}

and

scope: func(s Scope) Scope {
 return s
}

That way, you get to have the top-level one remain clean and passed in on each invocation of test.scope to get a fresh, mutable copy.

Up to you if you want to use that here or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion. I've reworked it to make the mods only in the test which saves some duplication.

@bfournie bfournie force-pushed the api-server-name-override branch from 141c227 to af5af05 Compare April 16, 2024 18:35
@bfournie bfournie force-pushed the api-server-name-override branch from af5af05 to be92b73 Compare April 17, 2024 11:59
Comment on lines 131 to 134
tag := infrav1.APIServerRoleTagValue
if m.ClusterGetter.LoadBalancer().APIServerInstanceGroupTagOverride != nil {
tag = *m.ClusterGetter.LoadBalancer().APIServerInstanceGroupTagOverride
}

Choose a reason for hiding this comment

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

same nit/suggestion to consider using ptr.Deref

@bfournie bfournie force-pushed the api-server-name-override branch 3 times, most recently from 2c5eab7 to 116f171 Compare April 18, 2024 20:57
@bfournie
Copy link
Contributor Author

/retest

@bfournie bfournie force-pushed the api-server-name-override branch from 116f171 to f740f56 Compare April 18, 2024 21:19
Copy link
Member

@richardcase richardcase left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks @bfournie . There is one nit.

As the API diff is related to the exported go packages and not the API definition:

/override pull-cluster-api-provider-gcp-apidiff

/approve

@k8s-ci-robot
Copy link
Contributor

@richardcase: Overrode contexts on behalf of richardcase: pull-cluster-api-provider-gcp-apidiff

In response to this:

This looks good to me, thanks @bfournie . There is one nit.

As the API diff is related to the exported go packages and not the API definition:

/override pull-cluster-api-provider-gcp-apidiff

/approve

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.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bfournie, richardcase

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 19, 2024
@bfournie bfournie force-pushed the api-server-name-override branch from f740f56 to 42a9f03 Compare April 19, 2024 11:21
Provides the ability to override the API server instance group name
to allow compatibility when using the Openshift Machine API.
@bfournie bfournie force-pushed the api-server-name-override branch from 42a9f03 to 318600d Compare April 19, 2024 11:39
@k8s-ci-robot
Copy link
Contributor

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

Test name Commit Details Required Rerun command
pull-cluster-api-provider-gcp-apidiff 318600d link false /test pull-cluster-api-provider-gcp-apidiff

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

Copy link
Member

@damdo damdo left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks @bfournie !

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 19, 2024
@damdo
Copy link
Member

damdo commented Apr 19, 2024

/tide refresh

@k8s-ci-robot k8s-ci-robot merged commit d0694bd into kubernetes-sigs:main Apr 19, 2024
@k8s-ci-robot k8s-ci-robot added this to the v1.1.0 milestone Apr 19, 2024
@bfournie bfournie deleted the api-server-name-override branch April 19, 2024 14:00
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow customization of API server instance group name

8 participants