Documentation ¶
Overview ¶
Copyright (C) 2021-2023, Kubefirst
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Index ¶
- func CheckForExistingPortForwards(ports ...int) error
- func CreateSecretV2(clientset kubernetes.Interface, secret *v1.Secret) error
- func DeleteSecretV2(clientset kubernetes.Interface, namespace string, secretName string) error
- func GetClientConfig(kubeconfigPath string) (*rest.Config, error)
- func GetClientSet(kubeconfigPath string) (*kubernetes.Clientset, error)
- func GetSecretValue(k8sClient coreV1Types.SecretInterface, secretName, key string) string
- func OpenPortForwardPodWrapper(clientset kubernetes.Interface, restConfig *rest.Config, podName string, ...) error
- func PortForwardPod(clientset kubernetes.Interface, req PortForwardAPodRequest) error
- func PortForwardPodWithRetry(clientset kubernetes.Interface, req PortForwardAPodRequest) error
- func ReadConfigMapV2(kubeConfigPath, namespace, configMapName string) (map[string]string, error)
- func ReadSecretV2(clientset kubernetes.Interface, namespace, secretName string) (map[string]string, error)
- func ReadSecretV2Old(clientset kubernetes.Interface, namespace string, secretName string) (map[string]interface{}, error)
- func ReadService(kubeConfigPath, namespace, serviceName string) (*v1.Service, error)
- func ReturnDeploymentObject(client kubernetes.Interface, matchLabel string, matchLabelValue string, ...) (*appsv1.Deployment, error)
- func ReturnJobObject(clientset kubernetes.Interface, namespace, jobName string) (*batchv1.Job, error)
- func ReturnPodObject(kubeConfigPath, matchLabel, matchLabelValue, namespace string, ...) (*v1.Pod, error)
- func ReturnStatefulSetObject(clientset kubernetes.Interface, matchLabel, matchLabelValue, namespace string, ...) (*appsv1.StatefulSet, error)
- func UpdateSecretV2(clientset kubernetes.Interface, namespace string, secretName string, ...) error
- func VerifyArgoCDReadiness(clientset kubernetes.Interface, highAvailabilityEnabled bool, ...) (bool, error)
- func WaitForDeploymentReady(clientset kubernetes.Interface, deployment *appsv1.Deployment, ...) (bool, error)
- func WaitForJobComplete(clientset kubernetes.Interface, jobName, jobNamespace string, ...) (bool, error)
- func WaitForNamespaceandPods(kubeconfigPath, kubectlClientPath, namespace, podLabel string)
- func WaitForPodReady(clientset kubernetes.Interface, pod *v1.Pod, timeoutSeconds int) (bool, error)
- func WaitForStatefulSetReady(clientset kubernetes.Interface, statefulset *appsv1.StatefulSet, ...) (bool, error)
- type KubernetesClient
- func (kcl KubernetesClient) ApplyObjects(yamlData [][]byte) error
- func (kcl KubernetesClient) KustomizeBuild(kustomizationDirectory string) (*bytes.Buffer, error)
- func (kcl KubernetesClient) ReadYAMLFile(filepath string) (string, error)
- func (kcl KubernetesClient) SplitYAMLFile(yamlData *bytes.Buffer) ([][]byte, error)
- type PatchJSON
- type PodSessionOptions
- type PortForwardAPodRequest
- type PortForwardAServiceRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckForExistingPortForwards ¶
CheckForExistingPortForwards determines whether or not port forwards are already running
func CreateSecretV2 ¶
func CreateSecretV2(clientset kubernetes.Interface, secret *v1.Secret) error
CreateSecretV2 creates a Kubernetes Secret
func DeleteSecretV2 ¶
func DeleteSecretV2(clientset kubernetes.Interface, namespace string, secretName string) error
DeleteSecretV2 reads the content of a Kubernetes Secret
func GetClientConfig ¶
GetClientConfig returns a rest.Config object for working with the Kubernetes API
func GetClientSet ¶
func GetClientSet(kubeconfigPath string) (*kubernetes.Clientset, error)
GetClientSet - Get reference to k8s credentials to use APIS
func GetSecretValue ¶
func GetSecretValue(k8sClient coreV1Types.SecretInterface, secretName, key string) string
func PortForwardPod ¶
func PortForwardPod(clientset kubernetes.Interface, req PortForwardAPodRequest) error
PortForwardPod receives a PortForwardAPodRequest, and enables port forwarding for the specified resource. If the provided Pod name matches a running Pod, it will try to port forward for that Pod on the specified port.
func PortForwardPodWithRetry ¶
func PortForwardPodWithRetry(clientset kubernetes.Interface, req PortForwardAPodRequest) error
func ReadConfigMapV2 ¶
ReadConfigMapV2 reads the content of a Kubernetes ConfigMap
func ReadSecretV2 ¶
func ReadSecretV2(clientset kubernetes.Interface, namespace, secretName string) (map[string]string, error)
ReadSecretV2 reads the content of a Kubernetes Secret
func ReadSecretV2Old ¶
func ReadSecretV2Old(clientset kubernetes.Interface, namespace string, secretName string) (map[string]interface{}, error)
ReadSecretV2 reads the content of a Kubernetes Secret
func ReadService ¶
ReadService reads a Kubernetes Service object
func ReturnDeploymentObject ¶
func ReturnDeploymentObject(client kubernetes.Interface, matchLabel string, matchLabelValue string, namespace string, timeoutSeconds int) (*appsv1.Deployment, error)
func ReturnJobObject ¶
func ReturnJobObject(clientset kubernetes.Interface, namespace, jobName string) (*batchv1.Job, error)
ReturnJobObject returns a matching appsv1.StatefulSet object based on the filters
func ReturnPodObject ¶
func ReturnPodObject(kubeConfigPath, matchLabel, matchLabelValue, namespace string, timeoutSeconds int) (*v1.Pod, error)
ReturnPodObject returns a matching v1.Pod object based on the filters
func ReturnStatefulSetObject ¶
func ReturnStatefulSetObject(clientset kubernetes.Interface, matchLabel, matchLabelValue, namespace string, timeoutSeconds int) (*appsv1.StatefulSet, error)
ReturnStatefulSetObject returns a matching appsv1.StatefulSet object based on the filters
func UpdateSecretV2 ¶
func UpdateSecretV2(clientset kubernetes.Interface, namespace string, secretName string, secretValues map[string][]byte) error
UpdateSecretV2 updates the key value pairs of a Kubernetes Secret
func VerifyArgoCDReadiness ¶
func VerifyArgoCDReadiness(clientset kubernetes.Interface, highAvailabilityEnabled bool, timeoutSeconds int) (bool, error)
VerifyArgoCDReadiness waits for critical resources within ArgoCD to be ready and only returns once they're all healthy
This helps prevent race conditions and timeouts
func WaitForDeploymentReady ¶
func WaitForDeploymentReady(clientset kubernetes.Interface, deployment *appsv1.Deployment, timeoutSeconds int) (bool, error)
WaitForDeploymentReady waits for a target Deployment to become ready
func WaitForJobComplete ¶
func WaitForJobComplete(clientset kubernetes.Interface, jobName, jobNamespace string, timeoutSeconds int64) (bool, error)
WaitForJobComplete waits for a target Job to reach completion
func WaitForNamespaceandPods ¶
func WaitForNamespaceandPods(kubeconfigPath, kubectlClientPath, namespace, podLabel string)
func WaitForPodReady ¶
WaitForPodReady waits for a target Pod to become ready
func WaitForStatefulSetReady ¶
func WaitForStatefulSetReady(clientset kubernetes.Interface, statefulset *appsv1.StatefulSet, timeoutSeconds int, ignoreReady bool) (bool, error)
WaitForStatefulSetReady waits for a target StatefulSet to become ready
Types ¶
type KubernetesClient ¶
type KubernetesClient struct { Clientset kubernetes.Interface RestConfig *rest.Config KubeConfigPath string }
func CreateKubeConfig ¶
func CreateKubeConfig(inCluster bool, kubeConfigPath string) (*KubernetesClient, error)
CreateKubeConfig returns a struct KubernetesClient with references to a clientset, restConfig, and path to the Kubernetes config used to generate the client
func (KubernetesClient) ApplyObjects ¶
func (kcl KubernetesClient) ApplyObjects(yamlData [][]byte) error
ApplyObjects parses a structured Kubernetes-compatible yaml file and applies its objects to a target Kubernetes cluster
func (KubernetesClient) KustomizeBuild ¶
func (kcl KubernetesClient) KustomizeBuild(kustomizationDirectory string) (*bytes.Buffer, error)
KustomizeBuild parses a file path and returns manifests built via kustomization.yaml if present
kustomizationDirectory should be a directory containing a kustomization.yaml file and subsequent configuration
The return values is a string representation of parsed resources in yaml
func (KubernetesClient) ReadYAMLFile ¶
func (kcl KubernetesClient) ReadYAMLFile(filepath string) (string, error)
ReadYAMLFile reads a yaml file in the filesystem
func (KubernetesClient) SplitYAMLFile ¶
func (kcl KubernetesClient) SplitYAMLFile(yamlData *bytes.Buffer) ([][]byte, error)
SplitYAMLFile takes a separated (---) yaml doc and returns [][]byte
type PodSessionOptions ¶
type PodSessionOptions struct { Command []string Namespace string PodName string Stdin bool Stdout bool Stderr bool TtyEnabled bool }
podSessionOptions provides a struct to assign parameters to an exec session
type PortForwardAPodRequest ¶
type PortForwardAPodRequest struct { // RestConfig is the kubernetes config RestConfig *rest.Config // Pod is the selected pod for this port forwarding Pod v1.Pod // LocalPort is the local port that will be selected to expose the PodPort LocalPort int // PodPort is the target port for the pod PodPort int // StopCh is the channel used to manage the port forward lifecycle StopCh <-chan struct{} // ReadyCh communicates when the tunnel is ready to receive traffic ReadyCh chan struct{} }
type PortForwardAServiceRequest ¶
type PortForwardAServiceRequest struct { // RestConfig is the kubernetes config RestConfig *rest.Config // Service is the selected service for this port forwarding Service v1.Service // LocalPort is the local port that will be selected to expose the ServicePort LocalPort int // ServicePort is the target port for the service ServicePort int // StopCh is the channel used to manage the port forward lifecycle StopCh <-chan struct{} // ReadyCh communicates when the tunnel is ready to receive traffic ReadyCh chan struct{} }