patch

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApplier

func NewApplier(clusterConfig *rest.Config, namespace string) (*applier, error)

func NewResourcePatcher

func NewResourcePatcher(applier jsonPatchApplier) *resourcePatcher

NewResourcePatcher creates a new resource patcher.

Types

type JsonPatch

type JsonPatch struct {
	// Operation describes how a json object should be modified.
	Operation JsonPatchOperation `yaml:"op" json:"op"`
	// Path contains a JSON pointer to the value that should be modified.
	// If keys contain '/' or '~', those characters have to be replaced with '~1' and '~0' respectively.
	Path string `yaml:"path" json:"path"`
	// Value contains the value that should be inserted at the specified path.
	Value map[string]interface{} `yaml:"value,omitempty" json:"value,omitempty"`
}

JsonPatch describes a single operation on a kubernetes resource.

func (JsonPatch) Validate

func (j JsonPatch) Validate() error

Validate checks the JsonPatch for errors.

type JsonPatchOperation

type JsonPatchOperation string

JsonPatchOperation describes how a json object should be modified.

type Phase

type Phase string

Phase is a sequential step in the setup process.

const (
	// ComponentPhase is the step where components will be installed.
	ComponentPhase Phase = "component"
	// DoguPhase is the step where dogus will be installed.
	DoguPhase Phase = "dogu"
	// LoadbalancerPhase is the step where the external loadbalancer for the Cloudogu EcoSystem will be created.
	LoadbalancerPhase Phase = "loadbalancer"
)

type ResourcePatch

type ResourcePatch struct {
	// Phase is a sequential step in the setup process.
	Phase Phase `json:"phase" yaml:"phase"`
	// ResourceReference uniquely identifies a kubernetes resource that should be patched.
	Resource ResourceReference `json:"resource" yaml:"resource"`
	// Patches contains a series of operations to be applied on the specified kubernetes resource.
	Patches []JsonPatch `json:"patches" yaml:"patches"`
}

ResourcePatch contains json patches for kubernetes resources to be applied on a phase of the setup process. The patch is applied at the end of its Phase. For namespaced resources, the namespace of the setup is inferred.

func (*ResourcePatch) Validate

func (rp *ResourcePatch) Validate() error

type ResourceReference

type ResourceReference struct {
	// ApiVersion contains the group and version of the resource.
	ApiVersion string `json:"apiVersion" yaml:"apiVersion"`
	// Kind contains the resource type.
	Kind string `json:"kind" yaml:"kind"`
	// Name contains the name of the resource.
	Name string `json:"name" yaml:"name"`
}

ResourceReference uniquely identifies a kubernetes resource.

func (ResourceReference) GroupVersionKind

func (r ResourceReference) GroupVersionKind() schema.GroupVersionKind

Jump to

Keyboard shortcuts

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