Documentation ¶
Index ¶
- func ConnectToCluster(kubeconfig string) (*kubernetes.Clientset, *rest.Config, error)
- func ForceDeleteOldResource(restConfig *rest.Config, ns string, resource schema.GroupVersionResource, ...) error
- func GetAPIVersionForResource(clientset ClientsetInterface, resource schema.GroupVersionResource) (string, error)
- func GetNamespaceObjects(restConfig *rest.Config, ns string, resource schema.GroupVersionResource) ([]string, error)
- func GetNamespacedObjects(clientset ClientsetInterface) ([]schema.GroupVersionResource, error)
- func GetNamespaces(clientset ClientsetInterface) ([]string, error)
- func IsObjectDeleted(restConfig *rest.Config, ns string, resource schema.GroupVersionResource, ...) (bool, time.Time, error)
- func ShouldIgnoreGroup(groupVersion string) bool
- func VerifyAccessToCluster(clientset ClientsetInterface) error
- type ClientsetInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectToCluster ¶
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 ¶
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.