rewriter

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition func(*unstructured.Unstructured) bool

Condition is function that returns bool with condition match result.

func MatchGVK

func MatchGVK(gvk schema.GroupVersionKind) Condition

MatchGVK checks if resource matches given GroupVersionKind.

type ResourceRewriter

type ResourceRewriter interface {
	// BeforeImport is invoked when object is created in API server.
	BeforeImport(u *unstructured.Unstructured) error

	// BeforeServing is applied when object passes proxy (via List or Get request).
	BeforeServing(u *unstructured.Unstructured) error
}

ResourceRewriter prepares object for saving on import and rewrites the object before its returned back from proxy server.

func Default

func Default() ResourceRewriter

Default provides a rewriter that covers most cases of required changes for successful import and serving of a diagnostics bundle.

func DeletedNamespace

func DeletedNamespace() ResourceRewriter

DeletedNamespace changes `.status.phase` for namespaces that were being deleted from `Terminating` to `Active` on import so that NS can get imported to API server. See: https://github.com/mhrabovcin/troubleshoot-live/issues/1

func GeneratedValues

func GeneratedValues() ResourceRewriter

GeneratedValues removes generated values. See: https://kubernetes.io/docs/reference/using-api/api-concepts/#generated-values

func Multi

func Multi(rewriters ...ResourceRewriter) ResourceRewriter

Multi executes serially multiple rewriters.

func RemoveField

func RemoveField(path ...string) ResourceRewriter

RemoveField removes a field from original object. This should be used for metadata fields that are generated by API server on write.

func When

func When(condition Condition, rewriter ResourceRewriter) ResourceRewriter

When executes provided rewriter only if condition matches.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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