kuberesource

package
v0.0.0-...-c4d1043 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InstallOrder = []string{
	"Namespace",
	"NetworkPolicy",
	"ResourceQuota",
	"LimitRange",
	"PodSecurityPolicy",
	"PodDisruptionBudget",
	"Secret",
	"ConfigMap",
	"StorageClass",
	"PersistentVolume",
	"PersistentVolumeClaim",
	"ServiceAccount",
	"CustomResourceDefinition",
	"ClusterRole",
	"ClusterRoleList",
	"ClusterRoleBinding",
	"ClusterRoleBindingList",
	"Role",
	"RoleList",
	"RoleBinding",
	"RoleBindingList",
	"Service",
	"DaemonSet",
	"Pod",
	"ReplicationController",
	"ReplicaSet",
	"Deployment",
	"HorizontalPodAutoscaler",
	"StatefulSet",
	"Job",
	"CronJob",
	"Ingress",
	"APIService",
}

InstallOrder is the order in which manifests should be installed (by Kind).

Those occurring earlier in the list get installed before those occurring later in the list.

Functions

func ConvertToUnstructured

func ConvertToUnstructured(obj runtime.Object) (*unstructured.Unstructured, error)

func ConvertUnstructured

func ConvertUnstructured(res *unstructured.Unstructured) (runtime.Object, error)

func GetPatch

func GetPatch(obj1, obj2 *unstructured.Unstructured) ([]byte, error)

func Match

func Match(ctx context.Context, obj1, obj2 *unstructured.Unstructured) bool

returns true if there is a difference between the objects, after having zeroed out note that this function updates the object for writing, which is fine as it zeroes out statuses and generated fields

func Patch

func Patch(obj *unstructured.Unstructured, patchJson []byte) error

Types

type ClusterResourceFetcher

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

type FilterResource

type FilterResource func(schema.GroupVersionResource) bool

type ResourceKey

type ResourceKey struct {
	Gvk             schema.GroupVersionKind
	Namespace, Name string
}

func (ResourceKey) String

func (k ResourceKey) String() string

type UnstructuredResources

type UnstructuredResources []*unstructured.Unstructured

func GetClusterResources

func GetClusterResources(ctx context.Context, cfg *rest.Config, filterFuncs ...FilterResource) (UnstructuredResources, error)

Use to get all CRUD'able resources for a cluster Returns a list of UnstructuredResources which are a wrapper for the map[string]interface{} type created from Kubernetes-style JSON objects.

Warning: slow function, be sure to call asynchronously. Filter funcs can be passed to reduce the latency of this function, i.e.: by excluding resource types (each resource type gets its own query, contributing to latency of this function).

func (UnstructuredResources) ByKey

func (UnstructuredResources) Filter

func (urs UnstructuredResources) Filter(filter func(resource *unstructured.Unstructured) bool) UnstructuredResources

func (UnstructuredResources) GroupedByGVK

func (urs UnstructuredResources) GroupedByGVK() []VersionedResources

func (UnstructuredResources) Sort

func (UnstructuredResources) WithLabels

func (urs UnstructuredResources) WithLabels(targetLabels map[string]string) UnstructuredResources

type UnstructuredResourcesByKey

type UnstructuredResourcesByKey map[ResourceKey]*unstructured.Unstructured

func (UnstructuredResourcesByKey) List

type VersionedResources

type VersionedResources struct {
	GVK       schema.GroupVersionKind
	Resources UnstructuredResources
}

Jump to

Keyboard shortcuts

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