Documentation ¶
Index ¶
- func AddPatchesToYAML(inputYAML string, patches map[string]string) (string, error)
- func ConcatYAMLs(y1 string, y2 string) string
- func ExtractYAMLs(yamls []*YAMLFile, extractPath string, yamlDir string, ...) error
- func NamespaceScopeMatcher(obj map[string]interface{}, resourceKind string) bool
- func TemplateScopeMatcher(obj map[string]interface{}, resourceKind string) bool
- func TemplatizeK8sYAML(inputYAML string, tmplOpts []*K8sTemplateOptions) (string, error)
- type ExtractYAMLFormat
- type K8sTemplateOptions
- type TemplateMatchFn
- type YAMLFile
- type YAMLTmplArguments
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPatchesToYAML ¶
AddPatchesToYAML takes a K8s YAML and adds the given patches using a strategic merge.
func ConcatYAMLs ¶
ConcatYAMLs concatenates two separate YAMLs.
func ExtractYAMLs ¶
func ExtractYAMLs(yamls []*YAMLFile, extractPath string, yamlDir string, format ExtractYAMLFormat) error
ExtractYAMLs writes the generated YAMLs to a tar at the given path in the given format.
func NamespaceScopeMatcher ¶
NamespaceScopeMatcher matches the resource if the resource is contained within a namespace.
func TemplateScopeMatcher ¶
TemplateScopeMatcher matches the resource definition contains a template for deploying other resources.
func TemplatizeK8sYAML ¶
func TemplatizeK8sYAML(inputYAML string, tmplOpts []*K8sTemplateOptions) (string, error)
TemplatizeK8sYAML takes a K8s YAML and templatizes the provided fields.
Types ¶
type ExtractYAMLFormat ¶
type ExtractYAMLFormat int
ExtractYAMLFormat represents the types of formats we can extract YAMLs to.
const ( // UnknownExtractYAMLFormat is an extraction format. UnknownExtractYAMLFormat ExtractYAMLFormat = iota // SingleFileExtractYAMLFormat extracts YAMLs to single file. SingleFileExtractYAMLFormat // MultiFileExtractYAMLFormat extract YAMLs into multiple files, according to type. MultiFileExtractYAMLFormat )
type K8sTemplateOptions ¶
type K8sTemplateOptions struct { // TemplateMatcher is a function that returns whether or not the template should be applied to the resource. TemplateMatcher TemplateMatchFn // The JSON that should be patched in, with the placeholder values. Patch string // Placeholder is the string in the YAML which should be replaced with the template value. Placeholder string // TemplateValue is the template string that should replace the placeholder. TemplateValue string }
K8sTemplateOptions specifies how the templated YAML should be constructed, by specifying selectors for which resources should contain the template, how the placeholder should be patched in, and what that placeholder should be replaced with.
type TemplateMatchFn ¶
TemplateMatchFn is a function used to determine whether or not the given resource should have the template applied.
func GenerateContainerNameMatcherFn ¶
func GenerateContainerNameMatcherFn(expectedName string) TemplateMatchFn
GenerateContainerNameMatcherFn creates a matcher function for matching the resource if the resource has a pod template with a container of the given name.
func GenerateResourceNameMatcherFn ¶
func GenerateResourceNameMatcherFn(expectedName string) TemplateMatchFn
GenerateResourceNameMatcherFn creates a matcher function for matching the resource if the resource's name matches matchValue.
func GenerateServiceAccountSubjectMatcher ¶
func GenerateServiceAccountSubjectMatcher(subjectName string) TemplateMatchFn
GenerateServiceAccountSubjectMatcher matches the resource definition containing a service account subject with the given name.
type YAMLFile ¶
YAMLFile is a YAML associated with a name.
func ExecuteTemplatedYAMLs ¶
func ExecuteTemplatedYAMLs(yamls []*YAMLFile, tmplValues *YAMLTmplArguments) ([]*YAMLFile, error)
ExecuteTemplatedYAMLs takes a template YAML and applies the given template values to it.
type YAMLTmplArguments ¶
type YAMLTmplArguments struct { Values *map[string]interface{} // Release values represent special fields that are filled out by Helm. Release *map[string]interface{} }
YAMLTmplArguments is a wrapper around YAMLTmplValues.