Deprecate 'bases:' field.

This commit is contained in:
Jeffrey Regan
2019-06-18 07:28:58 -07:00
parent 0dbe78149d
commit cc531af665
24 changed files with 156 additions and 152 deletions

View File

@@ -1,12 +1,22 @@
# Demo: multibases with a common base
`kustomize` encourages defining multiple variants - e.g. dev, staging and prod, as overlays on a common base.
`kustomize` encourages defining multiple variants -
e.g. dev, staging and prod,
as overlays on a common base.
It's possible to create an additional overlay to compose these variants together - just declare the overlays as the bases of a new kustomization.
It's possible to create an additional overlay to
compose these variants together - just declare the
overlays as the bases of a new kustomization.
This is also a means to apply a common label or annotation across the variants, if for some reason the base isn't under your control. It also allows one to define a left-most namePrefix across the variants - something that cannot be done by modifying the common base.
This is also a means to apply a common label or
annotation across the variants, if for some reason
the base isn't under your control. It also allows
one to define a left-most namePrefix across the
variants - something that cannot be
done by modifying the common base.
The following demonstrates this using a base that's just one pod.
The following demonstrates this using a base
that is just a single pod.
Define a place to work:
@@ -47,7 +57,7 @@ DEV=$DEMO_HOME/dev
mkdir $DEV
cat <<EOF >$DEV/kustomization.yaml
bases:
resources:
- ./../base
namePrefix: dev-
EOF
@@ -60,7 +70,7 @@ STAG=$DEMO_HOME/staging
mkdir $STAG
cat <<EOF >$STAG/kustomization.yaml
bases:
resources:
- ./../base
namePrefix: stag-
EOF
@@ -73,7 +83,7 @@ PROD=$DEMO_HOME/production
mkdir $PROD
cat <<EOF >$PROD/kustomization.yaml
bases:
resources:
- ./../base
namePrefix: prod-
EOF
@@ -83,7 +93,7 @@ Then define a _Kustomization_ composing three variants together:
<!-- @makeTopLayer @test -->
```
cat <<EOF >$DEMO_HOME/kustomization.yaml
bases:
resources:
- ./dev
- ./staging
- ./production

View File

@@ -1,4 +1,3 @@
bases:
- ./../base
namePrefix: dev-
resources:
- ../base
namePrefix: dev-

View File

@@ -1,6 +1,5 @@
bases:
- ./dev
- ./staging
- ./production
resources:
- dev
- staging
- production
namePrefix: cluster-a-

View File

@@ -2,7 +2,9 @@
`kustomize` supports defining multiple variants with different namespace, as overlays on a common base.
It's possible to create an additional overlay to compose these variants together - just declare the overlays as the bases of a new kustomization. The following demonstrates this using a base that's just one pod.
It's possible to create an additional overlay to compose these variants
together - just declare the overlays as the bases of a new kustomization. The
following demonstrates this using a base that's just one pod.
Define a place to work:
@@ -43,10 +45,9 @@ NSA=$DEMO_HOME/namespace-a
mkdir $NSA
cat <<EOF >$NSA/kustomization.yaml
bases:
- ./../base
resources:
- namespace.yaml
- ../base
namespace: namespace-a
EOF
@@ -65,10 +66,9 @@ NSB=$DEMO_HOME/namespace-b
mkdir $NSB
cat <<EOF >$NSB/kustomization.yaml
bases:
- ./../base
resources:
- namespace.yaml
- ../base
namespace: namespace-b
EOF
@@ -84,9 +84,9 @@ Then define a _Kustomization_ composing two variants together:
<!-- @makeTopLayer @test -->
```
cat <<EOF >$DEMO_HOME/kustomization.yaml
bases:
- ./namespace-a
- ./namespace-b
resources:
- namespace-a
- namespace-b
EOF
```
@@ -112,4 +112,4 @@ Confirm that the `kustomize build` output contains two pod objects from namespac
test 2 == \
$(kustomize build $DEMO_HOME| grep -B 4 "namespace: namespace-[ab]" | grep "name: myapp-pod" | wc -l); \
echo $?
```
```

View File

@@ -1,4 +1,3 @@
bases:
- ./../base
resources:
- ../base
namePrefix: prod-

View File

@@ -1,4 +1,3 @@
bases:
- ./../base
resources:
- ../base
namePrefix: staging-