topologymutation

package
v1.5.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 13 Imported by: 8

Documentation

Overview

Package topologymutation provides helpers for implementing the topology mutation hooks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStringVariable

func GetStringVariable(templateVariables map[string]apiextensionsv1.JSON, variableName string) (string, bool, error)

GetStringVariable get the variable value as a string.

func GetVariable

func GetVariable(templateVariables map[string]apiextensionsv1.JSON, variableName string) (*apiextensionsv1.JSON, bool, error)

GetVariable get the variable value.

func WalkTemplates

WalkTemplates walks through all templates of a GeneratePatchesRequest and calls the mutateFunc. By using walk templates it is possible to implement patches using typed API objects, which makes code easier to read and less error prone than using unstructured or working with raw json/yaml. Also, by using this func it is possible to ignore most of the details of the GeneratePatchesRequest and GeneratePatchesResponse messages format and focus on writing patches/modifying the templates.

Types

type FailForUnknownTypes

type FailForUnknownTypes struct{}

FailForUnknownTypes defines if WalkTemplates should fail when processing unknown types. If not set unknown types will be silently ignored, which allows to the WalkTemplates decoder to be configured only the API types it cares about.

func (FailForUnknownTypes) ApplyToWalkTemplates

func (f FailForUnknownTypes) ApplyToWalkTemplates(in *WalkTemplatesOptions)

ApplyToWalkTemplates applies this configuration to the given WalkTemplatesOptions.

type PatchFormat

type PatchFormat struct {
	Format runtimehooksv1.PatchType
}

PatchFormat defines the patch format that WalkTemplates should generate. If not set, JSONPatchType will be used.

func (PatchFormat) ApplyToWalkTemplates

func (d PatchFormat) ApplyToWalkTemplates(in *WalkTemplatesOptions)

ApplyToWalkTemplates applies this configuration to the given WalkTemplatesOptions.

type WalkTemplatesOption

type WalkTemplatesOption interface {
	// ApplyToWalkTemplates applies this configuration to the given WalkTemplatesOptions.
	ApplyToWalkTemplates(*WalkTemplatesOptions)
}

WalkTemplatesOption is some configuration that modifies WalkTemplates behavior.

type WalkTemplatesOptions

type WalkTemplatesOptions struct {
	// contains filtered or unexported fields
}

WalkTemplatesOptions contains options for WalkTemplates behavior.

Jump to

Keyboard shortcuts

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