Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
bdc4993
add more e2e tests; change readme to get rid of additional label fields
zyy98 Jul 13, 2022
9beb52c
update generated docs
zyy98 Jul 13, 2022
c19446c
add license make rule
zyy98 Jul 13, 2022
440fd79
change directory for make rule
zyy98 Jul 13, 2022
632d8f4
defer update license to next PR
zyy98 Jul 13, 2022
52f0772
fix tests bugs, add reply message for empty resource
zyy98 Jul 13, 2022
7a5fa4b
add good examples and fix old example readme
zyy98 Jul 14, 2022
010c76c
update metadata file
zyy98 Jul 14, 2022
9adb808
fix minor formatting
zyy98 Jul 14, 2022
183b011
minor rename and doc
zyy98 Jul 14, 2022
c59a4aa
doc rename
zyy98 Jul 14, 2022
2922e8a
doc rename
zyy98 Jul 14, 2022
25d7422
doc rename
zyy98 Jul 14, 2022
945bf4e
fix previous error logic in test files. Update set-labels to handle a…
zyy98 Jul 15, 2022
0462c90
handle local config
zyy98 Jul 18, 2022
c4dd0dc
update go module, add full coverage test, fix minor logic bug in set-…
zyy98 Jul 19, 2022
b256a6a
update unit test
zyy98 Jul 19, 2022
3819a29
delete unnecessary examples, all covered by full coverage
zyy98 Jul 19, 2022
c2132d2
readme wording
zyy98 Jul 19, 2022
634ad0e
seperated check local config into another PR
zyy98 Jul 19, 2022
5ebe543
update same local config, otherwise cannot pass tests
zyy98 Jul 19, 2022
da7375c
revert local config, actual change in another PR
zyy98 Jul 19, 2022
2e1d14c
merge from master
zyy98 Jul 20, 2022
6f585c9
delete selector from Kptfile
zyy98 Jul 20, 2022
fe31cc7
add more label path in common.go, add FieldPath "spec.template.spec.a…
zyy98 Jul 21, 2022
29d4f81
change to hard code resources; fix resource error in yaml
zyy98 Jul 23, 2022
c3ef4a0
delete unused comments
zyy98 Jul 23, 2022
b6bedec
doc string and rename
zyy98 Jul 23, 2022
2cc6104
a bit rename and refactor
zyy98 Jul 23, 2022
4d71f3b
refactor
zyy98 Jul 23, 2022
8535172
modify testvalue into different test value
zyy98 Jul 24, 2022
e9eb89d
delete comments in yaml
zyy98 Jul 25, 2022
da94748
merge with master; split PR to contain only tests
zyy98 Jul 26, 2022
8661e1e
draft for new PR
zyy98 Jul 26, 2022
cae7573
update code, previous merge miss out something
zyy98 Jul 26, 2022
0e58f07
test
zyy98 Jul 27, 2022
f8a7e91
PR clean up, delete modifications about more e2e tests
zyy98 Jul 27, 2022
efccb82
PR clean up, delete modifications about more e2e tests
zyy98 Jul 27, 2022
5c678a3
PR clean up, delete modifications about more e2e tests
zyy98 Jul 27, 2022
3edc5af
PR clean up, delete modifications about more e2e tests
zyy98 Jul 27, 2022
3f8009a
reverting back
zyy98 Jul 27, 2022
bcc581b
reverting back
zyy98 Jul 27, 2022
cdc3e3b
reverting back
zyy98 Jul 27, 2022
1487172
revert
zyy98 Jul 27, 2022
4b4a377
refactor code based on k8s struct
zyy98 Jul 29, 2022
178f4d6
delete unused function
zyy98 Jul 29, 2022
b89819c
fix check subObject exist
zyy98 Jul 29, 2022
7bde153
add doc string
zyy98 Jul 29, 2022
a95e511
rearrange functions
zyy98 Jul 29, 2022
8e7da00
switch case
zyy98 Aug 1, 2022
bdd42ab
merge with master
zyy98 Aug 1, 2022
f762557
delete unnecessary commonSpecFields
zyy98 Aug 1, 2022
dacaa35
delete unnecessary code
zyy98 Aug 1, 2022
c6fae1d
naming and structure minor fix to improve readability
zyy98 Aug 1, 2022
beae5a6
change naming in logging
zyy98 Aug 2, 2022
6f4ed4a
fix unit test according to new log format
zyy98 Aug 3, 2022
1219239
fix unit test according to new log format
zyy98 Aug 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/set-labels-full-coverage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ $ kpt fn render set-labels-full-coverage
Check all resources, the following labels should be upserted to the `labels`, `matchingLabels` or `seletors(labelSelector)` fields:
`color: orange`, `fruit: apple` and `app: new`.

