mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 09:02:53 +00:00
refactor: inlineAnyEmbeddedLists
This commit is contained in:
@@ -61,8 +61,6 @@ metadata:
|
||||
apiVersion: example.com/v1alpha1
|
||||
kind: MyResourceList
|
||||
metadata:
|
||||
annotations:
|
||||
kustomize.config.k8s.io/convertToInlineList: "false"
|
||||
name: test
|
||||
rules: []
|
||||
`)
|
||||
@@ -77,8 +75,6 @@ metadata:
|
||||
apiVersion: example.com/v1alpha1
|
||||
kind: MyResourceList
|
||||
metadata:
|
||||
annotations:
|
||||
kustomize.config.k8s.io/convertToInlineList: "false"
|
||||
name: test
|
||||
rules: []
|
||||
`)
|
||||
@@ -95,8 +91,6 @@ resources:
|
||||
apiVersion: infra.protonbase.io/v1alpha1
|
||||
kind: AccessWhiteList
|
||||
metadata:
|
||||
annotations:
|
||||
kustomize.config.k8s.io/convertToInlineList: "false"
|
||||
name: wlmls5769f
|
||||
namespace: dc7i4hyxzw
|
||||
spec:
|
||||
@@ -110,8 +104,6 @@ spec:
|
||||
apiVersion: infra.protonbase.io/v1alpha1
|
||||
kind: AccessWhiteList
|
||||
metadata:
|
||||
annotations:
|
||||
kustomize.config.k8s.io/convertToInlineList: "false"
|
||||
name: wlmls5769f
|
||||
namespace: dc7i4hyxzw
|
||||
spec:
|
||||
@@ -119,4 +111,104 @@ spec:
|
||||
- sourceIps: 0.0.0.0/16
|
||||
`)
|
||||
|
||||
}
|
||||
|
||||
func TestListToIndividualResources(t *testing.T) {
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
th.WriteK(".", `
|
||||
resources:
|
||||
- list.yaml
|
||||
`)
|
||||
|
||||
th.WriteF("list.yaml", `
|
||||
apiVersion: v1
|
||||
kind: PodList
|
||||
items:
|
||||
- apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: my-pod-1
|
||||
namespace: default
|
||||
labels:
|
||||
app: my-app
|
||||
spec:
|
||||
containers:
|
||||
- name: my-container
|
||||
image: nginx:1.19.10
|
||||
ports:
|
||||
- containerPort: 80
|
||||
- apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: my-pod-2
|
||||
namespace: default
|
||||
labels:
|
||||
app: my-app
|
||||
spec:
|
||||
containers:
|
||||
- name: my-container
|
||||
image: nginx:1.19.10
|
||||
ports:
|
||||
- containerPort: 80
|
||||
- apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: my-pod-3
|
||||
namespace: default
|
||||
labels:
|
||||
app: my-app
|
||||
spec:
|
||||
containers:
|
||||
- name: my-container
|
||||
image: nginx:1.19.10
|
||||
ports:
|
||||
- containerPort: 80
|
||||
`)
|
||||
|
||||
m := th.Run(".", th.MakeDefaultOptions())
|
||||
|
||||
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
labels:
|
||||
app: my-app
|
||||
name: my-pod-1
|
||||
namespace: default
|
||||
spec:
|
||||
containers:
|
||||
- image: nginx:1.19.10
|
||||
name: my-container
|
||||
ports:
|
||||
- containerPort: 80
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
labels:
|
||||
app: my-app
|
||||
name: my-pod-2
|
||||
namespace: default
|
||||
spec:
|
||||
containers:
|
||||
- image: nginx:1.19.10
|
||||
name: my-container
|
||||
ports:
|
||||
- containerPort: 80
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
labels:
|
||||
app: my-app
|
||||
name: my-pod-3
|
||||
namespace: default
|
||||
spec:
|
||||
containers:
|
||||
- image: nginx:1.19.10
|
||||
name: my-container
|
||||
ports:
|
||||
- containerPort: 80
|
||||
`)
|
||||
}
|
||||
Reference in New Issue
Block a user