Skip to content

Commit

Permalink
Update all readers with PreserveSeqIndent option and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phanimarupaka committed Jul 13, 2021
1 parent 49a252e commit c52869f
Show file tree
Hide file tree
Showing 49 changed files with 985 additions and 571 deletions.
69 changes: 0 additions & 69 deletions e2e/testdata/fn-eval/consistent-formatting/.expected/diff.patch

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,53 @@ 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:
# 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
annotations:
config.kubernetes.io/index: "0"
config.kubernetes.io/path: resources.yaml
internal.config.kubernetes.io/seqindent: compact
foo: bar
namespace: staging
labels:
tier: backend
spec:
replicas: 3
template:
metadata:
annotations:
foo: bar
labels:
tier: backend
template:
metadata:
labels:
tier: backend
annotations:
foo: bar
- apiVersion: custom.io/v1
kind: Custom
metadata:
name: custom
namespace: staging
labels:
selector:
matchLabels:
tier: backend
annotations:
config.kubernetes.io/index: "1"
config.kubernetes.io/path: resources.yaml
foo: bar
spec:
image: nginx:1.2.3
- apiVersion: custom.io/v1
kind: Custom
metadata:
name: custom
annotations:
config.kubernetes.io/index: "1"
config.kubernetes.io/path: resources.yaml
internal.config.kubernetes.io/seqindent: compact
foo: bar
namespace: staging
labels:
tier: backend
spec:
image: nginx:1.2.3
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,48 @@ stdErr: |
[RUNNING] "gcr.io/kpt-fn/set-labels:v0.1.3"
[PASS] "gcr.io/kpt-fn/set-labels:v0.1.3"
stdOut: |
# 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
annotations:
foo: bar
namespace: staging
labels:
tier: backend
annotations:
foo: bar
spec:
replicas: 3
selector:
matchLabels:
tier: backend
template:
metadata:
labels:
tier: backend
annotations:
foo: bar
labels:
tier: backend
selector:
matchLabels:
tier: backend
---
apiVersion: custom.io/v1
kind: Custom
metadata:
name: custom
annotations:
foo: bar
namespace: staging
labels:
tier: backend
annotations:
foo: bar
spec:
image: nginx:1.2.3
68 changes: 35 additions & 33 deletions e2e/testdata/fn-eval/output-to-stdout/.expected/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,38 @@ 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
annotations:
config.kubernetes.io/index: "0"
config.kubernetes.io/path: resources.yaml
spec:
replicas: 3
- apiVersion: custom.io/v1
kind: Custom
metadata:
name: custom
namespace: staging
annotations:
config.kubernetes.io/index: "1"
config.kubernetes.io/path: resources.yaml
spec:
image: nginx:1.2.3
- # 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
annotations:
config.kubernetes.io/index: "0"
config.kubernetes.io/path: resources.yaml
internal.config.kubernetes.io/seqindent: compact
namespace: staging
spec:
replicas: 3
- apiVersion: custom.io/v1
kind: Custom
metadata:
name: custom
annotations:
config.kubernetes.io/index: "1"
config.kubernetes.io/path: resources.yaml
internal.config.kubernetes.io/seqindent: compact
namespace: staging
spec:
image: nginx:1.2.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/Kptfile b/Kptfile
index 1f982e2..70d659f 100644
--- a/Kptfile
+++ b/Kptfile
@@ -2,6 +2,7 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: nginx
+ namespace: staging
info:
description: describe this package
site: https://github.com/GoogleContainerTools/kpt
diff --git a/resources.yaml b/resources.yaml
index f79e0a8..ce92e77 100644
--- a/resources.yaml
+++ b/resources.yaml
@@ -17,6 +17,7 @@ metadata:
labels:
foo: bar
name: my-nginx
+ namespace: staging
spec:
replicas: 3
selector:
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ spec:
app: nginx
spec:
containers:
- image: 'nginx:1.14.2'
name: nginx
ports:
- containerPort: 80
protocol: TCP
- image: nginx:1.14.2
name: nginx
ports:
- containerPort: 80
protocol: TCP
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
diff --git a/db/resources.yaml b/db/resources.yaml
index ac1fd96..2fa6e44 100644
index ac1fd96..0c25e84 100644
--- a/db/resources.yaml
+++ b/db/resources.yaml
@@ -15,5 +15,15 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: db
+ namespace: staging
+ labels:
+ tier: db
+ namespace: staging
spec:
replicas: 3
+ selector:
Expand Down Expand Up @@ -36,4 +36,4 @@ index 7a494c9..254b9cd 100644
name: custom
+ namespace: staging
spec:
image: nginx:1.2.3
image: nginx:1.2.3
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff --git a/another/file/out.yaml b/another/file/out.yaml
new file mode 100644
index 0000000..fa83ef1
index 0000000..6d9fb79
--- /dev/null
+++ b/another/file/out.yaml
@@ -0,0 +1,13 @@
Expand All @@ -13,7 +13,7 @@ index 0000000..fa83ef1
+ template:
+ spec:
+ containers:
+ - name: httpbin
+ image: kennethreitz/httpbin
+ ports:
+ - containerPort: 9876
+ - name: httpbin
+ image: kennethreitz/httpbin
+ ports:
+ - containerPort: 9876
Loading

0 comments on commit c52869f

Please # to comment.