builtinconfig

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package builtinconfig provides legacy methods for configuring builtin plugins from a common config file. As a user, its best to configure plugins individually with plugin config files specified in the `transformers:` or `generators:` field, than to use this legacy configuration technique.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NameBackReferences

type NameBackReferences struct {
	resid.Gvk  `json:",inline,omitempty" yaml:",inline,omitempty"`
	FieldSpecs types.FsSlice `json:"FieldSpecs,omitempty" yaml:"FieldSpecs,omitempty"`
}

NameBackReferences is an association between a gvk.GVK and a list of FieldSpec instances 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. To change the name of a ConfigMap instance from 'alice' to 'bob', one must visit all objects that could refer to the ConfigMap, see if they mention 'alice', and if so, change the 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 TransformerConfig

type TransformerConfig struct {
	NamePrefix        types.FsSlice `json:"namePrefix,omitempty" yaml:"namePrefix,omitempty"`
	NameSuffix        types.FsSlice `json:"nameSuffix,omitempty" yaml:"nameSuffix,omitempty"`
	NameSpace         types.FsSlice `json:"namespace,omitempty" yaml:"namespace,omitempty"`
	CommonLabels      types.FsSlice `json:"commonLabels,omitempty" yaml:"commonLabels,omitempty"`
	CommonAnnotations types.FsSlice `json:"commonAnnotations,omitempty" yaml:"commonAnnotations,omitempty"`
	NameReference     nbrSlice      `json:"nameReference,omitempty" yaml:"nameReference,omitempty"`
	VarReference      types.FsSlice `json:"varReference,omitempty" yaml:"varReference,omitempty"`
	Images            types.FsSlice `json:"images,omitempty" yaml:"images,omitempty"`
	Replicas          types.FsSlice `json:"replicas,omitempty" yaml:"replicas,omitempty"`
}

TransformerConfig holds the data needed to perform transformations.

func MakeDefaultConfig

func MakeDefaultConfig() *TransformerConfig

MakeDefaultConfig returns a default TransformerConfig.

func MakeEmptyConfig

func MakeEmptyConfig() *TransformerConfig

MakeEmptyConfig returns an empty TransformerConfig object

func MakeTransformerConfig

func MakeTransformerConfig(
	ldr ifc.Loader, paths []string) (*TransformerConfig, error)

MakeTransformerConfig returns a merger of custom config, if any, with default config.

func (*TransformerConfig) AddAnnotationFieldSpec

func (t *TransformerConfig) AddAnnotationFieldSpec(fs types.FieldSpec) (err error)

AddAnnotationFieldSpec adds a FieldSpec to CommonAnnotations

func (*TransformerConfig) AddLabelFieldSpec

func (t *TransformerConfig) AddLabelFieldSpec(fs types.FieldSpec) (err error)

AddLabelFieldSpec adds a FieldSpec to CommonLabels

func (*TransformerConfig) AddNamereferenceFieldSpec

func (t *TransformerConfig) AddNamereferenceFieldSpec(
	nbrs NameBackReferences) (err error)

AddNamereferenceFieldSpec adds a NameBackReferences to NameReference

func (*TransformerConfig) AddPrefixFieldSpec

func (t *TransformerConfig) AddPrefixFieldSpec(fs types.FieldSpec) (err error)

AddPrefixFieldSpec adds a FieldSpec to NamePrefix

func (*TransformerConfig) AddSuffixFieldSpec

func (t *TransformerConfig) AddSuffixFieldSpec(fs types.FieldSpec) (err error)

AddSuffixFieldSpec adds a FieldSpec to NameSuffix

func (*TransformerConfig) Merge

func (t *TransformerConfig) Merge(input *TransformerConfig) (
	merged *TransformerConfig, err error)

Merge merges two TransformerConfigs objects into a new TransformerConfig object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL