resourcemodifiers

package
v1.12.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigmapRefType                   = "configmap"
	ResourceModifierSupportedVersionV1 = "v1"
)

Variables

This section is empty.

Functions

func ApplyPatch

func ApplyPatch(patch []byte, obj *unstructured.Unstructured, log logrus.FieldLogger) error

Types

type Conditions

type Conditions struct {
	Namespaces        []string `yaml:"namespaces,omitempty"`
	GroupKind         string   `yaml:"groupKind"`
	ResourceNameRegex string   `yaml:"resourceNameRegex"`
}

func (*Conditions) Validate

func (c *Conditions) Validate() error

type JSONPatch

type JSONPatch struct {
	Operation string `yaml:"operation"`
	From      string `yaml:"from,omitempty"`
	Path      string `yaml:"path"`
	Value     string `yaml:"value,omitempty"`
}

func (*JSONPatch) ToString

func (p *JSONPatch) ToString() string

func (*JSONPatch) Validate

func (p *JSONPatch) Validate() error

type ResourceModifierRule

type ResourceModifierRule struct {
	Conditions Conditions  `yaml:"conditions"`
	Patches    []JSONPatch `yaml:"patches"`
}

func (*ResourceModifierRule) Apply

func (r *ResourceModifierRule) Apply(obj *unstructured.Unstructured, groupResource string, log logrus.FieldLogger) error

func (*ResourceModifierRule) PatchArrayToByteArray

func (r *ResourceModifierRule) PatchArrayToByteArray() ([]byte, error)

convert all JsonPatch to string array with the format of jsonpatch.Patch and then convert it to byte array

func (*ResourceModifierRule) Validate

func (r *ResourceModifierRule) Validate() error

type ResourceModifiers

type ResourceModifiers struct {
	Version               string                 `yaml:"version"`
	ResourceModifierRules []ResourceModifierRule `yaml:"resourceModifierRules"`
}

func GetResourceModifiersFromConfig

func GetResourceModifiersFromConfig(cm *v1.ConfigMap) (*ResourceModifiers, error)

func (*ResourceModifiers) ApplyResourceModifierRules

func (p *ResourceModifiers) ApplyResourceModifierRules(obj *unstructured.Unstructured, groupResource string, log logrus.FieldLogger) []error

func (*ResourceModifiers) Validate

func (p *ResourceModifiers) Validate() error

Jump to

Keyboard shortcuts

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