Skip to content

Commit ec02edf

Browse files
authored
update kyaml and cli-utils to latest (#2523)
1 parent 8675781 commit ec02edf

File tree

36 files changed

+723
-274
lines changed

36 files changed

+723
-274
lines changed

e2e/testdata/fn-eval/out-of-place-fnchain-stdout/.expected/config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ stdOut: |
2929
annotations:
3030
config.kubernetes.io/index: "0"
3131
config.kubernetes.io/path: resources.yaml
32+
internal.config.kubernetes.io/index: "0"
33+
internal.config.kubernetes.io/path: resources.yaml
3234
internal.config.kubernetes.io/seqindent: compact
3335
foo: bar
3436
namespace: staging
@@ -52,6 +54,8 @@ stdOut: |
5254
annotations:
5355
config.kubernetes.io/index: "1"
5456
config.kubernetes.io/path: resources.yaml
57+
internal.config.kubernetes.io/index: "1"
58+
internal.config.kubernetes.io/path: resources.yaml
5559
internal.config.kubernetes.io/seqindent: compact
5660
foo: bar
5761
namespace: staging

e2e/testdata/fn-eval/output-to-stdout/.expected/config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ stdOut: |
3636
annotations:
3737
config.kubernetes.io/index: "0"
3838
config.kubernetes.io/path: resources.yaml
39+
internal.config.kubernetes.io/index: "0"
40+
internal.config.kubernetes.io/path: resources.yaml
3941
internal.config.kubernetes.io/seqindent: compact
4042
namespace: staging
4143
spec:
@@ -47,6 +49,8 @@ stdOut: |
4749
annotations:
4850
config.kubernetes.io/index: "1"
4951
config.kubernetes.io/path: resources.yaml
52+
internal.config.kubernetes.io/index: "1"
53+
internal.config.kubernetes.io/path: resources.yaml
5054
internal.config.kubernetes.io/seqindent: compact
5155
namespace: staging
5256
spec:

e2e/testdata/fn-render/generator-absolute-path/starlark-httpbin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ source: |-
2222
"metadata": {
2323
"name": "httpbin",
2424
"annotations": {
25-
"config.kubernetes.io/index": 0,
25+
"internal.config.kubernetes.io/index": 0,
2626
# generates resource in parent directory
27-
"config.kubernetes.io/path": "/another/file/out.yaml"
27+
"internal.config.kubernetes.io/path": "/another/file/out.yaml"
2828
}
2929
},
3030
"spec": {
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/x.yaml b/y.yaml
2+
similarity index 100%
3+
rename from x.yaml
4+
rename to y.yaml
5+
index 7a494c9..e284e52 100644
6+
--- a/x.yaml
7+
+++ b/y.yaml
8+
@@ -1,3 +1,10 @@
9+
+apiVersion: custom.io/v1
10+
+kind: Custom
11+
+metadata:
12+
+ name: custom
13+
+spec:
14+
+ image: nginx:1.2.3
15+
+---
16+
# Copyright 2021 Google LLC
17+
#
18+
# Licensed under the Apache License, Version 2.0 (the "License");
19+
@@ -17,10 +24,3 @@ metadata:
20+
name: nginx-deployment
21+
spec:
22+
replicas: 3
23+
----
24+
-apiVersion: custom.io/v1
25+
-kind: Custom
26+
-metadata:
27+
- name: custom
28+
-spec:
29+
- image: nginx:1.2.3
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.expected
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: kpt.dev/v1
2+
kind: Kptfile
3+
metadata:
4+
name: app
5+
pipeline:
6+
mutators:
7+
- image: gcr.io/kpt-fn/starlark:v0.3.0
8+
configPath: starlark-mutate-path-index.yaml
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
apiVersion: fn.kpt.dev/v1alpha1
15+
kind: StarlarkRun
16+
metadata:
17+
name: httpbin-gen
18+
source: |-
19+
def change_path_index(resources):
20+
for r in resources:
21+
pathElems = r["metadata"]["annotations"]["config.kubernetes.io/path"].split("/")
22+
if pathElems[-1] == "y.yaml":
23+
return
24+
25+
pathElems[-1] = "y.yaml"
26+
r["metadata"]["annotations"]["config.kubernetes.io/path"] = "/".join(pathElems)
27+
28+
index = r["metadata"]["annotations"]["config.kubernetes.io/index"]
29+
if index == "0":
30+
r["metadata"]["annotations"]["config.kubernetes.io/index"] = "1"
31+
else:
32+
r["metadata"]["annotations"]["config.kubernetes.io/index"] = "0"
33+
34+
change_path_index(ctx.resource_list["items"])
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
apiVersion: apps/v1
15+
kind: Deployment
16+
metadata:
17+
name: nginx-deployment
18+
spec:
19+
replicas: 3
20+
---
21+
apiVersion: custom.io/v1
22+
kind: Custom
23+
metadata:
24+
name: custom
25+
spec:
26+
image: nginx:1.2.3
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/x.yaml b/y.yaml
2+
similarity index 100%
3+
rename from x.yaml
4+
rename to y.yaml
5+
index 7a494c9..e284e52 100644
6+
--- a/x.yaml
7+
+++ b/y.yaml
8+
@@ -1,3 +1,10 @@
9+
+apiVersion: custom.io/v1
10+
+kind: Custom
11+
+metadata:
12+
+ name: custom
13+
+spec:
14+
+ image: nginx:1.2.3
15+
+---
16+
# Copyright 2021 Google LLC
17+
#
18+
# Licensed under the Apache License, Version 2.0 (the "License");
19+
@@ -17,10 +24,3 @@ metadata:
20+
name: nginx-deployment
21+
spec:
22+
replicas: 3
23+
----
24+
-apiVersion: custom.io/v1
25+
-kind: Custom
26+
-metadata:
27+
- name: custom
28+
-spec:
29+
- image: nginx:1.2.3
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.expected

0 commit comments

Comments
 (0)