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

Added ':' in environment variable name valid characters list #69415

Closed
wants to merge 2 commits into from

Conversation

vithati
Copy link
Contributor

@vithati vithati commented Oct 4, 2018

What this PR does / why we need it:
This PR changes allows ':' in environment variable name for the containers. This is bug fix of issue
kubernetes/kubectl#47
Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes kubernetes/kubectl#47

Special notes for your reviewer:

Release note:

Relaxed restrictions on environment variable name characters. A valid environment variable name should not start with a digit. Older version of Kubelet ignores the environment variable names having other than [-._a-zA-Z0-9] characters and using these variables names will prevent apiserver rollback to older versions.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 4, 2018
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 4, 2018
@vithati
Copy link
Contributor Author

vithati commented Oct 4, 2018

/sig cli
/area kubectl
/assign @apelisse

@k8s-ci-robot k8s-ci-robot added sig/cli Categorizes an issue or PR as relevant to SIG CLI. area/kubectl labels Oct 4, 2018
@vithati
Copy link
Contributor Author

vithati commented Oct 4, 2018

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.

I have signed CLA.

@apelisse
Copy link
Member

apelisse commented Oct 4, 2018

/ok-to-test

You need to sign the CLA if you want your code to be merged.

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 4, 2018
@apelisse
Copy link
Member

apelisse commented Oct 4, 2018

I think this is relaxing (rather than tightening) the behavior, so it shouldn't be a compatibility problem.
I also think it's POSIX compliant (see here).

We've had some problems using colons in some arguments in the past, can you maybe add a test in test/cmd?

Also, I suspect we might want to relax the regex even more, since I suspect this won't be enough to fix the issue you're trying to fix (the example does include a whitespace).

@jennybuckley
Copy link

/cc @kubernetes/api-reviewers

@lavalamp
Copy link
Member

lavalamp commented Oct 4, 2018

Rollback is unsafe as soon as someone makes a env named with a ":".

@apelisse
Copy link
Member

apelisse commented Oct 4, 2018

That's a good point. I think kubectl shouldn't be setting the limit of what can be done for environment variables. Maybe the constraint is more relaxed on the server?

@apelisse
Copy link
Member

apelisse commented Oct 4, 2018

Oh, OK no, this is not just for kubectl, this is changing the apimachinery check.

@lavalamp
Copy link
Member

lavalamp commented Oct 4, 2018 via email

@apelisse
Copy link
Member

apelisse commented Oct 4, 2018

Rollback is unsafe as soon as someone makes a env named with a ":".

is this something we can't accept, or a release-note might be OK?

@thockin
Copy link
Member

thockin commented Oct 5, 2018

We have relaxed this in the past (it was once very strict). This is a POSIX compatible change though.

This is strictly rollback-unsafe, but I'd say it's relatively low-risk. How do we want to manage these? Do we say no to this forever? Do we replace Env with POSIXEnv?

If we do this, we should also update the comments in pkg/apis/core/types.go and staging/src/k8s.io/api/core/v1/types.go

@apelisse
Copy link
Member

apelisse commented Oct 8, 2018

This is strictly rollback-unsafe, but I'd say it's relatively low-risk.

I'd go with this, strongly suggest in the release note to delay using this variables (which people can't use today anyway) before they are confident they won't have to fallback their apiserver.

@lavalamp
Copy link
Member

lavalamp commented Oct 8, 2018

That works for me, fix the release note & I'll approve.

(also looks like CLA needs signing)

@vithati
Copy link
Contributor Author

vithati commented Oct 9, 2018

I signed it

@thockin
Copy link
Member

thockin commented Jan 26, 2019

@bgrant0607 I meant that 1.x release would tolerate and use any extended values it finds in etcd, but would not allow use of extended values in API mutations. I.e. if I upgrade to 1.y and rollback to 1.x or if I have version skew it will be OK.

Agree re: kubelet

@liggitt
Copy link
Member

liggitt commented Feb 6, 2019

I'd envision a rollout like this:

In version X:

  1. handle the expanded values, and tolerate persisted objects with the expanded values:
    1a: update validation to validate the expanded values
    1b: update consumers of the field to handle the expanded values
    1c: allow an update of an object already using the expanded values to continue using them
  2. prevent new use of the expanded values:
    2a: prevent creation of a new object using the expanded values
    2b: prevent an update of an object not yet using the expanded values from starting to use them

In some later version, the restrictions on create and update (2a,2b) can be removed.

  • This should be done no earlier than X+1 (so a skewed HA control plane does not consider persisted data invalid, and single version control plane rollback is safe).
  • This could require a longer waiting period, depending on the consumers that were updated in 1a, what behavior they had prior to being updated, and what level of skew is supported.
    • Did they skip the new data in a safe way? (e.g. not set the new envvar)
    • Did they skip the new data in an unsafe way? (e.g. format a volume as a filesystem instead of a block device... if so, this is probably a sign the API change is not a safe one to make at all)
    • Did they hard fail? Could require waiting until the oldest supported version of the consumer is version X (when the new data was handled), or could be the desired behavior (block incorrect use of objects containing the new data)

This is the same process we have to follow when allowing a new enum value (e.g. adding "SCTP" as a valid port protocol).

In this case, it appears kubelets do not validate envvar names coming from the API, and only warn on invalid envvar names resulting from secret/configmap -> envvar mappings. That means we could relax validation in 1.14, and remove create/update restrictions in 1.15.

@liggitt liggitt self-assigned this Feb 6, 2019
@thockin
Copy link
Member

thockin commented Mar 1, 2019

@vithati any appetite for trying to get this into 1.14 ?

@vithati
Copy link
Contributor Author

vithati commented Mar 7, 2019

@vithati any appetite for trying to get this into 1.14 ?

@thockin, I can't make it for 1.14. I will work on this for 1.15.

@alex-slynko
Copy link

Hi @vithati

Is there any news about the PR?
We tried to use the variable with : to configure npm registry for building image, but it failed. We have implemented a workaround, but it would be nice to have a proper fix.

@spiffxp
Copy link
Member

spiffxp commented Aug 5, 2019

/priority awaiting-more-evidence

@k8s-ci-robot k8s-ci-robot added priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. area/provider/gcp Issues or PRs related to gcp provider and removed sig/gcp labels Aug 5, 2019
@vithati
Copy link
Contributor Author

vithati commented Aug 6, 2019

I am not able to get time to work on the changes. Can someone take this up?

@spiffxp
Copy link
Member

spiffxp commented Aug 21, 2019

/remove-area conformance

@k8s-ci-robot k8s-ci-robot removed the area/conformance Issues or PRs related to kubernetes conformance tests label Aug 21, 2019
@spiffxp spiffxp removed this from To Triage in conformance-definition Aug 21, 2019
@hpandeycodeit
Copy link

@vithati I would like to resume working on this PR. Let me know if that's okay with you.

@vithati
Copy link
Contributor Author

vithati commented Sep 20, 2019

@vithati I would like to resume working on this PR. Let me know if that's okay with you.

@vithati I would like to resume working on this PR. Let me know if that's okay with you.

Thanks, you can take it up.

@liggitt
Copy link
Member

liggitt commented Sep 24, 2019

/close

in favor of #83032

@k8s-ci-robot
Copy link
Contributor

@liggitt: Closed this PR.

In response to this:

/close

in favor of #83032

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.

SIG Release automation moved this from Backlog to Done (1.17) Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/apiserver area/kubeadm area/kubectl area/kubelet area/provider/gcp Issues or PRs related to gcp provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/release Categorizes an issue or PR as relevant to SIG Release. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. 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.

Rejecting valid Environment Variable Names