-
Notifications
You must be signed in to change notification settings - Fork 40.9k
Setting Opaque as secret generic default option. #127916
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
base: master
Are you sure you want to change the base?
Setting Opaque as secret generic default option. #127916
Conversation
Signed-off-by: Ritikaa96 <[email protected]>
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-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Ritikaa96 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 |
/sig cli |
@Ritikaa96: 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-sigs/prow repository. I understand the commands that are listed here. |
@@ -131,6 +131,7 @@ type CreateSecretOptions struct { | |||
// NewSecretOptions creates a new *CreateSecretOptions with default value | |||
func NewSecretOptions(ioStreams genericiooptions.IOStreams) *CreateSecretOptions { | |||
return &CreateSecretOptions{ | |||
Type: "Opaque", |
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.
This field is optional and can be empty. You are changing the default to Opaque
which breaks the backward compatibility.
/hold
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.
I don't know if there is some other way this might break backward compatibility, but it looks like an empty type is converted to Opaque as the default, just not by kubectl:
kubernetes/pkg/apis/core/types.go
Lines 6025 to 6026 in a6ea7b8
// SecretTypeOpaque is the default; arbitrary user-defined data | |
SecretTypeOpaque SecretType = "Opaque" |
kubernetes/pkg/apis/core/v1/defaults.go
Lines 283 to 287 in a6ea7b8
func SetDefaults_Secret(obj *v1.Secret) { | |
if obj.Type == "" { | |
obj.Type = v1.SecretTypeOpaque | |
} | |
} |
When I create a secret without specifying --type
it creates it as Opaque.
~ $ kubectl create secret generic my-secret --from-literal=foo=bar
secret/my-secret created
~ $ k describe secret my-secret
Name: my-secret
Namespace: default
Labels: <none>
Annotations: <none>
Type: Opaque
Data
====
foo: 3 bytes
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.
Interesting. I didn't know that. But in any case, we can't set this explicitly in kubectl because when the default is changed in API level (even if this won't happen), kubectl value will be obsolete.
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.
Hi @mpuckett159 , would like your opinions here as well.
this change was inspired by the comment in another PR: #120337 (comment)
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 instead just add it as a text in the help message. the real target is to mention that there is a default value to the option. However in the discussion mentioned earlier @mpuckett159 mentioned it is better to add it as automatic value to come up when we use kubectl create secret generic --help
WDYT?
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.
@brianpursley @ardaguclu How should we proceed with this? waiting for further discussion.
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.
@brianpursley @ardaguclu How should we proceed with this? waiting for further discussion.
Hey @brianpursley any update for this?
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.
Kubectl isn't the one setting the default when type is unspecified, so I don't think the help text should make an assumption what the server will do.
My concern is that there could be some edge cases where an unspecified type is interpreted differently, and then the help text would be misleading.
Changelog suggestion -Opaque will be seen as defau;t value in the help message for `kubect create secret generic ..`
+Updated the kubectl help for Secret creation to mention that the default generic secret type is Opaque. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
What is the verdict on this PR? Are we waiting for something before we proceed or close this? |
As it was mentioned before, it could be a breaking change. While the server-side may happen to assign a default of "Opaque" based on an unspecified type, if we change kubectl to assign the default it could break people who expect the value not to be set by the client. If you feel strongly that this should be changed, my recommendation is to either make the case for it on the GitHub issue and/or add it as a topic on the agenda of the bi-weekly SIG-CLI meeting. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adding Opaque as default value for
kubectl create secret generic....
Which issue(s) this PR fixes:
Fixes ##127914
Special notes for your reviewer:
Does this PR introduce a user-facing change?