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

Add validation for GC tasks annotation #4485

Merged
merged 2 commits into from
Sep 8, 2023

Conversation

Fedosin
Copy link
Contributor

@Fedosin Fedosin commented Sep 4, 2023

What type of PR is this?
/kind support

What this PR does / why we need it:
This PR adds validation for the GC config annotation.

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 #

Special notes for your reviewer:
As a part of this work 2 constants ExternalResourceGCAnnotation and ExternalResourceGCTasksAnnotation were moved from exp/api/v1beta2 to api/v1beta2.
Checklist:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

Release note:

None

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/support Categorizes issue or PR as a support question. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Sep 4, 2023
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 4, 2023
@Fedosin Fedosin changed the title Gc config validation Add validation for GC tasks annotation Sep 4, 2023
@Ankitasw
Copy link
Member

Ankitasw commented Sep 5, 2023

/test ?

@k8s-ci-robot
Copy link
Contributor

@Ankitasw: The following commands are available to trigger required jobs:

  • /test pull-cluster-api-provider-aws-build
  • /test pull-cluster-api-provider-aws-test
  • /test pull-cluster-api-provider-aws-verify

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-provider-aws-apidiff-main
  • /test pull-cluster-api-provider-aws-e2e
  • /test pull-cluster-api-provider-aws-e2e-blocking
  • /test pull-cluster-api-provider-aws-e2e-clusterclass
  • /test pull-cluster-api-provider-aws-e2e-conformance
  • /test pull-cluster-api-provider-aws-e2e-conformance-with-ci-artifacts
  • /test pull-cluster-api-provider-aws-e2e-eks
  • /test pull-cluster-api-provider-aws-e2e-eks-gc
  • /test pull-cluster-api-provider-aws-e2e-eks-testing

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-provider-aws-apidiff-main
  • pull-cluster-api-provider-aws-build
  • pull-cluster-api-provider-aws-test
  • pull-cluster-api-provider-aws-verify

In response to this:

/test ?

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.

@Ankitasw
Copy link
Member

Ankitasw commented Sep 5, 2023

/test pull-cluster-api-provider-aws-e2e-eks-gc

Copy link
Member

@Ankitasw Ankitasw left a comment

Choose a reason for hiding this comment

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

Also, I am not aware but does this require any changes in E2E GC tests as well? cc @richardcase

@Ankitasw
Copy link
Member

Ankitasw commented Sep 5, 2023

@richardcase since this is API change, shall we include this as part of v1beta3 changes?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 5, 2023
@Fedosin
Copy link
Contributor Author

Fedosin commented Sep 5, 2023

I think we can avoid introducing a breaking change if we move ExternalResourceGCTasksAnnotation constant only. A new version (2.3) hasn't been released yet, so we can modify that part safely.

@Fedosin Fedosin force-pushed the gc_config_validation branch from 2ea9f5b to cf90cec Compare September 5, 2023 08:30
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 5, 2023
@Ankitasw Ankitasw added tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. and removed kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Sep 5, 2023
@Fedosin Fedosin force-pushed the gc_config_validation branch from cf90cec to 64ee831 Compare September 5, 2023 09:10
@@ -25,11 +25,11 @@ import (
const (
// ExternalResourceGCAnnotation is the name of an annotation that indicates if
// external resources should be garbage collected for the cluster.
ExternalResourceGCAnnotation = "aws.cluster.x-k8s.io/external-resource-gc"
ExternalResourceGCAnnotation = infrav1.ExternalResourceGCAnnotation
Copy link
Member

Choose a reason for hiding this comment

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

I think this would be duplication, either we keep these constants in exp/api/v1beta2, or in api/v1beta2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now these constants are in api/v1beta2, but I kept them as duplicates in exp/api/v1beta2 to prevent a breaking change in the API. People who used the constants from exp can continue to do so, but now the correct location is api/v1beta2.

Copy link
Member

@Ankitasw Ankitasw Sep 6, 2023

Choose a reason for hiding this comment

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

We might need more opinions here
cc @richardcase @Skarlso @dlipovetsky

Copy link
Contributor

Choose a reason for hiding this comment

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

It's OK not to duplicate it. If we remove it, make sure this gets into a minor release, though, because it might be a breaking change. Although, honestly, I doubt too many people call this from anywhere outside of CAPA.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alright! I'll remove it from exp completely since we don't consider it as a breaking change. for sure, it will make things simpler.

Copy link
Contributor

Choose a reason for hiding this comment

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

Noice.

@dlipovetsky
Copy link
Contributor

This is a follow-up to #4466

To prevent a breaking change we keep the constants in exp/api/v1beta2,
and they will have the same values as ones in api/v1beta2
@Fedosin Fedosin force-pushed the gc_config_validation branch from 64ee831 to 22d1ea4 Compare September 6, 2023 14:18
@Fedosin Fedosin force-pushed the gc_config_validation branch from 22d1ea4 to fe3457d Compare September 7, 2023 08:57
@Fedosin
Copy link
Contributor Author

Fedosin commented Sep 7, 2023

I moved this validation code to a separate function.

@Skarlso
Copy link
Contributor

Skarlso commented Sep 7, 2023

/lgtm

@Ankitasw final word :)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 7, 2023
@Ankitasw
Copy link
Member

Ankitasw commented Sep 8, 2023

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Ankitasw

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 Sep 8, 2023
@k8s-ci-robot k8s-ci-robot merged commit 15ae5f1 into kubernetes-sigs:main Sep 8, 2023
1 check passed
@Ankitasw
Copy link
Member

/cherry-pick release-2.2

@k8s-infra-cherrypick-robot

@Ankitasw: #4485 failed to apply on top of branch "release-2.2":

Applying: Move GC annotation constants from exp/api/v1beta2 to api/v1beta2
Using index info to reconstruct a base tree...
M	exp/api/v1beta2/types.go
M	pkg/cloud/services/gc/cleanup.go
M	pkg/cloud/services/gc/cleanup_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/cloud/services/gc/cleanup_test.go
CONFLICT (content): Merge conflict in pkg/cloud/services/gc/cleanup_test.go
Auto-merging pkg/cloud/services/gc/cleanup.go
CONFLICT (content): Merge conflict in pkg/cloud/services/gc/cleanup.go
Auto-merging exp/api/v1beta2/types.go
CONFLICT (content): Merge conflict in exp/api/v1beta2/types.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Move GC annotation constants from exp/api/v1beta2 to api/v1beta2
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-2.2

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.

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/support Categorizes issue or PR as a support question. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants