Skip to content

Commit 8e5e56f

Browse files
Merge branch 'main' into split/fn-eval-namespace-v2
2 parents 45146c6 + c59c2a6 commit 8e5e56f

11 files changed

Lines changed: 149 additions & 235 deletions

File tree

CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ All submissions, including submissions by project members, require review. We
5757
use GitHub pull requests for this purpose. Consult [GitHub Help] for more
5858
information on using pull requests.
5959

60+
Process for code reviews. Before requesting human review, a PR must:
61+
62+
* All tests passing
63+
* All linting passing
64+
* Meeting project code quality requirements, including passing all configured static analysis / SonarCloud quality gates and not reducing automated test coverage for the affected components
65+
* The comments from the first run of automatically generated comments (AI generated comments, SonarCloud comments, bot generated comments, etc.) of the PR are addressed (addressing further re-runs of AI are optional)
66+
* If it is not possible to resolve an automatic comment, please add a sub-comment indicating why the automated comment cannot be resolved or ask for help in resolving the comment
67+
6068
## Community Guidelines
6169

6270
This project follows a [Code of Conduct].
@@ -126,7 +134,7 @@ It's usually a good idea to test locally for the following:
126134

127135
#### Update docs
128136

129-
Docs are under [documentation/]. Refer to (the README,md)[documentation/README.md] in the folder to details about
137+
Docs are under [documentation/](documentation/). Refer to the [README.md](documentation/README.md) in the folder for details about
130138
documentation contributions.
131139

132140

e2e/testdata/fn-render/basicpipeline-semver/.expected/diff.patch

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/Kptfile b/Kptfile
2-
index 68ea4fc..85f42f5 100644
2+
index 2336da4..ca2bcea 100644
33
--- a/Kptfile
44
+++ b/Kptfile
55
@@ -1,14 +1,16 @@
@@ -15,24 +15,28 @@ index 68ea4fc..85f42f5 100644
1515
- namespace: staging
1616
- - image: ghcr.io/kptdev/krm-functions-catalog/set-labels
1717
- tag: "~0.2"
18-
- configMap:
19-
- tier: backend
20-
+apiVersion: kpt.dev/v1
21-
+kind: Kptfile
22-
+metadata:
23-
+ name: app
24-
+ labels:
25-
+ tier: backend
26-
+pipeline:
27-
+ mutators:
28-
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-namespace
29-
+ tag: "0.4.1 - 0.4.3"
30-
+ configMap:
31-
+ namespace: staging
32-
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-labels
33-
+ tag: "~0.2"
34-
+ configMap:
35-
+ tier: backend
18+
configMap:
19+
tier: backend
20+
+ tag: ~0.2
21+
+status:
22+
+ conditions:
23+
+ - type: Rendered
24+
+ status: "True"
25+
+ reason: RenderSuccess
26+
+ renderStatus:
27+
+ mutationSteps:
28+
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.4.3
29+
+ exitCode: 0
30+
+ results:
31+
+ - message: namespace [default] updated to "staging", 1 value(s) changed
32+
+ severity: info
33+
+ - message: all `depends-on` annotations are up-to-date. no `namespace` changed
34+
+ severity: info
35+
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.2.4
36+
+ exitCode: 0
37+
+ results:
38+
+ - message: set 4 labels in total
39+
+ severity: info
3640
diff --git a/resources.yaml b/resources.yaml
3741
index ffbb3d7..936d957 100644
3842
--- a/resources.yaml

e2e/testdata/fn-render/krm-check-exclude-kustomize/.expected/diff.patch

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/Kptfile b/Kptfile
2-
index 2985a1a..3dfdcf6 100644
2+
index 2985a1a..30b4376 100644
33
--- a/Kptfile
44
+++ b/Kptfile
55
@@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
@@ -11,6 +11,17 @@ index 2985a1a..3dfdcf6 100644
1111
pipeline:
1212
mutators:
1313
- image: set-labels:v0.1.5
14+
configMap:
15+
tier: backend
16+
+status:
17+
+ conditions:
18+
+ - type: Rendered
19+
+ status: "True"
20+
+ reason: RenderSuccess
21+
+ renderStatus:
22+
+ mutationSteps:
23+
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5
24+
+ exitCode: 0
1425
diff --git a/kustomization.yaml b/kustomization.yaml
1526
index f3f0207..6c517af 100644
1627
--- a/kustomization.yaml

