Skip to content

Commit 6a048ee

Browse files
author
Ke Zhu
committed
Include review comments
1 parent c16db69 commit 6a048ee

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

docs/design_proposals/configurable-transformable-allowlist.md

+29-9
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,47 @@ Option in `skaffold.yaml`
3737
deploy:
3838
config:
3939
transformableAllowList:
40-
- Group: example.com
41-
Kind: Application
42-
- Group: argoproj.io
43-
Kind: Workflow
44-
- Group: tekton.dev
45-
Kind: Task
40+
- type: pod # no group, implicitly all versions
41+
- type: batch/Job # group, implicitly all versions
42+
- type: openfaas.com/v1/Function
43+
image: [spec.image]
44+
labels: [spec.metadata.labels, spec.labels] # https://www.openfaas.com/blog/manage-functions-with-kubectl/
45+
- type: apps/v1beta1/Deployment
46+
image: [spec.template.spec.initContainers.*.image, spec.template.spec.containers.*.image]
47+
labels: [spec.metadata.labels, spec.template.metadata.labels]
4648
```
4749
50+
The value of `type` field points to a resource type. So it's case sensitive
51+
and should support API groups and resource versions:
52+
53+
* When not specifying group, it will transform given resource type of any group or versions.
54+
* When providing group but not resource version, it will transform given
55+
resource type of any versions.
56+
57+
The value of `labels` field is a list of JSON-path-like paths to apply `labels`
58+
block to. If no `labels` field configured, it will simply apply `labels` block
59+
if missing.
60+
61+
The value of `image` field is also a list of JSON-path-like paths to rewrite. If
62+
no `image` field configured, it will rewrite any field named `image`.
63+
4864
## Open issues/Questions
4965

5066
Since it is an allowlist, neither options could disable transformation on any
51-
built-in resource like `ReplicaSet` or `Deployment`.
67+
built-in resource like `ReplicaSet` or `Deployment`. However, it may need to
68+
refactor [current allowlist](https://github.com/GoogleContainerTools/skaffold/blob/27c38228ab929ddaf2636637b43f17fda1686652/pkg/skaffold/kubernetes/manifest/visitor.go#L28-L43).
5269

5370
Is there any need to work out a deny list?
5471

5572
## Implementation plan
5673

5774
1. `pkg/skaffold/schema/latest/v1/config.go` - Add config option
5875
`transformableAllowList` to `DeployConfig`.
59-
2. `pkg/skaffold/kubernetes/manifest/visitor.go` - Add new parameter `transformableAllowList`
60-
to `*ManifestList.Visit()` by appending it to existing coded `transformableAllowList`
76+
2. `pkg/skaffold/kubernetes/manifest/visitor.go` - Refactor allowlist and add
77+
new parameter `transformableAllowList` to `*ManifestList.Visit()` by appending
78+
it to existing coded `transformableAllowList`
79+
- Support `labels` field
80+
- Support `image` field
6181
3. `pkg/skaffold/kubernetes/manifest/images.go` - Add new parameter to `*ManifestList.ReplaceImages()`
6282
to support given `transformableAllowList`
6383
4. Instrument each deployer to use the new parameter `transformableAllowList`

0 commit comments

Comments
 (0)