mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Modify tests to present expected data in unsorted order.
Modify all `build` tests to use the raw, non-sorted output of build. This makes every test provide coverage for how kustomize re-orders (or doesn't reorder) resources during processing. Going forward, the ordering of resources in _expected_ output should match the depth-first ordering specified in the `resources:` field used in the test's kustomization file. The only exception to this rule would be tests that actually confirmed some other output ordering, e.g. the test of the `LegacyOrderTransformer` plugin. Fixes #756 Related #821
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
||||
"sigs.k8s.io/kustomize/pkg/target"
|
||||
"sigs.k8s.io/kustomize/pkg/transformers/config/defaultconfig"
|
||||
"sigs.k8s.io/kustomize/pkg/types"
|
||||
"sigs.k8s.io/kustomize/plugin/builtin"
|
||||
)
|
||||
|
||||
// KustTestHarness helps test kustomization generation and transformation.
|
||||
@@ -190,16 +189,6 @@ func hint(a, b string) string {
|
||||
|
||||
func (th *KustTestHarness) AssertActualEqualsExpected(
|
||||
m resmap.ResMap, expected string) {
|
||||
th.assertActualEqualsExpected(m, expected, true)
|
||||
}
|
||||
|
||||
func (th *KustTestHarness) AssertActualEqualsExpectedNoSort(
|
||||
m resmap.ResMap, expected string) {
|
||||
th.assertActualEqualsExpected(m, expected, false)
|
||||
}
|
||||
|
||||
func (th *KustTestHarness) assertActualEqualsExpected(
|
||||
m resmap.ResMap, expected string, doLegacySort bool) {
|
||||
if m == nil {
|
||||
th.t.Fatalf("Map should not be nil.")
|
||||
}
|
||||
@@ -208,9 +197,6 @@ func (th *KustTestHarness) assertActualEqualsExpected(
|
||||
if len(expected) > 0 && expected[0] == 10 {
|
||||
expected = expected[1:]
|
||||
}
|
||||
if doLegacySort {
|
||||
builtin.NewLegacyOrderTransformerPlugin().Transform(m)
|
||||
}
|
||||
actual, err := m.AsYaml()
|
||||
if err != nil {
|
||||
th.t.Fatalf("Unexpected err: %v", err)
|
||||
|
||||
@@ -79,22 +79,6 @@ func TestMediumBase(t *testing.T) {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
baseAnno: This is a base annotation
|
||||
labels:
|
||||
app: mungebot
|
||||
foo: bar
|
||||
name: baseprefix-mungebot-service
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: mungebot
|
||||
foo: bar
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -125,6 +109,22 @@ spec:
|
||||
name: nginx
|
||||
ports:
|
||||
- containerPort: 80
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
baseAnno: This is a base annotation
|
||||
labels:
|
||||
app: mungebot
|
||||
foo: bar
|
||||
name: baseprefix-mungebot-service
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: mungebot
|
||||
foo: bar
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ commonLabels:
|
||||
repo: test-infra
|
||||
commonAnnotations:
|
||||
note: This is a test annotation
|
||||
bases:
|
||||
resources:
|
||||
- ../base
|
||||
patchesStrategicMerge:
|
||||
- deployment/deployment.yaml
|
||||
@@ -210,63 +210,7 @@ spec:
|
||||
if err != nil {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
// TODO(#669): The name of the patched Deployment is
|
||||
// test-infra-baseprefix-mungebot, retaining the base
|
||||
// prefix (example of correct behavior).
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
data:
|
||||
nonsense: "Lorem ipsum dolor sit amet, consectetur\nadipiscing elit, sed do eiusmod
|
||||
tempor\nincididunt ut labore et dolore magna aliqua. \n"
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mungebot
|
||||
org: kubernetes
|
||||
repo: test-infra
|
||||
name: test-infra-app-config-f462h769f9
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
DB_PASSWORD: somepw
|
||||
DB_USERNAME: admin
|
||||
ENERGY: electronvolt
|
||||
FRUIT: banana
|
||||
LEGUME: chickpea
|
||||
LENGTH: kilometer
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mungebot
|
||||
org: kubernetes
|
||||
repo: test-infra
|
||||
name: test-infra-app-env-ffmd9b969m
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
baseAnno: This is a base annotation
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mungebot
|
||||
foo: bar
|
||||
org: kubernetes
|
||||
repo: test-infra
|
||||
name: test-infra-baseprefix-mungebot-service
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: mungebot
|
||||
foo: bar
|
||||
org: kubernetes
|
||||
repo: test-infra
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -325,5 +269,58 @@ spec:
|
||||
- configMap:
|
||||
name: test-infra-app-env-ffmd9b969m
|
||||
name: app-env
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
baseAnno: This is a base annotation
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mungebot
|
||||
foo: bar
|
||||
org: kubernetes
|
||||
repo: test-infra
|
||||
name: test-infra-baseprefix-mungebot-service
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: mungebot
|
||||
foo: bar
|
||||
org: kubernetes
|
||||
repo: test-infra
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
DB_PASSWORD: somepw
|
||||
DB_USERNAME: admin
|
||||
ENERGY: electronvolt
|
||||
FRUIT: banana
|
||||
LEGUME: chickpea
|
||||
LENGTH: kilometer
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mungebot
|
||||
org: kubernetes
|
||||
repo: test-infra
|
||||
name: test-infra-app-env-ffmd9b969m
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
nonsense: "Lorem ipsum dolor sit amet, consectetur\nadipiscing elit, sed do eiusmod
|
||||
tempor\nincididunt ut labore et dolore magna aliqua. \n"
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mungebot
|
||||
org: kubernetes
|
||||
repo: test-infra
|
||||
name: test-infra-app-config-f462h769f9
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ metadata:
|
||||
if err != nil {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.AssertActualEqualsExpectedNoSort(m, `
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
@@ -197,19 +197,6 @@ func TestSmallBase(t *testing.T) {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: myApp
|
||||
name: a-myService
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: myApp
|
||||
backend: bungie
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -229,6 +216,19 @@ spec:
|
||||
containers:
|
||||
- image: whatever
|
||||
name: whatever
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: myApp
|
||||
name: a-myService
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: myApp
|
||||
backend: bungie
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ func TestSmallOverlay(t *testing.T) {
|
||||
namePrefix: b-
|
||||
commonLabels:
|
||||
env: prod
|
||||
bases:
|
||||
resources:
|
||||
- ../base
|
||||
patchesStrategicMerge:
|
||||
- deployment/deployment.yaml
|
||||
@@ -268,25 +268,7 @@ spec:
|
||||
if err != nil {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
// TODO(#669): The name of the patched Deployment is
|
||||
// b-a-myDeployment, retaining the base prefix
|
||||
// (example of correct behavior).
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: myApp
|
||||
env: prod
|
||||
name: b-a-myService
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: myApp
|
||||
backend: bungie
|
||||
env: prod
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -310,6 +292,21 @@ spec:
|
||||
containers:
|
||||
- image: whatever:1.8.0
|
||||
name: whatever
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: myApp
|
||||
env: prod
|
||||
name: b-a-myService
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: myApp
|
||||
backend: bungie
|
||||
env: prod
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -321,7 +318,7 @@ func TestSharedPatchDisAllowed(t *testing.T) {
|
||||
th.WriteK("/app/overlay", `
|
||||
commonLabels:
|
||||
env: prod
|
||||
bases:
|
||||
resources:
|
||||
- ../base
|
||||
patchesStrategicMerge:
|
||||
- ../shared/deployment-patch.yaml
|
||||
@@ -353,7 +350,7 @@ func TestSharedPatchAllowed(t *testing.T) {
|
||||
th.WriteK("/app/overlay", `
|
||||
commonLabels:
|
||||
env: prod
|
||||
bases:
|
||||
resources:
|
||||
- ../base
|
||||
patchesStrategicMerge:
|
||||
- ../shared/deployment-patch.yaml
|
||||
@@ -371,21 +368,6 @@ spec:
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: myApp
|
||||
env: prod
|
||||
name: a-myService
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: myApp
|
||||
backend: bungie
|
||||
env: prod
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -409,6 +391,21 @@ spec:
|
||||
containers:
|
||||
- image: whatever
|
||||
name: whatever
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: myApp
|
||||
env: prod
|
||||
name: a-myService
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: myApp
|
||||
backend: bungie
|
||||
env: prod
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -416,7 +413,7 @@ func TestSmallOverlayJSONPatch(t *testing.T) {
|
||||
th := kusttest_test.NewKustTestHarness(t, "/app/overlay")
|
||||
writeSmallBase(th)
|
||||
th.WriteK("/app/overlay", `
|
||||
bases:
|
||||
resources:
|
||||
- ../base
|
||||
patchesJson6902:
|
||||
- target:
|
||||
@@ -436,19 +433,6 @@ patchesJson6902:
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: myApp
|
||||
name: a-myService
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: myApp
|
||||
backend: beagle
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -468,5 +452,18 @@ spec:
|
||||
containers:
|
||||
- image: whatever
|
||||
name: whatever
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: myApp
|
||||
name: a-myService
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
selector:
|
||||
app: myApp
|
||||
backend: beagle
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -68,6 +68,24 @@ metadata:
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
annotations:
|
||||
volume.alpha.kubernetes.io/storage-class: default
|
||||
labels:
|
||||
app: release-name-minecraft
|
||||
chart: minecraft-1.0.3
|
||||
heritage: Tiller
|
||||
release: release-name
|
||||
name: LOOOOOOOONG-release-name-minecraft-datadir
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
@@ -85,23 +103,5 @@ spec:
|
||||
selector:
|
||||
app: release-name-minecraft
|
||||
type: LoadBalancer
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
annotations:
|
||||
volume.alpha.kubernetes.io/storage-class: default
|
||||
labels:
|
||||
app: release-name-minecraft
|
||||
chart: minecraft-1.0.3
|
||||
heritage: Tiller
|
||||
release: release-name
|
||||
name: LOOOOOOOONG-release-name-minecraft-datadir
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ configMapGenerator:
|
||||
- from=base
|
||||
`)
|
||||
th.WriteK("/app/overlay/o1", `
|
||||
bases:
|
||||
resources:
|
||||
- ../../base1
|
||||
configMapGenerator:
|
||||
- name: com1
|
||||
@@ -199,7 +199,7 @@ configMapGenerator:
|
||||
- from=overlay
|
||||
`)
|
||||
th.WriteK("/app/overlay/o2", `
|
||||
bases:
|
||||
resources:
|
||||
- ../../base2
|
||||
configMapGenerator:
|
||||
- name: com2
|
||||
@@ -208,7 +208,7 @@ configMapGenerator:
|
||||
- from=overlay
|
||||
`)
|
||||
th.WriteK("/app/overlay", `
|
||||
bases:
|
||||
resources:
|
||||
- o1
|
||||
- o2
|
||||
configMapGenerator:
|
||||
|
||||
@@ -278,7 +278,7 @@ func TestCrdWithOverlay(t *testing.T) {
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namePrefix: prod-
|
||||
bases:
|
||||
resources:
|
||||
- ../base
|
||||
patchesStrategicMerge:
|
||||
- bee.yaml
|
||||
@@ -330,7 +330,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- crd.yaml
|
||||
|
||||
images:
|
||||
- name: test/test
|
||||
newName: registry.gitlab.com/test
|
||||
|
||||
@@ -41,27 +41,27 @@ vars:
|
||||
fieldref:
|
||||
fieldpath: spec.diet
|
||||
resources:
|
||||
- animalPark.yaml
|
||||
- giraffes.yaml
|
||||
- gorilla.yaml
|
||||
- animalPark.yaml
|
||||
configurations:
|
||||
- config/defaults.yaml
|
||||
- config/custom.yaml
|
||||
`)
|
||||
th.WriteF("/app/base/giraffes.yaml", `
|
||||
kind: Giraffe
|
||||
metadata:
|
||||
name: may
|
||||
spec:
|
||||
diet: acacia
|
||||
location: SE
|
||||
---
|
||||
kind: Giraffe
|
||||
metadata:
|
||||
name: april
|
||||
spec:
|
||||
diet: mimosa
|
||||
location: NE
|
||||
---
|
||||
kind: Giraffe
|
||||
metadata:
|
||||
name: may
|
||||
spec:
|
||||
diet: acacia
|
||||
location: SE
|
||||
`)
|
||||
th.WriteF("/app/base/gorilla.yaml", `
|
||||
kind: Gorilla
|
||||
@@ -248,9 +248,8 @@ commonLabels:
|
||||
patchesStrategicMerge:
|
||||
- animalPark.yaml
|
||||
resources:
|
||||
- ursus.yaml
|
||||
bases:
|
||||
- ../base
|
||||
- ursus.yaml
|
||||
`)
|
||||
th.WriteF("/app/overlay/ursus.yaml", `
|
||||
kind: Gorilla
|
||||
@@ -312,15 +311,6 @@ spec:
|
||||
location: SE
|
||||
---
|
||||
kind: Gorilla
|
||||
metadata:
|
||||
labels:
|
||||
movie: planetOfTheApes
|
||||
name: o-ursus
|
||||
spec:
|
||||
diet: heston
|
||||
location: Arizona
|
||||
---
|
||||
kind: Gorilla
|
||||
metadata:
|
||||
labels:
|
||||
app: myApp
|
||||
@@ -329,5 +319,14 @@ metadata:
|
||||
spec:
|
||||
diet: bambooshoots
|
||||
location: SW
|
||||
---
|
||||
kind: Gorilla
|
||||
metadata:
|
||||
labels:
|
||||
movie: planetOfTheApes
|
||||
name: o-ursus
|
||||
spec:
|
||||
diet: heston
|
||||
location: Arizona
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ commonLabels:
|
||||
commonAnnotations:
|
||||
note: This is a test annotation
|
||||
resources:
|
||||
- service.yaml
|
||||
- deployment.yaml
|
||||
- networkpolicy.yaml
|
||||
- service.yaml
|
||||
`)
|
||||
th.WriteF("/app/base/service.yaml", `
|
||||
apiVersion: v1
|
||||
@@ -237,52 +237,6 @@ func TestBaseWithGeneratorsAlone(t *testing.T) {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
data:
|
||||
foo: bar
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
org: example.com
|
||||
team: foo
|
||||
name: team-foo-configmap-in-base-bbdmdh7m8t
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
password: c29tZXB3
|
||||
username: YWRtaW4=
|
||||
kind: Secret
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
org: example.com
|
||||
team: foo
|
||||
name: team-foo-secret-in-base-tkm7hhtf8d
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
org: example.com
|
||||
team: foo
|
||||
name: team-foo-nginx
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
selector:
|
||||
app: mynginx
|
||||
org: example.com
|
||||
team: foo
|
||||
---
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -320,6 +274,52 @@ spec:
|
||||
- configMap:
|
||||
name: team-foo-configmap-in-base-bbdmdh7m8t
|
||||
name: configmap-in-base
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
org: example.com
|
||||
team: foo
|
||||
name: team-foo-nginx
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
selector:
|
||||
app: mynginx
|
||||
org: example.com
|
||||
team: foo
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
foo: bar
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
org: example.com
|
||||
team: foo
|
||||
name: team-foo-configmap-in-base-bbdmdh7m8t
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
password: c29tZXB3
|
||||
username: YWRtaW4=
|
||||
kind: Secret
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
org: example.com
|
||||
team: foo
|
||||
name: team-foo-secret-in-base-tkm7hhtf8d
|
||||
type: Opaque
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -351,9 +351,9 @@ commonLabels:
|
||||
env: staging
|
||||
team: override-foo
|
||||
patchesStrategicMerge:
|
||||
- deployment.yaml
|
||||
bases:
|
||||
- ../app
|
||||
- deployment.yaml
|
||||
resources:
|
||||
- ../app
|
||||
configMapGenerator:
|
||||
- name: configmap-in-overlay
|
||||
literals:
|
||||
@@ -373,67 +373,6 @@ secretGenerator:
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
data:
|
||||
hello: world
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
env: staging
|
||||
team: override-foo
|
||||
name: staging-configmap-in-overlay-k7cbc75tg8
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
foo: override-bar
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: override-foo
|
||||
name: staging-team-foo-configmap-in-base-gh9d7t85gb
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
password: c29tZXB3
|
||||
proxy: aGFwcm94eQ==
|
||||
username: YWRtaW4=
|
||||
kind: Secret
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: override-foo
|
||||
name: staging-team-foo-secret-in-base-c8db7gk2m2
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: override-foo
|
||||
name: staging-team-foo-nginx
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
selector:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: override-foo
|
||||
---
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -478,6 +417,67 @@ spec:
|
||||
- configMap:
|
||||
name: staging-team-foo-configmap-in-base-gh9d7t85gb
|
||||
name: configmap-in-base
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: override-foo
|
||||
name: staging-team-foo-nginx
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
selector:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: override-foo
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
foo: override-bar
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: override-foo
|
||||
name: staging-team-foo-configmap-in-base-gh9d7t85gb
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
password: c29tZXB3
|
||||
proxy: aGFwcm94eQ==
|
||||
username: YWRtaW4=
|
||||
kind: Secret
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: override-foo
|
||||
name: staging-team-foo-secret-in-base-c8db7gk2m2
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
hello: world
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
env: staging
|
||||
team: override-foo
|
||||
name: staging-configmap-in-overlay-k7cbc75tg8
|
||||
`)
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ configMapGenerator:
|
||||
th.WriteK("/app/overlay", `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
bases:
|
||||
resources:
|
||||
- ../base
|
||||
generatorOptions:
|
||||
disableNameSuffixHash: false
|
||||
@@ -95,15 +95,6 @@ configMapGenerator:
|
||||
}
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
data:
|
||||
fruit: apple
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
fruit: apple
|
||||
name: shouldHaveHash-2k9hc848ff
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
foo: bar
|
||||
kind: ConfigMap
|
||||
@@ -111,5 +102,14 @@ metadata:
|
||||
labels:
|
||||
foo: bar
|
||||
name: shouldNotHaveHash
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
fruit: apple
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
fruit: apple
|
||||
name: shouldHaveHash-2k9hc848ff
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -256,15 +256,15 @@ func TestIssue596AllowDirectoriesThatAreSubstringsOfEachOther(t *testing.T) {
|
||||
th := kusttest_test.NewKustTestHarness(t, "/app/overlays/aws-sandbox2.us-east-1")
|
||||
th.WriteK("/app/base", "")
|
||||
th.WriteK("/app/overlays/aws", `
|
||||
bases:
|
||||
resources:
|
||||
- ../../base
|
||||
`)
|
||||
th.WriteK("/app/overlays/aws-nonprod", `
|
||||
bases:
|
||||
resources:
|
||||
- ../aws
|
||||
`)
|
||||
th.WriteK("/app/overlays/aws-sandbox2.us-east-1", `
|
||||
bases:
|
||||
resources:
|
||||
- ../aws-nonprod
|
||||
`)
|
||||
m, err := th.MakeKustTarget().MakeCustomizedResMap()
|
||||
@@ -363,7 +363,7 @@ vars:
|
||||
objref:
|
||||
kind: Service
|
||||
name: apple
|
||||
bases:
|
||||
resources:
|
||||
- ../../base
|
||||
`)
|
||||
th.WriteK("/app/overlays/o2", `
|
||||
@@ -372,7 +372,7 @@ vars:
|
||||
objref:
|
||||
kind: Leafy
|
||||
name: kale
|
||||
bases:
|
||||
resources:
|
||||
- ../o1
|
||||
`)
|
||||
ra, err := th.MakeKustTarget().AccumulateTarget()
|
||||
@@ -416,7 +416,7 @@ vars:
|
||||
objref:
|
||||
kind: Service
|
||||
name: academy
|
||||
bases:
|
||||
resources:
|
||||
- ../../base
|
||||
`)
|
||||
th.WriteK("/app/overlays/o2", `
|
||||
@@ -425,7 +425,7 @@ vars:
|
||||
objref:
|
||||
kind: Leafy
|
||||
name: kale
|
||||
bases:
|
||||
resources:
|
||||
- ../o1
|
||||
`)
|
||||
_, err := th.MakeKustTarget().AccumulateTarget()
|
||||
|
||||
@@ -90,7 +90,7 @@ commonLabels:
|
||||
patchesStrategicMerge:
|
||||
- deployment-patch1.yaml
|
||||
- deployment-patch2.yaml
|
||||
bases:
|
||||
resources:
|
||||
- ../../base
|
||||
configMapGenerator:
|
||||
- name: configmap-in-overlay
|
||||
@@ -148,49 +148,6 @@ spec:
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
data:
|
||||
hello: world
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
env: staging
|
||||
name: staging-configmap-in-overlay-k7cbc75tg8
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
foo: bar
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: foo
|
||||
name: staging-team-foo-configmap-in-base-g7k6gt2889
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: foo
|
||||
name: staging-team-foo-nginx
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
selector:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: foo
|
||||
---
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -242,6 +199,49 @@ spec:
|
||||
- configMap:
|
||||
name: staging-team-foo-configmap-in-base-g7k6gt2889
|
||||
name: configmap-in-base
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: foo
|
||||
name: staging-team-foo-nginx
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
selector:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: foo
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
foo: bar
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
note: This is a test annotation
|
||||
labels:
|
||||
app: mynginx
|
||||
env: staging
|
||||
org: example.com
|
||||
team: foo
|
||||
name: staging-team-foo-configmap-in-base-g7k6gt2889
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
hello: world
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
env: staging
|
||||
name: staging-configmap-in-overlay-k7cbc75tg8
|
||||
`)
|
||||
}
|
||||
|
||||
|
||||
@@ -107,38 +107,6 @@ data:
|
||||
}
|
||||
//nolint
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
kustomize.config.k8s.io/Inventory: '{"current":{"apps_v1beta2_Deployment|default|my-mysql":null,"~G_v1_Secret|default|my-pass":[{"group":"apps","version":"v1beta2","kind":"Deployment","name":"my-mysql","namespace":"default"}],"~G_v1_Service|default|my-mmmysql":null}}'
|
||||
kustomize.config.k8s.io/InventoryHash: kd67f7ht8t
|
||||
name: haha
|
||||
namespace: default
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
password: YWRtaW4=
|
||||
username: jingfang
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: my-pass
|
||||
namespace: default
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: mysql
|
||||
name: my-mmmysql
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- port: 3306
|
||||
selector:
|
||||
app: mysql
|
||||
---
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -175,5 +143,37 @@ spec:
|
||||
volumes:
|
||||
- emptyDir: {}
|
||||
name: mysql-persistent-storage
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: mysql
|
||||
name: my-mmmysql
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- port: 3306
|
||||
selector:
|
||||
app: mysql
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
password: YWRtaW4=
|
||||
username: jingfang
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: my-pass
|
||||
namespace: default
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
kustomize.config.k8s.io/Inventory: '{"current":{"apps_v1beta2_Deployment|default|my-mysql":null,"~G_v1_Secret|default|my-pass":[{"group":"apps","version":"v1beta2","kind":"Deployment","name":"my-mysql","namespace":"default"}],"~G_v1_Service|default|my-mmmysql":null}}'
|
||||
kustomize.config.k8s.io/InventoryHash: kd67f7ht8t
|
||||
name: haha
|
||||
namespace: default
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -42,13 +42,13 @@ subjects:
|
||||
func writeMidOverlays(th *kusttest_test.KustTestHarness) {
|
||||
// Mid-level overlays
|
||||
th.WriteK("/app/overlays/a", `
|
||||
bases:
|
||||
resources:
|
||||
- ../../base
|
||||
namePrefix: a-
|
||||
nameSuffix: -suffixA
|
||||
`)
|
||||
th.WriteK("/app/overlays/b", `
|
||||
bases:
|
||||
resources:
|
||||
- ../../base
|
||||
namePrefix: b-
|
||||
nameSuffix: -suffixB
|
||||
@@ -58,7 +58,7 @@ nameSuffix: -suffixB
|
||||
func writeTopOverlay(th *kusttest_test.KustTestHarness) {
|
||||
// Top overlay, combining the mid-level overlays
|
||||
th.WriteK("/app/combined", `
|
||||
bases:
|
||||
resources:
|
||||
- ../overlays/a
|
||||
- ../overlays/b
|
||||
`)
|
||||
@@ -162,11 +162,6 @@ kind: ServiceAccount
|
||||
metadata:
|
||||
name: a-pfx-serviceaccount-sfx-suffixA
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: b-pfx-serviceaccount-sfx-suffixB
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
@@ -179,6 +174,11 @@ subjects:
|
||||
- kind: ServiceAccount
|
||||
name: a-pfx-serviceaccount-sfx-suffixA
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: b-pfx-serviceaccount-sfx-suffixB
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
@@ -200,12 +200,11 @@ func TestMultibasesWithConflict(t *testing.T) {
|
||||
writeTopOverlay(th)
|
||||
|
||||
th.WriteK("/app/overlays/a", `
|
||||
bases:
|
||||
- ../../base
|
||||
namePrefix: a-
|
||||
nameSuffix: -suffixA
|
||||
resources:
|
||||
- serviceaccount.yaml
|
||||
- ../../base
|
||||
`)
|
||||
// Expect an error because this resource in the overlay
|
||||
// matches a resource in the base.
|
||||
|
||||
@@ -27,8 +27,11 @@ func TestVariableRef(t *testing.T) {
|
||||
th.WriteK("/app/base", `
|
||||
namePrefix: base-
|
||||
resources:
|
||||
- cockroachdb-statefulset-secure.yaml
|
||||
- cronjob.yaml
|
||||
- role-stuff.yaml
|
||||
- services.yaml
|
||||
- statefulset.yaml
|
||||
- cronjob.yaml
|
||||
- pdb.yaml
|
||||
configMapGenerator:
|
||||
- name: test-config-map
|
||||
literals:
|
||||
@@ -87,7 +90,54 @@ spec:
|
||||
- name: CDB_PUBLIC_SVC
|
||||
value: "$(CDB_PUBLIC_SVC)"
|
||||
`)
|
||||
th.WriteF("/app/base/cockroachdb-statefulset-secure.yaml", `
|
||||
th.WriteF("/app/base/services.yaml", `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cockroachdb
|
||||
labels:
|
||||
app: cockroachdb
|
||||
annotations:
|
||||
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
|
||||
# Enable automatic monitoring of all instances when Prometheus is running in the cluster.
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/path: "_status/vars"
|
||||
prometheus.io/port: "8080"
|
||||
spec:
|
||||
ports:
|
||||
- port: 26257
|
||||
targetPort: 26257
|
||||
name: grpc
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
name: http
|
||||
clusterIP: None
|
||||
selector:
|
||||
app: cockroachdb
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
# This service is meant to be used by clients of the database. It exposes a ClusterIP that will
|
||||
# automatically load balance connections to the different database pods.
|
||||
name: cockroachdb-public
|
||||
labels:
|
||||
app: cockroachdb
|
||||
spec:
|
||||
ports:
|
||||
# The main port, served by gRPC, serves Postgres-flavor SQL, internode
|
||||
# traffic and the cli.
|
||||
- port: 26257
|
||||
targetPort: 26257
|
||||
name: grpc
|
||||
# The secondary port serves the UI as well as health and debug endpoints.
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
name: http
|
||||
selector:
|
||||
app: cockroachdb
|
||||
`)
|
||||
th.WriteF("/app/base/role-stuff.yaml", `
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
@@ -155,53 +205,8 @@ subjects:
|
||||
- kind: ServiceAccount
|
||||
name: cockroachdb
|
||||
namespace: default
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
# This service is meant to be used by clients of the database. It exposes a ClusterIP that will
|
||||
# automatically load balance connections to the different database pods.
|
||||
name: cockroachdb-public
|
||||
labels:
|
||||
app: cockroachdb
|
||||
spec:
|
||||
ports:
|
||||
# The main port, served by gRPC, serves Postgres-flavor SQL, internode
|
||||
# traffic and the cli.
|
||||
- port: 26257
|
||||
targetPort: 26257
|
||||
name: grpc
|
||||
# The secondary port serves the UI as well as health and debug endpoints.
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
name: http
|
||||
selector:
|
||||
app: cockroachdb
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cockroachdb
|
||||
labels:
|
||||
app: cockroachdb
|
||||
annotations:
|
||||
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
|
||||
# Enable automatic monitoring of all instances when Prometheus is running in the cluster.
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/path: "_status/vars"
|
||||
prometheus.io/port: "8080"
|
||||
spec:
|
||||
ports:
|
||||
- port: 26257
|
||||
targetPort: 26257
|
||||
name: grpc
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
name: http
|
||||
clusterIP: None
|
||||
selector:
|
||||
app: cockroachdb
|
||||
---
|
||||
`)
|
||||
th.WriteF("/app/base/pdb.yaml", `
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
@@ -213,7 +218,8 @@ spec:
|
||||
matchLabels:
|
||||
app: cockroachdb
|
||||
maxUnavailable: 1
|
||||
---
|
||||
`)
|
||||
th.WriteF("/app/base/statefulset.yaml", `
|
||||
apiVersion: apps/v1beta1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
@@ -324,7 +330,7 @@ spec:
|
||||
`)
|
||||
th.WriteK("/app/overlay/staging", `
|
||||
namePrefix: dev-
|
||||
bases:
|
||||
resources:
|
||||
- ../../base
|
||||
`)
|
||||
m, err := th.MakeKustTarget().MakeCustomizedResMap()
|
||||
@@ -401,14 +407,6 @@ subjects:
|
||||
namespace: default
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
baz: qux
|
||||
foo: bar
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: dev-base-test-config-map-b2g2dmd64b
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
@@ -575,6 +573,14 @@ spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cockroachdb
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
baz: qux
|
||||
foo: bar
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: dev-base-test-config-map-b2g2dmd64b
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -582,9 +588,9 @@ func TestVariableRefIngress(t *testing.T) {
|
||||
th := kusttest_test.NewKustTestHarness(t, "/app/overlay")
|
||||
th.WriteK("/app/base", `
|
||||
resources:
|
||||
- service.yaml
|
||||
- deployment.yaml
|
||||
- ingress.yaml
|
||||
- service.yaml
|
||||
|
||||
vars:
|
||||
- name: DEPLOYMENT_NAME
|
||||
@@ -655,7 +661,7 @@ spec:
|
||||
`)
|
||||
th.WriteK("/app/overlay", `
|
||||
nameprefix: kustomized-
|
||||
bases:
|
||||
resources:
|
||||
- ../base
|
||||
`)
|
||||
m, err := th.MakeKustTarget().MakeCustomizedResMap()
|
||||
@@ -768,11 +774,6 @@ vars:
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: my-namespace
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -792,6 +793,11 @@ spec:
|
||||
volumes:
|
||||
- emptyDir: {}
|
||||
name: my-volume
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: my-namespace
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -834,11 +840,6 @@ vars:
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: my-namespace
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -851,6 +852,11 @@ spec:
|
||||
containers:
|
||||
- image: busybox
|
||||
name: app
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: my-namespace
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -858,7 +864,7 @@ func TestVaribaleRefDifferentPrefix(t *testing.T) {
|
||||
th := kusttest_test.NewKustTestHarness(t, "/app/base")
|
||||
th.WriteK("/app/base", `
|
||||
namePrefix: base-
|
||||
bases:
|
||||
resources:
|
||||
- dev
|
||||
- test
|
||||
`)
|
||||
@@ -948,28 +954,6 @@ spec:
|
||||
}
|
||||
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: base-dev-elasticsearch
|
||||
spec:
|
||||
clusterIP: None
|
||||
ports:
|
||||
- name: transport
|
||||
port: 9300
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: base-test-elasticsearch
|
||||
spec:
|
||||
clusterIP: None
|
||||
ports:
|
||||
- name: transport
|
||||
port: 9300
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
@@ -983,6 +967,17 @@ spec:
|
||||
value: base-dev-elasticsearch.monitoring.svc.cluster.local
|
||||
name: elasticsearch
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: base-dev-elasticsearch
|
||||
spec:
|
||||
clusterIP: None
|
||||
ports:
|
||||
- name: transport
|
||||
port: 9300
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
@@ -995,5 +990,16 @@ spec:
|
||||
- name: DISCOVERY_SERVICE
|
||||
value: base-test-elasticsearch.monitoring.svc.cluster.local
|
||||
name: elasticsearch
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: base-test-elasticsearch
|
||||
spec:
|
||||
clusterIP: None
|
||||
ports:
|
||||
- name: transport
|
||||
port: 9300
|
||||
protocol: TCP
|
||||
`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user