e2e/testdata/fn-render/missing-fn-image/.expected/diff.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/Kptfile b/Kptfile
2-
index 11012de..9fadb6e 100644
2+
index 11012de..a0f4634 100644
33
--- a/Kptfile
44
+++ b/Kptfile
55
@@ -7,6 +7,26 @@ pipeline:
@@ -22,11 +22,11 @@ index 11012de..9fadb6e 100644
2222
+ mutationSteps:
2323
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0
2424
+ exitCode: 0
25-
+ - image: ghcr.io/kptdev/krm-functions-catalog/dne
25+
+ - image: ghcr.io/kptdev/krm-functions-catalog/dne:latest
2626
+ stderr: |-
2727
+ docker: Error response from daemon: error from registry: denied
2828
+ denied
2929
+
3030
+ Run 'docker run --help' for more information
3131
+ exitCode: 125
32-
+ errorSummary: 'ghcr.io/kptdev/krm-functions-catalog/dne: exit code 125'
32+
+ errorSummary: 'ghcr.io/kptdev/krm-functions-catalog/dne:latest: exit code 125'
Lines changed: 14 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -1,188 +1,17 @@
11
diff --git a/Kptfile b/Kptfile
2-
index 1e0e356..a7a2d0b 100644
2+
index a7a2d0b..3dbfee4 100644
33
--- a/Kptfile
44
+++ b/Kptfile
5-
@@ -1,7 +1,7 @@
6-
-apiVersion: kpt.dev/v1
7-
-kind: Kptfile
8-
-metadata:
9-
- name: app
10-
-pipeline:
11-
- mutators:
12-
- - image: ghcr.io/kptdev/krm-functions-catalog/no-op
13-
+apiVersion: kpt.dev/v1
14-
+kind: Kptfile
15-
+metadata:
16-
+ name: app
17-
+pipeline:
18-
+ mutators:
19-
+ - image: ghcr.io/kptdev/krm-functions-catalog/no-op
20-
diff --git a/resources.yaml b/resources.yaml
21-
index c0974f0..60f96f2 100644
22-
--- a/resources.yaml
23-
+++ b/resources.yaml
24-
@@ -1,82 +1,82 @@
25-
-# Copyright 2021 The kpt Authors
26-
-#
27-
-# Licensed under the Apache License, Version 2.0 (the "License");
28-
-# you may not use this file except in compliance with the License.
29-
-# You may obtain a copy of the License at
30-
-#
31-
-# http://www.apache.org/licenses/LICENSE-2.0
32-
-#
33-
-# Unless required by applicable law or agreed to in writing, software
34-
-# distributed under the License is distributed on an "AS IS" BASIS,
35-
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36-
-# See the License for the specific language governing permissions and
37-
-# limitations under the License.
38-
-apiVersion: apps/v1
39-
-kind: Deployment
40-
-metadata:
41-
- name: my-nginx
42-
- namespace: my-space
43-
- labels:
44-
- env: dev
45-
- foo: bar
46-
-spec:
47-
- # comment 1
48-
- replicas: 3
49-
- selector:
50-
- # comment 2
51-
- matchLabels: # comment 3
52-
- # comment 4
53-
- app: nginx # comment 5
54-
- template:
55-
- metadata:
56-
- labels:
57-
- app: nginx
58-
- spec:
59-
- # comment 6
60-
- containers:
61-
- # comment 7
62-
- - name: nginx
63-
- image: 'nginx:1.14.2' # comment 8
64-
- ports:
65-
- # comment 9
66-
- - containerPort: 80 # comment 10
67-
----
68-
-apiVersion: v1
69-
-kind: Service
70-
-metadata:
71-
- name: my-service
72-
-spec:
73-
- ports:
74-
- # comment 1
75-
- - name: etcd-server-ssl
76-
- port: 2380
77-
- # comment 2
78-
- - name: etcd-client-ssl
79-
- port: 2379
80-
----
81-
-apiVersion: constraints.gatekeeper.sh/v1beta1
82-
-kind: EnforceFoo
83-
-metadata:
84-
- name: enforce-foo
85-
-spec:
86-
- parameters:
87-
- naming_rules:
88-
- - kind: Folder
89-
- patterns:
90-
- # comment 1
91-
- - ^(dev|prod|staging|qa|shared)$
92-
----
93-
-apiVersion: v1
94-
-kind: ConfigMap
95-
-metadata:
96-
- name: setters-config
97-
-data:
98-
- # This should be the name of your Config Controller instance
99-
- cluster-name: cluster-name
100-
- # This should be the project where you deployed Config Controller
101-
- project-id: project-id
102-
- project-number: '1234567890123'
103-
- # You can leave these defaults
104-
- namespace: config-control
105-
- deployment-repo: deployment-repo
106-
- source-repo: source-repo
107-
+# Copyright 2021 The kpt Authors
108-
+#
109-
+# Licensed under the Apache License, Version 2.0 (the "License");
110-
+# you may not use this file except in compliance with the License.
111-
+# You may obtain a copy of the License at
112-
+#
113-
+# http://www.apache.org/licenses/LICENSE-2.0
114-
+#
115-
+# Unless required by applicable law or agreed to in writing, software
116-
+# distributed under the License is distributed on an "AS IS" BASIS,
117-
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
118-
+# See the License for the specific language governing permissions and
119-
+# limitations under the License.
120-
+apiVersion: apps/v1
121-
+kind: Deployment
122-
+metadata:
123-
+ name: my-nginx
124-
+ namespace: my-space
125-
+ labels:
126-
+ env: dev
127-
+ foo: bar
128-
+spec:
129-
+ # comment 1
130-
+ replicas: 3
131-
+ selector:
132-
+ # comment 2
133-
+ matchLabels: # comment 3
134-
+ # comment 4
135-
+ app: nginx # comment 5
136-
+ template:
137-
+ metadata:
138-
+ labels:
139-
+ app: nginx
140-
+ spec:
141-
+ # comment 6
142-
+ containers:
143-
+ # comment 7
144-
+ - name: nginx
145-
+ image: 'nginx:1.14.2' # comment 8
146-
+ ports:
147-
+ # comment 9
148-
+ - containerPort: 80 # comment 10
149-
+---
150-
+apiVersion: v1
151-
+kind: Service
152-
+metadata:
153-
+ name: my-service
154-
+spec:
155-
+ ports:
156-
+ # comment 1
157-
+ - name: etcd-server-ssl
158-
+ port: 2380
159-
+ # comment 2
160-
+ - name: etcd-client-ssl
161-
+ port: 2379
162-
+---
163-
+apiVersion: constraints.gatekeeper.sh/v1beta1
164-
+kind: EnforceFoo
165-
+metadata:
166-
+ name: enforce-foo
167-
+spec:
168-
+ parameters:
169-
+ naming_rules:
170-
+ - kind: Folder
171-
+ patterns:
172-
+ # comment 1
173-
+ - ^(dev|prod|staging|qa|shared)$
174-
+---
175-
+apiVersion: v1
176-
+kind: ConfigMap
177-
+metadata:
178-
+ name: setters-config
179-
+data:
180-
+ # This should be the name of your Config Controller instance
181-
+ cluster-name: cluster-name
182-
+ # This should be the project where you deployed Config Controller
183-
+ project-id: project-id
184-
+ project-number: '1234567890123'
185-
+ # You can leave these defaults
186-
+ namespace: config-control
187-
+ deployment-repo: deployment-repo
188-
+ source-repo: source-repo
5+
@@ -5,3 +5,12 @@ metadata:
6+
pipeline:
7+
mutators:
8+
- image: ghcr.io/kptdev/krm-functions-catalog/no-op
9+
+status:
10+
+ conditions:
11+
+ - type: Rendered
12+
+ status: "True"
13+
+ reason: RenderSuccess
14+
+ renderStatus:
15+
+ mutationSteps:
16+
+ - image: ghcr.io/kptdev/krm-functions-catalog/no-op:latest
17+
+ exitCode: 0