[`set-labels`]: https://catalog.kpt.dev/set-labels/v0.1/
[`set-labels`]: https://catalog.kpt.dev/set-labels/v0.1/
2 changes: 0 additions & 2 deletions functions/go/set-labels/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20220720212527-133180134b93 h1:c1GhPzYzU2a3E+/2WB9OxoljK2pNYfsBF5Fz9GkdYXs=
github.com/GoogleContainerTools/kpt-functions-sdk/go/api v0.0.0-20220720212527-133180134b93/go.mod h1:gkK43tTaPXFNASpbIbQImzhmt1hdcdin++kvzTblykc=
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20220608182028-78748f08d997 h1:yv4zLzpaPg0MJZWhNUlQxQNgqkV6qxL4xXVlaVoyMhg=
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20220608182028-78748f08d997/go.mod h1:5m1pYKzRjlYG/Oi//vcJ1pCHsW8b+gD+wAPXwxz/4jc=
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20220723081830-33aee7fe8a2e h1:a4rfmCZpbG78rCqOZYDB9HV2avrx5lZaytUVDpj8MqE=
github.com/GoogleContainerTools/kpt-functions-sdk/go/fn v0.0.0-20220723081830-33aee7fe8a2e/go.mod h1:Kfyd06y9XFV1QXUI1L7OI5xxINyK0Xq+7BcXcnv28c4=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
Expand Down
154 changes: 0 additions & 154 deletions functions/go/set-labels/transformer/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,157 +18,3 @@ const (
FnConfigKind = "SetLabels"
fnDeprecateField = "additionalLabelFields"
)

// generate common label paths
var CommonSpecs = FieldSpecs{
FieldSpec{
Gvk: GVK{"", "v1", "Service"},
FieldPath: FieldPath{"spec", "selector"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"", "v1", "ReplicationController"},
FieldPath: FieldPath{"spec", "selector"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"", "v1", "ReplicationController"},
FieldPath: FieldPath{"spec", "template", "metadata", "labels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"", "", "Deployment"},
FieldPath: FieldPath{"spec", "selector", "matchLabels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"", "", "Deployment"},
FieldPath: FieldPath{"spec", "template", "metadata", "labels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"apps", "", "Deployment"},
FieldPath: FieldPath{"spec", "template", "spec", "affinity", "podAffinity", "preferredDuringSchedulingIgnoredDuringExecution", "podAffinityTerm", "labelSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"apps", "", "Deployment"},
FieldPath: FieldPath{"spec", "template", "spec", "affinity", "podAffinity", "requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"apps", "", "Deployment"},
FieldPath: FieldPath{"spec", "template", "spec", "affinity", "podAntiAffinity", "preferredDuringSchedulingIgnoredDuringExecution", "podAffinityTerm", "labelSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"apps", "", "Deployment"},
FieldPath: FieldPath{"spec", "template", "spec", "affinity", "podAntiAffinity", "requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"apps", "", "Deployment"},
FieldPath: FieldPath{"spec", "template", "spec", "topologySpreadConstraints", "labelSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"", "", "ReplicaSet"},
FieldPath: FieldPath{"spec", "selector", "matchLabels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"", "", "ReplicaSet"},
FieldPath: FieldPath{"spec", "template", "metadata", "labels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"", "", "DaemonSet"},
FieldPath: FieldPath{"spec", "selector", "matchLabels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"", "", "DaemonSet"},
FieldPath: FieldPath{"spec", "template", "metadata", "labels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"apps", "", "StatefulSet"},
FieldPath: FieldPath{"spec", "selector", "matchLabels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"apps", "", "StatefulSet"},
FieldPath: FieldPath{"spec", "template", "metadata", "labels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"apps", "", "StatefulSet"},
FieldPath: FieldPath{"spec", "template", "spec", "affinity", "podAffinity", "preferredDuringSchedulingIgnoredDuringExecution", "podAffinityTerm", "labelSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"apps", "", "StatefulSet"},
FieldPath: FieldPath{"spec", "template", "spec", "affinity", "podAffinity", "requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"apps", "", "StatefulSet"},
FieldPath: FieldPath{"spec", "template", "spec", "affinity", "podAntiAffinity", "preferredDuringSchedulingIgnoredDuringExecution", "podAffinityTerm", "labelSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"apps", "", "StatefulSet"},
FieldPath: FieldPath{"spec", "template", "spec", "affinity", "podAntiAffinity", "requiredDuringSchedulingIgnoredDuringExecution", "labelSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"apps", "", "StatefulSet"},
FieldPath: FieldPath{"spec", "template", "spec", "topologySpreadConstraints", "labelSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"batch", "", "Job"},
FieldPath: FieldPath{"spec", "selector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"batch", "", "Job"},
FieldPath: FieldPath{"spec", "template", "metadata", "labels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"batch", "", "CronJob"},
FieldPath: FieldPath{"spec", "jobTemplate", "spec", "selector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"batch", "", "CronJob"},
FieldPath: FieldPath{"spec", "jobTemplate", "metadata", "labels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"batch", "", "CronJob"},
FieldPath: FieldPath{"spec", "jobTemplate", "spec", "template", "metadata", "labels"},
CreateIfNotPresent: true,
},
FieldSpec{
Gvk: GVK{"policy", "", "PodDisruptionBudget"},
FieldPath: FieldPath{"spec", "selector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"networking.k8s.io", "", "NetworkPolicy"},
FieldPath: FieldPath{"spec", "podSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"networking.k8s.io", "", "NetworkPolicy"},
FieldPath: FieldPath{"spec", "ingress", "from", "podSelector", "matchLabels"},
CreateIfNotPresent: false,
},
FieldSpec{
Gvk: GVK{"networking.k8s.io", "", "NetworkPolicy"},
FieldPath: FieldPath{"spec", "egress", "to", "podSelector", "matchLabels"},
CreateIfNotPresent: false,
},
}
Loading