Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions e2e/testdata/fn-eval/selectors/exclude/.expected/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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.

stdErr: |
[RUNNING] "gcr.io/kpt-fn/set-namespace:v0.1.3" on 1 resource(s)
[PASS] "gcr.io/kpt-fn/set-namespace:v0.1.3" in 0s
12 changes: 12 additions & 0 deletions e2e/testdata/fn-eval/selectors/exclude/.expected/diff.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/resources.yaml b/resources.yaml
index 7a494c9..9d82bd6 100644
--- a/resources.yaml
+++ b/resources.yaml
@@ -15,6 +15,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
+ namespace: staging
spec:
replicas: 3
---
18 changes: 18 additions & 0 deletions e2e/testdata/fn-eval/selectors/exclude/.expected/exec.sh
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 -i set-namespace:v0.1.3 --exclude-kind Custom -- namespace=staging
1 change: 1 addition & 0 deletions e2e/testdata/fn-eval/selectors/exclude/.krmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.expected
26 changes: 26 additions & 0 deletions e2e/testdata/fn-eval/selectors/exclude/resources.yaml
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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.

stdErr: |
[RUNNING] "gcr.io/kpt-fn/set-namespace:v0.1.3" on 1 resource(s)
[PASS] "gcr.io/kpt-fn/set-namespace:v0.1.3" in 0s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/resources.yaml b/resources.yaml
index 98394a0..163aba6 100644
--- a/resources.yaml
+++ b/resources.yaml
@@ -27,6 +27,7 @@ metadata:
labels:
foo: bar
foo-1: bar
+ namespace: staging
---
apiVersion: custom.io/v1
kind: Custom
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 -i set-namespace:v0.1.3 --match-labels foo=bar --match-labels foo-1=bar --exclude-annotations foo=bar -- namespace=staging
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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
labels:
foo: bar
spec:
replicas: 3
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-deployment
labels:
foo: bar
foo-1: bar
---
apiVersion: custom.io/v1
kind: Custom
metadata:
name: custom
annotations:
foo: bar
labels:
foo: bar
foo-1: bar
spec:
image: nginx:1.2.3
22 changes: 22 additions & 0 deletions e2e/testdata/fn-render/selectors/exclude/.expected/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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.

stdErr: |
Package "exclude":
[RUNNING] "gcr.io/kpt-fn/set-namespace:v0.1.3" on 1 resource(s)
[PASS] "gcr.io/kpt-fn/set-namespace:v0.1.3" in 0s
[RUNNING] "gcr.io/kpt-fn/set-labels:v0.1.4" on 2 resource(s)
[PASS] "gcr.io/kpt-fn/set-labels:v0.1.4" in 0s

Successfully executed 2 function(s) in 1 package(s).
29 changes: 29 additions & 0 deletions e2e/testdata/fn-render/selectors/exclude/.expected/diff.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/resources.yaml b/resources.yaml
index 7a494c9..1d36135 100644
--- a/resources.yaml
+++ b/resources.yaml
@@ -15,12 +15,24 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
+ namespace: staging
+ labels:
+ tier: backend
spec:
replicas: 3
+ selector:
+ matchLabels:
+ tier: backend
+ template:
+ metadata:
+ labels:
+ tier: backend
---
apiVersion: custom.io/v1
kind: Custom
metadata:
name: custom
+ labels:
+ tier: backend
spec:
image: nginx:1.2.3
1 change: 1 addition & 0 deletions e2e/testdata/fn-render/selectors/exclude/.krmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.expected
17 changes: 17 additions & 0 deletions e2e/testdata/fn-render/selectors/exclude/Kptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: app
pipeline:
mutators:
- image: gcr.io/kpt-fn/set-namespace:v0.1.3
configMap:
namespace: staging
selectors:
- name: nginx-deployment
kind: Deployment
- image: gcr.io/kpt-fn/set-labels:v0.1.4
configMap:
tier: backend
exclude:
- kind: Kptfile
26 changes: 26 additions & 0 deletions e2e/testdata/fn-render/selectors/exclude/resources.yaml
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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.

stdErr: |
Package "selectors-with-exclude":
[RUNNING] "gcr.io/kpt-fn/set-namespace:v0.1.3" on 1 resource(s)
[PASS] "gcr.io/kpt-fn/set-namespace:v0.1.3" in 0s
[RUNNING] "gcr.io/kpt-fn/set-labels:v0.1.4"
[PASS] "gcr.io/kpt-fn/set-labels:v0.1.4" in 0s

Successfully executed 2 function(s) in 1 package(s).
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
diff --git a/Kptfile b/Kptfile
index a47bd49..a402119 100644
--- a/Kptfile
+++ b/Kptfile
@@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: app
+ labels:
+ tier: backend
pipeline:
mutators:
- image: gcr.io/kpt-fn/set-namespace:v0.1.3
diff --git a/resources.yaml b/resources.yaml
index e7eda6a..f50b306 100644
--- a/resources.yaml
+++ b/resources.yaml
@@ -17,8 +17,17 @@ metadata:
name: nginx-deployment
labels:
foo: bar
+ tier: backend
+ namespace: staging
spec:
replicas: 3
+ selector:
+ matchLabels:
+ tier: backend
+ template:
+ metadata:
+ labels:
+ tier: backend
---
apiVersion: custom.io/v1
kind: Custom
@@ -26,5 +35,6 @@ metadata:
name: custom
labels:
foo: bar
+ tier: backend
spec:
image: nginx:1.2.3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.expected
17 changes: 17 additions & 0 deletions e2e/testdata/fn-render/selectors/selectors-with-exclude/Kptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: app
pipeline:
mutators:
- image: gcr.io/kpt-fn/set-namespace:v0.1.3
configMap:
namespace: staging
selectors:
- labels:
foo: bar
exclude:
- kind: Custom
- image: gcr.io/kpt-fn/set-labels:v0.1.4
configMap:
tier: backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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
labels:
foo: bar
spec:
replicas: 3
---
apiVersion: custom.io/v1
kind: Custom
metadata:
name: custom
labels:
foo: bar
spec:
image: nginx:1.2.3
Loading