Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRunningInCluster ¶
func IsRunningInCluster() bool
IsRunningInCluster returns true if the application is running inside a Kubernetes cluster.
Types ¶
type Client ¶
type Client interface {
// GetClientset returns the underlying kubernetes.Interface.
GetClientset() kubernetes.Interface
// GetDynamicClient returns the dynamic client for unstructured resources.
GetDynamicClient() dynamic.Interface
// GetDiscoveryClient returns the discovery client for API discovery.
GetDiscoveryClient() discovery.DiscoveryInterface
// GetSecret retrieves a secret by name from the specified namespace.
GetSecret(ctx context.Context, namespace, name string) (*corev1.Secret, error)
// CreateSecret creates a new secret in the specified namespace.
CreateSecret(ctx context.Context, namespace string, secret *corev1.Secret) (*corev1.Secret, error)
// UpdateSecret updates an existing secret.
UpdateSecret(ctx context.Context, namespace string, secret *corev1.Secret) (*corev1.Secret, error)
// ListResources lists resources of a given type.
ListResources(ctx context.Context, gvr schema.GroupVersionResource, namespace string) (*unstructured.UnstructuredList, error)
// WatchResources watches for changes to resources of a given type.
WatchResources(ctx context.Context, gvr schema.GroupVersionResource, namespace string, resourceVersion string) (watch.Interface, error)
}
Client abstracts Kubernetes API operations.
func NewClient ¶
NewClient creates a new Client that uses real K8s APIs. It supports both in-cluster and out-of-cluster (kubeconfig) execution.
func NewClientFromClients ¶
func NewClientFromClients(clientset kubernetes.Interface, dynamicClient dynamic.Interface) Client
NewClientFromClients creates a Client from existing clients.
Click to show internal directories.
Click to hide internal directories.