mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
remove commented code
update multibases/README.md
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
# Demo: multibases with a common base
|
||||
|
||||
When managing application in different environment, many Kustomize users have seen this scenario. There is a base _Kustomization_ for this application. On top of this base, there are several variants such as dev, staging and production variants. In each of those variants, a different _namePrefix_ is applied. Users sometimes need to create another _kustomization_ compsing all three variants, applying the same _namePrefix_, _commonLables_ or _commonAnnotations_ and deploying them together with one `kubectl` command.
|
||||
`kustomize` encourages defining multiple variants - e.g. dev, staging and prod, as overlays on a common base.
|
||||
|
||||
Kustomize supports composing multiple variants like that in the same `kustomization.yaml`. This demo shows how this works with a pod object.
|
||||
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.
|
||||
|
||||
The following demonstrates this using a base that's just one pod.
|
||||
|
||||
Define a place to work:
|
||||
|
||||
|
||||
@@ -46,13 +46,6 @@ func NewResId(g schema.GroupVersionKind, n string) ResId {
|
||||
|
||||
// String of ResId based on GVK, name and prefix
|
||||
func (n ResId) String() string {
|
||||
//var fields []string
|
||||
//for _, s := range []string{n.gvk.Group, n.gvk.Version, n.gvk.Kind, n.prefix, n.name} {
|
||||
// if s != "" {
|
||||
// fields = append(fields, s)
|
||||
// }
|
||||
//}
|
||||
//return strings.Join(fields, "_") + ".yaml"
|
||||
fields := []string{n.gvk.Group, n.gvk.Version, n.gvk.Kind, n.prefix, n.name}
|
||||
return strings.Join(fields, "_") + ".yaml"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user