utils

package
v0.1.20-experimental-l... Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFolder

func CreateFolder(path string, override bool) error

Create folder (clear its content if it exists)

func GetKubeConfigPath added in v0.1.8

func GetKubeConfigPath() (string, bool)

GetKubeConfigPath returns the path to the kubeconfig file and a boolean indicating if the file exists

func SplitYAMLDocuments added in v0.1.20

func SplitYAMLDocuments(manifest string) []string

func UniqueId added in v0.1.13

func UniqueId() string

func UniqueNumber added in v0.1.13

func UniqueNumber() uint64

func WriteFile

func WriteFile(path string, content string) error

WriteFile writes content to a file

Types

type K8sClient added in v0.1.4

type K8sClient struct {
	// contains filtered or unexported fields
}

func NewK8sClient added in v0.1.4

func NewK8sClient() (*K8sClient, error)

func (*K8sClient) ApplyManifest added in v0.1.8

func (c *K8sClient) ApplyManifest(obj *unstructured.Unstructured, source string, fallbackNamespace string) error

Helper function to apply a single manifest from an unstructured object

func (*K8sClient) ApplyManifestFromFile added in v0.1.4

func (c *K8sClient) ApplyManifestFromFile(path string, fallbackNamespace string) (int, error)

ApplyManifestFromFile applies a Kubernetes manifest from a file

func (*K8sClient) ApplyManifestFromString added in v0.1.4

func (c *K8sClient) ApplyManifestFromString(manifest string, fallbackNamespace string) (int, error)

func (*K8sClient) CheckIfResourceExists added in v0.1.7

func (c *K8sClient) CheckIfResourceExists(gvr schema.GroupVersionResource, namespace string, name string) (bool, error)

func (*K8sClient) CreateNamespace added in v0.1.4

func (c *K8sClient) CreateNamespace(namespace string) (bool, error)

create namespace. Returns true if the namespace was created, false if it already existed.

func (*K8sClient) DeleteAllApplicationsOlderThan added in v0.1.11

func (c *K8sClient) DeleteAllApplicationsOlderThan(namespace string, minutes int) error

DeleteAllApplicationsOlderThan deletes all ArgoCD applications older than a given number of minutes and matching the given label key

func (*K8sClient) DeleteArgoCDApplication added in v0.1.11

func (c *K8sClient) DeleteArgoCDApplication(namespace string, name string) error

DeleteArgoCDApplication deletes a single ArgoCD application by name

func (*K8sClient) DeleteArgoCDApplications added in v0.1.4

func (c *K8sClient) DeleteArgoCDApplications(namespace string) error

func (*K8sClient) GetArgoCDApplication added in v0.1.8

func (c *K8sClient) GetArgoCDApplication(namespace string, name string) (string, error)

GetArgoCDApplication gets a single ArgoCD application by name

func (*K8sClient) GetArgoCDApplications added in v0.1.4

func (c *K8sClient) GetArgoCDApplications(namespace string) (string, error)

func (*K8sClient) GetConfig

func (c *K8sClient) GetConfig() *rest.Config

GetConfig returns the rest.Config used by the client

func (*K8sClient) GetConfigMaps added in v0.1.4

func (c *K8sClient) GetConfigMaps(namespace string, names ...string) (string, error)

func (*K8sClient) GetSecretValue added in v0.1.4

func (c *K8sClient) GetSecretValue(namespace string, name string, key string) (string, error)

get secret value from key. e.g. key: "password"

func (*K8sClient) GetServiceNameByLabel

func (c *K8sClient) GetServiceNameByLabel(namespace, labelSelector string) (string, error)

GetServiceNameByLabel finds a service in the namespace with the specified label selector Returns the name of the first matching service, or an error if no service is found

func (*K8sClient) PortForwardToPod

func (c *K8sClient) PortForwardToPod(namespace, podName string, localPort, remotePort int, readyChan chan struct{}, stopChan chan struct{}) error

PortForwardToPod sets up a port forward to a pod in the specified namespace Returns a channel that will be closed when the port forward is ready, a stop channel to terminate the forward, and an error if the setup fails

func (*K8sClient) PortForwardToService

func (c *K8sClient) PortForwardToService(namespace, serviceName string, localPort, remotePort int, readyChan chan struct{}, stopChan chan struct{}) error

PortForwardToService sets up a port forward to a service by finding a pod for that service Returns a channel that will be closed when the port forward is ready, a stop channel to terminate the forward, and an error if the setup fails

func (*K8sClient) RemoveObstructiveFinalizers added in v0.1.4

func (c *K8sClient) RemoveObstructiveFinalizers(namespace string) error

RemoveObstructiveFinalizers removes finalizers from applications that would prevent deletion

func (*K8sClient) WaitForDeploymentReady added in v0.1.4

func (c *K8sClient) WaitForDeploymentReady(namespace, name string, timeoutSeconds int) error

WaitForDeploymentReady waits for a deployment to be available Looks for deployments with label app.kubernetes.io/name={name}

Jump to

Keyboard shortcuts

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