Skip to content

Allow users to specify their container name.#4289

Merged
knative-prow-robot merged 4 commits intoknative:masterfrom
mattmoor:allow-name
Jun 7, 2019
Merged

Allow users to specify their container name.#4289
knative-prow-robot merged 4 commits intoknative:masterfrom
mattmoor:allow-name

Conversation

@mattmoor
Copy link
Member

@mattmoor mattmoor commented Jun 7, 2019

With this change, users can specify the name: of the container they specify
in their revision spec. This is to ease migration from K8s abstractions of
a similar shape where this field is required, and to lessen the eyesore of the
yaml returned by the API server, which doesn't omitempty.

The default value for container name is configurable via config-defaults, but
defaults to user-container for consistency with what we have today. The
container name default in config-defaults is a Go template, which has access
to the ObjectMeta of the enclosing resource's ObjectMeta (e.g. Service,
Configuration), so if an operator wanted to make the container name match the
enclosing Service, they may set this to {{.Name}}.

This also pulls the user annotation stuff into v1beta1, which was apparently still TODO.

Fixes: #4257

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jun 7, 2019
@knative-prow-robot knative-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. area/API API objects and controllers labels Jun 7, 2019
@knative-prow-robot
Copy link
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 Jun 7, 2019
Copy link
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.

I think change to the spec is missing, where we specify that at least queue-proxy is a reserved name.

Otherwise mostly nits.

@vagababov
Copy link
Contributor

/lint

Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@vagababov: 2 warnings.

Details

In response to this:

/lint

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.

@mattmoor
Copy link
Member Author

mattmoor commented Jun 7, 2019

I had to rework this a bit due to the deepcopy-gen problem with text/template.Template. I'm also still looking at what I did to send name: to the preupgrade test.

@mattmoor
Copy link
Member Author

mattmoor commented Jun 7, 2019

Alright, 🤞 that it all works now.

@knative-prow-robot knative-prow-robot added the area/test-and-release It flags unit/e2e/conformance/perf test issues for product features label Jun 7, 2019
@mattmoor
Copy link
Member Author

mattmoor commented Jun 7, 2019

/retest

mattmoor added 3 commits June 7, 2019 15:26
With this change, users can specify the `name:` of the container they specify
in their revision spec.  This is to ease migration from K8s abstractions of
a similar shape where this field is required, and to lessen the eyesore of the
yaml returned by the API server, which doesn't `omitempty`.

The default value for container name is configurable via `config-defaults`, but
defaults to `user-container` for consistency with what we have today.  The
container name default in `config-defaults` is a Go template, which has access
to the ObjectMeta of the enclosing resource's ObjectMeta (e.g. Service,
Configuration), so if an operator wanted to make the container name match the
enclosing Service, they may set this to `{{.Name}}`.

Fixes: knative#4257
Add `name:` to spec.md
@mattmoor mattmoor force-pushed the allow-name branch 2 times, most recently from 335d1a1 to 13c9a37 Compare June 7, 2019 15:33
@mattmoor
Copy link
Member Author

mattmoor commented Jun 7, 2019

Alright, upgrade should be fixed for realz. The problem was a bad merge with Jon's change, which merged "cleanly" with mine. 🙄

@vagababov
Copy link
Contributor

still fails :)

@mattmoor
Copy link
Member Author

mattmoor commented Jun 7, 2019

Ugh, he put it in a separate file 🙄

(shakes fist at Jon lovingly for adding all these tests)

Also tweak the readiness logic to look for URL instead of Domain.
@mattmoor
Copy link
Member Author

mattmoor commented Jun 7, 2019

Ok, should be fixed now. (famous last words)

Copy link
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 Jun 7, 2019
@knative-metrics-robot
Copy link

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/config/defaults.go 100.0% 92.9% -7.1
pkg/apis/serving/k8s_validation.go 99.3% 98.7% -0.7
pkg/apis/serving/v1beta1/revision_defaults.go 86.7% 87.5% 0.8

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 area/test-and-release It flags unit/e2e/conformance/perf test issues for product features cla: yes Indicates the PR's author has signed the CLA. lgtm 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.

We should support name: in corev1.Container

6 participants