e2e/testdata/fn-render/short-image-path/.expected/diff.patch

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/Kptfile b/Kptfile
2-
index 5e29eb2..37954f5 100644
2+
index d4e5935..24022da 100644
33
--- a/Kptfile
44
+++ b/Kptfile
55
@@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
@@ -10,7 +10,22 @@ index 5e29eb2..37954f5 100644
1010
+ tier: backend
1111
pipeline:
1212
mutators:
13-
- image: set-namespace:latest
13+
- image: set-namespace:v0.2.0
14+
@@ -10,3 +13,14 @@ pipeline:
15+
- image: set-labels:v0.1.5
16+
configMap:
17+
tier: backend
18+
+status:
19+
+ conditions:
20+
+ - type: Rendered
21+
+ status: "True"
22+
+ reason: RenderSuccess
23+
+ renderStatus:
24+
+ mutationSteps:
25+
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0
26+
+ exitCode: 0
27+
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5
28+
+ exitCode: 0
1429
diff --git a/resources.yaml b/resources.yaml
1530
index f2eec52..e7f0c0b 100644
1631
--- a/resources.yaml

internal/fnruntime/container.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ type ContainerFn struct {
8080

8181
// Image is the container image to run
8282
Image string
83-
Tag string
8483
// ImagePullPolicy controls the image pulling behavior.
8584
ImagePullPolicy runneroptions.ImagePullPolicy
8685
// Container function will be killed after this timeour.
@@ -152,21 +151,6 @@ func (f *ContainerFn) Run(reader io.Reader, writer io.Writer) error {
152151
return err
153152
}
154153

155-
if f.Tag != "" {
156-
tagResolver := &TagResolver{
157-
lister: &RegClientLister{
158-
client: regclient.New(
159-
regclient.WithUserAgent(UserAgent),
160-
regclient.WithDockerCreds(),
161-
),
162-
},
163-
}
164-
f.Image, err = tagResolver.ResolveFunctionImage(f.Ctx, f.Image, f.Tag)
165-
if err != nil {
166-
return err
167-
}
168-
}
169-
170154
switch runtime {
171155
case Podman:
172156
return f.runCLI(reader, writer, podmanBin, filterPodmanCLIOutput)

0 commit comments

Comments
 (0)