k8s

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ManagedByLabelKey is Kubernetes recommended label key, it represents the tool being used to manage the operation of an application
	// For resources managed by SeaweedFS Operator, its value is always seaweedfs-operator
	ManagedByLabelKey string = "app.kubernetes.io/managed-by"
	// ComponentLabelKey is Kubernetes recommended label key, it represents the component within the architecture
	ComponentLabelKey string = "app.kubernetes.io/component"
	// NameLabelKey is Kubernetes recommended label key, it represents the name of the application
	NameLabelKey string = "app.kubernetes.io/name"
	// InstanceLabelKey is Kubernetes recommended label key, it represents a unique name identifying the instance of an application
	// It's set by helm when installing a release
	InstanceLabelKey string = "app.kubernetes.io/instance"
	// VersionLabelKey is Kubernetes recommended label key, it represents the version of the app
	VersionLabelKey    string = "app.kubernetes.io/version"
	VectorExcludeLabel string = "vector.dev/exclude"

	// PodName is to select pod by name
	// https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-selector
	PodName string = "statefulset.kubernetes.io/pod-name"
)

Variables

View Source
var (
	ErrNotSupported = errors.New("not Supported type for create or update kubernetes resource")
)

Functions

func CreateOrUpdateResource

func CreateOrUpdateResource(ctx context.Context, obj client.Object, c client.Client) error

func CreatePod

func CreatePod(ctx context.Context, pod *corev1.Pod, c client.Client) error

func DeletePod

func DeletePod(ctx context.Context, pod *corev1.Pod, c client.Client) error

func DeleteSecret

func DeleteSecret(ctx context.Context, secret *corev1.Secret, c client.Client) error

func FetchPod

func FetchPod(ctx context.Context, pod *corev1.Pod, c client.Client) (*corev1.Pod, error)

func GetPod

func GetPod(ctx context.Context, namespacedName types.NamespacedName, c client.Client) (*corev1.Pod, error)

func GetPodLogs

func GetPodLogs(ctx context.Context, pod *corev1.Pod, cs kubernetes.Interface) (string, error)

func GetSecret

func GetSecret(ctx context.Context, namespacedName types.NamespacedName, c client.Client) (*corev1.Secret, error)

func ListSecret

func ListSecret(ctx context.Context, c client.Client, listOpts client.ListOptions) ([]corev1.Secret, error)

func NamespaceNameToLabel

func NamespaceNameToLabel(namespace string) string

func NewNotSupportedError

func NewNotSupportedError(obj client.Object) error

func ResourceExists

func ResourceExists(dc discovery.DiscoveryInterface, apiGroupVersion, kind string) (bool, error)

ResourceExists returns true if the given resource kind exists in the given api groupversion

func UpdateStatus

func UpdateStatus(ctx context.Context, obj client.Object, c client.Client) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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