Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Out of place hydration using render and eval (#2137)
* Implement out of place hydration for eval and render * e2e tests for oop hydration * Reference docs * Fix tests * Address suggested changes * Unit tests for WriteFnOutput * out of place support in test harness * added support for fn-eval * output of place tests * --results-dir option should not print progress to stdout * print results dir message for error * Update reference docs with default behavior Co-authored-by: droot <sunilarora@google.com>
- Loading branch information
1 parent
4618a59
commit 7d765c3
Showing
73 changed files
with
1,510 additions
and
176 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
e2e/testdata/fn-eval/out-of-place-dir/.expected/diff.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/out/resources.yaml b/out/resources.yaml | ||
new file mode 100644 | ||
index 0000000..254b9cd | ||
--- /dev/null | ||
+++ b/out/resources.yaml | ||
@@ -0,0 +1,28 @@ | ||
+# Copyright 2021 Google LLC | ||
+# | ||
+# Licensed under the Apache License, Version 2.0 (the "License"); | ||
+# you may not use this file except in compliance with the License. | ||
+# You may obtain a copy of the License at | ||
+# | ||
+# http://www.apache.org/licenses/LICENSE-2.0 | ||
+# | ||
+# Unless required by applicable law or agreed to in writing, software | ||
+# distributed under the License is distributed on an "AS IS" BASIS, | ||
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
+# See the License for the specific language governing permissions and | ||
+# limitations under the License. | ||
+apiVersion: apps/v1 | ||
+kind: Deployment | ||
+metadata: | ||
+ name: nginx-deployment | ||
+ namespace: staging | ||
+spec: | ||
+ replicas: 3 | ||
+--- | ||
+apiVersion: custom.io/v1 | ||
+kind: Custom | ||
+metadata: | ||
+ name: custom | ||
+ namespace: staging | ||
+spec: | ||
+ image: nginx:1.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#! /bin/bash | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -eo pipefail | ||
|
||
kpt fn eval --image gcr.io/kpt-fn/set-namespace:v0.1.3 -o out -- namespace=staging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.expected | ||
out |
File renamed without changes.
52 changes: 52 additions & 0 deletions
52
e2e/testdata/fn-eval/out-of-place-fnchain-stdout/.expected/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
stdOut: | | ||
apiVersion: config.kubernetes.io/v1alpha1 | ||
kind: ResourceList | ||
items: | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
- apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx-deployment | ||
namespace: staging | ||
labels: | ||
tier: backend | ||
annotations: | ||
config.kubernetes.io/index: "0" | ||
config.kubernetes.io/path: resources.yaml | ||
foo: bar | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
tier: backend | ||
template: | ||
metadata: | ||
labels: | ||
tier: backend | ||
annotations: | ||
foo: bar | ||
- apiVersion: custom.io/v1 | ||
kind: Custom | ||
metadata: | ||
name: custom | ||
namespace: staging | ||
labels: | ||
tier: backend | ||
annotations: | ||
config.kubernetes.io/index: "1" | ||
config.kubernetes.io/path: resources.yaml | ||
foo: bar | ||
spec: | ||
image: nginx:1.2.3 |
7 changes: 7 additions & 0 deletions
7
e2e/testdata/fn-eval/out-of-place-fnchain-stdout/.expected/exec.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#! /bin/bash | ||
|
||
set -eo pipefail | ||
|
||
kpt fn eval --image gcr.io/kpt-fn/set-namespace:v0.1.3 -o stdout -- namespace=staging \ | ||
| kpt fn eval - --image gcr.io/kpt-fn/set-annotations:v0.1.3 -- foo=bar \ | ||
| kpt fn eval - --image gcr.io/kpt-fn/set-labels:v0.1.3 -- tier=backend |
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
e2e/testdata/fn-eval/out-of-place-fnchain-stdout/resources.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx-deployment | ||
spec: | ||
replicas: 3 | ||
--- | ||
apiVersion: custom.io/v1 | ||
kind: Custom | ||
metadata: | ||
name: custom | ||
spec: | ||
image: nginx:1.2.3 |
33 changes: 33 additions & 0 deletions
33
e2e/testdata/fn-eval/out-of-place-fnchain-unwrap/.expected/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
stdOut: | | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx-deployment | ||
namespace: staging | ||
labels: | ||
tier: backend | ||
annotations: | ||
foo: bar | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
tier: backend | ||
template: | ||
metadata: | ||
labels: | ||
tier: backend | ||
annotations: | ||
foo: bar | ||
--- | ||
apiVersion: custom.io/v1 | ||
kind: Custom | ||
metadata: | ||
name: custom | ||
namespace: staging | ||
labels: | ||
tier: backend | ||
annotations: | ||
foo: bar | ||
spec: | ||
image: nginx:1.2.3 |
7 changes: 7 additions & 0 deletions
7
e2e/testdata/fn-eval/out-of-place-fnchain-unwrap/.expected/exec.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#! /bin/bash | ||
|
||
set -eo pipefail | ||
|
||
kpt fn eval --image gcr.io/kpt-fn/set-namespace:v0.1.3 -o stdout -- namespace=staging \ | ||
| kpt fn eval - --image gcr.io/kpt-fn/set-annotations:v0.1.3 -- foo=bar \ | ||
| kpt fn eval - --image gcr.io/kpt-fn/set-labels:v0.1.3 -o unwrap -- tier=backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: kpt.dev/v1alpha2 | ||
kind: Kptfile | ||
metadata: | ||
name: app | ||
pipeline: | ||
mutators: | ||
- image: gcr.io/kpt-fn/set-namespace:v0.1.3 | ||
configMap: | ||
namespace: staging |
13 changes: 13 additions & 0 deletions
13
e2e/testdata/fn-eval/out-of-place-fnchain-unwrap/resources.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx-deployment | ||
spec: | ||
replicas: 3 | ||
--- | ||
apiVersion: custom.io/v1 | ||
kind: Custom | ||
metadata: | ||
name: custom | ||
spec: | ||
image: nginx:1.2.3 |
34 changes: 34 additions & 0 deletions
34
e2e/testdata/fn-eval/out-of-place-source-sink/.expected/diff.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/out/resources.yaml b/out/resources.yaml | ||
new file mode 100644 | ||
index 0000000..254b9cd | ||
--- /dev/null | ||
+++ b/out/resources.yaml | ||
@@ -0,0 +1,28 @@ | ||
+# Copyright 2021 Google LLC | ||
+# | ||
+# Licensed under the Apache License, Version 2.0 (the "License"); | ||
+# you may not use this file except in compliance with the License. | ||
+# You may obtain a copy of the License at | ||
+# | ||
+# http://www.apache.org/licenses/LICENSE-2.0 | ||
+# | ||
+# Unless required by applicable law or agreed to in writing, software | ||
+# distributed under the License is distributed on an "AS IS" BASIS, | ||
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
+# See the License for the specific language governing permissions and | ||
+# limitations under the License. | ||
+apiVersion: apps/v1 | ||
+kind: Deployment | ||
+metadata: | ||
+ name: nginx-deployment | ||
+ namespace: staging | ||
+spec: | ||
+ replicas: 3 | ||
+--- | ||
+apiVersion: custom.io/v1 | ||
+kind: Custom | ||
+metadata: | ||
+ name: custom | ||
+ namespace: staging | ||
+spec: | ||
+ image: nginx:1.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.expected | ||
out |
26 changes: 26 additions & 0 deletions
26
e2e/testdata/fn-eval/out-of-place-source-sink/resources.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx-deployment | ||
spec: | ||
replicas: 3 | ||
--- | ||
apiVersion: custom.io/v1 | ||
kind: Custom | ||
metadata: | ||
name: custom | ||
spec: | ||
image: nginx:1.2.3 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.