utils

package
v1.23.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyResource

func ApplyResource(ctx context.Context, cli client.Client, obj client.Object, options ApplyOptions) error

func ConvertToTyped

func ConvertToTyped(uns []*unstructured.Unstructured) []runtime.Object

func CorrectNamespaces

func CorrectNamespaces[T client.Object](cli client.Client, defaultNamespace string, list []T)

func CorrectNamespacesForRefrences

func CorrectNamespacesForRefrences(cli client.Client, defaultns string, list []corev1.ObjectReference)

func EqualMapValues

func EqualMapValues(a, b map[string]interface{}) bool

func GetReference added in v1.23.8

func GetReference(obj client.Object) corev1.ObjectReference

func IsCRD

func IsCRD(obj client.Object) bool

func IsSkipedOn

func IsSkipedOn(obj client.Object, key string) bool

func NamespacedScopeOf

func NamespacedScopeOf(cli client.Client, obj runtime.Object) (apimeta.RESTScopeName, error)

func NamespacedScopeOfGVK

func NamespacedScopeOfGVK(cli client.Client, gvk schema.GroupVersionKind) (apimeta.RESTScopeName, error)

func ReadObjectsFromFile

func ReadObjectsFromFile[T runtime.Object](path string) ([]T, error)

func SplitYAML

func SplitYAML(data []byte) ([]*unstructured.Unstructured, error)

func SplitYAMLFilterd

func SplitYAMLFilterd[T runtime.Object](raw io.Reader) ([]T, error)

SplitYAMLFilterd reurns objects has type of `t`

Types

type Apply

type Apply struct {
	Client client.Client
}

func (*Apply) Sync

func (a *Apply) Sync(ctx context.Context,
	defaultnamespace string,
	managed []corev1.ObjectReference,
	resources []*unstructured.Unstructured,
	options *SyncOptions,
) ([]corev1.ObjectReference, error)

func (*Apply) SyncDiff

func (a *Apply) SyncDiff(ctx context.Context, diff DiffResult, options *SyncOptions) ([]corev1.ObjectReference, error)

type ApplyOptions

type ApplyOptions struct {
	ServerSideApply bool
	FieldOwner      string
}

type DiffResult

type DiffResult struct {
	Creats  []*unstructured.Unstructured
	Applys  []*unstructured.Unstructured
	Removes []*unstructured.Unstructured
}

func Diff

func Diff(managed []corev1.ObjectReference, resources []*unstructured.Unstructured) DiffResult

func DiffWithDefaultNamespace

func DiffWithDefaultNamespace(
	cli client.Client,
	defaultnamespace string,
	managed []corev1.ObjectReference,
	resources []*unstructured.Unstructured,
) DiffResult

type SyncOptions

type SyncOptions struct {
	ServerSideApply bool
	CreateNamespace bool
	CleanCRD        bool
}

func NewDefaultSyncOptions

func NewDefaultSyncOptions() *SyncOptions

Jump to

Keyboard shortcuts

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