kubernetes

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyCRSpec

func ApplyCRSpec(ctx context.Context, restConfig *rest.Config, object *GenericObject, pluralName string) error

ApplyCRSpec either creates or updates an object identified by the RawExtension, using the new definition, first checking to see if there's a difference in Spec before applying TODO: use CreateCR and UpdateCR instead

func CreateCR

func CreateCR(
	ctx context.Context,
	restConfig *rest.Config,
	object *GenericObject,
	pluralName string,
) error

func GetLabel added in v0.2.0

func GetLabel(un *unstructured.Unstructured, key string) (string, error)

GetLabel returns the label identified by "key"

func GetResource

func GetResource(
	ctx context.Context,
	restConfig *rest.Config,
	object *GenericObject,
	pluralName string,
) (*unstructured.Unstructured, error)

func GetSecret

func GetSecret(ctx context.Context, client k8sClient.Client, namespace, secretName string) (*corev1.Secret, error)

GetSecret gets secret using the kubernetes client

func IsValidKubernetesManifestFile

func IsValidKubernetesManifestFile(fileName string) bool

func IsValidKubernetesNamespace

func IsValidKubernetesNamespace(name string) bool

func NewKubectl

func NewKubectl() kube.Kubectl

func NewPodDisruptionBudget added in v0.2.0

func NewPodDisruptionBudget(name, namespace string, maxUnavailable int32, ownerReference []metav1.OwnerReference) *policyv1.PodDisruptionBudget

func ObjectToUnstructured

func ObjectToUnstructured(object *GenericObject) (*unstructured.Unstructured, error)

func SetLabel added in v0.2.0

func SetLabel(target *unstructured.Unstructured, key, val string) error

SetLabel sets the label identified by "key" on an unstructured object

func StartConfigMapWatcher

func StartConfigMapWatcher(ctx context.Context, config *rest.Config) error

StartConfigMapWatcher will start a watcher for configmaps with the given label key and value

func UpdateStatus added in v0.2.0

func UpdateStatus(ctx context.Context, restConfig *rest.Config, object *GenericObject, pluralName string) error

Types

type GenericObject

type GenericObject struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   runtime.RawExtension `json:"spec"`
	Status runtime.RawExtension `json:"status,omitempty"`
}

func GetCR

func GetCR(ctx context.Context, restConfig *rest.Config, object *GenericObject, pluralName string) (*GenericObject, error)

look up a Resource

func UnstructuredToObject

func UnstructuredToObject(u *unstructured.Unstructured) (*GenericObject, error)

type GenericStatus

type GenericStatus struct {
	Phase              string             `json:"phase,omitempty"`
	Conditions         []metav1.Condition `json:"conditions,omitempty"`
	ObservedGeneration int64              `json:"observedGeneration,omitempty"`
}

func ParseStatus

func ParseStatus(obj *GenericObject) (GenericStatus, error)

Jump to

Keyboard shortcuts

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