Regression test for inability to add resources in function-based transfomer

This commit is contained in:
Katrina Verey
2021-02-03 17:32:06 -08:00
parent 7801830152
commit f927cf0b8e
5 changed files with 611 additions and 0 deletions

View 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"])