File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ apiVersion : v1
2+ kind : Service
3+ metadata :
4+ name : my-service
5+ spec :
6+ selector :
7+ app : MyApp
8+ ports :
9+ - protocol : TCP
10+ port : 80
11+ targetPort : 9376
12+ ---
13+ apiVersion : apps/v1
14+ kind : Deployment
15+ metadata :
16+ name : nginx-deployment
17+ labels :
18+ app : nginx
19+ spec :
20+ replicas : 3
21+ selector :
22+ matchLabels :
23+ app : nginx
24+ template :
25+ metadata :
26+ labels :
27+ app : nginx
28+ spec :
29+ containers :
30+ - name : nginx
31+ image : nginx:1.14.2
32+ ports :
33+ - containerPort : 80
Original file line number Diff line number Diff line change 1+ apiVersion : fn.kpt.dev/v1alpha1
2+ kind : StarlarkRun
3+ metadata :
4+ name : set-annotation
5+ # EDIT THE SOURCE!
6+ # This should be your starlark script which preloads the `ResourceList` to `ctx.resource_list`
7+ source : |
8+ for resource in ctx.resource_list["items"]:
9+ if resource.get("kind") == "Deployment":
10+ resource["metadata"]["annotations"]["managed-by"] = "kpt"
You can’t perform that action at this time.
0 commit comments