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

chore: move event reasons to the package and as constants #1915

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

Conversation

flavono123
Copy link

Fixes #1897

Description

  1. converts string literals as reasons of event to constant
  2. pull up them to the package events
  • i think events is enough over apis or under that

How was this change tested?

  • test or e2etest not yet, cannot run tests and more details would be written in a thread.
  • when finding double quoted strings, they are only exist in the events package.
    • except, "InsufficientCapacityError" which also is in cloudprovider/metrics package.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: flavono123
Once this PR has been reviewed and has the lgtm label, please assign tzneal 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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 15, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @flavono123!

It looks like this is your first PR to kubernetes-sigs/karpenter 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/karpenter has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 15, 2025
@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 15, 2025
@flavono123
Copy link
Author

when i tried a local test with the package i fixed, seems some settings are required concerned with kubebuilder, but it is not covered in any docs or different with a normal kubebuilder installation. how can i test in my local?:

❯ go test ./pkg/controllers/disruption/
Running Suite: Disruption - /Users/hansuk.hong/T/karpenter/pkg/controllers/disruption
=====================================================================================
Random Seed: 1736918483

Will run 175 of 175 specs
------------------------------
[BeforeSuite] [PANICKED] [0.015 seconds]
[BeforeSuite] 
/Users/hansuk.hong/T/karpenter/pkg/controllers/disruption/suite_test.go:90

  [PANICKED] Test Panicked
  In [BeforeSuite] at: /Users/hansuk.hong/go/1.23.4/pkg/mod/github.com/samber/[email protected]/errors.go:53 @ 01/15/25 14:21:24.002

  unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory

  Full Stack Trace
    github.com/samber/lo.must({0x1027b2be0, 0x140000ca340}, {0x0, 0x0, 0x0})
        /Users/hansuk.hong/go/1.23.4/pkg/mod/github.com/samber/[email protected]/errors.go:53 +0x1cc
    github.com/samber/lo.Must[...](...)
        /Users/hansuk.hong/go/1.23.4/pkg/mod/github.com/samber/[email protected]/errors.go:65
    sigs.k8s.io/karpenter/pkg/test.NewEnvironment({0x140002f7748?, 0x0?, 0x0?})
        /Users/hansuk.hong/T/karpenter/pkg/test/environment.go:133 +0x304
    sigs.k8s.io/karpenter/pkg/controllers/disruption_test.init.func4()
        /Users/hansuk.hong/T/karpenter/pkg/controllers/disruption/suite_test.go:91 +0xa8
------------------------------
[AfterSuite] [PANICKED] [0.000 seconds]
[AfterSuite] 
/Users/hansuk.hong/T/karpenter/pkg/controllers/disruption/suite_test.go:104

  [PANICKED] Test Panicked
  In [AfterSuite] at: /Users/hansuk.hong/.goenv/versions/1.23.4/src/runtime/panic.go:262 @ 01/15/25 14:21:24.002

  runtime error: invalid memory address or nil pointer dereference

  Full Stack Trace
    sigs.k8s.io/karpenter/pkg/test.(*Environment).Stop(0x0)
        /Users/hansuk.hong/T/karpenter/pkg/test/environment.go:169 +0x1c
    sigs.k8s.io/karpenter/pkg/controllers/disruption_test.init.func5()
        /Users/hansuk.hong/T/karpenter/pkg/controllers/disruption/suite_test.go:105 +0x24
------------------------------

Summarizing 2 Failures:
  [PANICKED!] [BeforeSuite] 
  /Users/hansuk.hong/go/1.23.4/pkg/mod/github.com/samber/[email protected]/errors.go:53
  [PANICKED!] [AfterSuite] 
  /Users/hansuk.hong/.goenv/versions/1.23.4/src/runtime/panic.go:262

Ran 0 of 175 Specs in 0.015 seconds
FAIL! -- A BeforeSuite node failed so all tests were skipped.
--- FAIL: TestAPIs (0.02s)
FAIL
FAIL    sigs.k8s.io/karpenter/pkg/controllers/disruption        0.536s
FAIL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. 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.

event strings are should be enums
2 participants