kubernetes

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCR

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

func CreateUnstructuredCR added in v0.4.0

func CreateUnstructuredCR(
	ctx context.Context,
	restConfig *rest.Config,
	unstruc *unstructured.Unstructured,
	gvr schema.GroupVersionResource,
	namespace string,
	name 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 GetSecret

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

GetSecret gets secret using the kubernetes client

func GetUnstructuredCR added in v0.4.0

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

func IsValidKubernetesManifestFile

func IsValidKubernetesManifestFile(fileName string) bool

func IsValidKubernetesNamespace

func IsValidKubernetesNamespace(name string) bool

func ListUnstructuredCR added in v0.4.0

func ListUnstructuredCR(
	ctx context.Context,
	restConfig *rest.Config,
	apiGroup string,
	version string,
	pluralName string,
	namespace string,
	labelSelector string,
	fieldSelector string,
) (*unstructured.UnstructuredList, error)

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 UpdateCR added in v0.4.0

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

update the CR in Kubernetes, and if successful, set the GenericObject to point to the result (i.e. goal is to have the right resourceVersion)

func UpdateUnstructuredCR added in v0.4.0

func UpdateUnstructuredCR(
	ctx context.Context,
	restConfig *rest.Config,
	unstruc *unstructured.Unstructured,
	gvr schema.GroupVersionResource,
	namespace string,
	name string,
) error

update the CR in Kubernetes, and if successful, set the unstruc to point to the result (i.e. goal is to have the right resourceVersion)

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 ListCR added in v0.4.0

func ListCR(ctx context.Context,
	restConfig *rest.Config,
	apiGroup string,
	version string,
	pluralName string,
	namespace string,

	labelSelector string,

	fieldSelector string) ([]*GenericObject, error)

func UnstructuredToObject

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

func (*GenericObject) DeepCopy added in v0.4.0

func (obj *GenericObject) DeepCopy() *GenericObject

func (*GenericObject) DeepCopyObject added in v0.4.0

func (obj *GenericObject) DeepCopyObject() runtime.Object

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