kubernetes

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 27 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, shouldUpdateCR bool) 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 ApplyOwnership

func ApplyOwnership(manifest string, controllerRollout *v1alpha1.NumaflowControllerRollout) ([]byte, error)

func CreateCR

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

func GetNumaplaneInstanceLabel

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

GetNumaplaneInstanceLabel returns the application instance name from label

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 ObjectToUnstructured

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

func SetAnnotation

func SetAnnotation(obj metav1.Object, key, value string)

func SetNumaplaneInstanceLabel

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

SetNumaplaneInstanceLabel sets the recommended app.kubernetes.io/instance label against 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

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"`
}

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