mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Regression test for inability to add resources in function-based transfomer
This commit is contained in:
18
plugin/someteam.example.com/v1/starlarkmixer/mixer.star
Normal file
18
plugin/someteam.example.com/v1/starlarkmixer/mixer.star
Normal file
@@ -0,0 +1,18 @@
|
||||
def run(r, fc):
|
||||
for resource in r:
|
||||
if resource.get("metadata") == None:
|
||||
resource["metadata"] = {}
|
||||
if resource["metadata"].get("annotations") == None:
|
||||
resource["metadata"]["annotations"] = {}
|
||||
resource["metadata"]["annotations"]["modified-by"] = fc["metadata"]["name"]
|
||||
|
||||
new = {
|
||||
"kind": "ConfigMap",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "net-new"
|
||||
}
|
||||
}
|
||||
r.append(new)
|
||||
|
||||
run(ctx.resource_list["items"], ctx.resource_list["functionConfig"])
|
||||
Reference in New Issue
Block a user