mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-09-15 12:18:57 +00:00
Replace 'patch' with 'comp' in test data.
This commit is contained in:
@@ -52,8 +52,8 @@ spec:
|
|||||||
}
|
}
|
||||||
|
|
||||||
func writeTestComponent(th kusttest_test.Harness) {
|
func writeTestComponent(th kusttest_test.Harness) {
|
||||||
th.WriteC("/app/patch", `
|
th.WriteC("/app/comp", `
|
||||||
namePrefix: patched-
|
namePrefix: comp-
|
||||||
replicas:
|
replicas:
|
||||||
- name: storefront
|
- name: storefront
|
||||||
count: 3
|
count: 3
|
||||||
@@ -64,9 +64,9 @@ configMapGenerator:
|
|||||||
behavior: merge
|
behavior: merge
|
||||||
literals:
|
literals:
|
||||||
- testValue=2
|
- testValue=2
|
||||||
- patchValue=5
|
- compValue=5
|
||||||
`)
|
`)
|
||||||
th.WriteF("/app/patch/stub.yaml", `
|
th.WriteF("/app/comp/stub.yaml", `
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
@@ -83,7 +83,7 @@ resources:
|
|||||||
- db
|
- db
|
||||||
|
|
||||||
components:
|
components:
|
||||||
- ../patch
|
- ../comp
|
||||||
`)
|
`)
|
||||||
writeDB(th)
|
writeDB(th)
|
||||||
}
|
}
|
||||||
@@ -114,39 +114,39 @@ func TestComponent(t *testing.T) {
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-storefront
|
name: comp-storefront
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
replicas: 3
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
data:
|
data:
|
||||||
|
compValue: "5"
|
||||||
otherValue: "10"
|
otherValue: "10"
|
||||||
patchValue: "5"
|
|
||||||
testValue: "2"
|
testValue: "2"
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
annotations: {}
|
annotations: {}
|
||||||
labels: {}
|
labels: {}
|
||||||
name: patched-my-configmap-5g55h28cdh
|
name: comp-my-configmap-ct5bgtbccd
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-db
|
name: comp-db
|
||||||
spec:
|
spec:
|
||||||
type: Logical
|
type: Logical
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-stub
|
name: comp-stub
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
"multiple-components": {
|
"multiple-components": {
|
||||||
input: []FileGen{writeTestBase, writeTestComponent, writeDB,
|
input: []FileGen{writeTestBase, writeTestComponent, writeDB,
|
||||||
writeC("/app/additionalpatch", `
|
writeC("/app/additionalcomp", `
|
||||||
configMapGenerator:
|
configMapGenerator:
|
||||||
- name: my-configmap
|
- name: my-configmap
|
||||||
behavior: merge
|
behavior: merge
|
||||||
@@ -159,8 +159,8 @@ resources:
|
|||||||
- db
|
- db
|
||||||
|
|
||||||
components:
|
components:
|
||||||
- ../patch
|
- ../comp
|
||||||
- ../additionalpatch
|
- ../additionalcomp
|
||||||
`),
|
`),
|
||||||
},
|
},
|
||||||
runPath: "/app/prod",
|
runPath: "/app/prod",
|
||||||
@@ -168,41 +168,41 @@ components:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-storefront
|
name: comp-storefront
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
replicas: 3
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
data:
|
data:
|
||||||
|
compValue: "5"
|
||||||
otherValue: "9"
|
otherValue: "9"
|
||||||
patchValue: "5"
|
|
||||||
testValue: "2"
|
testValue: "2"
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
annotations: {}
|
annotations: {}
|
||||||
labels: {}
|
labels: {}
|
||||||
name: patched-my-configmap-9fddc87cdk
|
name: comp-my-configmap-dgf97tmg6h
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-db
|
name: comp-db
|
||||||
spec:
|
spec:
|
||||||
type: Logical
|
type: Logical
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-stub
|
name: comp-stub
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
"nested-components": {
|
"nested-components": {
|
||||||
input: []FileGen{writeTestBase, writeTestComponent, writeDB,
|
input: []FileGen{writeTestBase, writeTestComponent, writeDB,
|
||||||
writeC("/app/additionalpatch", `
|
writeC("/app/additionalcomp", `
|
||||||
components:
|
components:
|
||||||
- ../patch
|
- ../comp
|
||||||
configMapGenerator:
|
configMapGenerator:
|
||||||
- name: my-configmap
|
- name: my-configmap
|
||||||
behavior: merge
|
behavior: merge
|
||||||
@@ -215,7 +215,7 @@ resources:
|
|||||||
- db
|
- db
|
||||||
|
|
||||||
components:
|
components:
|
||||||
- ../additionalpatch
|
- ../additionalcomp
|
||||||
`),
|
`),
|
||||||
},
|
},
|
||||||
runPath: "/app/prod",
|
runPath: "/app/prod",
|
||||||
@@ -223,38 +223,38 @@ components:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-storefront
|
name: comp-storefront
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
replicas: 3
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
data:
|
data:
|
||||||
|
compValue: "5"
|
||||||
otherValue: "9"
|
otherValue: "9"
|
||||||
patchValue: "5"
|
|
||||||
testValue: "2"
|
testValue: "2"
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
annotations: {}
|
annotations: {}
|
||||||
labels: {}
|
labels: {}
|
||||||
name: patched-my-configmap-9fddc87cdk
|
name: comp-my-configmap-dgf97tmg6h
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-db
|
name: comp-db
|
||||||
spec:
|
spec:
|
||||||
type: Logical
|
type: Logical
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-stub
|
name: comp-stub
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
// If a patch sets a name prefix on a base, then that base can also be separately included
|
// If a component sets a name prefix on a base, then that base can also be separately included
|
||||||
// without being affected by the patch in another branch of the resource tree
|
// without being affected by the component in another branch of the resource tree
|
||||||
"basic-component-with-repeated-base": {
|
"basic-component-with-repeated-base": {
|
||||||
input: []FileGen{writeTestBase, writeTestComponent, writeOverlayProd,
|
input: []FileGen{writeTestBase, writeTestComponent, writeOverlayProd,
|
||||||
writeK("/app/repeated", `
|
writeK("/app/repeated", `
|
||||||
@@ -283,32 +283,32 @@ metadata:
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-storefront
|
name: comp-storefront
|
||||||
spec:
|
spec:
|
||||||
replicas: 3
|
replicas: 3
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
data:
|
data:
|
||||||
|
compValue: "5"
|
||||||
otherValue: "10"
|
otherValue: "10"
|
||||||
patchValue: "5"
|
|
||||||
testValue: "2"
|
testValue: "2"
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
annotations: {}
|
annotations: {}
|
||||||
labels: {}
|
labels: {}
|
||||||
name: patched-my-configmap-5g55h28cdh
|
name: comp-my-configmap-ct5bgtbccd
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-db
|
name: comp-db
|
||||||
spec:
|
spec:
|
||||||
type: Logical
|
type: Logical
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: patched-stub
|
name: comp-stub
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
`,
|
`,
|
||||||
@@ -322,7 +322,7 @@ configMapGenerator:
|
|||||||
- name: my-configmap
|
- name: my-configmap
|
||||||
behavior: merge
|
behavior: merge
|
||||||
literals:
|
literals:
|
||||||
- patchValue=5
|
- compValue=5
|
||||||
- testValue=2
|
- testValue=2
|
||||||
`),
|
`),
|
||||||
},
|
},
|
||||||
@@ -337,19 +337,19 @@ spec:
|
|||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
data:
|
data:
|
||||||
|
compValue: "5"
|
||||||
otherValue: "10"
|
otherValue: "10"
|
||||||
patchValue: "5"
|
|
||||||
testValue: "2"
|
testValue: "2"
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
annotations: {}
|
annotations: {}
|
||||||
labels: {}
|
labels: {}
|
||||||
name: my-configmap-t86ktk6tdk
|
name: my-configmap-96dt22k28h
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
"missing-optional-component-api-version": {
|
"missing-optional-component-api-version": {
|
||||||
input: []FileGen{writeTestBase, writeOverlayProd,
|
input: []FileGen{writeTestBase, writeOverlayProd,
|
||||||
writeF("/app/patch/"+konfig.DefaultKustomizationFileName(), `
|
writeF("/app/comp/"+konfig.DefaultKustomizationFileName(), `
|
||||||
kind: Component
|
kind: Component
|
||||||
configMapGenerator:
|
configMapGenerator:
|
||||||
- name: my-configmap
|
- name: my-configmap
|
||||||
@@ -410,18 +410,18 @@ func TestComponentErrors(t *testing.T) {
|
|||||||
writeK("/app/compinres", `
|
writeK("/app/compinres", `
|
||||||
resources:
|
resources:
|
||||||
- ../base
|
- ../base
|
||||||
- ../patch
|
- ../comp
|
||||||
`),
|
`),
|
||||||
},
|
},
|
||||||
runPath: "app/compinres",
|
runPath: "app/compinres",
|
||||||
expectedError: "expected kind != 'Component' for path '/app/patch'",
|
expectedError: "expected kind != 'Component' for path '/app/comp'",
|
||||||
},
|
},
|
||||||
"kustomizations-cannot-be-added-to-components": {
|
"kustomizations-cannot-be-added-to-components": {
|
||||||
input: []FileGen{writeTestBase, writeTestComponent,
|
input: []FileGen{writeTestBase, writeTestComponent,
|
||||||
writeK("/app/kustincomponents", `
|
writeK("/app/kustincomponents", `
|
||||||
components:
|
components:
|
||||||
- ../base
|
- ../base
|
||||||
- ../patch
|
- ../comp
|
||||||
`),
|
`),
|
||||||
},
|
},
|
||||||
runPath: "/app/kustincomponents",
|
runPath: "/app/kustincomponents",
|
||||||
@@ -441,7 +441,7 @@ spec:
|
|||||||
writeK("/app/filesincomponents", `
|
writeK("/app/filesincomponents", `
|
||||||
components:
|
components:
|
||||||
- stub.yaml
|
- stub.yaml
|
||||||
- ../patch
|
- ../comp
|
||||||
`),
|
`),
|
||||||
},
|
},
|
||||||
runPath: "/app/filesincomponents",
|
runPath: "/app/filesincomponents",
|
||||||
@@ -449,7 +449,7 @@ components:
|
|||||||
},
|
},
|
||||||
"invalid-component-api-version": {
|
"invalid-component-api-version": {
|
||||||
input: []FileGen{writeTestBase, writeOverlayProd,
|
input: []FileGen{writeTestBase, writeOverlayProd,
|
||||||
writeF("/app/patch/"+konfig.DefaultKustomizationFileName(), `
|
writeF("/app/comp/"+konfig.DefaultKustomizationFileName(), `
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Component
|
kind: Component
|
||||||
configMapGenerator:
|
configMapGenerator:
|
||||||
|
|||||||
Reference in New Issue
Block a user