Documentation ¶
Index ¶
Constants ¶
const ( // ConfigMapAnnotation defines the annotation that should be set on Filters if they should be applied to // YAMLs stored in configmaps. Valid values are "only" and "both". Only means only apply to configmap and // both means apply to both the configmap contents and all other resources. ConfigMapAnnotation = "kustomize.primer.ai/applytocm" // ConfigMapOnly is the value of the annotation to only apply filter to configmap contents. ConfigMapOnly = "only" // ConfigMapBoth is the value of the annotation to apply filter to configmap contents and YAMLs in source directory. ConfigMapBoth = "both" )
const (
// Kind is the kind for the kustomize function.
Kind = "ConfigMapPatch"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PatchFn ¶
type PatchFn struct { // Kind is the API name. Must be ConfigMapPatch. Kind string `yaml:"kind"` // APIVersion is the API version. Must be examples.kpt.dev/v1alpha1 APIVersion string `yaml:"apiVersion"` // Metadata defines instance metadata. Metadata v1alpha1.Metadata `yaml:"metadata"` // Spec defines the desired declarative configuration. Spec Spec `yaml:"spec"` }
PatchFn patches a configmap. It works by looking for all configmaps that define the specified keys and overriding them. This is different from a strategic patch merge because we don't need to know the name of the configmap to apply it.
type Spec ¶
type Spec struct { // Data is a mapping of the values to set if present. Data map[string]string `yaml:"data"` }
Spec is the spec for the kustomize function.
type WrappedFilter ¶
WrappedFilter applies a set of Filters to the data inside a configmap. This is useful if you have a ConfigMap containing YAML files and you want to apply the filters to the contents of those YAML files.
To users, users add the annotation "kustomize.primer.ai/applytocm" to their kustomize function definitions. The dispatcher will then wrap the specified kustomize function.
Example: apiVersion: v1alpha1 kind: PodEnvs metadata: annotations:
kustomize.primer.ai/applytocm: both
spec:
remove: - DD_AGENT_HOST
Important: If you have a function that accumulates data (see for example readFn in extractor.go) note that the init function of the filter gets invoked multiple times. Therefore, its important to not zero out the field doing accumulation on each call to init.