k8s

package
v0.0.0-...-1d6c69d Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToCluster

func ConnectToCluster(kubeconfig string) (*kubernetes.Clientset, *rest.Config, error)

ConnectToCluster connects to the Kubernetes cluster using the provided kubeconfig file. If the environment variables KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT are set, it assumes the application is running inside a Kubernetes cluster and uses the in-cluster config.

func ForceDeleteOldResource

func ForceDeleteOldResource(restConfig *rest.Config, ns string, resource schema.GroupVersionResource, name string) error

ForceDeleteOldResource forcefully deletes a specific resource that has been in the deletion state for more than DeleteAfter hours.

func GetAPIVersionForResource

func GetAPIVersionForResource(clientset ClientsetInterface, resource schema.GroupVersionResource) (string, error)

GetAPIVersionForResource retrieves the API version for a given resource.

func GetNamespaceObjects

func GetNamespaceObjects(restConfig *rest.Config, ns string, resource schema.GroupVersionResource) ([]string, error)

GetNamespaceObjects retrieves the objects in a namespace for a given resource.

func GetNamespacedObjects

func GetNamespacedObjects(clientset ClientsetInterface) ([]schema.GroupVersionResource, error)

GetNamespacedObjects retrieves the list of namespaced objects available in the cluster.

func GetNamespaces

func GetNamespaces(clientset ClientsetInterface) ([]string, error)

GetNamespaces retrieves the list of namespaces in the Kubernetes cluster.

func IsObjectDeleted

func IsObjectDeleted(restConfig *rest.Config, ns string, resource schema.GroupVersionResource, name string) (bool, time.Time, error)

IsObjectDeleted checks if an object is marked for deletion and returns the deletion timestamp if it exists.

func ShouldIgnoreGroup

func ShouldIgnoreGroup(groupVersion string) bool

ShouldIgnoreGroup determines if a group should be ignored during discovery.

func VerifyAccessToCluster

func VerifyAccessToCluster(clientset ClientsetInterface) error

VerifyAccessToCluster verifies if the application has access to the Kubernetes cluster by attempting to list the nodes in the cluster.

Types

type ClientsetInterface

type ClientsetInterface interface {
	CoreV1() v1.CoreV1Interface
	Discovery() discovery.DiscoveryInterface
}

ClientsetInterface defines the interface for Kubernetes clientsets.

Jump to

Keyboard shortcuts

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