kubernetes

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateResource added in v0.8.0

func CreateResource(ctx context.Context, c client.Client, obj *unstructured.Unstructured) error

CreateResource creates the resource in the kubernetes cluster

func DeleteResource added in v0.8.0

func DeleteResource(ctx context.Context, c client.Client, obj *unstructured.Unstructured) error

DeleteResource deletes the resource from the kubernetes cluster

func GetLabel added in v0.2.0

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

GetLabel returns the label identified by "key"

func GetLiveResource added in v0.8.0

func GetLiveResource(
	ctx context.Context,
	object *unstructured.Unstructured,
	pluralName string,
) (*unstructured.Unstructured, error)

GetLiveResource converts the generic object to unstructured object and fetches the resource from the API server

func GetResource

GetResource retrieves the resource from the informer cache, if it's not found then it fetches from the API server.

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 ListLiveResource added in v0.8.0

func ListLiveResource(
	ctx context.Context,
	apiGroup string,
	version string,
	pluralName string,
	namespace string,
	labelSelector string,
	fieldSelector string,
) (*unstructured.UnstructuredList, error)

func ListResources added in v0.8.0

ListResources retrieves the list of resources from the informer cache, if it's not found then it fetches from the API server.

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 PatchResource added in v0.8.0

func PatchResource(
	ctx context.Context,
	c client.Client,
	obj *unstructured.Unstructured,
	patch string,
	patchType k8stypes.PatchType,
) error

func SetDynamicClient added in v0.8.0

func SetDynamicClient(restConfig *rest.Config) 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 UpdateResource added in v0.8.0

func UpdateResource(ctx context.Context, c client.Client, obj *unstructured.Unstructured) error

UpdateResource updates the resource in the kubernetes cluster

Types

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 *unstructured.Unstructured) (GenericStatus, error)

Jump to

Keyboard shortcuts

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