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

✨ envtest utility, defaultable flags #972

Merged

Conversation

DirectXMan12
Copy link
Contributor

This adds a small example/utility that lets you run envtest as a standalone binary. I've probably written this code about 20 times in /tmp/xyz-debug when debugging controller issues or reproducing apiserver behavior, so I figured it was time to push it somewhere.

This also tweaks the way a flag gets initialized in the zap flags so that the value passed to options gets set as the default for --zap-devel. This should make that flag behave like the other flags -- if you pass a "default" via the options struct and the user doesn't set the flag, they'll get that default.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 28, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DirectXMan12

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 28, 2020
@DirectXMan12
Copy link
Contributor Author

/kind feature

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 28, 2020
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 20, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 18, 2020
This defaults the value of `--zap-devel` to whatever is in the options
struct.  This allows programs to set a "prefered" default.  Since folks
would already be passing an empty options struct, this shouldn't affect
any existing users (famous last words).
@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 28, 2020
@DirectXMan12
Copy link
Contributor Author

@vincepri or someone, mind taking a quick peek at this

/assign @vincepri

@vincepri
Copy link
Member

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 29, 2020
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

Mostly nits, everything else lgtm

examples/scratch-env/go.mod Outdated Show resolved Hide resolved
examples/scratch-env/go.mod Outdated Show resolved Hide resolved
examples/scratch-env/main.go Outdated Show resolved Hide resolved
examples/scratch-env/main.go Outdated Show resolved Hide resolved
examples/scratch-env/main.go Outdated Show resolved Hide resolved
examples/scratch-env/main.go Outdated Show resolved Hide resolved
examples/scratch-env/main.go Outdated Show resolved Hide resolved
examples/scratch-env/main.go Outdated Show resolved Hide resolved
@vincepri
Copy link
Member

/milestone v0.7.x

@k8s-ci-robot k8s-ci-robot added this to the v0.7.x milestone Sep 29, 2020
This adds a standalone example of envtest not being used in testing.
It's super useful for interactive testing of controller and webhook
behavior, and code I've written in various forms for a one-off at least
a dozen times.
@DirectXMan12
Copy link
Contributor Author

all fixed up

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 1, 2020
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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants