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

Fix HPA E2E CustomResourceDefinition test #112335

Merged
merged 1 commit into from Sep 22, 2022

Conversation

piotrnosek
Copy link
Contributor

@piotrnosek piotrnosek commented Sep 8, 2022

What type of PR is this?

Fix for a failing e2e test

What this PR does / why we need it:

Major fix for running HPA E2E CustomResourceDefinition test. This specifically adds all necessary utilities around creating a CRD, creating an instance and making sure HPA is able to fetch number of Replicas from CRD's status via scale client.

Which issue(s) this PR fixes:

Fixes bug(s) introduced by #111865

Special notes for your reviewer:

Does this PR introduce a user-facing change?

    NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework labels Sep 8, 2022
@k8s-ci-robot k8s-ci-robot added area/test sig/apps Categorizes an issue or PR as relevant to SIG Apps. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. sig/autoscaling Categorizes an issue or PR as relevant to SIG Autoscaling. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. sig/testing Categorizes an issue or PR as relevant to SIG Testing. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 8, 2022
@k8s-ci-robot
Copy link
Contributor

@piotrnosek: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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

Hi @piotrnosek. Thanks for your PR.

I'm waiting for a kubernetes 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Sep 8, 2022
@piotrnosek
Copy link
Contributor Author

/kind failing-test

@k8s-ci-robot k8s-ci-robot added kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Sep 8, 2022
@piotrnosek
Copy link
Contributor Author

/assign liggitt
Jordan, would you find time to look at this? This touches some files outside of autoscaling OWNERS power.

@piotrnosek
Copy link
Contributor Author

/assign mwielgus
/assign pbetkier

test/utils/delete_resources.go Outdated Show resolved Hide resolved
test/utils/delete_resources.go Outdated Show resolved Hide resolved
test/e2e/framework/resource/runtimeobj.go Outdated Show resolved Hide resolved
test/e2e/framework/resource/resources.go Outdated Show resolved Hide resolved
test/e2e/framework/autoscaling/autoscaling_utils.go Outdated Show resolved Hide resolved
Copy link
Contributor Author

@piotrnosek piotrnosek left a comment

Choose a reason for hiding this comment

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

Thanks for all the comments - all should be resolved now.

test/e2e/framework/autoscaling/autoscaling_utils.go Outdated Show resolved Hide resolved
test/utils/delete_resources.go Outdated Show resolved Hide resolved
test/utils/delete_resources.go Outdated Show resolved Hide resolved
test/e2e/framework/resource/runtimeobj.go Outdated Show resolved Hide resolved
test/e2e/framework/resource/resources.go Outdated Show resolved Hide resolved
@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 15, 2022
@piotrnosek
Copy link
Contributor Author

did part of this merge in another PR? looks like it needs a rebase

I've just rebased the PR and resolved conflicts - some stuff in autoscaling_utils.go were refactored in another PR (#112252).

@piotrnosek
Copy link
Contributor Author

@liggitt - many thanks for the comments. I've fixed some of those, but I'm not sure I understand what you mean by some others - can you elaborate on that a bit more?

@piotrnosek piotrnosek force-pushed the fixcustomcrd branch 3 times, most recently from b31c5b7 to 4e7a69f Compare September 18, 2022 22:58
@piotrnosek
Copy link
Contributor Author

/retest-required

1 similar comment
@piotrnosek
Copy link
Contributor Author

/retest-required

@liggitt
Copy link
Member

liggitt commented Sep 20, 2022

(drop the spurious files in the repo root in this PR)

Copy link
Member

@liggitt liggitt left a comment

Choose a reason for hiding this comment

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

I pushed a commit up to https://github.com/liggitt/kubernetes/commits/fixcustomcrd on top of this PR's commit with an example of what I'm envisioning, in case that's helpful. The diff against this PR looks messy, but it's actually getting closer to the current state of master and adding a distinct parallel path for handling custom resources

test/e2e/framework/resource/resources.go Outdated Show resolved Hide resolved
gvr := schema.GroupVersionResource{Group: crdGroup, Version: crdVersion, Resource: crdNamePlural}
framework.ExpectNoError(e2eresource.DeleteResourceAndWaitForGCWithDynamicClient(rc.clientSet, rc.dynamicClient, rc.scaleClient, true, gvr, kind, rc.nsName, rc.name))
// Delete CRD kind.
err := rc.apiExtensionClient.ApiextensionsV1().CustomResourceDefinitions().Delete(context.TODO(), crdNamePlural+"."+crdGroup, metav1.DeleteOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

this is deleting the entire CRD (the whole type), not just the custom resource instance ... doesn't that mean any test using this must be serial / cannot run concurrently with other tests using this CRD?

Copy link
Member

Choose a reason for hiding this comment

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

also, this delete request just sets deletionTimestamp on the CRD, it doesn't synchronously wait for the CRD and CR instances to be cleaned up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. True, though we don't have any other tests using this CRD (and I'm not aware of any plans).
  2. Right.
    So maybe it's best to not delete the CRD (the whole type)? I believe it won't hurt us to leave it to just be deleted with the whole cluster deletion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to not delete the CRD type. Let me know if you think it's okay or we should have some solution which deletes CRD while still allowing to run concurrently / wait sync.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And regarding this comment:

I noted in the cleanup the bit that will disrupt other concurrent tests using the same CRD

Creating CRD should work fine - we have checks that if CRD already exists, we do not create it.

Copy link
Member

Choose a reason for hiding this comment

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

I decided to not delete the CRD type. Let me know if you think it's okay or we should have some solution which deletes CRD while still allowing to run concurrently / wait sync.

that's probably ok, at least for now

Copy link
Member

Choose a reason for hiding this comment

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

(the normal way to be non-disruptive is to generate a CRD with a unique name per test)

test/utils/delete_resources.go Outdated Show resolved Hide resolved
test/e2e/framework/resource/resources.go Outdated Show resolved Hide resolved
@piotrnosek
Copy link
Contributor Author

Many thanks for all the comments and the example commit. I've refactored the code to include your proposed changes.

@piotrnosek

This comment was marked as duplicate.

@piotrnosek
Copy link
Contributor Author

/retest-required

@liggitt
Copy link
Member

liggitt commented Sep 22, 2022

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 22, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, piotrnosek

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 22, 2022
@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-ci-robot k8s-ci-robot merged commit 3a0dbe5 into kubernetes:master Sep 22, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Sep 22, 2022
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. area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/autoscaling Categorizes an issue or PR as relevant to SIG Autoscaling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. 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.

None yet

6 participants