Skip to content

Be strict about env vars reserved by the runtime contract.#4050

Merged
knative-prow-robot merged 1 commit intoknative:masterfrom
mattmoor:strict-env-var-names
May 9, 2019
Merged

Be strict about env vars reserved by the runtime contract.#4050
knative-prow-robot merged 1 commit intoknative:masterfrom
mattmoor:strict-env-var-names

Conversation

@mattmoor
Copy link
Copy Markdown
Member

@mattmoor mattmoor commented May 9, 2019

Add validation analogous to the "reserved paths" validation for
volume mounts, which rejects env vars that take a name that has
been specified as part of the runtime contract.

Fixes: #3328

/hold

I want to make sure @dgerd is on board with this, given the back-and-forth in the linked issue.

Add validation analogous to the "reserved paths" validation for
volume mounts, which rejects env vars that take a name that has
been specified as part of the runtime contract.

Fixes: knative#3328
@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 9, 2019
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label May 9, 2019
@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/API API objects and controllers labels May 9, 2019
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 9, 2019
@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on pkg/.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/serving/k8s_validation.go 98.6% 99.3% 0.7

Copy link
Copy Markdown
Contributor

@vagababov vagababov left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label May 9, 2019
@dgerd
Copy link
Copy Markdown

dgerd commented May 9, 2019

I am okay with this. I do think this is the right timing to add stricter validation as the longer we wait the more breaking this becomes. I also like that it covers all environment variables that we set so we get a more consistent experience rather than just PORT. This won't catch all of the error cases (i.e. envFrom), but our default controller behavior seems sane when there is a conflict.

Given the possibility of adding additional "K_[A-Z]*" environment variables in the future, I do think we should potentially be more aggressive here and cover the regex space. We do this already similar things for the "name" field of port, and this will prevent new knative environment variables from being breaking changes.

@mattmoor
Copy link
Copy Markdown
Member Author

mattmoor commented May 9, 2019

As discussed in person, I think we should reserve KNATIVE_ vs. K_, but I think that warrants further discussion and follow-up.

@mattmoor
Copy link
Copy Markdown
Member Author

mattmoor commented May 9, 2019

/hold cancel

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 9, 2019
@knative-prow-robot knative-prow-robot merged commit c8fd92b into knative:master May 9, 2019
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. area/API API objects and controllers cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Fail revision creation if system-specified env vars are set

6 participants