Documentation ¶
Index ¶
- Constants
- func CollectParamsFromPath(parameterizersDir string) (map[string][]ParameterizerT, error)
- func GetSubKeys(key string) []string
- func Parameterize(srcDir, outDir string, packSpecConfig ParameterizerConfigT, ...) ([]string, error)
- type FilterT
- type HelmValuesT
- type OCParamT
- type ParamOrStringT
- type ParamTargetT
- type ParameterT
- type ParameterValueT
- type ParameterizerConfigT
- type ParameterizerFileT
- type ParameterizerSpecT
- type ParameterizerT
- type PatchMetadataT
- type PatchMetadataTargetT
- type PatchOpT
- type PatchT
- type RT
Constants ¶
const ( // PackagingKind is the kind for Packaging yamls PackagingKind = "Packaging" // ParameterizerKind is the kind for Parameterizer yamls ParameterizerKind = "Parameterizer" // ReplaceOp replaces the value at the key with a different value ReplaceOp PatchOpT = "replace" // AddOp inserts a value at the key AddOp PatchOpT = "add" // RemoveOp removes the value at the key RemoveOp PatchOpT = "remove" // TargetHelm is used when the target is the parameterization of Helm TargetHelm ParamTargetT = "helm" // TargetKustomize is used when the target is the parameterization of Kustomize TargetKustomize ParamTargetT = "kustomize" // TargetOCTemplates is used when the target is the parameterization of Openshift Templates TargetOCTemplates ParamTargetT = "openshifttemplates" // ParamQuesIDPrefix is used as a prefix when the key is not specified in the questions in a parameterizer ParamQuesIDPrefix = common.BaseKey + common.Delim + "parameterization" )
Variables ¶
This section is empty.
Functions ¶
func CollectParamsFromPath ¶
func CollectParamsFromPath(parameterizersDir string) (map[string][]ParameterizerT, error)
CollectParamsFromPath returns parameterizers found in a directory
func GetSubKeys ¶
GetSubKeys returns the parts of a key. Example aaa.bbb."ccc ddd".eee.fff -> {"aaa", "bbb", "ccc ddd", "eee", "fff"}
func Parameterize ¶
func Parameterize(srcDir, outDir string, packSpecConfig ParameterizerConfigT, ps []ParameterizerT) ([]string, error)
Parameterize does the parameterization based on a spec
Types ¶
type FilterT ¶
type FilterT struct { Kind string `yaml:"kind,omitempty" json:"kind,omitempty"` APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"` Name string `yaml:"name,omitempty" json:"name,omitempty"` Envs []string `yaml:"envs,omitempty" json:"envs,omitempty"` }
FilterT is used to choose the k8s resources that the parameterizer should be applied on
type ParamOrStringT ¶
ParamOrStringT is string along with a flag to indicate if it is a parameter
type ParameterT ¶
type ParameterT struct { Name string `yaml:"name" json:"name"` Default string `yaml:"default,omitempty" json:"default,omitempty"` HelmTemplate string `yaml:"helmTemplate,omitempty" json:"helmTemplate,omitempty"` OpenshiftTemplate string `yaml:"openshiftTemplate,omitempty" json:"openshiftTemplate,omitempty"` Values []ParameterValueT `yaml:"values,omitempty" json:"values,omitempty"` }
ParameterT is used to specify the environment specific defaults for the keys in the template
type ParameterValueT ¶
type ParameterValueT struct { Envs []string `yaml:"envs,omitempty" json:"envs,omitempty"` Kind string `yaml:"kind,omitempty" json:"kind,omitempty"` APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"` MetadataName string `yaml:"metadataName,omitempty" json:"metadataName,omitempty"` Custom map[string]string `yaml:"custom,omitempty" json:"custom,omitempty"` Value string `yaml:"value" json:"value"` }
ParameterValueT is used to specify the value for a parameter in different contexts
type ParameterizerConfigT ¶
type ParameterizerConfigT struct { ProjectName string `yaml:"projectName,omitempty" json:"projectName,omitempty"` Helm string `yaml:"helm,omitempty" json:"helm,omitempty"` Kustomize string `yaml:"kustomize,omitempty" json:"kustomize,omitempty"` OCTemplates string `yaml:"openshiftTemplates,omitempty" json:"openshiftTemplates,omitempty"` Envs []string `yaml:"envs,omitempty" json:"envs,omitempty"` }
ParameterizerConfigT is the set of paths to be parameterized
type ParameterizerFileT ¶
type ParameterizerFileT struct { metav1.TypeMeta `yaml:",inline" json:",inline"` metav1.ObjectMeta `yaml:"metadata" json:"metadata"` Spec ParameterizerSpecT `yaml:"spec" json:"spec"` }
ParameterizerFileT is the file format for the parameterizers
type ParameterizerSpecT ¶
type ParameterizerSpecT struct {
Parameterizers []ParameterizerT `yaml:"parameterizers" json:"parameterizers"`
}
ParameterizerSpecT is the spec inside the parameterizers file
type ParameterizerT ¶
type ParameterizerT struct { Target string `yaml:"target" json:"target"` Template string `yaml:"template,omitempty" json:"template,omitempty"` Regex string `yaml:"regex,omitempty" json:"regex,omitempty"` Default interface{} `yaml:"default,omitempty" json:"default,omitempty"` Question *qaengine.Problem `yaml:"question,omitempty" json:"question,omitempty"` Filters []FilterT `yaml:"filters,omitempty" json:"filters,omitempty"` Parameters []ParameterT `yaml:"parameters,omitempty" json:"parameters,omitempty"` }
ParameterizerT is a paramterizer
type PatchMetadataT ¶
type PatchMetadataT struct { Path string `yaml:"path"` Target PatchMetadataTargetT `yaml:"target"` }
PatchMetadataT is contains the target k8s resources and the patch filename
type PatchMetadataTargetT ¶
type PatchMetadataTargetT struct { Group string `yaml:"group"` Version string `yaml:"version"` Kind string `yaml:"kind"` Namespace string `yaml:"namespace,omitempty"` Name string `yaml:"name"` }
PatchMetadataTargetT is used to specify the target k8s resource that the json path should be applied on (this is specific to kustomize)
type PatchT ¶
type PatchT struct { Op PatchOpT `yaml:"op"` Path string `yaml:"path"` Value interface{} `yaml:"value"` }
PatchT represents a single json patch https://tools.ietf.org/html/rfc6902