-
Notifications
You must be signed in to change notification settings - Fork 40k
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
kubeadm certs check-expiration support json/yaml output #123372
Conversation
Skipping CI for Draft Pull Request. |
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
4b7b6c5
to
2e93d33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our "unwritten policy" is to make API changes in a new version.
so this has to go in v1alpha3 - a new API.
i will have a more detailed review pass once you complete that.
i think the important part is to not break the CLI output (stdout) as some users were already parsing it . :/ but for the new structured output we can make some new decisions for example a boolean option can be marshaled to true/false instead of "yes"/"no" strings. |
842e3d6
to
1e9f80c
Compare
/release-note-edit
|
@carlory please add a `DEPRECATED: this API will be removed in a future release. Please use v1alpha3." text above this line: |
cmd/kubeadm/app/cmd/certs.go
Outdated
} | ||
w := tabwriter.NewWriter(out, 10, 4, 3, ' ', 0) | ||
fmt.Fprintln(w, "CERTIFICATE\tEXPIRES\tRESIDUAL TIME\tCERTIFICATE AUTHORITY\tEXTERNALLY MANAGED") | ||
info := &outputapiv1alpha3.ExpirationInfo{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move the whole code in a new helper function and add a unit test for it?
no need to be very verbose in the unit test, just test a basic JSON output scenario with some certs and CAs, maybe some missing certs too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neolit123 added a unit test for this command. please see https://github.com/kubernetes/kubernetes/compare/0b3e5411c83eef6f658d037eb4c5e0a3847df0fc..6ec538fc25c17a8c72855c8117865be9f1fb3524
be020f4
to
829cae6
Compare
829cae6
to
57c27fe
Compare
d68b0b5
to
afa9ab4
Compare
if cfgPath == "" { | ||
client, err := kubeconfigutil.ClientSetFromFile(kubeconfigPath) | ||
if cfgPath == "" && client != nil { | ||
internalcfg, err := configutil.FetchInitConfigurationFromCluster(client, printer, logPrefix, false, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neolit123 if we give the printer to FetchInitConfigurationFromCluster, -o json will not print the message then.
I split the previous commit into two commits.
the first commit fixes the JSON output (-o json will not print the message)
the second commit adds some tests.
this seems OK, but can we also fix upgrade plan -o json
?
afa9ab4
to
4d49edf
Compare
This PR doesn't fix I can fix it in another PR after this PR is merged. @neolit123 |
thanks, ping me on that pr. |
4d49edf
to
ecaf269
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested locally and it looks good.
added 2 minor comments / 1 question.
@carlory: The following test failed, say
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. |
unrelated failures |
/lgtm
Thanks. |
LGTM label has been added. Git tree hash: f68b696b1ffe0957766b792e1f474727d523fa7e
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @carlory
please ping me on the fix PR for "upgrade plan" when you send it.
/hold cancel
/lgtm
these can be fixed with |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Part of kubernetes/kubeadm#494
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: