Repository navigation
Allow VolumeMounts to be specified in Container. - #3061
Conversation
|
Interestingly, we already pass-thru |
|
I've updated this to also pass things through (and unit test it). I want to poke at it a bit more manually, and then add an e2e test tomorrow. |
|
I've also fixed the markdown linting 🤦♂️ |
|
Ok, this now has conformance tests for a ConfigMap and a Secret as well. |
|
@evankanderson I believe we need to update this portion of the runtime contract as well, do you have any suggested wording?
|
|
I want to make sure certain folks have a crack at this, so I'm going to put a |
82086cd to
3c53040
Compare
cf4c807 to
3367836
Compare
This requires this new feature available in 0.4: knative/serving#3061
This requires this new feature available in 0.4: knative/serving#3061
|
Here's a sample for the Secrets portion of this: knative/docs#852 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor, vagababov The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
/retest Looks like our test setup is really struggling with |
This extends the knative/serving API to allow for ConfigMaps and Secrets to be mounted as volumes. All other forms of volume are disallowed. The container's volume mounts must include all of the provided volumes, they must be ReadOnly (this is defaulted in the webhook), and only a MountPath may be specified. These are then passed through to the Deployment, and the rest is up to K8s. This adds two conformance tests, one for each of ConfigMap and Secret, which simply expects the Service to echo back the randomized text read from the mounted volume. Related: knative#1504
evankanderson
left a comment
There was a problem hiding this comment.
Overall, this LGTM, except for the question about exclusion between (/tmp, /var/log, dev), and volumeMounts. (IMO, it's fine for the deployer to stomp the name-resolution related files in /etc if they know what they are doing.)
It looks like this also needs some text in docs/runtime-contract.md for the new volume mount types, including guidance about when and how to use ConfigMaps and Secrets? I suggest something like the following:
In general, stateless applications should package their dependencies within the container and not rely on mutable external state for templates, logging configuration, etc. In some cases, it may be necessary for certain application settings to be overridden at deploy time (for example, database backends or authentication credentials). When these settings need to be loaded via a file, read-only mounts of application configuration and secrets are supported by
ConfigMapandSecretsvolumes. Platform providers MAY apply updates to Secrets and ConfigMaps while the application is running; these updates could complicate rollout and rollback. It is up to the developer to choose appropriate policies for mounting and updatingConfigMapandSecretswhich are mounted as volumes.As serverless applications are expected to scale horizontally and statelessly, per-container volumes are likely to introduce state and scaling bottlenecks and are NOT RECOMMENDED.
Add validation checks for the mountPath of volumeMounts (for conflicts with reserved paths). Improve resource naming in the conformance testing.
mattmoor
left a comment
There was a problem hiding this comment.
/hold cancel
Now that we're updated the runtime contract text.
I believe I've addressed all of the feedback here, so this is RFAL.
|
Also, thanks for the updated wording for the runtime contract @evankanderson! |
markusthoemmes
left a comment
There was a problem hiding this comment.
A few drive-by comments.
Overall lgtm.
| ) | ||
|
|
||
| const ( | ||
| HelloVolumePath = "/hello/world" |
There was a problem hiding this comment.
Do we need to specify this as a const and use it in the image? Could we not pass a path to the application as a query parameter and the app then tries to read that path? That'd keep these settings contained in the test and potentially make the image reusable for other filesystem checks.
There was a problem hiding this comment.
That was the content of my https://github.com/knative/serving/pull/3061/files#r253688795
It sounds like that refactor and consolidation of all our test images is in flight, but will be a separate PR.
There was a problem hiding this comment.
No, but I think I'd rather address this holistically in follow up than starting to build general purpose images for individual tests. @dgerd has been doing this for the conformance testing, so it is possible that this can reuse that image.
| ) | ||
|
|
||
| const ( | ||
| HelloVolumePath = "/hello/world" |
There was a problem hiding this comment.
That was the content of my https://github.com/knative/serving/pull/3061/files#r253688795
It sounds like that refactor and consolidation of all our test images is in flight, but will be a separate PR.
|
The following is the coverage report on pkg/.
|
|
/lgtm /hold if Matt wants more eyes on this. |
|
@evankanderson That |
|
502 talking to https://go.googlesource.com/tools/ /test pull-knative-serving-build-tests |
* Allow VolumeMounts to be specified in Container. This extends the knative/serving API to allow for ConfigMaps and Secrets to be mounted as volumes. All other forms of volume are disallowed. The container's volume mounts must include all of the provided volumes, they must be ReadOnly (this is defaulted in the webhook), and only a MountPath may be specified. These are then passed through to the Deployment, and the rest is up to K8s. This adds two conformance tests, one for each of ConfigMap and Secret, which simply expects the Service to echo back the randomized text read from the mounted volume. Related: knative#1504 * Fix the type name used in the spec changed. * Incorporate new runtime contract wording. Add validation checks for the mountPath of volumeMounts (for conflicts with reserved paths). Improve resource naming in the conformance testing. * Rename functional options and improve test errors. * Check absolute paths, reserved directory parents, and a few other pieces of feedback.
This requires this new feature available in 0.4: knative/serving#3061
This extends the knative/serving API to allow for ConfigMaps and Secrets to be mounted as volumes. All other forms of volume are disallowed.
The container's volume mounts must include all of the provided volumes, they must be ReadOnly (this is defaulted in the webhook), and only a MountPath may be specified.
Related: #1504