Documentation
¶
Index ¶
Constants ¶
const (
NameReferenceFieldSpecs = `` /* 14569-byte string literal not displayed */
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldSpec ¶
type FieldSpec struct {
resid.Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
CreateIfNotPresent bool `json:"create,omitempty" yaml:"create,omitempty"`
}
FieldSpec completely specifies a kustomizable field in a k8s API object. It helps define the operands of transformations.
For example, a directive to add a common label to objects will need to know that a 'Deployment' object (in API group 'apps', any version) can have labels at field path 'spec/template/metadata/labels', and further that it is OK (or not OK) to add that field path to the object if the field path doesn't exist already.
This would look like
{
group: apps
kind: Deployment
path: spec/template/metadata/labels
create: true
}
type FsSlice ¶
type FsSlice []FieldSpec
func (FsSlice) MergeAll ¶
MergeAll merges the argument into this, returning the result. Items already present are ignored. Items that conflict (primary key matches, but remain data differs) result in an error.
type NameBackReferences ¶
type NameBackReferences struct {
resid.Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
// TODO: rename json 'fieldSpecs' to 'referrers' for clarity.
// This will, however, break anyone using a custom config.
Referrers FsSlice `json:"fieldSpecs,omitempty" yaml:"fieldSpecs,omitempty"`
}
NameBackReferences is an association between a gvk.GVK (a ReferralTarget) and a list of Referrers that could refer to it.
It is used to handle name changes, and can be thought of as a a contact list. If you change your own contact info (name, phone number, etc.), you must tell your contacts or they won't know about the change.
For example, ConfigMaps can be used by Pods and everything that contains a Pod; Deployment, Job, StatefulSet, etc. The ConfigMap is the ReferralTarget, the others are Referrers.
If the name of a ConfigMap instance changed from 'alice' to 'bob', one must
- visit all objects that could refer to the ConfigMap (the Referrers)
- see if they mention 'alice',
- if so, change the Referrer's name reference to 'bob'.
The NameBackReferences instance to aid in this could look like
{
kind: ConfigMap
version: v1
fieldSpecs:
- kind: Pod
version: v1
path: spec/volumes/configMap/name
- kind: Deployment
path: spec/template/spec/volumes/configMap/name
- kind: Job
path: spec/template/spec/volumes/configMap/name
(etc.)
}
func (NameBackReferences) String ¶
func (n NameBackReferences) String() string
type NbrSlice ¶
type NbrSlice []NameBackReferences