mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Merge pull request #2728 from prachirp/markdownlint
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!
|
||||
{{% /blocks/feature %}}
|
||||
|
||||
|
||||
{{< /blocks/section >}}
|
||||
|
||||
@@ -8,6 +8,7 @@ description: >
|
||||
---
|
||||
|
||||
# Glossary
|
||||
|
||||
[CRD spec]: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
|
||||
[CRD]: #custom-resource-definition
|
||||
[DAM]: #declarative-application-management
|
||||
@@ -67,7 +68,6 @@ dashboards.
|
||||
[kustomize] configures k8s resources, and the proposed
|
||||
application resource is just another resource.
|
||||
|
||||
|
||||
## apply
|
||||
|
||||
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
|
||||
deploy cycle.
|
||||
|
||||
|
||||
## bespoke configuration
|
||||
|
||||
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
|
||||
|
||||
* Work with any configuration, be it bespoke,
|
||||
* Work with any configuration, be it bespoke,
|
||||
off-the-shelf, stateless, stateful, etc.
|
||||
* Support common customizations, and creation of
|
||||
* Support common customizations, and creation of
|
||||
[variants] (e.g. _development_ vs.
|
||||
_staging_ vs. _production_).
|
||||
* Expose and teach native k8s APIs, rather than
|
||||
* Expose and teach native k8s APIs, rather than
|
||||
hide them.
|
||||
* Add no friction to version control integration to
|
||||
* Add no friction to version control integration to
|
||||
support reviews and audit trails.
|
||||
* Compose with other tools in a unix sense.
|
||||
* Eschew crossing the line into templating, domain
|
||||
* Compose with other tools in a unix sense.
|
||||
* Eschew crossing the line into templating, domain
|
||||
specific languages, etc., frustrating the other
|
||||
goals.
|
||||
|
||||
@@ -152,7 +151,6 @@ In brief, kustomize should
|
||||
A generator makes resources that can be used as is,
|
||||
or fed into a [transformer].
|
||||
|
||||
|
||||
## gitops
|
||||
|
||||
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
|
||||
with [kustomize], it could be in the form of
|
||||
|
||||
* one file called `kustomization.yaml`,
|
||||
* a tarball (containing that YAML file plus what it references),
|
||||
* a git archive (ditto),
|
||||
* a URL to a git repo (ditto), etc.
|
||||
* one file called `kustomization.yaml`,
|
||||
* a tarball (containing that YAML file plus what it references),
|
||||
* a git archive (ditto),
|
||||
* a URL to a git repo (ditto), etc.
|
||||
|
||||
A kustomization file contains [fields](fields.md)
|
||||
falling into four categories:
|
||||
|
||||
* _resources_ - what existing [resources] are to be customized.
|
||||
* _resources_ - what existing [resources] are to be customized.
|
||||
Example fields: _resources_, _crds_.
|
||||
|
||||
* _generators_ - what _new_ resources should be created.
|
||||
* _generators_ - what _new_ resources should be created.
|
||||
Example fields: _configMapGenerator_ (legacy),
|
||||
_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_,
|
||||
_commonLabels_, _patchesJson6902_, etc. and the more
|
||||
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_,
|
||||
_apiVersion_, _kind_, etc.
|
||||
|
||||
|
||||
## kustomization root
|
||||
|
||||
The directory that immediately contains a
|
||||
@@ -222,8 +219,8 @@ absolute path, or by relative path.
|
||||
|
||||
If kustomization __A__ depends on kustomization __B__, then
|
||||
|
||||
* __B__ may not _contain_ __A__.
|
||||
* __B__ may not _depend on_ __A__, even transitively.
|
||||
* __B__ may not _contain_ __A__.
|
||||
* __B__ may not _depend on_ __A__, even transitively.
|
||||
|
||||
__A__ may contain __B__, but in this case it might be
|
||||
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
|
||||
git repository, referencable from any kustomization.
|
||||
|
||||
|
||||
A common layout is
|
||||
|
||||
> ```
|
||||
@@ -291,7 +287,6 @@ resource patching.
|
||||
|
||||
kustomize is an implementation of [DAM].
|
||||
|
||||
|
||||
## off-the-shelf configuration
|
||||
|
||||
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
|
||||
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
|
||||
string, but may not be desired when the target
|
||||
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
|
||||
[central concept](/kustomize/api-reference/kustomization/glossary#base) - to be
|
||||
ordered relative to other input resources.
|
||||
|
||||
|
||||
@@ -55,4 +55,3 @@ metadata:
|
||||
spec:
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
@@ -98,4 +98,4 @@ spec:
|
||||
app: bingo
|
||||
owner: alice
|
||||
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).
|
||||
|
||||
The example below creates four ConfigMaps:
|
||||
|
||||
- first, with the names and contents of the given files
|
||||
- second, with key/value as data using key/value pairs from files
|
||||
- third, also with key/value as data, directly specified using `literals`
|
||||
@@ -87,4 +88,4 @@ configMapGenerator:
|
||||
- name: app-whatever
|
||||
files:
|
||||
- myFileName.ini=whatever.ini
|
||||
```
|
||||
```
|
||||
|
||||
@@ -22,12 +22,13 @@ with namePrefix, nameSuffix, or hashing in the
|
||||
same way.
|
||||
|
||||
The annotations can be put into openAPI definitions are:
|
||||
- "x-kubernetes-annotation": ""
|
||||
- "x-kubernetes-label-selector": ""
|
||||
- "x-kubernetes-identity": ""
|
||||
- "x-kubernetes-object-ref-api-version": "v1",
|
||||
- "x-kubernetes-object-ref-kind": "Secret",
|
||||
- "x-kubernetes-object-ref-name-key": "name",
|
||||
|
||||
- "x-kubernetes-annotation": ""
|
||||
- "x-kubernetes-label-selector": ""
|
||||
- "x-kubernetes-identity": ""
|
||||
- "x-kubernetes-object-ref-api-version": "v1",
|
||||
- "x-kubernetes-object-ref-kind": "Secret",
|
||||
- "x-kubernetes-object-ref-name-key": "name",
|
||||
|
||||
```yaml
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
@@ -36,4 +37,4 @@ kind: Kustomization
|
||||
crds:
|
||||
- crds/typeA.yaml
|
||||
- crds/typeB.yaml
|
||||
```
|
||||
```
|
||||
|
||||
@@ -28,4 +28,4 @@ generatorOptions:
|
||||
# suffix to the names of generated resources that is a hash of
|
||||
# the resource contents.
|
||||
disableNameSuffixHash: true
|
||||
```
|
||||
```
|
||||
|
||||
@@ -27,11 +27,11 @@ spec:
|
||||
```
|
||||
|
||||
one can change the `image` in the following ways:
|
||||
|
||||
- `postgres:8` to `my-registry/my-postgres:v1`,
|
||||
- nginx tag `1.7.9` to `1.8.0`,
|
||||
- image name `my-demo-app` to `my-app`,
|
||||
- alpine's tag `3.7` to a digest value
|
||||
|
||||
- `postgres:8` to `my-registry/my-postgres:v1`,
|
||||
- nginx tag `1.7.9` to `1.8.0`,
|
||||
- image name `my-demo-app` to `my-app`,
|
||||
- alpine's tag `3.7` to a digest value
|
||||
|
||||
all with the following *kustomization*:
|
||||
|
||||
@@ -49,4 +49,4 @@ images:
|
||||
newName: my-app
|
||||
- name: alpine
|
||||
digest: sha256:24a0c4b4a4c0eb97a1aabb8e29f18e917d05abfe1b7a7c07857230879ce7d3d3
|
||||
```
|
||||
```
|
||||
|
||||
@@ -13,4 +13,4 @@ kind: Kustomization
|
||||
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
|
||||
if it is not set on a resource.
|
||||
if it is not set on a resource.
|
||||
|
||||
@@ -13,6 +13,6 @@ kind: Kustomization
|
||||
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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Each patch may:
|
||||
|
||||
|
||||
- be either a [strategic merge] patch, or a [JSON] patch
|
||||
- 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
|
||||
annotationSelector. Any resource which matches all the **specified** fields has the patch applied
|
||||
@@ -43,9 +43,9 @@ patches:
|
||||
value: new value
|
||||
target:
|
||||
kind: MyKind
|
||||
labelSelector: "env=dev"
|
||||
labelSelector: "env=dev"
|
||||
```
|
||||
|
||||
The `name` and `namespace` fields of the patch target selector are
|
||||
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.
|
||||
|
||||
```yaml
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
@@ -53,4 +54,4 @@ patchesStrategicMerge:
|
||||
Note that kustomize does not support more than one patch
|
||||
for the same object that contain a _delete_ directive. To remove
|
||||
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
|
||||
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
|
||||
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:`
|
||||
it will match any `group` and `kind` that has a matching name and
|
||||
that is one of:
|
||||
|
||||
- `Deployment`
|
||||
- `ReplicationController`
|
||||
- `ReplicaSet`
|
||||
- `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"
|
||||
labels:
|
||||
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
|
||||
ConfigMap, it knows to change the name reference
|
||||
in the Deployment.
|
||||
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@ Initial release after move from github.com/kubernetes/kubectl to github.com/kube
|
||||
|
||||
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.
|
||||
Has kustomization file, bases, overlays, basic transforms.
|
||||
* Apr 2018: s/kinflate/kustomize/, s/manifest/kustomization/
|
||||
* Oct 2017: s/kexpand/kinflate/
|
||||
* Sep 2017: kexpand [starts](https://github.com/kubernetes/kubectl/pull/65)
|
||||
* Apr 2018: s/kinflate/kustomize/, s/manifest/kustomization/
|
||||
* Oct 2017: s/kexpand/kinflate/
|
||||
* Sep 2017: kexpand [starts](https://github.com/kubernetes/kubectl/pull/65)
|
||||
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
|
||||
|
||||
@@ -151,7 +151,7 @@ path or URL to a kustomization directory in the
|
||||
![pruning dead branches][imgPruning]
|
||||
|
||||
_Alpha_
|
||||
|
||||
|
||||
Users can add an `inventory` stanza to their
|
||||
kustomization file, to add a special _inventory
|
||||
object_ to the `build` result.
|
||||
@@ -164,10 +164,9 @@ orphaned cluster resources.
|
||||
For more information see the
|
||||
[kustomize inventory object documentation].
|
||||
|
||||
|
||||
## Field changes / deprecations
|
||||
|
||||
### `resources` expanded, `bases` deprecated
|
||||
### `resources` expanded, `bases` deprecated
|
||||
|
||||
The `resources` field has been generalized; it now
|
||||
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 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
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ floor on a stable API for [plugin] developers
|
||||
(both _Go_ plugin developers and _exec_ plugin
|
||||
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
|
||||
[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.
|
||||
Such shrinkage will trigger a major version
|
||||
increment.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ description: >
|
||||
---
|
||||
|
||||
## 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).
|
||||
|
||||
## Improved Resource Matching
|
||||
@@ -52,7 +53,6 @@ spec:
|
||||
value: PRODVALUE
|
||||
```
|
||||
|
||||
|
||||
### Variable resolution improvement
|
||||
|
||||
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
|
||||
|
||||
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,
|
||||
- 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.
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ description: >
|
||||
---
|
||||
|
||||
## 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).
|
||||
|
||||
## 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.
|
||||
|
||||
Create a new overlay from the base ../base
|
||||
|
||||
```
|
||||
kustomize create --resources ../base
|
||||
```
|
||||
|
||||
Create a new kustomization detecing resources in the current directory
|
||||
|
||||
```
|
||||
kustomize create --autodetect
|
||||
```
|
||||
@@ -30,5 +33,5 @@ kustomize create --autodetect --recursive
|
||||
```
|
||||
|
||||
### 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
|
||||
[release process documentation]: /releasing
|
||||
|
||||
|
||||
## 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
|
||||
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
|
||||
yet released) and be a clean break with `v3` etc.
|
||||
|
||||
|
||||
### Change log since v3.2.0
|
||||
|
||||
```
|
||||
|
||||
@@ -7,4 +7,4 @@ menu:
|
||||
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
|
||||
with how `kustomize build` works, please report
|
||||
|
||||
* the output of `kustomize version`,
|
||||
* the input (the content of `kustomization.yaml`
|
||||
* the output of `kustomize version`,
|
||||
* the input (the content of `kustomization.yaml`
|
||||
and any files it refers to),
|
||||
* the expected YAML output.
|
||||
* the expected YAML output.
|
||||
|
||||
## If you have `go` installed
|
||||
|
||||
@@ -26,7 +26,7 @@ package] for specifying a kustomization's input and the
|
||||
expected output.
|
||||
|
||||
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.
|
||||
|
||||
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 [slack channel] and reach out
|
||||
- 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**
|
||||
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/)
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ description: >
|
||||
[eschewed feature list]: https://kubernetes-sigs.github.io/kustomize/faq/eschewedfeatures/
|
||||
[kind/feature]: https://github.com/kubernetes-sigs/kustomize/labels/kind%2Ffeature
|
||||
|
||||
|
||||
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
|
||||
|
||||
@@ -48,7 +48,7 @@ Call stack when running `kustomize build`, with links to code.
|
||||
* Iterate all generators
|
||||
* [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)
|
||||
* PatchStrategicMergeTransformer
|
||||
* PatchStrategicMergeTransformer
|
||||
* PatchTransformer
|
||||
* NamespaceTransformer
|
||||
* 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.
|
||||
* [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.
|
||||
* [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
|
||||
|
||||
## Pre-Reqs:
|
||||
- PowerShell installed
|
||||
- PowerShell Core is supported
|
||||
- go installed
|
||||
- golangci-lint installed
|
||||
- mdrip installed
|
||||
## Pre-Reqs
|
||||
|
||||
- PowerShell installed
|
||||
- PowerShell Core is supported
|
||||
- go 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).
|
||||
|
||||
### 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:
|
||||
- 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
|
||||
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
|
||||
|
||||
#### 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
|
||||
- Open new PowerShell Administrative window
|
||||
- Install golangci-lint
|
||||
- ```go get -u github.com/golangci/golangci-lint/cmd/golangci-lint```
|
||||
- Install mdrip
|
||||
- ```go get github.com/monopole/mdrip```
|
||||
|
||||
- Open new PowerShell Administrative window
|
||||
- Install golangci-lint
|
||||
- ```go get -u github.com/golangci/golangci-lint/cmd/golangci-lint```
|
||||
- Install mdrip
|
||||
- ```go get github.com/monopole/mdrip```
|
||||
|
||||
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
|
||||
|
||||
- In your GoRoot src
|
||||
- ```Example: C:\_go\src```
|
||||
- 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.
|
||||
|
||||
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
|
||||
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
|
||||
[JSON patches] or [SMP 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`,
|
||||
`AnnotationsTransformer`, etc.
|
||||
These accept relatively simple YAML configuration
|
||||
@@ -69,7 +69,7 @@ informed error messages if inputs are invalid.
|
||||
|
||||
_Unstructured edits_, edits that don't limit
|
||||
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
|
||||
parameterization approach.
|
||||
|
||||
@@ -93,7 +93,7 @@ kustomize eschews parameterization, because
|
||||
- The input becomes [unintelligible] as the project
|
||||
scales in any number of dimensions (resource
|
||||
count, cluster count, environment count, etc.)
|
||||
|
||||
|
||||
Kustomizations are meant to be sharable and stackable.
|
||||
Imagine tracing down a problem rooted in a
|
||||
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
|
||||
`kustomize build`.
|
||||
|
||||
|
||||
## Globs in kustomization files
|
||||
|
||||
`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.
|
||||
|
||||
|
||||
## Kustomization File Versioning
|
||||
|
||||
|
||||
The kustomization file is a struct that is part of
|
||||
the kustomize Go API (the `sigs.k8s.io/kustomize`
|
||||
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].
|
||||
>
|
||||
> ```
|
||||
> kubectl apply -k ~/ldap/overlays/staging
|
||||
> 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
|
||||
[workflowOts]: /kustomize/images/workflowOts.jpg
|
||||
[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
|
||||
they are based on an [off-the-shelf] configuration that is periodically consulted for updates.
|
||||
|
||||
|
||||
![off-the-shelf config workflow image][workflowOts]
|
||||
|
||||
#### 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].
|
||||
>
|
||||
> ```
|
||||
> kubectl apply -k ~/ldap/overlays/staging
|
||||
> kubectl apply -k ~/ldap/overlays/production
|
||||
|
||||
@@ -18,14 +18,14 @@ or [transformer configs] doesn't meet your needs.
|
||||
|
||||
[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
|
||||
components (deployment, service, scaler,
|
||||
ingress, etc.) needed by someone's [12-factor]
|
||||
application, based on a smaller number of free
|
||||
variables.
|
||||
|
||||
* A _transformer_ plugin might perform special
|
||||
* A _transformer_ plugin might perform special
|
||||
container command line edits, or any other
|
||||
transformation beyond those provided by the
|
||||
builtin (`namePrefix`, `commonLabels`, etc.)
|
||||
@@ -63,7 +63,6 @@ in-process kustomization run. Each of the
|
||||
resulting objects is now further interpreted by
|
||||
kustomize as a _plugin configuration_ object.
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
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
|
||||
[NameTransformer].
|
||||
|
||||
|
||||
## Placement
|
||||
|
||||
Each plugin gets its own dedicated directory named
|
||||
@@ -228,11 +226,11 @@ provided in the kustomization file).
|
||||
|
||||
#### Examples
|
||||
|
||||
* [helm chart inflator] - A generator that inflates a helm chart.
|
||||
* [bashed config map] - Super simple configMap generation from bash.
|
||||
* [sed transformer] - Define your unstructured edits using a
|
||||
* [helm chart inflator] - A generator that inflates a helm chart.
|
||||
* [bashed config map] - Super simple configMap generation from bash.
|
||||
* [sed transformer] - Define your unstructured edits using a
|
||||
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
|
||||
generated resources to `stdout`.
|
||||
@@ -247,7 +245,7 @@ marshalled resources on `stdin` and capture
|
||||
|
||||
#### 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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Example:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
@@ -266,14 +265,15 @@ metadata:
|
||||
annotations:
|
||||
kustomize.config.k8s.io/needs-hash: "true"
|
||||
data:
|
||||
foo: bar
|
||||
foo: bar
|
||||
```
|
||||
|
||||
**`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:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
@@ -282,7 +282,7 @@ metadata:
|
||||
annotations:
|
||||
kustomize.config.k8s.io/behavior: "merge"
|
||||
data:
|
||||
foo: bar
|
||||
foo: bar
|
||||
```
|
||||
|
||||
### Go plugins
|
||||
@@ -306,7 +306,7 @@ A Go plugin for kustomize looks like this:
|
||||
> package main
|
||||
>
|
||||
> 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
|
||||
|
||||
* [service generator] - generate a service from a name and port argument.
|
||||
* [string prefixer] - uses the value in `metadata/name` as the prefix.
|
||||
* [service generator] - generate a service from a name and port argument.
|
||||
* [string prefixer] - uses the value in `metadata/name` as the prefix.
|
||||
This particular example exists to show how a plugin can
|
||||
transform the behavior of a plugin. See the
|
||||
`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.
|
||||
* [secret generator] - generate secrets from a toy database.
|
||||
* [sops encoded secrets] - a more complex secret generator that converts SOPS files into Kubernetes Secrets
|
||||
* [SOPSGenerator] - another generator that decrypts SOPS files into Secrets
|
||||
* [All the builtin plugins](https://github.com/kubernetes-sigs/kustomize/tree/master/plugin/builtin).
|
||||
* [secret generator] - generate secrets from a toy database.
|
||||
* [sops encoded secrets] - a more complex secret generator that converts SOPS files into Kubernetes Secrets
|
||||
* [SOPSGenerator] - another generator that decrypts SOPS files into Secrets
|
||||
* [All the builtin plugins](https://github.com/kubernetes-sigs/kustomize/tree/master/plugin/builtin).
|
||||
User authored plugins are
|
||||
on the same footing as builtin operations.
|
||||
|
||||
@@ -372,4 +372,3 @@ d=$XDG_CONFIG_HOME/kustomize/plugin\
|
||||
go build -buildmode plugin \
|
||||
-o $d/${kind}.so $d/${kind}.go
|
||||
```
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ For each plugin, an example is given for
|
||||
|
||||
* implicitly triggering
|
||||
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).
|
||||
|
||||
* explicitly triggering the plugin
|
||||
@@ -24,12 +24,11 @@ via the `generators` or `transformers` field
|
||||
(by providing a config file specifying the
|
||||
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
|
||||
be defaulted. The latter method allows for
|
||||
complete plugin argument specification.
|
||||
|
||||
|
||||
[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.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
|
||||
|
||||
## _AnnotationTransformer_
|
||||
|
||||
### Usage via `kustomization.yaml`
|
||||
|
||||
#### field name: `commonAnnotations`
|
||||
@@ -56,6 +56,7 @@ commonAnnotations:
|
||||
```
|
||||
|
||||
### Usage via plugin
|
||||
|
||||
#### Arguments
|
||||
|
||||
> Annotations map\[string\]string
|
||||
@@ -63,6 +64,7 @@ commonAnnotations:
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```
|
||||
> apiVersion: builtin
|
||||
> kind: AnnotationsTransformer
|
||||
@@ -76,8 +78,6 @@ commonAnnotations:
|
||||
> create: true
|
||||
> ```
|
||||
|
||||
|
||||
|
||||
## _ConfigMapGenerator_
|
||||
|
||||
### Usage via `kustomization.yaml`
|
||||
@@ -122,7 +122,7 @@ configMapGenerator:
|
||||
- application.properties
|
||||
- more.properties
|
||||
- name: my-java-server-env-vars
|
||||
literals:
|
||||
literals:
|
||||
- JAVA_HOME=/opt/java/jdk
|
||||
- JAVA_TOOL_OPTIONS=-agentlib:hprof
|
||||
options:
|
||||
@@ -156,11 +156,13 @@ configMapGenerator:
|
||||
```
|
||||
|
||||
### Usage via plugin
|
||||
|
||||
#### Arguments
|
||||
|
||||
> [types.ConfigMapArgs]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```
|
||||
> apiVersion: builtin
|
||||
> kind: ConfigMapGenerator
|
||||
@@ -174,8 +176,8 @@ configMapGenerator:
|
||||
> - VEGETABLE=carrot
|
||||
> ```
|
||||
|
||||
|
||||
## _ImageTagTransformer_
|
||||
|
||||
### Usage via `kustomization.yaml`
|
||||
|
||||
#### field name: `images`
|
||||
@@ -197,11 +199,11 @@ containers:
|
||||
```
|
||||
|
||||
one can change the `image` in the following ways:
|
||||
|
||||
- `postgres:8` to `my-registry/my-postgres:v1`,
|
||||
- nginx tag `1.7.9` to `1.8.0`,
|
||||
- image name `my-demo-app` to `my-app`,
|
||||
- alpine's tag `3.7` to a digest value
|
||||
|
||||
- `postgres:8` to `my-registry/my-postgres:v1`,
|
||||
- nginx tag `1.7.9` to `1.8.0`,
|
||||
- image name `my-demo-app` to `my-app`,
|
||||
- alpine's tag `3.7` to a digest value
|
||||
|
||||
all with the following *kustomization*:
|
||||
|
||||
@@ -219,6 +221,7 @@ images:
|
||||
```
|
||||
|
||||
### Usage via plugin
|
||||
|
||||
#### Arguments
|
||||
|
||||
> ImageTag [image.Image]
|
||||
@@ -226,6 +229,7 @@ images:
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```
|
||||
> apiVersion: builtin
|
||||
> kind: ImageTagTransformer
|
||||
@@ -236,9 +240,8 @@ images:
|
||||
> newTag: v2
|
||||
> ```
|
||||
|
||||
|
||||
|
||||
## _LabelTransformer_
|
||||
|
||||
### Usage via `kustomization.yaml`
|
||||
|
||||
#### field name: `commonLabels`
|
||||
@@ -253,6 +256,7 @@ commonLabels:
|
||||
```
|
||||
|
||||
### Usage via plugin
|
||||
|
||||
#### Arguments
|
||||
|
||||
> Labels map\[string\]string
|
||||
@@ -260,6 +264,7 @@ commonLabels:
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```
|
||||
> apiVersion: builtin
|
||||
> kind: LabelTransformer
|
||||
@@ -273,14 +278,8 @@ commonLabels:
|
||||
> create: true
|
||||
> ```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## _NamespaceTransformer_
|
||||
|
||||
### Usage via `kustomization.yaml`
|
||||
|
||||
#### field name: `namespace`
|
||||
@@ -292,6 +291,7 @@ namespace: my-namespace
|
||||
```
|
||||
|
||||
### Usage via plugin
|
||||
|
||||
#### Arguments
|
||||
|
||||
> [types.ObjectMeta]
|
||||
@@ -299,6 +299,7 @@ namespace: my-namespace
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```
|
||||
> apiVersion: builtin
|
||||
> kind: NamespaceTransformer
|
||||
@@ -316,11 +317,8 @@ namespace: my-namespace
|
||||
> group: rbac.authorization.k8s.io
|
||||
> ```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## _PatchesJson6902_
|
||||
|
||||
### Usage via `kustomization.yaml`
|
||||
|
||||
#### field name: `patchesJson6902`
|
||||
@@ -328,7 +326,7 @@ namespace: my-namespace
|
||||
Each entry in this list should resolve to
|
||||
a kubernetes object and a JSON patch that will be applied
|
||||
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
|
||||
by the object's group, version, kind, name and namespace.
|
||||
@@ -385,7 +383,9 @@ patchesJson6902:
|
||||
```
|
||||
|
||||
### Usage via plugin
|
||||
|
||||
#### Arguments
|
||||
|
||||
> Target [types.PatchTarget]
|
||||
>
|
||||
> Path string
|
||||
@@ -393,6 +393,7 @@ patchesJson6902:
|
||||
> JsonOp string
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```
|
||||
> apiVersion: builtin
|
||||
> kind: PatchJson6902Transformer
|
||||
@@ -406,8 +407,8 @@ patchesJson6902:
|
||||
> path: jsonpatch.json
|
||||
> ```
|
||||
|
||||
|
||||
## _PatchesStrategicMerge_
|
||||
|
||||
### Usage via `kustomization.yaml`
|
||||
|
||||
#### field name: `patchesStrategicMerge`
|
||||
@@ -435,6 +436,7 @@ patchesStrategicMerge:
|
||||
```
|
||||
|
||||
The patch content can be a inline string as well.
|
||||
|
||||
```
|
||||
patchesStrategicMerge:
|
||||
- |-
|
||||
@@ -463,8 +465,8 @@ patch that performs all the needed deletions.
|
||||
>
|
||||
> Patches string
|
||||
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```
|
||||
> apiVersion: builtin
|
||||
> kind: PatchStrategicMergeTransformer
|
||||
@@ -474,14 +476,14 @@ patch that performs all the needed deletions.
|
||||
> - patch.yaml
|
||||
> ```
|
||||
|
||||
|
||||
## _PatchTransformer_
|
||||
|
||||
### Usage via `kustomization.yaml`
|
||||
|
||||
#### field name: `patches`
|
||||
|
||||
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
|
||||
JSON patch. it can be either a patch file or an inline
|
||||
string. The target selects
|
||||
@@ -506,23 +508,25 @@ patches:
|
||||
value: new value
|
||||
target:
|
||||
kind: MyKind
|
||||
labelSelector: "env=dev"
|
||||
labelSelector: "env=dev"
|
||||
```
|
||||
|
||||
The `name` and `namespace` fields of the patch target selector are
|
||||
automatically anchored regular expressions. This means that the value `myapp`
|
||||
is equivalent to `^myapp$`.
|
||||
is equivalent to `^myapp$`.
|
||||
|
||||
### Usage via plugin
|
||||
|
||||
#### Arguments
|
||||
|
||||
> Path string
|
||||
>
|
||||
> Patch string
|
||||
>
|
||||
> Target \*[types.Selector]
|
||||
> Target \*[types.Selector]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```
|
||||
> apiVersion: builtin
|
||||
> kind: PatchTransformer
|
||||
@@ -534,10 +538,8 @@ is equivalent to `^myapp$`.
|
||||
> kind: Deployment
|
||||
> ```
|
||||
|
||||
|
||||
|
||||
|
||||
## _PrefixSuffixTransformer_
|
||||
|
||||
### Usage via `kustomization.yaml`
|
||||
|
||||
#### field names: `namePrefix`, `nameSuffix`
|
||||
@@ -547,7 +549,7 @@ of all resources.
|
||||
|
||||
E.g. a deployment named `wordpress` could
|
||||
become `alices-wordpress` or `wordpress-v2`
|
||||
or `alices-wordpress-v2`.
|
||||
or `alices-wordpress-v2`.
|
||||
|
||||
```
|
||||
namePrefix: alices-
|
||||
@@ -558,6 +560,7 @@ The suffix is appended before the content hash if
|
||||
the resource type is ConfigMap or Secret.
|
||||
|
||||
### Usage via plugin
|
||||
|
||||
#### Arguments
|
||||
|
||||
> Prefix string
|
||||
@@ -567,6 +570,7 @@ the resource type is ConfigMap or Secret.
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```
|
||||
> apiVersion: builtin
|
||||
> kind: PrefixSuffixTransformer
|
||||
@@ -578,9 +582,8 @@ the resource type is ConfigMap or Secret.
|
||||
> - path: metadata/name
|
||||
> ```
|
||||
|
||||
|
||||
|
||||
## _ReplicaCountTransformer_
|
||||
|
||||
### Usage via `kustomization.yaml`
|
||||
|
||||
#### 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:`
|
||||
it will match any `group` and `kind` that has a matching name and
|
||||
that is one of:
|
||||
|
||||
- `Deployment`
|
||||
- `ReplicationController`
|
||||
- `ReplicaSet`
|
||||
@@ -628,6 +632,7 @@ For more complex use cases, revert to using a patch.
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```
|
||||
> apiVersion: builtin
|
||||
> kind: ReplicaCountTransformer
|
||||
@@ -645,8 +650,6 @@ For more complex use cases, revert to using a patch.
|
||||
> kind: ReplicationController
|
||||
> ```
|
||||
|
||||
|
||||
|
||||
## _SecretGenerator_
|
||||
|
||||
### Usage via `kustomization.yaml`
|
||||
|
||||
@@ -18,8 +18,7 @@ current setup.
|
||||
|
||||
#### requirements
|
||||
|
||||
* linux, git, curl, Go 1.13
|
||||
|
||||
* linux, git, curl, Go 1.13
|
||||
|
||||
## Make a place to work
|
||||
|
||||
@@ -128,11 +127,11 @@ EOF
|
||||
```
|
||||
|
||||
Review the files
|
||||
|
||||
```
|
||||
ls -C1 $MYAPP
|
||||
```
|
||||
|
||||
|
||||
## Make a home for plugins
|
||||
|
||||
Plugins must live in a particular place for
|
||||
@@ -205,6 +204,7 @@ chmod a+x $MY_PLUGIN_DIR/SillyConfigMapGenerator
|
||||
## Install kustomize
|
||||
|
||||
Per the [instructions](/kustomize/installation):
|
||||
|
||||
```
|
||||
curl -s "https://raw.githubusercontent.com/\
|
||||
kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
||||
@@ -218,7 +218,7 @@ mv kustomize $DEMO/bin
|
||||
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
|
||||
|
||||
@@ -57,6 +57,7 @@ accepting a shared plugin _must compile both
|
||||
kustomize and the plugin_.
|
||||
|
||||
This means a one-time run of
|
||||
|
||||
```
|
||||
# Or whatever is appropriate at time of reading
|
||||
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 \
|
||||
-o ${wherever}/${kind}.so ${wherever}/${kind}.go
|
||||
```
|
||||
|
||||
with paths and the release version tag (e.g. `v3.0.0`)
|
||||
adjusted as needed.
|
||||
|
||||
For comparison, consider what one
|
||||
must do to write a [tensorflow plugin].
|
||||
|
||||
## Why support Go plugins?
|
||||
## Why support Go plugins
|
||||
|
||||
### Safety
|
||||
|
||||
|
||||
The Go plugin developer sees the same API offered
|
||||
to native kustomize operations, assuring certain
|
||||
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`
|
||||
to emit a _Go plugin_ (or vice versa).
|
||||
|
||||
### Unit of contribution
|
||||
### Unit of contribution
|
||||
|
||||
All the builtin generators and transformers
|
||||
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
|
||||
line below.
|
||||
|
||||
### What apiVersion and kind?
|
||||
### What apiVersion and kind
|
||||
|
||||
At this stage in the development of kustomize
|
||||
plugins, plugin code doesn't know or care what
|
||||
@@ -180,12 +180,12 @@ dependency [skew].
|
||||
|
||||
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`
|
||||
(_linux_) and `$GOARCH` (_amd64_) used to build
|
||||
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
|
||||
kustomize's `go.mod` used in its tagged commit).
|
||||
|
||||
@@ -356,7 +356,7 @@ This should look something like:
|
||||
> └── secGenerator.yaml
|
||||
> ```
|
||||
|
||||
## Build your app, using the plugin:
|
||||
## Build your app, using the plugin
|
||||
|
||||
```shell
|
||||
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
|
||||
and prior releases, see:
|
||||
|
||||
- [Choco Package](https://chocolatey.org/packages/kustomize)
|
||||
- [Package Source](https://github.com/kenmaglio/choco-kustomize)
|
||||
|
||||
@@ -18,4 +18,3 @@ For [MacPorts](https://www.macports.org) users:
|
||||
```
|
||||
sudo port install kustomize
|
||||
```
|
||||
|
||||
|
||||
@@ -39,5 +39,4 @@ git checkout kustomize/v3.2.3
|
||||
~/go/bin/kustomize version
|
||||
```
|
||||
|
||||
|
||||
[Go]: https://golang.org
|
||||
|
||||
@@ -28,7 +28,6 @@ linkTitle = "Kustomize"
|
||||
|
||||
{{< blocks/section >}}
|
||||
|
||||
|
||||
{{% blocks/feature icon="fab fa-github" title="参与贡献" %}}
|
||||
欢迎在 **Github** 提交 [RP](https://github.com/kubernetes-sigs/kustomize/pulls),贡献你的力量。
|
||||
{{% /blocks/feature %}}
|
||||
|
||||
@@ -96,4 +96,4 @@ spec:
|
||||
app: bingo
|
||||
owner: alice
|
||||
someName: someValue
|
||||
```
|
||||
```
|
||||
|
||||
@@ -9,6 +9,7 @@ description: >
|
||||
列表中的每个条目都将生成一个 ConfigMap (合计可以生成 n 个 ConfigMap)。
|
||||
|
||||
以下示例创建四个 ConfigMap:
|
||||
|
||||
- 第一个使用给定文件的名称和内容创建数据
|
||||
- 第二个使用文件中的键/值对将数据创建为键/值
|
||||
- 第三个使用 `literals` 中的键/值对创建数据作为键/值
|
||||
@@ -69,4 +70,4 @@ configMapGenerator:
|
||||
- name: app-whatever
|
||||
files:
|
||||
- myFileName.ini=whatever.ini
|
||||
```
|
||||
```
|
||||
|
||||
@@ -17,12 +17,12 @@ description: >
|
||||
|
||||
Annotations 可以放入 openAPI 的定义中:
|
||||
|
||||
- "x-kubernetes-annotation": ""
|
||||
- "x-kubernetes-label-selector": ""
|
||||
- "x-kubernetes-identity": ""
|
||||
- "x-kubernetes-object-ref-api-version": "v1",
|
||||
- "x-kubernetes-object-ref-kind": "Secret",
|
||||
- "x-kubernetes-object-ref-name-key": "name",
|
||||
- "x-kubernetes-annotation": ""
|
||||
- "x-kubernetes-label-selector": ""
|
||||
- "x-kubernetes-identity": ""
|
||||
- "x-kubernetes-object-ref-api-version": "v1",
|
||||
- "x-kubernetes-object-ref-kind": "Secret",
|
||||
- "x-kubernetes-object-ref-name-key": "name",
|
||||
|
||||
```yaml
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
|
||||
@@ -26,11 +26,11 @@ spec:
|
||||
```
|
||||
|
||||
想要将 `image` 做如下更改:
|
||||
|
||||
- 将 `postgres:8` 改为 `my-registry/my-postgres:v1`
|
||||
- 将 nginx tag 从 `1.7.9` 改为 `1.8.0`
|
||||
- 将镜像名称 `my-demo-app` 改为 `my-app`
|
||||
- 将 alpine 的 tag `3.7` 改为 digest 值
|
||||
|
||||
- 将 `postgres:8` 改为 `my-registry/my-postgres:v1`
|
||||
- 将 nginx tag 从 `1.7.9` 改为 `1.8.0`
|
||||
- 将镜像名称 `my-demo-app` 改为 `my-app`
|
||||
- 将 alpine 的 tag `3.7` 改为 digest 值
|
||||
|
||||
只需在 *kustomization* 中添加以下内容:
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ description: >
|
||||
[strategic merge]: /kustomize/zh/api-reference/glossary#patchstrategicmerge
|
||||
[JSON]: /kustomize/zh/api-reference/glossary#patchjson6902
|
||||
|
||||
|
||||
Patches 在资源上添加或覆盖字段,Kustomization 使用 `patches` 字段来提供该功能。
|
||||
|
||||
`patches` 字段包含要按指定顺序应用的 patch 列表。
|
||||
|
||||
@@ -23,6 +23,7 @@ patchesStrategicMerge:
|
||||
```
|
||||
|
||||
patch 内容也可以是一个inline string:
|
||||
|
||||
```yaml
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
@@ -31,9 +31,10 @@ replicas:
|
||||
该字段内容为列表,所以可以同时修改许多资源。
|
||||
|
||||
由于这个声明无法设置 `kind:` 或 `group:`,所以他只能匹配如下资源中的一种:
|
||||
|
||||
- `Deployment`
|
||||
- `ReplicationController`
|
||||
- `ReplicaSet`
|
||||
- `StatefulSet`
|
||||
|
||||
对于更复杂的用例,请使用 patch 。
|
||||
对于更复杂的用例,请使用 patch 。
|
||||
|
||||
@@ -7,6 +7,7 @@ description: >
|
||||
---
|
||||
|
||||
该条目可以是指向本地目录的相对路径,也可以是指向远程仓库中的目录的 URL,例如:
|
||||
|
||||
```yaml
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
@@ -10,13 +10,13 @@ Initial release after move from github.com/kubernetes/kubectl to github.com/kube
|
||||
|
||||
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.
|
||||
Has kustomization file, bases, overlays, basic transforms.
|
||||
* Apr 2018: s/kinflate/kustomize/, s/manifest/kustomization/
|
||||
* Oct 2017: s/kexpand/kinflate/
|
||||
* Sep 2017: kexpand [starts](https://github.com/kubernetes/kubectl/pull/65)
|
||||
* Apr 2018: s/kinflate/kustomize/, s/manifest/kustomization/
|
||||
* Oct 2017: s/kexpand/kinflate/
|
||||
* Sep 2017: kexpand [starts](https://github.com/kubernetes/kubectl/pull/65)
|
||||
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
|
||||
|
||||
@@ -151,7 +151,7 @@ path or URL to a kustomization directory in the
|
||||
![pruning dead branches][imgPruning]
|
||||
|
||||
_Alpha_
|
||||
|
||||
|
||||
Users can add an `inventory` stanza to their
|
||||
kustomization file, to add a special _inventory
|
||||
object_ to the `build` result.
|
||||
@@ -164,10 +164,9 @@ orphaned cluster resources.
|
||||
For more information see the
|
||||
[kustomize inventory object documentation].
|
||||
|
||||
|
||||
## Field changes / deprecations
|
||||
|
||||
### `resources` expanded, `bases` deprecated
|
||||
### `resources` expanded, `bases` deprecated
|
||||
|
||||
The `resources` field has been generalized; it now
|
||||
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 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
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ floor on a stable API for [plugin] developers
|
||||
(both _Go_ plugin developers and _exec_ plugin
|
||||
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
|
||||
[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.
|
||||
Such shrinkage will trigger a major version
|
||||
increment.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ description: >
|
||||
---
|
||||
|
||||
## 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).
|
||||
|
||||
## Improved Resource Matching
|
||||
@@ -52,7 +53,6 @@ spec:
|
||||
value: PRODVALUE
|
||||
```
|
||||
|
||||
|
||||
### Variable resolution improvement
|
||||
|
||||
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
|
||||
|
||||
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,
|
||||
- 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.
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ description: >
|
||||
---
|
||||
|
||||
## 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).
|
||||
|
||||
## 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.
|
||||
|
||||
Create a new overlay from the base ../base
|
||||
|
||||
```
|
||||
kustomize create --resources ../base
|
||||
```
|
||||
|
||||
Create a new kustomization detecing resources in the current directory
|
||||
|
||||
```
|
||||
kustomize create --autodetect
|
||||
```
|
||||
@@ -30,5 +33,5 @@ kustomize create --autodetect --recursive
|
||||
```
|
||||
|
||||
### 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
|
||||
[release process documentation]: /releasing
|
||||
|
||||
|
||||
## 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
|
||||
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
|
||||
yet released) and be a clean break with `v3` etc.
|
||||
|
||||
|
||||
### Change log since v3.2.0
|
||||
|
||||
```
|
||||
|
||||
@@ -14,10 +14,10 @@ description: >
|
||||
File issues as desired, but if you've found a problem
|
||||
with how `kustomize build` works, please report
|
||||
|
||||
* the output of `kustomize version`,
|
||||
* the input (the content of `kustomization.yaml`
|
||||
* the output of `kustomize version`,
|
||||
* the input (the content of `kustomization.yaml`
|
||||
and any files it refers to),
|
||||
* the expected YAML output.
|
||||
* the expected YAML output.
|
||||
|
||||
## If you have `go` installed
|
||||
|
||||
@@ -26,7 +26,7 @@ package] for specifying a kustomization's input and the
|
||||
expected output.
|
||||
|
||||
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.
|
||||
|
||||
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 [slack channel] and reach out
|
||||
- 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**
|
||||
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/)
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ description: >
|
||||
[eschewed feature list]: https://kubernetes-sigs.github.io/kustomize/faq/eschewedfeatures/
|
||||
[kind/feature]: https://github.com/kubernetes-sigs/kustomize/labels/kind%2Ffeature
|
||||
|
||||
|
||||
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
|
||||
|
||||
@@ -48,7 +48,7 @@ Call stack when running `kustomize build`, with links to code.
|
||||
* Iterate all generators
|
||||
* [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)
|
||||
* PatchStrategicMergeTransformer
|
||||
* PatchStrategicMergeTransformer
|
||||
* PatchTransformer
|
||||
* NamespaceTransformer
|
||||
* 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.
|
||||
* [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.
|
||||
* [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
|
||||
|
||||
## Pre-Reqs:
|
||||
- PowerShell installed
|
||||
- PowerShell Core is supported
|
||||
- go installed
|
||||
- golangci-lint installed
|
||||
- mdrip installed
|
||||
## Pre-Reqs
|
||||
|
||||
- PowerShell installed
|
||||
- PowerShell Core is supported
|
||||
- go 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).
|
||||
|
||||
### 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:
|
||||
- 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
|
||||
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
|
||||
|
||||
#### 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
|
||||
- Open new PowerShell Administrative window
|
||||
- Install golangci-lint
|
||||
- ```go get -u github.com/golangci/golangci-lint/cmd/golangci-lint```
|
||||
- Install mdrip
|
||||
- ```go get github.com/monopole/mdrip```
|
||||
|
||||
- Open new PowerShell Administrative window
|
||||
- Install golangci-lint
|
||||
- ```go get -u github.com/golangci/golangci-lint/cmd/golangci-lint```
|
||||
- Install mdrip
|
||||
- ```go get github.com/monopole/mdrip```
|
||||
|
||||
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
|
||||
|
||||
- In your GoRoot src
|
||||
- ```Example: C:\_go\src```
|
||||
- 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.
|
||||
|
||||
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
|
||||
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
|
||||
[JSON patches] or [SMP 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`,
|
||||
`AnnotationsTransformer`, etc.
|
||||
These accept relatively simple YAML configuration
|
||||
@@ -69,7 +69,7 @@ informed error messages if inputs are invalid.
|
||||
|
||||
_Unstructured edits_, edits that don't limit
|
||||
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
|
||||
parameterization approach.
|
||||
|
||||
@@ -93,7 +93,7 @@ kustomize eschews parameterization, because
|
||||
- The input becomes [unintelligible] as the project
|
||||
scales in any number of dimensions (resource
|
||||
count, cluster count, environment count, etc.)
|
||||
|
||||
|
||||
Kustomizations are meant to be sharable and stackable.
|
||||
Imagine tracing down a problem rooted in a
|
||||
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
|
||||
`kustomize build`.
|
||||
|
||||
|
||||
## Globs in kustomization files
|
||||
|
||||
`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.
|
||||
|
||||
|
||||
## Kustomization File Versioning
|
||||
|
||||
|
||||
The kustomization file is a struct that is part of
|
||||
the kustomize Go API (the `sigs.k8s.io/kustomize`
|
||||
module), but it also evolves as a k8s API object -
|
||||
|
||||
@@ -51,6 +51,7 @@ description: >
|
||||
> ```
|
||||
|
||||
也可以在 [kubectl-v1.14.0] 版,使用 ```kubectl``` 命令发布你的 [variants] 。
|
||||
>
|
||||
> ```
|
||||
> kubectl apply -k ~/ldap/overlays/staging
|
||||
> kubectl apply -k ~/ldap/overlays/production
|
||||
|
||||
@@ -45,6 +45,7 @@ description: >
|
||||
> ```
|
||||
|
||||
也可以在 [kubectl-v1.14.0] 版,使用 ```kubectl``` 命令发布你的 [variants] 。
|
||||
>
|
||||
> ```bash
|
||||
> kubectl apply -k ~/ldap/overlays/staging
|
||||
> kubectl apply -k ~/ldap/overlays/production
|
||||
|
||||
@@ -16,8 +16,8 @@ Kustomize 提供一个插件框架,允许用户开发自己的 _生成器_ 和
|
||||
|
||||
[12-factor]: https://12factor.net
|
||||
|
||||
* _generator_ 插件生成 k8s 资源,比如 [helm chart inflator] 是一个 generator 插件,基于少量自由变量生成一个 [12-factor] 应用所包含的全部组件 deployment,service,scaler,ingress 等)也是一个 generator 插件。
|
||||
* _transformer_ 插件转化(修改)k8s 资源,比如可能会执行对特殊容器命令行的编辑,或为其他内置转换器(`namePrefix`、`commonLabels` 等)无法转换的内容提供转换。
|
||||
* _generator_ 插件生成 k8s 资源,比如 [helm chart inflator] 是一个 generator 插件,基于少量自由变量生成一个 [12-factor] 应用所包含的全部组件 deployment,service,scaler,ingress 等)也是一个 generator 插件。
|
||||
* _transformer_ 插件转化(修改)k8s 资源,比如可能会执行对特殊容器命令行的编辑,或为其他内置转换器(`namePrefix`、`commonLabels` 等)无法转换的内容提供转换。
|
||||
|
||||
## `kustomization.yaml` 的格式
|
||||
|
||||
@@ -42,7 +42,6 @@ Kustomize 提供一个插件框架,允许用户开发自己的 _生成器_ 和
|
||||
|
||||
从磁盘上读取 YAML 文件,kustomization 的路径或 URL 会触发 kustomization 的运行。由此产生的每个的对象都会被 kustomize 进一步解析为 _plugin configuration_ 对象。
|
||||
|
||||
|
||||
## 配置
|
||||
|
||||
kustomization 文件可以包含如下内容:
|
||||
@@ -149,10 +148,10 @@ _exec 插件_ 是一个可以在命令行中接收参数可执行文件,该参
|
||||
|
||||
#### 示例
|
||||
|
||||
* [helm chart inflator] - helm chart inflates 生成器。
|
||||
* [bashed config map] - 使用 bash 生成十分简单的 configMap。
|
||||
* [sed transformer] - 使用插件来定义非结构化的编辑。
|
||||
* [hashicorp go-getter] - 下载 kustomize layes 并通过构建它来生成资源。
|
||||
* [helm chart inflator] - helm chart inflates 生成器。
|
||||
* [bashed config map] - 使用 bash 生成十分简单的 configMap。
|
||||
* [sed transformer] - 使用插件来定义非结构化的编辑。
|
||||
* [hashicorp go-getter] - 下载 kustomize layes 并通过构建它来生成资源。
|
||||
|
||||
生成器插件无需在 `stdin` 上输入任何东西,就会将生成的资源输出到 `stdout`。
|
||||
|
||||
@@ -173,6 +172,7 @@ kustomize 会使用 exec 插件适配器,为 `stdin` 提供的资源,并获
|
||||
如果此注释被设置在不受哈希转换器支持的资源上,将导致构建将失败。
|
||||
|
||||
示例:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
@@ -181,7 +181,7 @@ metadata:
|
||||
annotations:
|
||||
kustomize.config.k8s.io/needs-hash: "true"
|
||||
data:
|
||||
foo: bar
|
||||
foo: bar
|
||||
```
|
||||
|
||||
**`kustomize.config.k8s.io/behavior`**
|
||||
@@ -189,6 +189,7 @@ data:
|
||||
`behavior` 注释为当资源发生冲突时插件的处理方式,有效值包括:"create"、"merge "和 "replace",默认为 "create"。
|
||||
|
||||
示例:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
@@ -197,7 +198,7 @@ metadata:
|
||||
annotations:
|
||||
kustomize.config.k8s.io/behavior: "merge"
|
||||
data:
|
||||
foo: bar
|
||||
foo: bar
|
||||
```
|
||||
|
||||
### Go 插件
|
||||
@@ -216,8 +217,8 @@ kustomize 的一个 Go 插件看起来是这样的:
|
||||
> package main
|
||||
>
|
||||
> import (
|
||||
> "sigs.k8s.io/kustomize/api/ifc"
|
||||
> "sigs.k8s.io/kustomize/api/resmap"
|
||||
> "sigs.k8s.io/kustomize/api/ifc"
|
||||
> "sigs.k8s.io/kustomize/api/resmap"
|
||||
> ...
|
||||
> )
|
||||
>
|
||||
@@ -247,12 +248,12 @@ kustomize 的一个 Go 插件看起来是这样的:
|
||||
|
||||
#### 示例
|
||||
|
||||
* [service generator] - 使用 name 和 port 参数生成一个 service。
|
||||
* [string prefixer] - 使用 `metadata/name` 值作为前缀。这个特殊的示例是为了展示插件的转化行为。详见 `target` 包中的 `TestTransformedTransformers` 测试。
|
||||
* [date prefixer] - 将当前日期作为前缀添加到资源名称上,这是一个用于修改刚才提到的字符串前缀插件的简单示例。
|
||||
* [secret generator] - 从 toy 数据库生成 secret。
|
||||
* [sops encoded secrets] - 一个更复杂的 secret 生成器。
|
||||
* [All the builtin plugins](https://github.com/kubernetes-sigs/kustomize/tree/master/plugin/builtin).
|
||||
* [service generator] - 使用 name 和 port 参数生成一个 service。
|
||||
* [string prefixer] - 使用 `metadata/name` 值作为前缀。这个特殊的示例是为了展示插件的转化行为。详见 `target` 包中的 `TestTransformedTransformers` 测试。
|
||||
* [date prefixer] - 将当前日期作为前缀添加到资源名称上,这是一个用于修改刚才提到的字符串前缀插件的简单示例。
|
||||
* [secret generator] - 从 toy 数据库生成 secret。
|
||||
* [sops encoded secrets] - 一个更复杂的 secret 生成器。
|
||||
* [All the builtin plugins](https://github.com/kubernetes-sigs/kustomize/tree/master/plugin/builtin).
|
||||
用户自制的插件与内置插件是一样的。
|
||||
|
||||
Go 插件既可以是生成器,也可以是转化器。`Generate` 方法将在 `Transform` 方法运行之前与所有其他生成器一起运行。
|
||||
|
||||
@@ -50,6 +50,7 @@ commonAnnotations:
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```yaml
|
||||
> apiVersion: builtin
|
||||
> kind: AnnotationsTransformer
|
||||
@@ -63,8 +64,6 @@ commonAnnotations:
|
||||
> create: true
|
||||
> ```
|
||||
|
||||
|
||||
|
||||
## _ConfigMapGenerator_
|
||||
|
||||
### 使用 `kustomization.yaml`
|
||||
@@ -94,7 +93,7 @@ configMapGenerator:
|
||||
- application.properties
|
||||
- more.properties
|
||||
- name: my-java-server-env-vars
|
||||
literals:
|
||||
literals:
|
||||
- JAVA_HOME=/opt/java/jdk
|
||||
- JAVA_TOOL_OPTIONS=-agentlib:hprof
|
||||
options:
|
||||
@@ -129,6 +128,7 @@ configMapGenerator:
|
||||
> [types.ConfigMapArgs]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```yaml
|
||||
> apiVersion: builtin
|
||||
> kind: ConfigMapGenerator
|
||||
@@ -142,7 +142,6 @@ configMapGenerator:
|
||||
> - VEGETABLE=carrot
|
||||
> ```
|
||||
|
||||
|
||||
## _ImageTagTransformer_
|
||||
|
||||
### 使用 `kustomization.yaml`
|
||||
@@ -164,11 +163,11 @@ containers:
|
||||
```
|
||||
|
||||
想要将 `image` 做如下更改:
|
||||
|
||||
- 将 `postgres:8` 改为 `my-registry/my-postgres:v1`
|
||||
- 将 nginx tag 从 `1.7.9` 改为 `1.8.0`
|
||||
- 将镜像名称 `my-demo-app` 改为 `my-app`
|
||||
- 将 alpine 的 tag `3.7` 改为 digest 值
|
||||
|
||||
- 将 `postgres:8` 改为 `my-registry/my-postgres:v1`
|
||||
- 将 nginx tag 从 `1.7.9` 改为 `1.8.0`
|
||||
- 将镜像名称 `my-demo-app` 改为 `my-app`
|
||||
- 将 alpine 的 tag `3.7` 改为 digest 值
|
||||
|
||||
只需在 *kustomization* 中添加以下内容:
|
||||
|
||||
@@ -194,6 +193,7 @@ images:
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```yaml
|
||||
> apiVersion: builtin
|
||||
> kind: ImageTagTransformer
|
||||
@@ -204,8 +204,6 @@ images:
|
||||
> newTag: v2
|
||||
> ```
|
||||
|
||||
|
||||
|
||||
## _LabelTransformer_
|
||||
|
||||
### 使用 `kustomization.yaml`
|
||||
@@ -230,6 +228,7 @@ commonLabels:
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```yaml
|
||||
> apiVersion: builtin
|
||||
> kind: LabelTransformer
|
||||
@@ -264,6 +263,7 @@ namespace: my-namespace
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```yaml
|
||||
> apiVersion: builtin
|
||||
> kind: NamespaceTransformer
|
||||
@@ -345,6 +345,7 @@ patchesJson6902:
|
||||
### 使用插件
|
||||
|
||||
#### Arguments
|
||||
|
||||
> Target [types.PatchTarget]
|
||||
>
|
||||
> Path string
|
||||
@@ -352,6 +353,7 @@ patchesJson6902:
|
||||
> JsonOp string
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```yaml
|
||||
> apiVersion: builtin
|
||||
> kind: PatchJson6902Transformer
|
||||
@@ -385,6 +387,7 @@ patchesStrategicMerge:
|
||||
```
|
||||
|
||||
patch 内容也可以是一个inline string:
|
||||
|
||||
```yaml
|
||||
patchesStrategicMerge:
|
||||
- |-
|
||||
@@ -411,6 +414,7 @@ patchesStrategicMerge:
|
||||
> Patches string
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```yaml
|
||||
> apiVersion: builtin
|
||||
> kind: PatchStrategicMergeTransformer
|
||||
@@ -420,7 +424,6 @@ patchesStrategicMerge:
|
||||
> - patch.yaml
|
||||
> ```
|
||||
|
||||
|
||||
## _PatchTransformer_
|
||||
|
||||
### 使用 `kustomization.yaml`
|
||||
@@ -460,9 +463,10 @@ is equivalent to `^myapp$`。
|
||||
>
|
||||
> Patch string
|
||||
>
|
||||
> Target \*[types.Selector]
|
||||
> Target \*[types.Selector]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```yaml
|
||||
> apiVersion: builtin
|
||||
> kind: PatchTransformer
|
||||
@@ -502,6 +506,7 @@ nameSuffix: -v2
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```yaml
|
||||
> apiVersion: builtin
|
||||
> kind: PrefixSuffixTransformer
|
||||
@@ -542,6 +547,7 @@ replicas:
|
||||
该字段内容为列表,所以可以同时修改许多资源。
|
||||
|
||||
由于这个声明无法设置 `kind:` 或 `group:`,所以他只能匹配如下资源中的一种:
|
||||
|
||||
- `Deployment`
|
||||
- `ReplicationController`
|
||||
- `ReplicaSet`
|
||||
@@ -558,6 +564,7 @@ replicas:
|
||||
> FieldSpecs \[\][config.FieldSpec]
|
||||
|
||||
#### Example
|
||||
>
|
||||
> ```yaml
|
||||
> apiVersion: builtin
|
||||
> kind: ReplicaCountTransformer
|
||||
|
||||
@@ -15,10 +15,10 @@ description: >
|
||||
|
||||
#### 环境要求
|
||||
|
||||
* `linux`
|
||||
* `git`
|
||||
* `curl`
|
||||
* `Go 1.13`
|
||||
* `linux`
|
||||
* `git`
|
||||
* `curl`
|
||||
* `Go 1.13`
|
||||
|
||||
## 创建一个工作空间/目录
|
||||
|
||||
@@ -203,7 +203,7 @@ mv kustomize $DEMO/bin
|
||||
tree $DEMO
|
||||
```
|
||||
|
||||
## 使用插件构建 APP:
|
||||
## 使用插件构建 APP
|
||||
|
||||
```bash
|
||||
XDG_CONFIG_HOME=$DEMO $DEMO/bin/kustomize build --enable_alpha_plugins $MYAPP
|
||||
|
||||
@@ -50,7 +50,7 @@ go build -buildmode plugin \
|
||||
|
||||
为了进行比较,可以参考编写 [tensorflow plugin] 必须做的事情。
|
||||
|
||||
## 为什么支持 Go 插件?
|
||||
## 为什么支持 Go 插件
|
||||
|
||||
### 安全
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ PLUGIN_ROOT=$DEMO/kustomize/plugin
|
||||
|
||||
并在下面的命令行中临时设置 `XDG_CONFIG_HOME`。
|
||||
|
||||
### 使用什么 apiVersion 和 kind?
|
||||
### 使用什么 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 插件生态。
|
||||
|
||||
@@ -296,7 +296,7 @@ tree $DEMO
|
||||
> └── secGenerator.yaml
|
||||
> ```
|
||||
|
||||
## 使用插件构建您的应用:
|
||||
## 使用插件构建您的应用
|
||||
|
||||
```shell
|
||||
XDG_CONFIG_HOME=$DEMO $tmpGoPath/bin/kustomize build --enable_alpha_plugins $MYAPP
|
||||
|
||||
@@ -12,5 +12,6 @@ choco install kustomize
|
||||
```
|
||||
|
||||
有关软件包管理器 chocolatey 的使用以及对之前版本的支持,请参考以下链接:
|
||||
|
||||
- [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