mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Docs: Auto-fix markdownlint issues
This commit is contained in:
@@ -33,5 +33,4 @@ We do a [Pull Request](https://github.com/kubernetes-sigs/kustomize/pulls) contr
|
|||||||
New users are always welcome!
|
New users are always welcome!
|
||||||
{{% /blocks/feature %}}
|
{{% /blocks/feature %}}
|
||||||
|
|
||||||
|
|
||||||
{{< /blocks/section >}}
|
{{< /blocks/section >}}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ description: >
|
|||||||
---
|
---
|
||||||
|
|
||||||
# Glossary
|
# Glossary
|
||||||
|
|
||||||
[CRD spec]: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
|
[CRD spec]: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
|
||||||
[CRD]: #custom-resource-definition
|
[CRD]: #custom-resource-definition
|
||||||
[DAM]: #declarative-application-management
|
[DAM]: #declarative-application-management
|
||||||
@@ -67,7 +68,6 @@ dashboards.
|
|||||||
[kustomize] configures k8s resources, and the proposed
|
[kustomize] configures k8s resources, and the proposed
|
||||||
application resource is just another resource.
|
application resource is just another resource.
|
||||||
|
|
||||||
|
|
||||||
## apply
|
## apply
|
||||||
|
|
||||||
The verb _apply_ in the context of k8s refers to a
|
The verb _apply_ in the context of k8s refers to a
|
||||||
@@ -100,7 +100,6 @@ dedicated to that purpose_. Same with [overlays].
|
|||||||
Changes in a repo could generate a build, test and
|
Changes in a repo could generate a build, test and
|
||||||
deploy cycle.
|
deploy cycle.
|
||||||
|
|
||||||
|
|
||||||
## bespoke configuration
|
## bespoke configuration
|
||||||
|
|
||||||
A _bespoke_ configuration is a [kustomization] and some
|
A _bespoke_ configuration is a [kustomization] and some
|
||||||
@@ -133,17 +132,17 @@ a set of best practices around managing k8s clusters.
|
|||||||
|
|
||||||
In brief, kustomize should
|
In brief, kustomize should
|
||||||
|
|
||||||
* Work with any configuration, be it bespoke,
|
* Work with any configuration, be it bespoke,
|
||||||
off-the-shelf, stateless, stateful, etc.
|
off-the-shelf, stateless, stateful, etc.
|
||||||
* Support common customizations, and creation of
|
* Support common customizations, and creation of
|
||||||
[variants] (e.g. _development_ vs.
|
[variants] (e.g. _development_ vs.
|
||||||
_staging_ vs. _production_).
|
_staging_ vs. _production_).
|
||||||
* Expose and teach native k8s APIs, rather than
|
* Expose and teach native k8s APIs, rather than
|
||||||
hide them.
|
hide them.
|
||||||
* Add no friction to version control integration to
|
* Add no friction to version control integration to
|
||||||
support reviews and audit trails.
|
support reviews and audit trails.
|
||||||
* Compose with other tools in a unix sense.
|
* Compose with other tools in a unix sense.
|
||||||
* Eschew crossing the line into templating, domain
|
* Eschew crossing the line into templating, domain
|
||||||
specific languages, etc., frustrating the other
|
specific languages, etc., frustrating the other
|
||||||
goals.
|
goals.
|
||||||
|
|
||||||
@@ -152,7 +151,6 @@ In brief, kustomize should
|
|||||||
A generator makes resources that can be used as is,
|
A generator makes resources that can be used as is,
|
||||||
or fed into a [transformer].
|
or fed into a [transformer].
|
||||||
|
|
||||||
|
|
||||||
## gitops
|
## gitops
|
||||||
|
|
||||||
Devops or CICD workflows that use a git repository as a
|
Devops or CICD workflows that use a git repository as a
|
||||||
@@ -171,31 +169,30 @@ data that doesn't require a URL specification).
|
|||||||
I.e. if someone gives you a _kustomization_ for use
|
I.e. if someone gives you a _kustomization_ for use
|
||||||
with [kustomize], it could be in the form of
|
with [kustomize], it could be in the form of
|
||||||
|
|
||||||
* one file called `kustomization.yaml`,
|
* one file called `kustomization.yaml`,
|
||||||
* a tarball (containing that YAML file plus what it references),
|
* a tarball (containing that YAML file plus what it references),
|
||||||
* a git archive (ditto),
|
* a git archive (ditto),
|
||||||
* a URL to a git repo (ditto), etc.
|
* a URL to a git repo (ditto), etc.
|
||||||
|
|
||||||
A kustomization file contains [fields](fields.md)
|
A kustomization file contains [fields](fields.md)
|
||||||
falling into four categories:
|
falling into four categories:
|
||||||
|
|
||||||
* _resources_ - what existing [resources] are to be customized.
|
* _resources_ - what existing [resources] are to be customized.
|
||||||
Example fields: _resources_, _crds_.
|
Example fields: _resources_, _crds_.
|
||||||
|
|
||||||
* _generators_ - what _new_ resources should be created.
|
* _generators_ - what _new_ resources should be created.
|
||||||
Example fields: _configMapGenerator_ (legacy),
|
Example fields: _configMapGenerator_ (legacy),
|
||||||
_secretGenerator_ (legacy), _generators_ (v2.1).
|
_secretGenerator_ (legacy), _generators_ (v2.1).
|
||||||
|
|
||||||
* _transformers_ - what to _do_ to the aforementioned resources.
|
* _transformers_ - what to _do_ to the aforementioned resources.
|
||||||
Example fields: _namePrefix_, _nameSuffix_, _images_,
|
Example fields: _namePrefix_, _nameSuffix_, _images_,
|
||||||
_commonLabels_, _patchesJson6902_, etc. and the more
|
_commonLabels_, _patchesJson6902_, etc. and the more
|
||||||
general _transformers_ (v2.1) field.
|
general _transformers_ (v2.1) field.
|
||||||
|
|
||||||
* _meta_ - fields which may influence all or some of
|
* _meta_ - fields which may influence all or some of
|
||||||
the above. Example fields: _vars_, _namespace_,
|
the above. Example fields: _vars_, _namespace_,
|
||||||
_apiVersion_, _kind_, etc.
|
_apiVersion_, _kind_, etc.
|
||||||
|
|
||||||
|
|
||||||
## kustomization root
|
## kustomization root
|
||||||
|
|
||||||
The directory that immediately contains a
|
The directory that immediately contains a
|
||||||
@@ -222,8 +219,8 @@ absolute path, or by relative path.
|
|||||||
|
|
||||||
If kustomization __A__ depends on kustomization __B__, then
|
If kustomization __A__ depends on kustomization __B__, then
|
||||||
|
|
||||||
* __B__ may not _contain_ __A__.
|
* __B__ may not _contain_ __A__.
|
||||||
* __B__ may not _depend on_ __A__, even transitively.
|
* __B__ may not _depend on_ __A__, even transitively.
|
||||||
|
|
||||||
__A__ may contain __B__, but in this case it might be
|
__A__ may contain __B__, but in this case it might be
|
||||||
simplest to have __A__ directly depend on __B__'s
|
simplest to have __A__ directly depend on __B__'s
|
||||||
@@ -234,7 +231,6 @@ Conventionally, __B__ is in a directory that's sibling
|
|||||||
to __A__, or __B__ is off in a completely independent
|
to __A__, or __B__ is off in a completely independent
|
||||||
git repository, referencable from any kustomization.
|
git repository, referencable from any kustomization.
|
||||||
|
|
||||||
|
|
||||||
A common layout is
|
A common layout is
|
||||||
|
|
||||||
> ```
|
> ```
|
||||||
@@ -291,7 +287,6 @@ resource patching.
|
|||||||
|
|
||||||
kustomize is an implementation of [DAM].
|
kustomize is an implementation of [DAM].
|
||||||
|
|
||||||
|
|
||||||
## off-the-shelf configuration
|
## off-the-shelf configuration
|
||||||
|
|
||||||
An _off-the-shelf_ configuration is a kustomization and
|
An _off-the-shelf_ configuration is a kustomization and
|
||||||
@@ -379,7 +374,7 @@ fields to establish the group/version/kind/name of the
|
|||||||
to step into a nested structure to specify a new field
|
to step into a nested structure to specify a new field
|
||||||
value, e.g. an image tag.
|
value, e.g. an image tag.
|
||||||
|
|
||||||
By default, an SMP _replaces_ values. This is
|
By default, an SMP _replaces_ values. This is
|
||||||
usually desired when the target value is a simple
|
usually desired when the target value is a simple
|
||||||
string, but may not be desired when the target
|
string, but may not be desired when the target
|
||||||
value is a list.
|
value is a list.
|
||||||
|
|||||||
@@ -14,4 +14,3 @@ Move entries into the [resources](/kustomize/api-reference/kustomization/resourc
|
|||||||
field. This allows bases - which are still a
|
field. This allows bases - which are still a
|
||||||
[central concept](/kustomize/api-reference/kustomization/glossary#base) - to be
|
[central concept](/kustomize/api-reference/kustomization/glossary#base) - to be
|
||||||
ordered relative to other input resources.
|
ordered relative to other input resources.
|
||||||
|
|
||||||
|
|||||||
@@ -55,4 +55,3 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -98,4 +98,4 @@ spec:
|
|||||||
app: bingo
|
app: bingo
|
||||||
owner: alice
|
owner: alice
|
||||||
someName: someValue
|
someName: someValue
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ Each entry in this list results in the creation of
|
|||||||
one ConfigMap resource (it's a generator of n maps).
|
one ConfigMap resource (it's a generator of n maps).
|
||||||
|
|
||||||
The example below creates four ConfigMaps:
|
The example below creates four ConfigMaps:
|
||||||
|
|
||||||
- first, with the names and contents of the given files
|
- first, with the names and contents of the given files
|
||||||
- second, with key/value as data using key/value pairs from files
|
- second, with key/value as data using key/value pairs from files
|
||||||
- third, also with key/value as data, directly specified using `literals`
|
- third, also with key/value as data, directly specified using `literals`
|
||||||
@@ -87,4 +88,4 @@ configMapGenerator:
|
|||||||
- name: app-whatever
|
- name: app-whatever
|
||||||
files:
|
files:
|
||||||
- myFileName.ini=whatever.ini
|
- myFileName.ini=whatever.ini
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -22,12 +22,13 @@ with namePrefix, nameSuffix, or hashing in the
|
|||||||
same way.
|
same way.
|
||||||
|
|
||||||
The annotations can be put into openAPI definitions are:
|
The annotations can be put into openAPI definitions are:
|
||||||
- "x-kubernetes-annotation": ""
|
|
||||||
- "x-kubernetes-label-selector": ""
|
- "x-kubernetes-annotation": ""
|
||||||
- "x-kubernetes-identity": ""
|
- "x-kubernetes-label-selector": ""
|
||||||
- "x-kubernetes-object-ref-api-version": "v1",
|
- "x-kubernetes-identity": ""
|
||||||
- "x-kubernetes-object-ref-kind": "Secret",
|
- "x-kubernetes-object-ref-api-version": "v1",
|
||||||
- "x-kubernetes-object-ref-name-key": "name",
|
- "x-kubernetes-object-ref-kind": "Secret",
|
||||||
|
- "x-kubernetes-object-ref-name-key": "name",
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
@@ -36,4 +37,4 @@ kind: Kustomization
|
|||||||
crds:
|
crds:
|
||||||
- crds/typeA.yaml
|
- crds/typeA.yaml
|
||||||
- crds/typeB.yaml
|
- crds/typeB.yaml
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -28,4 +28,4 @@ generatorOptions:
|
|||||||
# suffix to the names of generated resources that is a hash of
|
# suffix to the names of generated resources that is a hash of
|
||||||
# the resource contents.
|
# the resource contents.
|
||||||
disableNameSuffixHash: true
|
disableNameSuffixHash: true
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ spec:
|
|||||||
```
|
```
|
||||||
|
|
||||||
one can change the `image` in the following ways:
|
one can change the `image` in the following ways:
|
||||||
|
|
||||||
- `postgres:8` to `my-registry/my-postgres:v1`,
|
- `postgres:8` to `my-registry/my-postgres:v1`,
|
||||||
- nginx tag `1.7.9` to `1.8.0`,
|
- nginx tag `1.7.9` to `1.8.0`,
|
||||||
- image name `my-demo-app` to `my-app`,
|
- image name `my-demo-app` to `my-app`,
|
||||||
- alpine's tag `3.7` to a digest value
|
- alpine's tag `3.7` to a digest value
|
||||||
|
|
||||||
all with the following *kustomization*:
|
all with the following *kustomization*:
|
||||||
|
|
||||||
@@ -49,4 +49,4 @@ images:
|
|||||||
newName: my-app
|
newName: my-app
|
||||||
- name: alpine
|
- name: alpine
|
||||||
digest: sha256:24a0c4b4a4c0eb97a1aabb8e29f18e917d05abfe1b7a7c07857230879ce7d3d3
|
digest: sha256:24a0c4b4a4c0eb97a1aabb8e29f18e917d05abfe1b7a7c07857230879ce7d3d3
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -13,4 +13,4 @@ kind: Kustomization
|
|||||||
namePrefix: alices-
|
namePrefix: alices-
|
||||||
```
|
```
|
||||||
|
|
||||||
A deployment named `wordpress` would become `alices-wordpress`.
|
A deployment named `wordpress` would become `alices-wordpress`.
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ namespace: my-namespace
|
|||||||
```
|
```
|
||||||
|
|
||||||
Will override the existing namespace if it is set on a resource, or add it
|
Will override the existing namespace if it is set on a resource, or add it
|
||||||
if it is not set on a resource.
|
if it is not set on a resource.
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ kind: Kustomization
|
|||||||
nameSuffix: -v2
|
nameSuffix: -v2
|
||||||
```
|
```
|
||||||
|
|
||||||
A deployment named `wordpress` would become `wordpress-v2`.
|
A deployment named `wordpress` would become `wordpress-v2`.
|
||||||
|
|
||||||
**Note:** The suffix is appended before the content hash if the resource type is ConfigMap or Secret.
|
**Note:** The suffix is appended before the content hash if the resource type is ConfigMap or Secret.
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ Patches (also call overlays) add or override fields on resources. They are prov
|
|||||||
The `patches` field contains a list of patches to be applied in the order they are specified.
|
The `patches` field contains a list of patches to be applied in the order they are specified.
|
||||||
|
|
||||||
Each patch may:
|
Each patch may:
|
||||||
|
|
||||||
- be either a [strategic merge] patch, or a [JSON] patch
|
- be either a [strategic merge] patch, or a [JSON] patch
|
||||||
- be either a file, or an inline string
|
- be either a file, or an inline string
|
||||||
- target a single resource or multiple resources
|
- target a single resource or multiple resources
|
||||||
|
|
||||||
The patch target selects resources by group, version, kind, name, namespace, labelSelector and
|
The patch target selects resources by group, version, kind, name, namespace, labelSelector and
|
||||||
annotationSelector. Any resource which matches all the **specified** fields has the patch applied
|
annotationSelector. Any resource which matches all the **specified** fields has the patch applied
|
||||||
@@ -43,9 +43,9 @@ patches:
|
|||||||
value: new value
|
value: new value
|
||||||
target:
|
target:
|
||||||
kind: MyKind
|
kind: MyKind
|
||||||
labelSelector: "env=dev"
|
labelSelector: "env=dev"
|
||||||
```
|
```
|
||||||
|
|
||||||
The `name` and `namespace` fields of the patch target selector are
|
The `name` and `namespace` fields of the patch target selector are
|
||||||
automatically anchored regular expressions. This means that the value `myapp`
|
automatically anchored regular expressions. This means that the value `myapp`
|
||||||
is equivalent to `^myapp$`.
|
is equivalent to `^myapp$`.
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ patchesStrategicMerge:
|
|||||||
```
|
```
|
||||||
|
|
||||||
The patch content can be a inline string as well.
|
The patch content can be a inline string as well.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
@@ -53,4 +54,4 @@ patchesStrategicMerge:
|
|||||||
Note that kustomize does not support more than one patch
|
Note that kustomize does not support more than one patch
|
||||||
for the same object that contain a _delete_ directive. To remove
|
for the same object that contain a _delete_ directive. To remove
|
||||||
several fields / slice elements from an object create a single
|
several fields / slice elements from an object create a single
|
||||||
patch that performs all the needed deletions.
|
patch that performs all the needed deletions.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ description: >
|
|||||||
|
|
||||||
Each entry in this list should resolve to a kubernetes object and a JSON patch that will be applied
|
Each entry in this list should resolve to a kubernetes object and a JSON patch that will be applied
|
||||||
to the object.
|
to the object.
|
||||||
The JSON patch is documented at https://tools.ietf.org/html/rfc6902
|
The JSON patch is documented at <https://tools.ietf.org/html/rfc6902>
|
||||||
|
|
||||||
target field points to a kubernetes object within the same kustomization
|
target field points to a kubernetes object within the same kustomization
|
||||||
by the object's group, version, kind, name and namespace.
|
by the object's group, version, kind, name and namespace.
|
||||||
|
|||||||
@@ -35,9 +35,10 @@ be modified at the same time.
|
|||||||
As this declaration does not take in a `kind:` nor a `group:`
|
As this declaration does not take in a `kind:` nor a `group:`
|
||||||
it will match any `group` and `kind` that has a matching name and
|
it will match any `group` and `kind` that has a matching name and
|
||||||
that is one of:
|
that is one of:
|
||||||
|
|
||||||
- `Deployment`
|
- `Deployment`
|
||||||
- `ReplicationController`
|
- `ReplicationController`
|
||||||
- `ReplicaSet`
|
- `ReplicaSet`
|
||||||
- `StatefulSet`
|
- `StatefulSet`
|
||||||
|
|
||||||
For more complex use cases, revert to using a patch.
|
For more complex use cases, revert to using a patch.
|
||||||
|
|||||||
@@ -41,4 +41,4 @@ secretGenerator:
|
|||||||
app_config: "true"
|
app_config: "true"
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: "app2"
|
app.kubernetes.io/name: "app2"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -81,5 +81,3 @@ job. E.g., a Deployment may reference a ConfigMap
|
|||||||
by name, and if kustomize changes the name of a
|
by name, and if kustomize changes the name of a
|
||||||
ConfigMap, it knows to change the name reference
|
ConfigMap, it knows to change the name reference
|
||||||
in the Deployment.
|
in the Deployment.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ Initial release after move from github.com/kubernetes/kubectl to github.com/kube
|
|||||||
|
|
||||||
History
|
History
|
||||||
|
|
||||||
* May 2018: v1.0 after move to github.com/kubernetes-sigs/kubectl
|
* May 2018: v1.0 after move to github.com/kubernetes-sigs/kubectl
|
||||||
from github.com/kubernetes/kubectl.
|
from github.com/kubernetes/kubectl.
|
||||||
Has kustomization file, bases, overlays, basic transforms.
|
Has kustomization file, bases, overlays, basic transforms.
|
||||||
* Apr 2018: s/kinflate/kustomize/, s/manifest/kustomization/
|
* Apr 2018: s/kinflate/kustomize/, s/manifest/kustomization/
|
||||||
* Oct 2017: s/kexpand/kinflate/
|
* Oct 2017: s/kexpand/kinflate/
|
||||||
* Sep 2017: kexpand [starts](https://github.com/kubernetes/kubectl/pull/65)
|
* Sep 2017: kexpand [starts](https://github.com/kubernetes/kubectl/pull/65)
|
||||||
in github.com/kubernetes/kubectl
|
in github.com/kubernetes/kubectl
|
||||||
* Aug 2017: [DAM] authored by Brian Grant
|
* Aug 2017: [DAM] authored by Brian Grant
|
||||||
|
|
||||||
[DAM]: https://docs.google.com/document/d/1cLPGweVEYrVqQvBLJg6sxV-TrE5Rm2MNOBA_cxZP2WU
|
[DAM]: https://docs.google.com/document/d/1cLPGweVEYrVqQvBLJg6sxV-TrE5Rm2MNOBA_cxZP2WU
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ path or URL to a kustomization directory in the
|
|||||||
![pruning dead branches][imgPruning]
|
![pruning dead branches][imgPruning]
|
||||||
|
|
||||||
_Alpha_
|
_Alpha_
|
||||||
|
|
||||||
Users can add an `inventory` stanza to their
|
Users can add an `inventory` stanza to their
|
||||||
kustomization file, to add a special _inventory
|
kustomization file, to add a special _inventory
|
||||||
object_ to the `build` result.
|
object_ to the `build` result.
|
||||||
@@ -164,10 +164,9 @@ orphaned cluster resources.
|
|||||||
For more information see the
|
For more information see the
|
||||||
[kustomize inventory object documentation].
|
[kustomize inventory object documentation].
|
||||||
|
|
||||||
|
|
||||||
## Field changes / deprecations
|
## Field changes / deprecations
|
||||||
|
|
||||||
### `resources` expanded, `bases` deprecated
|
### `resources` expanded, `bases` deprecated
|
||||||
|
|
||||||
The `resources` field has been generalized; it now
|
The `resources` field has been generalized; it now
|
||||||
accepts what formerly could only be specified in
|
accepts what formerly could only be specified in
|
||||||
@@ -235,7 +234,7 @@ or transform a generator or a transformer (see
|
|||||||
|
|
||||||
The common task of patching a deployment to edit
|
The common task of patching a deployment to edit
|
||||||
the number of replicas is now made easier
|
the number of replicas is now made easier
|
||||||
with the new [replicas](/kustomize/api-reference/kustomization/replicas) field.
|
with the new [replicas](/kustomize/api-reference/kustomization/replicas) field.
|
||||||
|
|
||||||
### `envs` field
|
### `envs` field
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ floor on a stable API for [plugin] developers
|
|||||||
(both _Go_ plugin developers and _exec_ plugin
|
(both _Go_ plugin developers and _exec_ plugin
|
||||||
developers who happen to use Go).
|
developers who happen to use Go).
|
||||||
|
|
||||||
### Why so soon after v2.1.0?
|
### Why so soon after v2.1.0
|
||||||
|
|
||||||
[semantic versioning]: https://semver.org
|
[semantic versioning]: https://semver.org
|
||||||
[Go modules doc]: https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher
|
[Go modules doc]: https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher
|
||||||
@@ -70,6 +70,3 @@ Aside - the set of kustomize packages outside
|
|||||||
by package use, this API surface must shrink.
|
by package use, this API surface must shrink.
|
||||||
Such shrinkage will trigger a major version
|
Such shrinkage will trigger a major version
|
||||||
increment.
|
increment.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ description: >
|
|||||||
---
|
---
|
||||||
|
|
||||||
## Extended patches
|
## Extended patches
|
||||||
|
|
||||||
Since this version, Kustomize allows applying one patch to multiple resources. This works for both Strategic Merge Patch and JSON Patch. Take a look at [patch multiple objects](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/patchMultipleObjects.md).
|
Since this version, Kustomize allows applying one patch to multiple resources. This works for both Strategic Merge Patch and JSON Patch. Take a look at [patch multiple objects](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/patchMultipleObjects.md).
|
||||||
|
|
||||||
## Improved Resource Matching
|
## Improved Resource Matching
|
||||||
@@ -52,7 +53,6 @@ spec:
|
|||||||
value: PRODVALUE
|
value: PRODVALUE
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Variable resolution improvement
|
### Variable resolution improvement
|
||||||
|
|
||||||
It is possible to add namespace field to the variable declaration. In the following example,
|
It is possible to add namespace field to the variable declaration. In the following example,
|
||||||
@@ -87,7 +87,8 @@ vars:
|
|||||||
### Simultaneous change of names and namespaces
|
### Simultaneous change of names and namespaces
|
||||||
|
|
||||||
Kustomize is now able to deal with simultaneous changes of name and namespace.
|
Kustomize is now able to deal with simultaneous changes of name and namespace.
|
||||||
Special attention has been paid the handling of:
|
Special attention has been paid the handling of:
|
||||||
|
|
||||||
- ClusterRoleBinding/RoleBinding "subjects" field,
|
- ClusterRoleBinding/RoleBinding "subjects" field,
|
||||||
- ValidatingWebhookConfiguration "webhooks" field.
|
- ValidatingWebhookConfiguration "webhooks" field.
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ resources:
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
### Resource and Kustomize Context matching.
|
### Resource and Kustomize Context matching
|
||||||
|
|
||||||
Kustomize is now able to support more aggregation patterns.
|
Kustomize is now able to support more aggregation patterns.
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ description: >
|
|||||||
---
|
---
|
||||||
|
|
||||||
## Inline Patch
|
## Inline Patch
|
||||||
|
|
||||||
Since this version, Kustomize allows inline patches in all three of `patchesStrategicMerge`, `patchesJson6902` and `patches`. Take a look at [inline patch](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/examples/inlinePatch.md).
|
Since this version, Kustomize allows inline patches in all three of `patchesStrategicMerge`, `patchesJson6902` and `patches`. Take a look at [inline patch](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/examples/inlinePatch.md).
|
||||||
|
|
||||||
## New Subcommand
|
## New Subcommand
|
||||||
@@ -14,11 +15,13 @@ Since this version, Kustomize allows inline patches in all three of `patchesStra
|
|||||||
Since this version, one can create a kustomization.yaml file in a directory through a `create` subcommand.
|
Since this version, one can create a kustomization.yaml file in a directory through a `create` subcommand.
|
||||||
|
|
||||||
Create a new overlay from the base ../base
|
Create a new overlay from the base ../base
|
||||||
|
|
||||||
```
|
```
|
||||||
kustomize create --resources ../base
|
kustomize create --resources ../base
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a new kustomization detecing resources in the current directory
|
Create a new kustomization detecing resources in the current directory
|
||||||
|
|
||||||
```
|
```
|
||||||
kustomize create --autodetect
|
kustomize create --autodetect
|
||||||
```
|
```
|
||||||
@@ -30,5 +33,5 @@ kustomize create --autodetect --recursive
|
|||||||
```
|
```
|
||||||
|
|
||||||
### New Example Generator
|
### New Example Generator
|
||||||
A new example generator of using go-getter to download resources is added. Take a look at [go-getter generator](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/goGetterGeneratorPlugin.md).
|
|
||||||
|
|
||||||
|
A new example generator of using go-getter to download resources is added. Take a look at [go-getter generator](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/goGetterGeneratorPlugin.md).
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ description: >
|
|||||||
|
|
||||||
[versioning policy documentation]: /site/content/en/faq/versioningPolicy.md
|
[versioning policy documentation]: /site/content/en/faq/versioningPolicy.md
|
||||||
[release process documentation]: /releasing
|
[release process documentation]: /releasing
|
||||||
|
|
||||||
## Summary of changes
|
## Summary of changes
|
||||||
|
|
||||||
### First release of the Go API-only module.
|
### First release of the Go API-only module
|
||||||
|
|
||||||
Many of the PRs since the last vrelease were
|
Many of the PRs since the last vrelease were
|
||||||
around restructuring the _sigs.k8s.io/kustomize_
|
around restructuring the _sigs.k8s.io/kustomize_
|
||||||
@@ -43,7 +43,6 @@ any other client.
|
|||||||
The new semver-able API will begin with `v4.0.0` (not
|
The new semver-able API will begin with `v4.0.0` (not
|
||||||
yet released) and be a clean break with `v3` etc.
|
yet released) and be a clean break with `v3` etc.
|
||||||
|
|
||||||
|
|
||||||
### Change log since v3.2.0
|
### Change log since v3.2.0
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ menu:
|
|||||||
weight: 99
|
weight: 99
|
||||||
---
|
---
|
||||||
|
|
||||||
Follow are resources for Kustomize contributors.
|
Follow are resources for Kustomize contributors.
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ description: >
|
|||||||
File issues as desired, but if you've found a problem
|
File issues as desired, but if you've found a problem
|
||||||
with how `kustomize build` works, please report
|
with how `kustomize build` works, please report
|
||||||
|
|
||||||
* the output of `kustomize version`,
|
* the output of `kustomize version`,
|
||||||
* the input (the content of `kustomization.yaml`
|
* the input (the content of `kustomization.yaml`
|
||||||
and any files it refers to),
|
and any files it refers to),
|
||||||
* the expected YAML output.
|
* the expected YAML output.
|
||||||
|
|
||||||
## If you have `go` installed
|
## If you have `go` installed
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ package] for specifying a kustomization's input and the
|
|||||||
expected output.
|
expected output.
|
||||||
|
|
||||||
Copy one of those tests, e.g. this [reusable custom
|
Copy one of those tests, e.g. this [reusable custom
|
||||||
transformer test], to a new test file in the
|
transformer test], to a new test file in the
|
||||||
krusty package.
|
krusty package.
|
||||||
|
|
||||||
Insert the inputs you want to use, and run it as
|
Insert the inputs you want to use, and run it as
|
||||||
|
|||||||
@@ -21,5 +21,3 @@ If you are interested in contributing towards Kustomize or getting more involved
|
|||||||
- join the [mailing list] and reach out
|
- join the [mailing list] and reach out
|
||||||
- join the [slack channel] and reach out
|
- join the [slack channel] and reach out
|
||||||
- attend one of the [bi-weekly meetings] (alternating Wednesdays at 9:00am Pacific Time)
|
- attend one of the [bi-weekly meetings] (alternating Wednesdays at 9:00am Pacific Time)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,4 +79,3 @@ Changes must be pushed to the fork's **master branch** to be served as the fork'
|
|||||||
4. Commit and push the changes to the *remote fork's* **master branch**
|
4. Commit and push the changes to the *remote fork's* **master branch**
|
||||||
5. After a few minutes, the docs should be served from the fork's GitHub Page
|
5. After a few minutes, the docs should be served from the fork's GitHub Page
|
||||||
- e.g. [https://pwittrock.github.io/kustomize/](https://pwittrock.github.io/kustomize/)
|
- e.g. [https://pwittrock.github.io/kustomize/](https://pwittrock.github.io/kustomize/)
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ description: >
|
|||||||
[eschewed feature list]: https://kubernetes-sigs.github.io/kustomize/faq/eschewedfeatures/
|
[eschewed feature list]: https://kubernetes-sigs.github.io/kustomize/faq/eschewedfeatures/
|
||||||
[kind/feature]: https://github.com/kubernetes-sigs/kustomize/labels/kind%2Ffeature
|
[kind/feature]: https://github.com/kubernetes-sigs/kustomize/labels/kind%2Ffeature
|
||||||
|
|
||||||
|
|
||||||
Following is the process for proposing a new Kustomize feature:
|
Following is the process for proposing a new Kustomize feature:
|
||||||
|
|
||||||
1. Check the [eschewed feature list] to see if the feature has already been proposed
|
1. Check the [eschewed feature list] to see if the feature has already been proposed
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ Call stack when running `kustomize build`, with links to code.
|
|||||||
* Iterate all generators
|
* Iterate all generators
|
||||||
* [runTransfomers](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget.go#L274)
|
* [runTransfomers](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget.go#L274)
|
||||||
* [configureBuiltinTransformers](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget_configplugin.go#L44)
|
* [configureBuiltinTransformers](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget_configplugin.go#L44)
|
||||||
* PatchStrategicMergeTransformer
|
* PatchStrategicMergeTransformer
|
||||||
* PatchTransformer
|
* PatchTransformer
|
||||||
* NamespaceTransformer
|
* NamespaceTransformer
|
||||||
* PrefixSuffixTransformer
|
* PrefixSuffixTransformer
|
||||||
@@ -62,4 +62,4 @@ Call stack when running `kustomize build`, with links to code.
|
|||||||
* The following steps must be done last, not as part of the recursion implicit in AccumulateTarget.
|
* The following steps must be done last, not as part of the recursion implicit in AccumulateTarget.
|
||||||
* [addHashesToNames](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget.go#L153)
|
* [addHashesToNames](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget.go#L153)
|
||||||
* [FixBackReferences](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/accumulator/resaccumulator.go#L160): Given that names have changed (prefixs/suffixes added), fix all the back references to those names.
|
* [FixBackReferences](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/accumulator/resaccumulator.go#L160): Given that names have changed (prefixs/suffixes added), fix all the back references to those names.
|
||||||
* [ResolveVars](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/accumulator/resaccumulator.go#L141)
|
* [ResolveVars](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/accumulator/resaccumulator.go#L141)
|
||||||
|
|||||||
@@ -9,34 +9,38 @@ description: >
|
|||||||
|
|
||||||
This is the PowerShell script to run all go tests for Kustomize on a windows based platform which mimics /build/pre-commit.sh
|
This is the PowerShell script to run all go tests for Kustomize on a windows based platform which mimics /build/pre-commit.sh
|
||||||
|
|
||||||
## Pre-Reqs:
|
## Pre-Reqs
|
||||||
- PowerShell installed
|
|
||||||
- PowerShell Core is supported
|
- PowerShell installed
|
||||||
- go installed
|
- PowerShell Core is supported
|
||||||
- golangci-lint installed
|
- go installed
|
||||||
- mdrip installed
|
- golangci-lint installed
|
||||||
|
- mdrip installed
|
||||||
|
|
||||||
This script should output to the current console and return an exit code if all tests are successful(0) or any failed(1).
|
This script should output to the current console and return an exit code if all tests are successful(0) or any failed(1).
|
||||||
|
|
||||||
### If you are tryin to run these tests locally you can follow these instructions.
|
### If you are tryin to run these tests locally you can follow these instructions
|
||||||
|
|
||||||
Assume:
|
Assume:
|
||||||
- Running a stock Windows 10 system
|
|
||||||
- Local Admin rights.
|
|
||||||
- You can open [PowerShell as administrator](http://lmgtfy.com/?iie=1&q=How+to+open+powershell+as+administrator)
|
|
||||||
- You should be knowledgeable enough to pull source for packages into your GO ```src``` directory
|
|
||||||
- Yes, this means you also need to know a bit about **git** usually
|
|
||||||
|
|
||||||
|
- Running a stock Windows 10 system
|
||||||
|
- Local Admin rights.
|
||||||
|
- You can open [PowerShell as administrator](http://lmgtfy.com/?iie=1&q=How+to+open+powershell+as+administrator)
|
||||||
|
- You should be knowledgeable enough to pull source for packages into your GO ```src``` directory
|
||||||
|
- Yes, this means you also need to know a bit about **git** usually
|
||||||
|
|
||||||
#### Step 1 - Install Go
|
#### Step 1 - Install Go
|
||||||
- [Install Go](https://golang.org/dl/) - please use the msi
|
|
||||||
- If you use chocolatey - it's using the zip not msi and assumptions on where go is located are made for you.
|
- [Install Go](https://golang.org/dl/) - please use the msi
|
||||||
|
- If you use chocolatey - it's using the zip not msi and assumptions on where go is located are made for you.
|
||||||
|
|
||||||
#### Step 2 - Install Go Packages
|
#### Step 2 - Install Go Packages
|
||||||
- Open new PowerShell Administrative window
|
|
||||||
- Install golangci-lint
|
- Open new PowerShell Administrative window
|
||||||
- ```go get -u github.com/golangci/golangci-lint/cmd/golangci-lint```
|
- Install golangci-lint
|
||||||
- Install mdrip
|
- ```go get -u github.com/golangci/golangci-lint/cmd/golangci-lint```
|
||||||
- ```go get github.com/monopole/mdrip```
|
- Install mdrip
|
||||||
|
- ```go get github.com/monopole/mdrip```
|
||||||
|
|
||||||
You should now be able to issue these commands and see comparable responses
|
You should now be able to issue these commands and see comparable responses
|
||||||
|
|
||||||
@@ -51,6 +55,7 @@ Usage: C:\_go\bin\mdrip.exe {fileName}...
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### Step 3 - Get Source and Test
|
#### Step 3 - Get Source and Test
|
||||||
|
|
||||||
- In your GoRoot src
|
- In your GoRoot src
|
||||||
- ```Example: C:\_go\src```
|
- ```Example: C:\_go\src```
|
||||||
- Navigate to the Kustomize `travis` directory
|
- Navigate to the Kustomize `travis` directory
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ kustomize build --load_restrictor none $target
|
|||||||
|
|
||||||
Example: [#1319](https://github.com/kubernetes-sigs/kustomize/issues/1319), [#1322](https://github.com/kubernetes-sigs/kustomize/issues/1322), [#1347](https://github.com/kubernetes-sigs/kustomize/issues/1347) and etc.
|
Example: [#1319](https://github.com/kubernetes-sigs/kustomize/issues/1319), [#1322](https://github.com/kubernetes-sigs/kustomize/issues/1322), [#1347](https://github.com/kubernetes-sigs/kustomize/issues/1347) and etc.
|
||||||
|
|
||||||
The fields transformed by kustomize is configured explicitly in [defaultconfig](https://github.com/kubernetes-sigs/kustomize/tree/master/api/konfig/builtinpluginconsts/defaultconfig.go). The configuration itself can be customized by including `configurations` in `kustomization.yaml`, e.g.
|
The fields transformed by kustomize is configured explicitly in [defaultconfig](https://github.com/kubernetes-sigs/kustomize/tree/master/api/konfig/builtinpluginconsts/defaultconfig.go). The configuration itself can be customized by including `configurations` in `kustomization.yaml`, e.g.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ knowledge of the k8s API, and YAML or JSON syntax.
|
|||||||
Most edits performed by kustomize can be expressed as
|
Most edits performed by kustomize can be expressed as
|
||||||
[JSON patches] or [SMP patches].
|
[JSON patches] or [SMP patches].
|
||||||
Those can be verbose, so common patches,
|
Those can be verbose, so common patches,
|
||||||
like adding labels or annotatations, get dedicated
|
like adding labels or annotatations, get dedicated
|
||||||
transformer plugins - `LabelTransformer`,
|
transformer plugins - `LabelTransformer`,
|
||||||
`AnnotationsTransformer`, etc.
|
`AnnotationsTransformer`, etc.
|
||||||
These accept relatively simple YAML configuration
|
These accept relatively simple YAML configuration
|
||||||
@@ -69,7 +69,7 @@ informed error messages if inputs are invalid.
|
|||||||
|
|
||||||
_Unstructured edits_, edits that don't limit
|
_Unstructured edits_, edits that don't limit
|
||||||
themselves to a syntax or object structure,
|
themselves to a syntax or object structure,
|
||||||
come in many forms. A common one in the
|
come in many forms. A common one in the
|
||||||
configuration domain is the template or
|
configuration domain is the template or
|
||||||
parameterization approach.
|
parameterization approach.
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ kustomize eschews parameterization, because
|
|||||||
- The input becomes [unintelligible] as the project
|
- The input becomes [unintelligible] as the project
|
||||||
scales in any number of dimensions (resource
|
scales in any number of dimensions (resource
|
||||||
count, cluster count, environment count, etc.)
|
count, cluster count, environment count, etc.)
|
||||||
|
|
||||||
Kustomizations are meant to be sharable and stackable.
|
Kustomizations are meant to be sharable and stackable.
|
||||||
Imagine tracing down a problem rooted in a
|
Imagine tracing down a problem rooted in a
|
||||||
clever set of stacked regexp replacements
|
clever set of stacked regexp replacements
|
||||||
@@ -132,7 +132,6 @@ kustomize edit set image nginx:$MY_NGINX_VERSION
|
|||||||
as part of some encapsulating work flow executed before
|
as part of some encapsulating work flow executed before
|
||||||
`kustomize build`.
|
`kustomize build`.
|
||||||
|
|
||||||
|
|
||||||
## Globs in kustomization files
|
## Globs in kustomization files
|
||||||
|
|
||||||
`kustomize` supports the best practice of storing one's
|
`kustomize` supports the best practice of storing one's
|
||||||
|
|||||||
@@ -118,10 +118,8 @@ itself is an API client requiring this module.
|
|||||||
|
|
||||||
The clients and API will evolve independently.
|
The clients and API will evolve independently.
|
||||||
|
|
||||||
|
|
||||||
## Kustomization File Versioning
|
## Kustomization File Versioning
|
||||||
|
|
||||||
|
|
||||||
The kustomization file is a struct that is part of
|
The kustomization file is a struct that is part of
|
||||||
the kustomize Go API (the `sigs.k8s.io/kustomize`
|
the kustomize Go API (the `sigs.k8s.io/kustomize`
|
||||||
module), but it also evolves as a k8s API object -
|
module), but it also evolves as a k8s API object -
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ Run kustomize, and pipe the output to [apply].
|
|||||||
> ```
|
> ```
|
||||||
|
|
||||||
You can also use [kubectl-v1.14.0] to apply your [variants].
|
You can also use [kubectl-v1.14.0] to apply your [variants].
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> kubectl apply -k ~/ldap/overlays/staging
|
> kubectl apply -k ~/ldap/overlays/staging
|
||||||
> kubectl apply -k ~/ldap/overlays/production
|
> kubectl apply -k ~/ldap/overlays/production
|
||||||
@@ -78,4 +79,3 @@ You can also use [kubectl-v1.14.0] to apply your [variants].
|
|||||||
[workflowBespoke]: /kustomize/images/workflowBespoke.jpg
|
[workflowBespoke]: /kustomize/images/workflowBespoke.jpg
|
||||||
[workflowOts]: /kustomize/images/workflowOts.jpg
|
[workflowOts]: /kustomize/images/workflowOts.jpg
|
||||||
[kubectl-v1.14.0]:https://kubernetes.io/blog/2019/03/25/kubernetes-1-14-release-announcement/
|
[kubectl-v1.14.0]:https://kubernetes.io/blog/2019/03/25/kubernetes-1-14-release-announcement/
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ description: >
|
|||||||
In this workflow, all files are owned by the user and maintained in a repository under their control, but
|
In this workflow, all files are owned by the user and maintained in a repository under their control, but
|
||||||
they are based on an [off-the-shelf] configuration that is periodically consulted for updates.
|
they are based on an [off-the-shelf] configuration that is periodically consulted for updates.
|
||||||
|
|
||||||
|
|
||||||
![off-the-shelf config workflow image][workflowOts]
|
![off-the-shelf config workflow image][workflowOts]
|
||||||
|
|
||||||
#### 1) find and [fork] an [OTS] config
|
#### 1) find and [fork] an [OTS] config
|
||||||
@@ -49,6 +48,7 @@ distinct repository.
|
|||||||
> ```
|
> ```
|
||||||
|
|
||||||
You can also use [kubectl-v1.14.0] to apply your [variants].
|
You can also use [kubectl-v1.14.0] to apply your [variants].
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> kubectl apply -k ~/ldap/overlays/staging
|
> kubectl apply -k ~/ldap/overlays/staging
|
||||||
> kubectl apply -k ~/ldap/overlays/production
|
> kubectl apply -k ~/ldap/overlays/production
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ or [transformer configs] doesn't meet your needs.
|
|||||||
|
|
||||||
[12-factor]: https://12factor.net
|
[12-factor]: https://12factor.net
|
||||||
|
|
||||||
* A _generator_ plugin could be a helm chart
|
* A _generator_ plugin could be a helm chart
|
||||||
inflator, or a plugin that emits all the
|
inflator, or a plugin that emits all the
|
||||||
components (deployment, service, scaler,
|
components (deployment, service, scaler,
|
||||||
ingress, etc.) needed by someone's [12-factor]
|
ingress, etc.) needed by someone's [12-factor]
|
||||||
application, based on a smaller number of free
|
application, based on a smaller number of free
|
||||||
variables.
|
variables.
|
||||||
|
|
||||||
* A _transformer_ plugin might perform special
|
* A _transformer_ plugin might perform special
|
||||||
container command line edits, or any other
|
container command line edits, or any other
|
||||||
transformation beyond those provided by the
|
transformation beyond those provided by the
|
||||||
builtin (`namePrefix`, `commonLabels`, etc.)
|
builtin (`namePrefix`, `commonLabels`, etc.)
|
||||||
@@ -63,7 +63,6 @@ in-process kustomization run. Each of the
|
|||||||
resulting objects is now further interpreted by
|
resulting objects is now further interpreted by
|
||||||
kustomize as a _plugin configuration_ object.
|
kustomize as a _plugin configuration_ object.
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
A kustomization file could have the following lines:
|
A kustomization file could have the following lines:
|
||||||
@@ -112,7 +111,6 @@ browse the unit tests below the [plugins] root,
|
|||||||
e.g. the tests for [ChartInflator] or
|
e.g. the tests for [ChartInflator] or
|
||||||
[NameTransformer].
|
[NameTransformer].
|
||||||
|
|
||||||
|
|
||||||
## Placement
|
## Placement
|
||||||
|
|
||||||
Each plugin gets its own dedicated directory named
|
Each plugin gets its own dedicated directory named
|
||||||
@@ -228,11 +226,11 @@ provided in the kustomization file).
|
|||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
* [helm chart inflator] - A generator that inflates a helm chart.
|
* [helm chart inflator] - A generator that inflates a helm chart.
|
||||||
* [bashed config map] - Super simple configMap generation from bash.
|
* [bashed config map] - Super simple configMap generation from bash.
|
||||||
* [sed transformer] - Define your unstructured edits using a
|
* [sed transformer] - Define your unstructured edits using a
|
||||||
plugin like this one.
|
plugin like this one.
|
||||||
* [hashicorp go-getter] - Download kustomize layes and build it to generate resources
|
* [hashicorp go-getter] - Download kustomize layes and build it to generate resources
|
||||||
|
|
||||||
A generator plugin accepts nothing on `stdin`, but emits
|
A generator plugin accepts nothing on `stdin`, but emits
|
||||||
generated resources to `stdout`.
|
generated resources to `stdout`.
|
||||||
@@ -247,7 +245,7 @@ marshalled resources on `stdin` and capture
|
|||||||
|
|
||||||
#### Generator Options
|
#### Generator Options
|
||||||
|
|
||||||
A generator exec plugin can adjust the generator options for the resources it emits by setting one of the following internal annotations.
|
A generator exec plugin can adjust the generator options for the resources it emits by setting one of the following internal annotations.
|
||||||
|
|
||||||
> NOTE: These annotations are local to kustomize and will not be included in the final output.
|
> NOTE: These annotations are local to kustomize and will not be included in the final output.
|
||||||
|
|
||||||
@@ -258,6 +256,7 @@ Resources can be marked as needing to be processed by the internal hash transfor
|
|||||||
If this annotation is set on a resource not supported by the hash transformer the build will fail.
|
If this annotation is set on a resource not supported by the hash transformer the build will fail.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
@@ -266,14 +265,15 @@ metadata:
|
|||||||
annotations:
|
annotations:
|
||||||
kustomize.config.k8s.io/needs-hash: "true"
|
kustomize.config.k8s.io/needs-hash: "true"
|
||||||
data:
|
data:
|
||||||
foo: bar
|
foo: bar
|
||||||
```
|
```
|
||||||
|
|
||||||
**`kustomize.config.k8s.io/behavior`**
|
**`kustomize.config.k8s.io/behavior`**
|
||||||
|
|
||||||
The `behavior` annotation will influence how conflicts are handled for resources emitted by the plugin. Valid values include "create", "merge", and "replace" with "create" being the default.
|
The `behavior` annotation will influence how conflicts are handled for resources emitted by the plugin. Valid values include "create", "merge", and "replace" with "create" being the default.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
@@ -282,7 +282,7 @@ metadata:
|
|||||||
annotations:
|
annotations:
|
||||||
kustomize.config.k8s.io/behavior: "merge"
|
kustomize.config.k8s.io/behavior: "merge"
|
||||||
data:
|
data:
|
||||||
foo: bar
|
foo: bar
|
||||||
```
|
```
|
||||||
|
|
||||||
### Go plugins
|
### Go plugins
|
||||||
@@ -306,7 +306,7 @@ A Go plugin for kustomize looks like this:
|
|||||||
> package main
|
> package main
|
||||||
>
|
>
|
||||||
> import (
|
> import (
|
||||||
> "sigs.k8s.io/kustomize/api/resmap"
|
> "sigs.k8s.io/kustomize/api/resmap"
|
||||||
> ...
|
> ...
|
||||||
> )
|
> )
|
||||||
>
|
>
|
||||||
@@ -342,17 +342,17 @@ Do one or the other or both as desired.
|
|||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
* [service generator] - generate a service from a name and port argument.
|
* [service generator] - generate a service from a name and port argument.
|
||||||
* [string prefixer] - uses the value in `metadata/name` as the prefix.
|
* [string prefixer] - uses the value in `metadata/name` as the prefix.
|
||||||
This particular example exists to show how a plugin can
|
This particular example exists to show how a plugin can
|
||||||
transform the behavior of a plugin. See the
|
transform the behavior of a plugin. See the
|
||||||
`TestTransformedTransformers` test in the `target` package.
|
`TestTransformedTransformers` test in the `target` package.
|
||||||
* [date prefixer] - prefix the current date to resource names, a simple
|
* [date prefixer] - prefix the current date to resource names, a simple
|
||||||
example used to modify the string prefixer plugin just mentioned.
|
example used to modify the string prefixer plugin just mentioned.
|
||||||
* [secret generator] - generate secrets from a toy database.
|
* [secret generator] - generate secrets from a toy database.
|
||||||
* [sops encoded secrets] - a more complex secret generator that converts SOPS files into Kubernetes Secrets
|
* [sops encoded secrets] - a more complex secret generator that converts SOPS files into Kubernetes Secrets
|
||||||
* [SOPSGenerator] - another generator that decrypts SOPS files into Secrets
|
* [SOPSGenerator] - another generator that decrypts SOPS files into Secrets
|
||||||
* [All the builtin plugins](https://github.com/kubernetes-sigs/kustomize/tree/master/plugin/builtin).
|
* [All the builtin plugins](https://github.com/kubernetes-sigs/kustomize/tree/master/plugin/builtin).
|
||||||
User authored plugins are
|
User authored plugins are
|
||||||
on the same footing as builtin operations.
|
on the same footing as builtin operations.
|
||||||
|
|
||||||
@@ -372,4 +372,3 @@ d=$XDG_CONFIG_HOME/kustomize/plugin\
|
|||||||
go build -buildmode plugin \
|
go build -buildmode plugin \
|
||||||
-o $d/${kind}.so $d/${kind}.go
|
-o $d/${kind}.so $d/${kind}.go
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ For each plugin, an example is given for
|
|||||||
|
|
||||||
* implicitly triggering
|
* implicitly triggering
|
||||||
the plugin via a dedicated kustomization
|
the plugin via a dedicated kustomization
|
||||||
file field (e.g. the `AnnotationsTransformer` is
|
file field (e.g. the `AnnotationsTransformer` is
|
||||||
triggered by the `commonAnnotations` field).
|
triggered by the `commonAnnotations` field).
|
||||||
|
|
||||||
* explicitly triggering the plugin
|
* explicitly triggering the plugin
|
||||||
@@ -24,12 +24,11 @@ via the `generators` or `transformers` field
|
|||||||
(by providing a config file specifying the
|
(by providing a config file specifying the
|
||||||
plugin).
|
plugin).
|
||||||
|
|
||||||
The former method is convenient but limited in
|
The former method is convenient but limited in
|
||||||
power as most of the plugins arguments must
|
power as most of the plugins arguments must
|
||||||
be defaulted. The latter method allows for
|
be defaulted. The latter method allows for
|
||||||
complete plugin argument specification.
|
complete plugin argument specification.
|
||||||
|
|
||||||
|
|
||||||
[types.GeneratorOptions]: https://github.com/kubernetes-sigs/kustomize/tree/master/api/types/generatoroptions.go
|
[types.GeneratorOptions]: https://github.com/kubernetes-sigs/kustomize/tree/master/api/types/generatoroptions.go
|
||||||
[types.SecretArgs]: https://github.com/kubernetes-sigs/kustomize/tree/master/api/types/secretargs.go
|
[types.SecretArgs]: https://github.com/kubernetes-sigs/kustomize/tree/master/api/types/secretargs.go
|
||||||
[types.ConfigMapArgs]: https://github.com/kubernetes-sigs/kustomize/tree/master/api/types/configmapargs.go
|
[types.ConfigMapArgs]: https://github.com/kubernetes-sigs/kustomize/tree/master/api/types/configmapargs.go
|
||||||
@@ -42,6 +41,7 @@ complete plugin argument specification.
|
|||||||
[image.Image]: https://github.com/kubernetes-sigs/kustomize/tree/master/api/types/image.go
|
[image.Image]: https://github.com/kubernetes-sigs/kustomize/tree/master/api/types/image.go
|
||||||
|
|
||||||
## _AnnotationTransformer_
|
## _AnnotationTransformer_
|
||||||
|
|
||||||
### Usage via `kustomization.yaml`
|
### Usage via `kustomization.yaml`
|
||||||
|
|
||||||
#### field name: `commonAnnotations`
|
#### field name: `commonAnnotations`
|
||||||
@@ -56,6 +56,7 @@ commonAnnotations:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Usage via plugin
|
### Usage via plugin
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
|
|
||||||
> Annotations map\[string\]string
|
> Annotations map\[string\]string
|
||||||
@@ -63,6 +64,7 @@ commonAnnotations:
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: AnnotationsTransformer
|
> kind: AnnotationsTransformer
|
||||||
@@ -76,8 +78,6 @@ commonAnnotations:
|
|||||||
> create: true
|
> create: true
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## _ConfigMapGenerator_
|
## _ConfigMapGenerator_
|
||||||
|
|
||||||
### Usage via `kustomization.yaml`
|
### Usage via `kustomization.yaml`
|
||||||
@@ -122,7 +122,7 @@ configMapGenerator:
|
|||||||
- application.properties
|
- application.properties
|
||||||
- more.properties
|
- more.properties
|
||||||
- name: my-java-server-env-vars
|
- name: my-java-server-env-vars
|
||||||
literals:
|
literals:
|
||||||
- JAVA_HOME=/opt/java/jdk
|
- JAVA_HOME=/opt/java/jdk
|
||||||
- JAVA_TOOL_OPTIONS=-agentlib:hprof
|
- JAVA_TOOL_OPTIONS=-agentlib:hprof
|
||||||
options:
|
options:
|
||||||
@@ -156,11 +156,13 @@ configMapGenerator:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Usage via plugin
|
### Usage via plugin
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
|
|
||||||
> [types.ConfigMapArgs]
|
> [types.ConfigMapArgs]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: ConfigMapGenerator
|
> kind: ConfigMapGenerator
|
||||||
@@ -174,8 +176,8 @@ configMapGenerator:
|
|||||||
> - VEGETABLE=carrot
|
> - VEGETABLE=carrot
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
## _ImageTagTransformer_
|
## _ImageTagTransformer_
|
||||||
|
|
||||||
### Usage via `kustomization.yaml`
|
### Usage via `kustomization.yaml`
|
||||||
|
|
||||||
#### field name: `images`
|
#### field name: `images`
|
||||||
@@ -197,11 +199,11 @@ containers:
|
|||||||
```
|
```
|
||||||
|
|
||||||
one can change the `image` in the following ways:
|
one can change the `image` in the following ways:
|
||||||
|
|
||||||
- `postgres:8` to `my-registry/my-postgres:v1`,
|
- `postgres:8` to `my-registry/my-postgres:v1`,
|
||||||
- nginx tag `1.7.9` to `1.8.0`,
|
- nginx tag `1.7.9` to `1.8.0`,
|
||||||
- image name `my-demo-app` to `my-app`,
|
- image name `my-demo-app` to `my-app`,
|
||||||
- alpine's tag `3.7` to a digest value
|
- alpine's tag `3.7` to a digest value
|
||||||
|
|
||||||
all with the following *kustomization*:
|
all with the following *kustomization*:
|
||||||
|
|
||||||
@@ -219,6 +221,7 @@ images:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Usage via plugin
|
### Usage via plugin
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
|
|
||||||
> ImageTag [image.Image]
|
> ImageTag [image.Image]
|
||||||
@@ -226,6 +229,7 @@ images:
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: ImageTagTransformer
|
> kind: ImageTagTransformer
|
||||||
@@ -236,9 +240,8 @@ images:
|
|||||||
> newTag: v2
|
> newTag: v2
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## _LabelTransformer_
|
## _LabelTransformer_
|
||||||
|
|
||||||
### Usage via `kustomization.yaml`
|
### Usage via `kustomization.yaml`
|
||||||
|
|
||||||
#### field name: `commonLabels`
|
#### field name: `commonLabels`
|
||||||
@@ -253,6 +256,7 @@ commonLabels:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Usage via plugin
|
### Usage via plugin
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
|
|
||||||
> Labels map\[string\]string
|
> Labels map\[string\]string
|
||||||
@@ -260,6 +264,7 @@ commonLabels:
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: LabelTransformer
|
> kind: LabelTransformer
|
||||||
@@ -273,14 +278,8 @@ commonLabels:
|
|||||||
> create: true
|
> create: true
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## _NamespaceTransformer_
|
## _NamespaceTransformer_
|
||||||
|
|
||||||
### Usage via `kustomization.yaml`
|
### Usage via `kustomization.yaml`
|
||||||
|
|
||||||
#### field name: `namespace`
|
#### field name: `namespace`
|
||||||
@@ -292,6 +291,7 @@ namespace: my-namespace
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Usage via plugin
|
### Usage via plugin
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
|
|
||||||
> [types.ObjectMeta]
|
> [types.ObjectMeta]
|
||||||
@@ -299,6 +299,7 @@ namespace: my-namespace
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: NamespaceTransformer
|
> kind: NamespaceTransformer
|
||||||
@@ -316,11 +317,8 @@ namespace: my-namespace
|
|||||||
> group: rbac.authorization.k8s.io
|
> group: rbac.authorization.k8s.io
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## _PatchesJson6902_
|
## _PatchesJson6902_
|
||||||
|
|
||||||
### Usage via `kustomization.yaml`
|
### Usage via `kustomization.yaml`
|
||||||
|
|
||||||
#### field name: `patchesJson6902`
|
#### field name: `patchesJson6902`
|
||||||
@@ -328,7 +326,7 @@ namespace: my-namespace
|
|||||||
Each entry in this list should resolve to
|
Each entry in this list should resolve to
|
||||||
a kubernetes object and a JSON patch that will be applied
|
a kubernetes object and a JSON patch that will be applied
|
||||||
to the object.
|
to the object.
|
||||||
The JSON patch is documented at https://tools.ietf.org/html/rfc6902
|
The JSON patch is documented at <https://tools.ietf.org/html/rfc6902>
|
||||||
|
|
||||||
target field points to a kubernetes object within the same kustomization
|
target field points to a kubernetes object within the same kustomization
|
||||||
by the object's group, version, kind, name and namespace.
|
by the object's group, version, kind, name and namespace.
|
||||||
@@ -385,7 +383,9 @@ patchesJson6902:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Usage via plugin
|
### Usage via plugin
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
|
|
||||||
> Target [types.PatchTarget]
|
> Target [types.PatchTarget]
|
||||||
>
|
>
|
||||||
> Path string
|
> Path string
|
||||||
@@ -393,6 +393,7 @@ patchesJson6902:
|
|||||||
> JsonOp string
|
> JsonOp string
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: PatchJson6902Transformer
|
> kind: PatchJson6902Transformer
|
||||||
@@ -406,8 +407,8 @@ patchesJson6902:
|
|||||||
> path: jsonpatch.json
|
> path: jsonpatch.json
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
## _PatchesStrategicMerge_
|
## _PatchesStrategicMerge_
|
||||||
|
|
||||||
### Usage via `kustomization.yaml`
|
### Usage via `kustomization.yaml`
|
||||||
|
|
||||||
#### field name: `patchesStrategicMerge`
|
#### field name: `patchesStrategicMerge`
|
||||||
@@ -435,6 +436,7 @@ patchesStrategicMerge:
|
|||||||
```
|
```
|
||||||
|
|
||||||
The patch content can be a inline string as well.
|
The patch content can be a inline string as well.
|
||||||
|
|
||||||
```
|
```
|
||||||
patchesStrategicMerge:
|
patchesStrategicMerge:
|
||||||
- |-
|
- |-
|
||||||
@@ -463,8 +465,8 @@ patch that performs all the needed deletions.
|
|||||||
>
|
>
|
||||||
> Patches string
|
> Patches string
|
||||||
|
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: PatchStrategicMergeTransformer
|
> kind: PatchStrategicMergeTransformer
|
||||||
@@ -474,14 +476,14 @@ patch that performs all the needed deletions.
|
|||||||
> - patch.yaml
|
> - patch.yaml
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
## _PatchTransformer_
|
## _PatchTransformer_
|
||||||
|
|
||||||
### Usage via `kustomization.yaml`
|
### Usage via `kustomization.yaml`
|
||||||
|
|
||||||
#### field name: `patches`
|
#### field name: `patches`
|
||||||
|
|
||||||
Each entry in this list should resolve to an Patch
|
Each entry in this list should resolve to an Patch
|
||||||
object, which includes a patch and a target selector.
|
object, which includes a patch and a target selector.
|
||||||
The patch can be either a strategic merge patch or a
|
The patch can be either a strategic merge patch or a
|
||||||
JSON patch. it can be either a patch file or an inline
|
JSON patch. it can be either a patch file or an inline
|
||||||
string. The target selects
|
string. The target selects
|
||||||
@@ -506,23 +508,25 @@ patches:
|
|||||||
value: new value
|
value: new value
|
||||||
target:
|
target:
|
||||||
kind: MyKind
|
kind: MyKind
|
||||||
labelSelector: "env=dev"
|
labelSelector: "env=dev"
|
||||||
```
|
```
|
||||||
|
|
||||||
The `name` and `namespace` fields of the patch target selector are
|
The `name` and `namespace` fields of the patch target selector are
|
||||||
automatically anchored regular expressions. This means that the value `myapp`
|
automatically anchored regular expressions. This means that the value `myapp`
|
||||||
is equivalent to `^myapp$`.
|
is equivalent to `^myapp$`.
|
||||||
|
|
||||||
### Usage via plugin
|
### Usage via plugin
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
|
|
||||||
> Path string
|
> Path string
|
||||||
>
|
>
|
||||||
> Patch string
|
> Patch string
|
||||||
>
|
>
|
||||||
> Target \*[types.Selector]
|
> Target \*[types.Selector]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: PatchTransformer
|
> kind: PatchTransformer
|
||||||
@@ -534,10 +538,8 @@ is equivalent to `^myapp$`.
|
|||||||
> kind: Deployment
|
> kind: Deployment
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## _PrefixSuffixTransformer_
|
## _PrefixSuffixTransformer_
|
||||||
|
|
||||||
### Usage via `kustomization.yaml`
|
### Usage via `kustomization.yaml`
|
||||||
|
|
||||||
#### field names: `namePrefix`, `nameSuffix`
|
#### field names: `namePrefix`, `nameSuffix`
|
||||||
@@ -547,7 +549,7 @@ of all resources.
|
|||||||
|
|
||||||
E.g. a deployment named `wordpress` could
|
E.g. a deployment named `wordpress` could
|
||||||
become `alices-wordpress` or `wordpress-v2`
|
become `alices-wordpress` or `wordpress-v2`
|
||||||
or `alices-wordpress-v2`.
|
or `alices-wordpress-v2`.
|
||||||
|
|
||||||
```
|
```
|
||||||
namePrefix: alices-
|
namePrefix: alices-
|
||||||
@@ -558,6 +560,7 @@ The suffix is appended before the content hash if
|
|||||||
the resource type is ConfigMap or Secret.
|
the resource type is ConfigMap or Secret.
|
||||||
|
|
||||||
### Usage via plugin
|
### Usage via plugin
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
|
|
||||||
> Prefix string
|
> Prefix string
|
||||||
@@ -567,6 +570,7 @@ the resource type is ConfigMap or Secret.
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: PrefixSuffixTransformer
|
> kind: PrefixSuffixTransformer
|
||||||
@@ -578,9 +582,8 @@ the resource type is ConfigMap or Secret.
|
|||||||
> - path: metadata/name
|
> - path: metadata/name
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## _ReplicaCountTransformer_
|
## _ReplicaCountTransformer_
|
||||||
|
|
||||||
### Usage via `kustomization.yaml`
|
### Usage via `kustomization.yaml`
|
||||||
|
|
||||||
#### field name: `replicas`
|
#### field name: `replicas`
|
||||||
@@ -612,6 +615,7 @@ be modified at the same time.
|
|||||||
As this declaration does not take in a `kind:` nor a `group:`
|
As this declaration does not take in a `kind:` nor a `group:`
|
||||||
it will match any `group` and `kind` that has a matching name and
|
it will match any `group` and `kind` that has a matching name and
|
||||||
that is one of:
|
that is one of:
|
||||||
|
|
||||||
- `Deployment`
|
- `Deployment`
|
||||||
- `ReplicationController`
|
- `ReplicationController`
|
||||||
- `ReplicaSet`
|
- `ReplicaSet`
|
||||||
@@ -628,6 +632,7 @@ For more complex use cases, revert to using a patch.
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: ReplicaCountTransformer
|
> kind: ReplicaCountTransformer
|
||||||
@@ -645,8 +650,6 @@ For more complex use cases, revert to using a patch.
|
|||||||
> kind: ReplicationController
|
> kind: ReplicationController
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## _SecretGenerator_
|
## _SecretGenerator_
|
||||||
|
|
||||||
### Usage via `kustomization.yaml`
|
### Usage via `kustomization.yaml`
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ current setup.
|
|||||||
|
|
||||||
#### requirements
|
#### requirements
|
||||||
|
|
||||||
* linux, git, curl, Go 1.13
|
* linux, git, curl, Go 1.13
|
||||||
|
|
||||||
|
|
||||||
## Make a place to work
|
## Make a place to work
|
||||||
|
|
||||||
@@ -128,11 +127,11 @@ EOF
|
|||||||
```
|
```
|
||||||
|
|
||||||
Review the files
|
Review the files
|
||||||
|
|
||||||
```
|
```
|
||||||
ls -C1 $MYAPP
|
ls -C1 $MYAPP
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Make a home for plugins
|
## Make a home for plugins
|
||||||
|
|
||||||
Plugins must live in a particular place for
|
Plugins must live in a particular place for
|
||||||
@@ -205,6 +204,7 @@ chmod a+x $MY_PLUGIN_DIR/SillyConfigMapGenerator
|
|||||||
## Install kustomize
|
## Install kustomize
|
||||||
|
|
||||||
Per the [instructions](/kustomize/installation):
|
Per the [instructions](/kustomize/installation):
|
||||||
|
|
||||||
```
|
```
|
||||||
curl -s "https://raw.githubusercontent.com/\
|
curl -s "https://raw.githubusercontent.com/\
|
||||||
kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
||||||
@@ -218,7 +218,7 @@ mv kustomize $DEMO/bin
|
|||||||
tree $DEMO
|
tree $DEMO
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build your app, using the plugin:
|
## Build your app, using the plugin
|
||||||
|
|
||||||
```
|
```
|
||||||
XDG_CONFIG_HOME=$DEMO $DEMO/bin/kustomize build --enable_alpha_plugins $MYAPP
|
XDG_CONFIG_HOME=$DEMO $DEMO/bin/kustomize build --enable_alpha_plugins $MYAPP
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ accepting a shared plugin _must compile both
|
|||||||
kustomize and the plugin_.
|
kustomize and the plugin_.
|
||||||
|
|
||||||
This means a one-time run of
|
This means a one-time run of
|
||||||
|
|
||||||
```
|
```
|
||||||
# Or whatever is appropriate at time of reading
|
# Or whatever is appropriate at time of reading
|
||||||
GOPATH=${whatever} GO111MODULE=on go get sigs.k8s.io/kustomize/api
|
GOPATH=${whatever} GO111MODULE=on go get sigs.k8s.io/kustomize/api
|
||||||
@@ -68,16 +69,17 @@ and then a normal development cycle using
|
|||||||
go build -buildmode plugin \
|
go build -buildmode plugin \
|
||||||
-o ${wherever}/${kind}.so ${wherever}/${kind}.go
|
-o ${wherever}/${kind}.so ${wherever}/${kind}.go
|
||||||
```
|
```
|
||||||
|
|
||||||
with paths and the release version tag (e.g. `v3.0.0`)
|
with paths and the release version tag (e.g. `v3.0.0`)
|
||||||
adjusted as needed.
|
adjusted as needed.
|
||||||
|
|
||||||
For comparison, consider what one
|
For comparison, consider what one
|
||||||
must do to write a [tensorflow plugin].
|
must do to write a [tensorflow plugin].
|
||||||
|
|
||||||
## Why support Go plugins?
|
## Why support Go plugins
|
||||||
|
|
||||||
### Safety
|
### Safety
|
||||||
|
|
||||||
The Go plugin developer sees the same API offered
|
The Go plugin developer sees the same API offered
|
||||||
to native kustomize operations, assuring certain
|
to native kustomize operations, assuring certain
|
||||||
semantics, invariants, checks, etc. An exec
|
semantics, invariants, checks, etc. An exec
|
||||||
@@ -104,7 +106,7 @@ a developer can write an `.go` program that functions
|
|||||||
as an _exec plugin_, but can be processed by `go generate`
|
as an _exec plugin_, but can be processed by `go generate`
|
||||||
to emit a _Go plugin_ (or vice versa).
|
to emit a _Go plugin_ (or vice versa).
|
||||||
|
|
||||||
### Unit of contribution
|
### Unit of contribution
|
||||||
|
|
||||||
All the builtin generators and transformers
|
All the builtin generators and transformers
|
||||||
are themselves Go plugins. This means that
|
are themselves Go plugins. This means that
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ PLUGIN_ROOT=$DEMO/kustomize/plugin
|
|||||||
and ephemerally set `XDG_CONFIG_HOME` on a command
|
and ephemerally set `XDG_CONFIG_HOME` on a command
|
||||||
line below.
|
line below.
|
||||||
|
|
||||||
### What apiVersion and kind?
|
### What apiVersion and kind
|
||||||
|
|
||||||
At this stage in the development of kustomize
|
At this stage in the development of kustomize
|
||||||
plugins, plugin code doesn't know or care what
|
plugins, plugin code doesn't know or care what
|
||||||
@@ -180,12 +180,12 @@ dependency [skew].
|
|||||||
|
|
||||||
On load failure
|
On load failure
|
||||||
|
|
||||||
* be sure to build the plugin with the same
|
* be sure to build the plugin with the same
|
||||||
version of Go (_go1.13_) on the same `$GOOS`
|
version of Go (_go1.13_) on the same `$GOOS`
|
||||||
(_linux_) and `$GOARCH` (_amd64_) used to build
|
(_linux_) and `$GOARCH` (_amd64_) used to build
|
||||||
the kustomize being [used in this demo].
|
the kustomize being [used in this demo].
|
||||||
|
|
||||||
* change the plugin's dependencies in its `go.mod`
|
* change the plugin's dependencies in its `go.mod`
|
||||||
to match the versions used by kustomize (check
|
to match the versions used by kustomize (check
|
||||||
kustomize's `go.mod` used in its tagged commit).
|
kustomize's `go.mod` used in its tagged commit).
|
||||||
|
|
||||||
@@ -356,7 +356,7 @@ This should look something like:
|
|||||||
> └── secGenerator.yaml
|
> └── secGenerator.yaml
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
## Build your app, using the plugin:
|
## Build your app, using the plugin
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
XDG_CONFIG_HOME=$DEMO $tmpGoPath/bin/kustomize build --enable_alpha_plugins $MYAPP
|
XDG_CONFIG_HOME=$DEMO $tmpGoPath/bin/kustomize build --enable_alpha_plugins $MYAPP
|
||||||
|
|||||||
@@ -13,5 +13,6 @@ choco install kustomize
|
|||||||
|
|
||||||
For support on the chocolatey package
|
For support on the chocolatey package
|
||||||
and prior releases, see:
|
and prior releases, see:
|
||||||
|
|
||||||
- [Choco Package](https://chocolatey.org/packages/kustomize)
|
- [Choco Package](https://chocolatey.org/packages/kustomize)
|
||||||
- [Package Source](https://github.com/kenmaglio/choco-kustomize)
|
- [Package Source](https://github.com/kenmaglio/choco-kustomize)
|
||||||
|
|||||||
@@ -18,4 +18,3 @@ For [MacPorts](https://www.macports.org) users:
|
|||||||
```
|
```
|
||||||
sudo port install kustomize
|
sudo port install kustomize
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -39,5 +39,4 @@ git checkout kustomize/v3.2.3
|
|||||||
~/go/bin/kustomize version
|
~/go/bin/kustomize version
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[Go]: https://golang.org
|
[Go]: https://golang.org
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ linkTitle = "Kustomize"
|
|||||||
|
|
||||||
{{< blocks/section >}}
|
{{< blocks/section >}}
|
||||||
|
|
||||||
|
|
||||||
{{% blocks/feature icon="fab fa-github" title="参与贡献" %}}
|
{{% blocks/feature icon="fab fa-github" title="参与贡献" %}}
|
||||||
欢迎在 **Github** 提交 [RP](https://github.com/kubernetes-sigs/kustomize/pulls),贡献你的力量。
|
欢迎在 **Github** 提交 [RP](https://github.com/kubernetes-sigs/kustomize/pulls),贡献你的力量。
|
||||||
{{% /blocks/feature %}}
|
{{% /blocks/feature %}}
|
||||||
|
|||||||
@@ -96,4 +96,4 @@ spec:
|
|||||||
app: bingo
|
app: bingo
|
||||||
owner: alice
|
owner: alice
|
||||||
someName: someValue
|
someName: someValue
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ description: >
|
|||||||
列表中的每个条目都将生成一个 ConfigMap (合计可以生成 n 个 ConfigMap)。
|
列表中的每个条目都将生成一个 ConfigMap (合计可以生成 n 个 ConfigMap)。
|
||||||
|
|
||||||
以下示例创建四个 ConfigMap:
|
以下示例创建四个 ConfigMap:
|
||||||
|
|
||||||
- 第一个使用给定文件的名称和内容创建数据
|
- 第一个使用给定文件的名称和内容创建数据
|
||||||
- 第二个使用文件中的键/值对将数据创建为键/值
|
- 第二个使用文件中的键/值对将数据创建为键/值
|
||||||
- 第三个使用 `literals` 中的键/值对创建数据作为键/值
|
- 第三个使用 `literals` 中的键/值对创建数据作为键/值
|
||||||
@@ -69,4 +70,4 @@ configMapGenerator:
|
|||||||
- name: app-whatever
|
- name: app-whatever
|
||||||
files:
|
files:
|
||||||
- myFileName.ini=whatever.ini
|
- myFileName.ini=whatever.ini
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ description: >
|
|||||||
|
|
||||||
Annotations 可以放入 openAPI 的定义中:
|
Annotations 可以放入 openAPI 的定义中:
|
||||||
|
|
||||||
- "x-kubernetes-annotation": ""
|
- "x-kubernetes-annotation": ""
|
||||||
- "x-kubernetes-label-selector": ""
|
- "x-kubernetes-label-selector": ""
|
||||||
- "x-kubernetes-identity": ""
|
- "x-kubernetes-identity": ""
|
||||||
- "x-kubernetes-object-ref-api-version": "v1",
|
- "x-kubernetes-object-ref-api-version": "v1",
|
||||||
- "x-kubernetes-object-ref-kind": "Secret",
|
- "x-kubernetes-object-ref-kind": "Secret",
|
||||||
- "x-kubernetes-object-ref-name-key": "name",
|
- "x-kubernetes-object-ref-name-key": "name",
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ spec:
|
|||||||
```
|
```
|
||||||
|
|
||||||
想要将 `image` 做如下更改:
|
想要将 `image` 做如下更改:
|
||||||
|
|
||||||
- 将 `postgres:8` 改为 `my-registry/my-postgres:v1`
|
- 将 `postgres:8` 改为 `my-registry/my-postgres:v1`
|
||||||
- 将 nginx tag 从 `1.7.9` 改为 `1.8.0`
|
- 将 nginx tag 从 `1.7.9` 改为 `1.8.0`
|
||||||
- 将镜像名称 `my-demo-app` 改为 `my-app`
|
- 将镜像名称 `my-demo-app` 改为 `my-app`
|
||||||
- 将 alpine 的 tag `3.7` 改为 digest 值
|
- 将 alpine 的 tag `3.7` 改为 digest 值
|
||||||
|
|
||||||
只需在 *kustomization* 中添加以下内容:
|
只需在 *kustomization* 中添加以下内容:
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ description: >
|
|||||||
[strategic merge]: /kustomize/zh/api-reference/glossary#patchstrategicmerge
|
[strategic merge]: /kustomize/zh/api-reference/glossary#patchstrategicmerge
|
||||||
[JSON]: /kustomize/zh/api-reference/glossary#patchjson6902
|
[JSON]: /kustomize/zh/api-reference/glossary#patchjson6902
|
||||||
|
|
||||||
|
|
||||||
Patches 在资源上添加或覆盖字段,Kustomization 使用 `patches` 字段来提供该功能。
|
Patches 在资源上添加或覆盖字段,Kustomization 使用 `patches` 字段来提供该功能。
|
||||||
|
|
||||||
`patches` 字段包含要按指定顺序应用的 patch 列表。
|
`patches` 字段包含要按指定顺序应用的 patch 列表。
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ patchesStrategicMerge:
|
|||||||
```
|
```
|
||||||
|
|
||||||
patch 内容也可以是一个inline string:
|
patch 内容也可以是一个inline string:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
|
|||||||
@@ -31,9 +31,10 @@ replicas:
|
|||||||
该字段内容为列表,所以可以同时修改许多资源。
|
该字段内容为列表,所以可以同时修改许多资源。
|
||||||
|
|
||||||
由于这个声明无法设置 `kind:` 或 `group:`,所以他只能匹配如下资源中的一种:
|
由于这个声明无法设置 `kind:` 或 `group:`,所以他只能匹配如下资源中的一种:
|
||||||
|
|
||||||
- `Deployment`
|
- `Deployment`
|
||||||
- `ReplicationController`
|
- `ReplicationController`
|
||||||
- `ReplicaSet`
|
- `ReplicaSet`
|
||||||
- `StatefulSet`
|
- `StatefulSet`
|
||||||
|
|
||||||
对于更复杂的用例,请使用 patch 。
|
对于更复杂的用例,请使用 patch 。
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ description: >
|
|||||||
---
|
---
|
||||||
|
|
||||||
该条目可以是指向本地目录的相对路径,也可以是指向远程仓库中的目录的 URL,例如:
|
该条目可以是指向本地目录的相对路径,也可以是指向远程仓库中的目录的 URL,例如:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ Initial release after move from github.com/kubernetes/kubectl to github.com/kube
|
|||||||
|
|
||||||
History
|
History
|
||||||
|
|
||||||
* May 2018: v1.0 after move to github.com/kubernetes-sigs/kubectl
|
* May 2018: v1.0 after move to github.com/kubernetes-sigs/kubectl
|
||||||
from github.com/kubernetes/kubectl.
|
from github.com/kubernetes/kubectl.
|
||||||
Has kustomization file, bases, overlays, basic transforms.
|
Has kustomization file, bases, overlays, basic transforms.
|
||||||
* Apr 2018: s/kinflate/kustomize/, s/manifest/kustomization/
|
* Apr 2018: s/kinflate/kustomize/, s/manifest/kustomization/
|
||||||
* Oct 2017: s/kexpand/kinflate/
|
* Oct 2017: s/kexpand/kinflate/
|
||||||
* Sep 2017: kexpand [starts](https://github.com/kubernetes/kubectl/pull/65)
|
* Sep 2017: kexpand [starts](https://github.com/kubernetes/kubectl/pull/65)
|
||||||
in github.com/kubernetes/kubectl
|
in github.com/kubernetes/kubectl
|
||||||
* Aug 2017: [DAM] authored by Brian Grant
|
* Aug 2017: [DAM] authored by Brian Grant
|
||||||
|
|
||||||
[DAM]: https://docs.google.com/document/d/1cLPGweVEYrVqQvBLJg6sxV-TrE5Rm2MNOBA_cxZP2WU
|
[DAM]: https://docs.google.com/document/d/1cLPGweVEYrVqQvBLJg6sxV-TrE5Rm2MNOBA_cxZP2WU
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ path or URL to a kustomization directory in the
|
|||||||
![pruning dead branches][imgPruning]
|
![pruning dead branches][imgPruning]
|
||||||
|
|
||||||
_Alpha_
|
_Alpha_
|
||||||
|
|
||||||
Users can add an `inventory` stanza to their
|
Users can add an `inventory` stanza to their
|
||||||
kustomization file, to add a special _inventory
|
kustomization file, to add a special _inventory
|
||||||
object_ to the `build` result.
|
object_ to the `build` result.
|
||||||
@@ -164,10 +164,9 @@ orphaned cluster resources.
|
|||||||
For more information see the
|
For more information see the
|
||||||
[kustomize inventory object documentation].
|
[kustomize inventory object documentation].
|
||||||
|
|
||||||
|
|
||||||
## Field changes / deprecations
|
## Field changes / deprecations
|
||||||
|
|
||||||
### `resources` expanded, `bases` deprecated
|
### `resources` expanded, `bases` deprecated
|
||||||
|
|
||||||
The `resources` field has been generalized; it now
|
The `resources` field has been generalized; it now
|
||||||
accepts what formerly could only be specified in
|
accepts what formerly could only be specified in
|
||||||
@@ -235,7 +234,7 @@ or transform a generator or a transformer (see
|
|||||||
|
|
||||||
The common task of patching a deployment to edit
|
The common task of patching a deployment to edit
|
||||||
the number of replicas is now made easier
|
the number of replicas is now made easier
|
||||||
with the new [replicas](/kustomize/api-reference/kustomization/replicas) field.
|
with the new [replicas](/kustomize/api-reference/kustomization/replicas) field.
|
||||||
|
|
||||||
### `envs` field
|
### `envs` field
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ floor on a stable API for [plugin] developers
|
|||||||
(both _Go_ plugin developers and _exec_ plugin
|
(both _Go_ plugin developers and _exec_ plugin
|
||||||
developers who happen to use Go).
|
developers who happen to use Go).
|
||||||
|
|
||||||
### Why so soon after v2.1.0?
|
### Why so soon after v2.1.0
|
||||||
|
|
||||||
[semantic versioning]: https://semver.org
|
[semantic versioning]: https://semver.org
|
||||||
[Go modules doc]: https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher
|
[Go modules doc]: https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher
|
||||||
@@ -70,6 +70,3 @@ Aside - the set of kustomize packages outside
|
|||||||
by package use, this API surface must shrink.
|
by package use, this API surface must shrink.
|
||||||
Such shrinkage will trigger a major version
|
Such shrinkage will trigger a major version
|
||||||
increment.
|
increment.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ description: >
|
|||||||
---
|
---
|
||||||
|
|
||||||
## Extended patches
|
## Extended patches
|
||||||
|
|
||||||
Since this version, Kustomize allows applying one patch to multiple resources. This works for both Strategic Merge Patch and JSON Patch. Take a look at [patch multiple objects](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/patchMultipleObjects.md).
|
Since this version, Kustomize allows applying one patch to multiple resources. This works for both Strategic Merge Patch and JSON Patch. Take a look at [patch multiple objects](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/patchMultipleObjects.md).
|
||||||
|
|
||||||
## Improved Resource Matching
|
## Improved Resource Matching
|
||||||
@@ -52,7 +53,6 @@ spec:
|
|||||||
value: PRODVALUE
|
value: PRODVALUE
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Variable resolution improvement
|
### Variable resolution improvement
|
||||||
|
|
||||||
It is possible to add namespace field to the variable declaration. In the following example,
|
It is possible to add namespace field to the variable declaration. In the following example,
|
||||||
@@ -87,7 +87,8 @@ vars:
|
|||||||
### Simultaneous change of names and namespaces
|
### Simultaneous change of names and namespaces
|
||||||
|
|
||||||
Kustomize is now able to deal with simultaneous changes of name and namespace.
|
Kustomize is now able to deal with simultaneous changes of name and namespace.
|
||||||
Special attention has been paid the handling of:
|
Special attention has been paid the handling of:
|
||||||
|
|
||||||
- ClusterRoleBinding/RoleBinding "subjects" field,
|
- ClusterRoleBinding/RoleBinding "subjects" field,
|
||||||
- ValidatingWebhookConfiguration "webhooks" field.
|
- ValidatingWebhookConfiguration "webhooks" field.
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ resources:
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
### Resource and Kustomize Context matching.
|
### Resource and Kustomize Context matching
|
||||||
|
|
||||||
Kustomize is now able to support more aggregation patterns.
|
Kustomize is now able to support more aggregation patterns.
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ description: >
|
|||||||
---
|
---
|
||||||
|
|
||||||
## Inline Patch
|
## Inline Patch
|
||||||
|
|
||||||
Since this version, Kustomize allows inline patches in all three of `patchesStrategicMerge`, `patchesJson6902` and `patches`. Take a look at [inline patch](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/examples/inlinePatch.md).
|
Since this version, Kustomize allows inline patches in all three of `patchesStrategicMerge`, `patchesJson6902` and `patches`. Take a look at [inline patch](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/examples/inlinePatch.md).
|
||||||
|
|
||||||
## New Subcommand
|
## New Subcommand
|
||||||
@@ -14,11 +15,13 @@ Since this version, Kustomize allows inline patches in all three of `patchesStra
|
|||||||
Since this version, one can create a kustomization.yaml file in a directory through a `create` subcommand.
|
Since this version, one can create a kustomization.yaml file in a directory through a `create` subcommand.
|
||||||
|
|
||||||
Create a new overlay from the base ../base
|
Create a new overlay from the base ../base
|
||||||
|
|
||||||
```
|
```
|
||||||
kustomize create --resources ../base
|
kustomize create --resources ../base
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a new kustomization detecing resources in the current directory
|
Create a new kustomization detecing resources in the current directory
|
||||||
|
|
||||||
```
|
```
|
||||||
kustomize create --autodetect
|
kustomize create --autodetect
|
||||||
```
|
```
|
||||||
@@ -30,5 +33,5 @@ kustomize create --autodetect --recursive
|
|||||||
```
|
```
|
||||||
|
|
||||||
### New Example Generator
|
### New Example Generator
|
||||||
A new example generator of using go-getter to download resources is added. Take a look at [go-getter generator](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/goGetterGeneratorPlugin.md).
|
|
||||||
|
|
||||||
|
A new example generator of using go-getter to download resources is added. Take a look at [go-getter generator](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/goGetterGeneratorPlugin.md).
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ description: >
|
|||||||
|
|
||||||
[versioning policy documentation]: /site/content/en/faq/versioningPolicy.md
|
[versioning policy documentation]: /site/content/en/faq/versioningPolicy.md
|
||||||
[release process documentation]: /releasing
|
[release process documentation]: /releasing
|
||||||
|
|
||||||
## Summary of changes
|
## Summary of changes
|
||||||
|
|
||||||
### First release of the Go API-only module.
|
### First release of the Go API-only module
|
||||||
|
|
||||||
Many of the PRs since the last vrelease were
|
Many of the PRs since the last vrelease were
|
||||||
around restructuring the _sigs.k8s.io/kustomize_
|
around restructuring the _sigs.k8s.io/kustomize_
|
||||||
@@ -43,7 +43,6 @@ any other client.
|
|||||||
The new semver-able API will begin with `v4.0.0` (not
|
The new semver-able API will begin with `v4.0.0` (not
|
||||||
yet released) and be a clean break with `v3` etc.
|
yet released) and be a clean break with `v3` etc.
|
||||||
|
|
||||||
|
|
||||||
### Change log since v3.2.0
|
### Change log since v3.2.0
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ description: >
|
|||||||
File issues as desired, but if you've found a problem
|
File issues as desired, but if you've found a problem
|
||||||
with how `kustomize build` works, please report
|
with how `kustomize build` works, please report
|
||||||
|
|
||||||
* the output of `kustomize version`,
|
* the output of `kustomize version`,
|
||||||
* the input (the content of `kustomization.yaml`
|
* the input (the content of `kustomization.yaml`
|
||||||
and any files it refers to),
|
and any files it refers to),
|
||||||
* the expected YAML output.
|
* the expected YAML output.
|
||||||
|
|
||||||
## If you have `go` installed
|
## If you have `go` installed
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ package] for specifying a kustomization's input and the
|
|||||||
expected output.
|
expected output.
|
||||||
|
|
||||||
Copy one of those tests, e.g. this [reusable custom
|
Copy one of those tests, e.g. this [reusable custom
|
||||||
transformer test], to a new test file in the
|
transformer test], to a new test file in the
|
||||||
krusty package.
|
krusty package.
|
||||||
|
|
||||||
Insert the inputs you want to use, and run it as
|
Insert the inputs you want to use, and run it as
|
||||||
|
|||||||
@@ -21,5 +21,3 @@ If you are interested in contributing towards Kustomize or getting more involved
|
|||||||
- join the [mailing list] and reach out
|
- join the [mailing list] and reach out
|
||||||
- join the [slack channel] and reach out
|
- join the [slack channel] and reach out
|
||||||
- attend one of the [bi-weekly meetings] (alternating Wednesdays at 9:00am Pacific Time)
|
- attend one of the [bi-weekly meetings] (alternating Wednesdays at 9:00am Pacific Time)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,4 +79,3 @@ Changes must be pushed to the fork's **master branch** to be served as the fork'
|
|||||||
4. Commit and push the changes to the *remote fork's* **master branch**
|
4. Commit and push the changes to the *remote fork's* **master branch**
|
||||||
5. After a few minutes, the docs should be served from the fork's GitHub Page
|
5. After a few minutes, the docs should be served from the fork's GitHub Page
|
||||||
- e.g. [https://pwittrock.github.io/kustomize/](https://pwittrock.github.io/kustomize/)
|
- e.g. [https://pwittrock.github.io/kustomize/](https://pwittrock.github.io/kustomize/)
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ description: >
|
|||||||
[eschewed feature list]: https://kubernetes-sigs.github.io/kustomize/faq/eschewedfeatures/
|
[eschewed feature list]: https://kubernetes-sigs.github.io/kustomize/faq/eschewedfeatures/
|
||||||
[kind/feature]: https://github.com/kubernetes-sigs/kustomize/labels/kind%2Ffeature
|
[kind/feature]: https://github.com/kubernetes-sigs/kustomize/labels/kind%2Ffeature
|
||||||
|
|
||||||
|
|
||||||
Following is the process for proposing a new Kustomize feature:
|
Following is the process for proposing a new Kustomize feature:
|
||||||
|
|
||||||
1. Check the [eschewed feature list] to see if the feature has already been proposed
|
1. Check the [eschewed feature list] to see if the feature has already been proposed
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ Call stack when running `kustomize build`, with links to code.
|
|||||||
* Iterate all generators
|
* Iterate all generators
|
||||||
* [runTransfomers](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget.go#L274)
|
* [runTransfomers](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget.go#L274)
|
||||||
* [configureBuiltinTransformers](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget_configplugin.go#L44)
|
* [configureBuiltinTransformers](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget_configplugin.go#L44)
|
||||||
* PatchStrategicMergeTransformer
|
* PatchStrategicMergeTransformer
|
||||||
* PatchTransformer
|
* PatchTransformer
|
||||||
* NamespaceTransformer
|
* NamespaceTransformer
|
||||||
* PrefixSuffixTransformer
|
* PrefixSuffixTransformer
|
||||||
@@ -62,4 +62,4 @@ Call stack when running `kustomize build`, with links to code.
|
|||||||
* The following steps must be done last, not as part of the recursion implicit in AccumulateTarget.
|
* The following steps must be done last, not as part of the recursion implicit in AccumulateTarget.
|
||||||
* [addHashesToNames](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget.go#L153)
|
* [addHashesToNames](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/target/kusttarget.go#L153)
|
||||||
* [FixBackReferences](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/accumulator/resaccumulator.go#L160): Given that names have changed (prefixs/suffixes added), fix all the back references to those names.
|
* [FixBackReferences](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/accumulator/resaccumulator.go#L160): Given that names have changed (prefixs/suffixes added), fix all the back references to those names.
|
||||||
* [ResolveVars](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/accumulator/resaccumulator.go#L141)
|
* [ResolveVars](https://github.com/kubernetes-sigs/kustomize/blob/c7d78970fb86782dbdded3a93944b774f826071f/api/internal/accumulator/resaccumulator.go#L141)
|
||||||
|
|||||||
@@ -9,34 +9,38 @@ description: >
|
|||||||
|
|
||||||
This is the PowerShell script to run all go tests for Kustomize on a windows based platform which mimics /build/pre-commit.sh
|
This is the PowerShell script to run all go tests for Kustomize on a windows based platform which mimics /build/pre-commit.sh
|
||||||
|
|
||||||
## Pre-Reqs:
|
## Pre-Reqs
|
||||||
- PowerShell installed
|
|
||||||
- PowerShell Core is supported
|
- PowerShell installed
|
||||||
- go installed
|
- PowerShell Core is supported
|
||||||
- golangci-lint installed
|
- go installed
|
||||||
- mdrip installed
|
- golangci-lint installed
|
||||||
|
- mdrip installed
|
||||||
|
|
||||||
This script should output to the current console and return an exit code if all tests are successful(0) or any failed(1).
|
This script should output to the current console and return an exit code if all tests are successful(0) or any failed(1).
|
||||||
|
|
||||||
### If you are tryin to run these tests locally you can follow these instructions.
|
### If you are tryin to run these tests locally you can follow these instructions
|
||||||
|
|
||||||
Assume:
|
Assume:
|
||||||
- Running a stock Windows 10 system
|
|
||||||
- Local Admin rights.
|
|
||||||
- You can open [PowerShell as administrator](http://lmgtfy.com/?iie=1&q=How+to+open+powershell+as+administrator)
|
|
||||||
- You should be knowledgeable enough to pull source for packages into your GO ```src``` directory
|
|
||||||
- Yes, this means you also need to know a bit about **git** usually
|
|
||||||
|
|
||||||
|
- Running a stock Windows 10 system
|
||||||
|
- Local Admin rights.
|
||||||
|
- You can open [PowerShell as administrator](http://lmgtfy.com/?iie=1&q=How+to+open+powershell+as+administrator)
|
||||||
|
- You should be knowledgeable enough to pull source for packages into your GO ```src``` directory
|
||||||
|
- Yes, this means you also need to know a bit about **git** usually
|
||||||
|
|
||||||
#### Step 1 - Install Go
|
#### Step 1 - Install Go
|
||||||
- [Install Go](https://golang.org/dl/) - please use the msi
|
|
||||||
- If you use chocolatey - it's using the zip not msi and assumptions on where go is located are made for you.
|
- [Install Go](https://golang.org/dl/) - please use the msi
|
||||||
|
- If you use chocolatey - it's using the zip not msi and assumptions on where go is located are made for you.
|
||||||
|
|
||||||
#### Step 2 - Install Go Packages
|
#### Step 2 - Install Go Packages
|
||||||
- Open new PowerShell Administrative window
|
|
||||||
- Install golangci-lint
|
- Open new PowerShell Administrative window
|
||||||
- ```go get -u github.com/golangci/golangci-lint/cmd/golangci-lint```
|
- Install golangci-lint
|
||||||
- Install mdrip
|
- ```go get -u github.com/golangci/golangci-lint/cmd/golangci-lint```
|
||||||
- ```go get github.com/monopole/mdrip```
|
- Install mdrip
|
||||||
|
- ```go get github.com/monopole/mdrip```
|
||||||
|
|
||||||
You should now be able to issue these commands and see comparable responses
|
You should now be able to issue these commands and see comparable responses
|
||||||
|
|
||||||
@@ -51,6 +55,7 @@ Usage: C:\_go\bin\mdrip.exe {fileName}...
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### Step 3 - Get Source and Test
|
#### Step 3 - Get Source and Test
|
||||||
|
|
||||||
- In your GoRoot src
|
- In your GoRoot src
|
||||||
- ```Example: C:\_go\src```
|
- ```Example: C:\_go\src```
|
||||||
- Navigate to the Kustomize `travis` directory
|
- Navigate to the Kustomize `travis` directory
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ kustomize build --load_restrictor none $target
|
|||||||
|
|
||||||
Example: [#1319](https://github.com/kubernetes-sigs/kustomize/issues/1319), [#1322](https://github.com/kubernetes-sigs/kustomize/issues/1322), [#1347](https://github.com/kubernetes-sigs/kustomize/issues/1347) and etc.
|
Example: [#1319](https://github.com/kubernetes-sigs/kustomize/issues/1319), [#1322](https://github.com/kubernetes-sigs/kustomize/issues/1322), [#1347](https://github.com/kubernetes-sigs/kustomize/issues/1347) and etc.
|
||||||
|
|
||||||
The fields transformed by kustomize is configured explicitly in [defaultconfig](https://github.com/kubernetes-sigs/kustomize/tree/master/api/konfig/builtinpluginconsts/defaultconfig.go). The configuration itself can be customized by including `configurations` in `kustomization.yaml`, e.g.
|
The fields transformed by kustomize is configured explicitly in [defaultconfig](https://github.com/kubernetes-sigs/kustomize/tree/master/api/konfig/builtinpluginconsts/defaultconfig.go). The configuration itself can be customized by including `configurations` in `kustomization.yaml`, e.g.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ knowledge of the k8s API, and YAML or JSON syntax.
|
|||||||
Most edits performed by kustomize can be expressed as
|
Most edits performed by kustomize can be expressed as
|
||||||
[JSON patches] or [SMP patches].
|
[JSON patches] or [SMP patches].
|
||||||
Those can be verbose, so common patches,
|
Those can be verbose, so common patches,
|
||||||
like adding labels or annotatations, get dedicated
|
like adding labels or annotatations, get dedicated
|
||||||
transformer plugins - `LabelTransformer`,
|
transformer plugins - `LabelTransformer`,
|
||||||
`AnnotationsTransformer`, etc.
|
`AnnotationsTransformer`, etc.
|
||||||
These accept relatively simple YAML configuration
|
These accept relatively simple YAML configuration
|
||||||
@@ -69,7 +69,7 @@ informed error messages if inputs are invalid.
|
|||||||
|
|
||||||
_Unstructured edits_, edits that don't limit
|
_Unstructured edits_, edits that don't limit
|
||||||
themselves to a syntax or object structure,
|
themselves to a syntax or object structure,
|
||||||
come in many forms. A common one in the
|
come in many forms. A common one in the
|
||||||
configuration domain is the template or
|
configuration domain is the template or
|
||||||
parameterization approach.
|
parameterization approach.
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ kustomize eschews parameterization, because
|
|||||||
- The input becomes [unintelligible] as the project
|
- The input becomes [unintelligible] as the project
|
||||||
scales in any number of dimensions (resource
|
scales in any number of dimensions (resource
|
||||||
count, cluster count, environment count, etc.)
|
count, cluster count, environment count, etc.)
|
||||||
|
|
||||||
Kustomizations are meant to be sharable and stackable.
|
Kustomizations are meant to be sharable and stackable.
|
||||||
Imagine tracing down a problem rooted in a
|
Imagine tracing down a problem rooted in a
|
||||||
clever set of stacked regexp replacements
|
clever set of stacked regexp replacements
|
||||||
@@ -132,7 +132,6 @@ kustomize edit set image nginx:$MY_NGINX_VERSION
|
|||||||
as part of some encapsulating work flow executed before
|
as part of some encapsulating work flow executed before
|
||||||
`kustomize build`.
|
`kustomize build`.
|
||||||
|
|
||||||
|
|
||||||
## Globs in kustomization files
|
## Globs in kustomization files
|
||||||
|
|
||||||
`kustomize` supports the best practice of storing one's
|
`kustomize` supports the best practice of storing one's
|
||||||
|
|||||||
@@ -118,10 +118,8 @@ itself is an API client requiring this module.
|
|||||||
|
|
||||||
The clients and API will evolve independently.
|
The clients and API will evolve independently.
|
||||||
|
|
||||||
|
|
||||||
## Kustomization File Versioning
|
## Kustomization File Versioning
|
||||||
|
|
||||||
|
|
||||||
The kustomization file is a struct that is part of
|
The kustomization file is a struct that is part of
|
||||||
the kustomize Go API (the `sigs.k8s.io/kustomize`
|
the kustomize Go API (the `sigs.k8s.io/kustomize`
|
||||||
module), but it also evolves as a k8s API object -
|
module), but it also evolves as a k8s API object -
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ description: >
|
|||||||
> ```
|
> ```
|
||||||
|
|
||||||
也可以在 [kubectl-v1.14.0] 版,使用 ```kubectl``` 命令发布你的 [variants] 。
|
也可以在 [kubectl-v1.14.0] 版,使用 ```kubectl``` 命令发布你的 [variants] 。
|
||||||
|
>
|
||||||
> ```
|
> ```
|
||||||
> kubectl apply -k ~/ldap/overlays/staging
|
> kubectl apply -k ~/ldap/overlays/staging
|
||||||
> kubectl apply -k ~/ldap/overlays/production
|
> kubectl apply -k ~/ldap/overlays/production
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ description: >
|
|||||||
> ```
|
> ```
|
||||||
|
|
||||||
也可以在 [kubectl-v1.14.0] 版,使用 ```kubectl``` 命令发布你的 [variants] 。
|
也可以在 [kubectl-v1.14.0] 版,使用 ```kubectl``` 命令发布你的 [variants] 。
|
||||||
|
>
|
||||||
> ```bash
|
> ```bash
|
||||||
> kubectl apply -k ~/ldap/overlays/staging
|
> kubectl apply -k ~/ldap/overlays/staging
|
||||||
> kubectl apply -k ~/ldap/overlays/production
|
> kubectl apply -k ~/ldap/overlays/production
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ Kustomize 提供一个插件框架,允许用户开发自己的 _生成器_ 和
|
|||||||
|
|
||||||
[12-factor]: https://12factor.net
|
[12-factor]: https://12factor.net
|
||||||
|
|
||||||
* _generator_ 插件生成 k8s 资源,比如 [helm chart inflator] 是一个 generator 插件,基于少量自由变量生成一个 [12-factor] 应用所包含的全部组件 deployment,service,scaler,ingress 等)也是一个 generator 插件。
|
* _generator_ 插件生成 k8s 资源,比如 [helm chart inflator] 是一个 generator 插件,基于少量自由变量生成一个 [12-factor] 应用所包含的全部组件 deployment,service,scaler,ingress 等)也是一个 generator 插件。
|
||||||
* _transformer_ 插件转化(修改)k8s 资源,比如可能会执行对特殊容器命令行的编辑,或为其他内置转换器(`namePrefix`、`commonLabels` 等)无法转换的内容提供转换。
|
* _transformer_ 插件转化(修改)k8s 资源,比如可能会执行对特殊容器命令行的编辑,或为其他内置转换器(`namePrefix`、`commonLabels` 等)无法转换的内容提供转换。
|
||||||
|
|
||||||
## `kustomization.yaml` 的格式
|
## `kustomization.yaml` 的格式
|
||||||
|
|
||||||
@@ -42,7 +42,6 @@ Kustomize 提供一个插件框架,允许用户开发自己的 _生成器_ 和
|
|||||||
|
|
||||||
从磁盘上读取 YAML 文件,kustomization 的路径或 URL 会触发 kustomization 的运行。由此产生的每个的对象都会被 kustomize 进一步解析为 _plugin configuration_ 对象。
|
从磁盘上读取 YAML 文件,kustomization 的路径或 URL 会触发 kustomization 的运行。由此产生的每个的对象都会被 kustomize 进一步解析为 _plugin configuration_ 对象。
|
||||||
|
|
||||||
|
|
||||||
## 配置
|
## 配置
|
||||||
|
|
||||||
kustomization 文件可以包含如下内容:
|
kustomization 文件可以包含如下内容:
|
||||||
@@ -149,10 +148,10 @@ _exec 插件_ 是一个可以在命令行中接收参数可执行文件,该参
|
|||||||
|
|
||||||
#### 示例
|
#### 示例
|
||||||
|
|
||||||
* [helm chart inflator] - helm chart inflates 生成器。
|
* [helm chart inflator] - helm chart inflates 生成器。
|
||||||
* [bashed config map] - 使用 bash 生成十分简单的 configMap。
|
* [bashed config map] - 使用 bash 生成十分简单的 configMap。
|
||||||
* [sed transformer] - 使用插件来定义非结构化的编辑。
|
* [sed transformer] - 使用插件来定义非结构化的编辑。
|
||||||
* [hashicorp go-getter] - 下载 kustomize layes 并通过构建它来生成资源。
|
* [hashicorp go-getter] - 下载 kustomize layes 并通过构建它来生成资源。
|
||||||
|
|
||||||
生成器插件无需在 `stdin` 上输入任何东西,就会将生成的资源输出到 `stdout`。
|
生成器插件无需在 `stdin` 上输入任何东西,就会将生成的资源输出到 `stdout`。
|
||||||
|
|
||||||
@@ -173,6 +172,7 @@ kustomize 会使用 exec 插件适配器,为 `stdin` 提供的资源,并获
|
|||||||
如果此注释被设置在不受哈希转换器支持的资源上,将导致构建将失败。
|
如果此注释被设置在不受哈希转换器支持的资源上,将导致构建将失败。
|
||||||
|
|
||||||
示例:
|
示例:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
@@ -181,7 +181,7 @@ metadata:
|
|||||||
annotations:
|
annotations:
|
||||||
kustomize.config.k8s.io/needs-hash: "true"
|
kustomize.config.k8s.io/needs-hash: "true"
|
||||||
data:
|
data:
|
||||||
foo: bar
|
foo: bar
|
||||||
```
|
```
|
||||||
|
|
||||||
**`kustomize.config.k8s.io/behavior`**
|
**`kustomize.config.k8s.io/behavior`**
|
||||||
@@ -189,6 +189,7 @@ data:
|
|||||||
`behavior` 注释为当资源发生冲突时插件的处理方式,有效值包括:"create"、"merge "和 "replace",默认为 "create"。
|
`behavior` 注释为当资源发生冲突时插件的处理方式,有效值包括:"create"、"merge "和 "replace",默认为 "create"。
|
||||||
|
|
||||||
示例:
|
示例:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
@@ -197,7 +198,7 @@ metadata:
|
|||||||
annotations:
|
annotations:
|
||||||
kustomize.config.k8s.io/behavior: "merge"
|
kustomize.config.k8s.io/behavior: "merge"
|
||||||
data:
|
data:
|
||||||
foo: bar
|
foo: bar
|
||||||
```
|
```
|
||||||
|
|
||||||
### Go 插件
|
### Go 插件
|
||||||
@@ -216,8 +217,8 @@ kustomize 的一个 Go 插件看起来是这样的:
|
|||||||
> package main
|
> package main
|
||||||
>
|
>
|
||||||
> import (
|
> import (
|
||||||
> "sigs.k8s.io/kustomize/api/ifc"
|
> "sigs.k8s.io/kustomize/api/ifc"
|
||||||
> "sigs.k8s.io/kustomize/api/resmap"
|
> "sigs.k8s.io/kustomize/api/resmap"
|
||||||
> ...
|
> ...
|
||||||
> )
|
> )
|
||||||
>
|
>
|
||||||
@@ -247,12 +248,12 @@ kustomize 的一个 Go 插件看起来是这样的:
|
|||||||
|
|
||||||
#### 示例
|
#### 示例
|
||||||
|
|
||||||
* [service generator] - 使用 name 和 port 参数生成一个 service。
|
* [service generator] - 使用 name 和 port 参数生成一个 service。
|
||||||
* [string prefixer] - 使用 `metadata/name` 值作为前缀。这个特殊的示例是为了展示插件的转化行为。详见 `target` 包中的 `TestTransformedTransformers` 测试。
|
* [string prefixer] - 使用 `metadata/name` 值作为前缀。这个特殊的示例是为了展示插件的转化行为。详见 `target` 包中的 `TestTransformedTransformers` 测试。
|
||||||
* [date prefixer] - 将当前日期作为前缀添加到资源名称上,这是一个用于修改刚才提到的字符串前缀插件的简单示例。
|
* [date prefixer] - 将当前日期作为前缀添加到资源名称上,这是一个用于修改刚才提到的字符串前缀插件的简单示例。
|
||||||
* [secret generator] - 从 toy 数据库生成 secret。
|
* [secret generator] - 从 toy 数据库生成 secret。
|
||||||
* [sops encoded secrets] - 一个更复杂的 secret 生成器。
|
* [sops encoded secrets] - 一个更复杂的 secret 生成器。
|
||||||
* [All the builtin plugins](https://github.com/kubernetes-sigs/kustomize/tree/master/plugin/builtin).
|
* [All the builtin plugins](https://github.com/kubernetes-sigs/kustomize/tree/master/plugin/builtin).
|
||||||
用户自制的插件与内置插件是一样的。
|
用户自制的插件与内置插件是一样的。
|
||||||
|
|
||||||
Go 插件既可以是生成器,也可以是转化器。`Generate` 方法将在 `Transform` 方法运行之前与所有其他生成器一起运行。
|
Go 插件既可以是生成器,也可以是转化器。`Generate` 方法将在 `Transform` 方法运行之前与所有其他生成器一起运行。
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ commonAnnotations:
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: AnnotationsTransformer
|
> kind: AnnotationsTransformer
|
||||||
@@ -63,8 +64,6 @@ commonAnnotations:
|
|||||||
> create: true
|
> create: true
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## _ConfigMapGenerator_
|
## _ConfigMapGenerator_
|
||||||
|
|
||||||
### 使用 `kustomization.yaml`
|
### 使用 `kustomization.yaml`
|
||||||
@@ -94,7 +93,7 @@ configMapGenerator:
|
|||||||
- application.properties
|
- application.properties
|
||||||
- more.properties
|
- more.properties
|
||||||
- name: my-java-server-env-vars
|
- name: my-java-server-env-vars
|
||||||
literals:
|
literals:
|
||||||
- JAVA_HOME=/opt/java/jdk
|
- JAVA_HOME=/opt/java/jdk
|
||||||
- JAVA_TOOL_OPTIONS=-agentlib:hprof
|
- JAVA_TOOL_OPTIONS=-agentlib:hprof
|
||||||
options:
|
options:
|
||||||
@@ -129,6 +128,7 @@ configMapGenerator:
|
|||||||
> [types.ConfigMapArgs]
|
> [types.ConfigMapArgs]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: ConfigMapGenerator
|
> kind: ConfigMapGenerator
|
||||||
@@ -142,7 +142,6 @@ configMapGenerator:
|
|||||||
> - VEGETABLE=carrot
|
> - VEGETABLE=carrot
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
## _ImageTagTransformer_
|
## _ImageTagTransformer_
|
||||||
|
|
||||||
### 使用 `kustomization.yaml`
|
### 使用 `kustomization.yaml`
|
||||||
@@ -164,11 +163,11 @@ containers:
|
|||||||
```
|
```
|
||||||
|
|
||||||
想要将 `image` 做如下更改:
|
想要将 `image` 做如下更改:
|
||||||
|
|
||||||
- 将 `postgres:8` 改为 `my-registry/my-postgres:v1`
|
- 将 `postgres:8` 改为 `my-registry/my-postgres:v1`
|
||||||
- 将 nginx tag 从 `1.7.9` 改为 `1.8.0`
|
- 将 nginx tag 从 `1.7.9` 改为 `1.8.0`
|
||||||
- 将镜像名称 `my-demo-app` 改为 `my-app`
|
- 将镜像名称 `my-demo-app` 改为 `my-app`
|
||||||
- 将 alpine 的 tag `3.7` 改为 digest 值
|
- 将 alpine 的 tag `3.7` 改为 digest 值
|
||||||
|
|
||||||
只需在 *kustomization* 中添加以下内容:
|
只需在 *kustomization* 中添加以下内容:
|
||||||
|
|
||||||
@@ -194,6 +193,7 @@ images:
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: ImageTagTransformer
|
> kind: ImageTagTransformer
|
||||||
@@ -204,8 +204,6 @@ images:
|
|||||||
> newTag: v2
|
> newTag: v2
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## _LabelTransformer_
|
## _LabelTransformer_
|
||||||
|
|
||||||
### 使用 `kustomization.yaml`
|
### 使用 `kustomization.yaml`
|
||||||
@@ -230,6 +228,7 @@ commonLabels:
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: LabelTransformer
|
> kind: LabelTransformer
|
||||||
@@ -264,6 +263,7 @@ namespace: my-namespace
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: NamespaceTransformer
|
> kind: NamespaceTransformer
|
||||||
@@ -345,6 +345,7 @@ patchesJson6902:
|
|||||||
### 使用插件
|
### 使用插件
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
|
|
||||||
> Target [types.PatchTarget]
|
> Target [types.PatchTarget]
|
||||||
>
|
>
|
||||||
> Path string
|
> Path string
|
||||||
@@ -352,6 +353,7 @@ patchesJson6902:
|
|||||||
> JsonOp string
|
> JsonOp string
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: PatchJson6902Transformer
|
> kind: PatchJson6902Transformer
|
||||||
@@ -385,6 +387,7 @@ patchesStrategicMerge:
|
|||||||
```
|
```
|
||||||
|
|
||||||
patch 内容也可以是一个inline string:
|
patch 内容也可以是一个inline string:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
patchesStrategicMerge:
|
patchesStrategicMerge:
|
||||||
- |-
|
- |-
|
||||||
@@ -411,6 +414,7 @@ patchesStrategicMerge:
|
|||||||
> Patches string
|
> Patches string
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: PatchStrategicMergeTransformer
|
> kind: PatchStrategicMergeTransformer
|
||||||
@@ -420,7 +424,6 @@ patchesStrategicMerge:
|
|||||||
> - patch.yaml
|
> - patch.yaml
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
## _PatchTransformer_
|
## _PatchTransformer_
|
||||||
|
|
||||||
### 使用 `kustomization.yaml`
|
### 使用 `kustomization.yaml`
|
||||||
@@ -460,9 +463,10 @@ is equivalent to `^myapp$`。
|
|||||||
>
|
>
|
||||||
> Patch string
|
> Patch string
|
||||||
>
|
>
|
||||||
> Target \*[types.Selector]
|
> Target \*[types.Selector]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: PatchTransformer
|
> kind: PatchTransformer
|
||||||
@@ -502,6 +506,7 @@ nameSuffix: -v2
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: PrefixSuffixTransformer
|
> kind: PrefixSuffixTransformer
|
||||||
@@ -542,6 +547,7 @@ replicas:
|
|||||||
该字段内容为列表,所以可以同时修改许多资源。
|
该字段内容为列表,所以可以同时修改许多资源。
|
||||||
|
|
||||||
由于这个声明无法设置 `kind:` 或 `group:`,所以他只能匹配如下资源中的一种:
|
由于这个声明无法设置 `kind:` 或 `group:`,所以他只能匹配如下资源中的一种:
|
||||||
|
|
||||||
- `Deployment`
|
- `Deployment`
|
||||||
- `ReplicationController`
|
- `ReplicationController`
|
||||||
- `ReplicaSet`
|
- `ReplicaSet`
|
||||||
@@ -558,6 +564,7 @@ replicas:
|
|||||||
> FieldSpecs \[\][config.FieldSpec]
|
> FieldSpecs \[\][config.FieldSpec]
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
>
|
||||||
> ```yaml
|
> ```yaml
|
||||||
> apiVersion: builtin
|
> apiVersion: builtin
|
||||||
> kind: ReplicaCountTransformer
|
> kind: ReplicaCountTransformer
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ description: >
|
|||||||
|
|
||||||
#### 环境要求
|
#### 环境要求
|
||||||
|
|
||||||
* `linux`
|
* `linux`
|
||||||
* `git`
|
* `git`
|
||||||
* `curl`
|
* `curl`
|
||||||
* `Go 1.13`
|
* `Go 1.13`
|
||||||
|
|
||||||
## 创建一个工作空间/目录
|
## 创建一个工作空间/目录
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ mv kustomize $DEMO/bin
|
|||||||
tree $DEMO
|
tree $DEMO
|
||||||
```
|
```
|
||||||
|
|
||||||
## 使用插件构建 APP:
|
## 使用插件构建 APP
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
XDG_CONFIG_HOME=$DEMO $DEMO/bin/kustomize build --enable_alpha_plugins $MYAPP
|
XDG_CONFIG_HOME=$DEMO $DEMO/bin/kustomize build --enable_alpha_plugins $MYAPP
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ go build -buildmode plugin \
|
|||||||
|
|
||||||
为了进行比较,可以参考编写 [tensorflow plugin] 必须做的事情。
|
为了进行比较,可以参考编写 [tensorflow plugin] 必须做的事情。
|
||||||
|
|
||||||
## 为什么支持 Go 插件?
|
## 为什么支持 Go 插件
|
||||||
|
|
||||||
### 安全
|
### 安全
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ PLUGIN_ROOT=$DEMO/kustomize/plugin
|
|||||||
|
|
||||||
并在下面的命令行中临时设置 `XDG_CONFIG_HOME`。
|
并在下面的命令行中临时设置 `XDG_CONFIG_HOME`。
|
||||||
|
|
||||||
### 使用什么 apiVersion 和 kind?
|
### 使用什么 apiVersion 和 kind
|
||||||
|
|
||||||
在 kustomize 插件的开发时,插件代码不关心也不知道配置文件中的 `apiVersion` 或 `kind`。
|
在 kustomize 插件的开发时,插件代码不关心也不知道配置文件中的 `apiVersion` 或 `kind`。
|
||||||
|
|
||||||
@@ -136,9 +136,9 @@ GOPATH=$tmpGoPath go build -buildmode plugin -o ${kind}.so ${kind}.go
|
|||||||
|
|
||||||
在加载失败时
|
在加载失败时
|
||||||
|
|
||||||
* 确保使用相同版本的Go (_go1.13_),在相同的 `$GOOS`(_linux_)和 `$GOARCH`(_amd64_) 上构建插件,用于构建本演示中使用的 [kustomize](#安装-kustomize)。
|
* 确保使用相同版本的Go (_go1.13_),在相同的 `$GOOS`(_linux_)和 `$GOARCH`(_amd64_) 上构建插件,用于构建本演示中使用的 [kustomize](#安装-kustomize)。
|
||||||
|
|
||||||
* 修改插件中的依赖文件 `go.mod` 以匹配 kustomize 使用的版本。
|
* 修改插件中的依赖文件 `go.mod` 以匹配 kustomize 使用的版本。
|
||||||
|
|
||||||
缺乏工具和元数据来实现自动化,就不会有一个完整的 Go 插件生态。
|
缺乏工具和元数据来实现自动化,就不会有一个完整的 Go 插件生态。
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ tree $DEMO
|
|||||||
> └── secGenerator.yaml
|
> └── secGenerator.yaml
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
## 使用插件构建您的应用:
|
## 使用插件构建您的应用
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
XDG_CONFIG_HOME=$DEMO $tmpGoPath/bin/kustomize build --enable_alpha_plugins $MYAPP
|
XDG_CONFIG_HOME=$DEMO $tmpGoPath/bin/kustomize build --enable_alpha_plugins $MYAPP
|
||||||
|
|||||||
@@ -12,5 +12,6 @@ choco install kustomize
|
|||||||
```
|
```
|
||||||
|
|
||||||
有关软件包管理器 chocolatey 的使用以及对之前版本的支持,请参考以下链接:
|
有关软件包管理器 chocolatey 的使用以及对之前版本的支持,请参考以下链接:
|
||||||
|
|
||||||
- [Choco Package](https://chocolatey.org/packages/kustomize)
|
- [Choco Package](https://chocolatey.org/packages/kustomize)
|
||||||
- [Package Source](https://github.com/kenmaglio/choco-kustomize)
|
- [Package Source](https://github.com/kenmaglio/choco-kustomize)
|
||||||
|
|||||||
Reference in New Issue
Block a user