Documentation ¶
Index ¶
- Constants
- func CreateConfigmap(namespace, name string, labels map[string]string, data map[string][]byte) (*corev1.ConfigMap, error)
- func CreateNamespace(name string, namespace *corev1.Namespace) (*corev1.Namespace, error)
- func CreatePod(pod *corev1.Pod) (*corev1.Pod, error)
- func CreateSecret(secret *corev1.Secret) error
- func CreateService(service *corev1.Service) (*corev1.Service, error)
- func DeleteConfigMapsByLabel(namespace string, labels map[string]string) error
- func DeleteConfigmap(namespace, name string) error
- func DeletePod(namespace string, name string) error
- func DeleteSecret(secret *corev1.Secret) error
- func DeleteService(namespace, name string) error
- func DeleteZarfNamespace()
- func DetectDistro() (string, error)
- func GeneratePod(name, namespace string) *corev1.Pod
- func GenerateRegistryPullCreds(namespace, name string) *corev1.Secret
- func GenerateSecret(namespace, name string, secretType corev1.SecretType) *corev1.Secret
- func GenerateService(namespace, name string) *corev1.Service
- func GenerateTLSSecret(namespace, name string, conf types.GeneratedPKI) (*corev1.Secret, error)
- func GetAllPods() (*corev1.PodList, error)
- func GetAllServiceAccounts() (*corev1.ServiceAccountList, error)
- func GetArchitecture() (string, error)
- func GetAvailablePort() (int, error)
- func GetContext() (string, error)
- func GetNamespaces() (*corev1.NamespaceList, error)
- func GetNodes() (*corev1.NodeList, error)
- func GetPods(namespace string) (*corev1.PodList, error)
- func GetSecret(namespace, name string) (*corev1.Secret, error)
- func GetService(namespace, serviceName string) (*corev1.Service, error)
- func GetServiceAccount(namespace, name string) (*corev1.ServiceAccount, error)
- func GetServiceAccounts(namespace string) (*corev1.ServiceAccountList, error)
- func GetServicesByLabel(namespace, label, value string) (*corev1.ServiceList, error)
- func GetServicesByLabelExists(namespace, label string) (*corev1.ServiceList, error)
- func LoadZarfState() types.ZarfState
- func PrintConnectTable() error
- func ProcessYamlFilesInPath(path string, component types.ZarfComponent) []string
- func ReplaceConfigmap(namespace, name string, labels map[string]string, data map[string][]byte) (*corev1.ConfigMap, error)
- func ReplaceSecret(secret *corev1.Secret) error
- func ReplaceService(service *corev1.Service) (*corev1.Service, error)
- func ReplaceTLSSecret(namespace, name string, conf types.GeneratedPKI) error
- func SaveServiceAccount(svcAccount *corev1.ServiceAccount) (*corev1.ServiceAccount, error)
- func SaveZarfState(state types.ZarfState) error
- func SortImages(images, compareWith ImageMap) []string
- func SplitYAML(yamlData []byte) ([]*unstructured.Unstructured, error)
- func StripZarfLabelsAndSecretsFromNamespaces()
- func UpdateNamespace(namespace *corev1.Namespace) (*corev1.Namespace, error)
- func WaitForHealthyCluster(timeout time.Duration) error
- func WaitForPodsAndContainers(target types.ZarfContainerTarget, waitForAllPods bool) []string
- type DockerConfig
- type DockerConfigEntry
- type DockerConfigEntryWithAuth
- type ImageMap
- type ImageNodeMap
- type Tunnel
Constants ¶
const ( DistroIsUnknown = "unknown" DistroIsK3s = "k3s" DistroIsK3d = "k3d" DistroIsKind = "kind" DistroIsMicroK8s = "microk8s" DistroIsEKS = "eks" DistroIsEKSAnywhere = "eksanywhere" DistroIsDockerDesktop = "dockerdesktop" DistroIsGKE = "gke" DistroIsAKS = "aks" DistroIsRKE2 = "rke2" DistroIsTKG = "tkg" )
const ( ZarfNamespace = "zarf" ZarfStateSecretName = "zarf-state" ZarfStateDataKey = "state" )
const ( PodResource = "pod" SvcResource = "svc" ZarfRegistry = "REGISTRY" ZarfLogging = "LOGGING" ZarfGit = "GIT" ZarfInjector = "INJECTOR" )
Variables ¶
This section is empty.
Functions ¶
func CreateConfigmap ¶
func CreateConfigmap(namespace, name string, labels map[string]string, data map[string][]byte) (*corev1.ConfigMap, error)
CreateConfigmap applys a configmap to the cluster
func CreateNamespace ¶
func CreateSecret ¶
func CreateService ¶
CreateService creates the given service in the cluster.
func DeleteConfigMapsByLabel ¶
DeleteConfigMapsByLabel deletes a configmap by label(s)
func DeleteConfigmap ¶
DeleteConfigmap delets a confimap by name
func DeleteSecret ¶
func DeleteService ¶
DeleteService removes a service from the cluster by namespace and name.
func DeleteZarfNamespace ¶
func DeleteZarfNamespace()
func DetectDistro ¶
DetectDistro returns the matching distro or unknown if not found
func GeneratePod ¶
GeneratePod creates a new pod without adding it to the k8s cluster
func GenerateSecret ¶ added in v0.19.0
func GenerateSecret(namespace, name string, secretType corev1.SecretType) *corev1.Secret
func GenerateService ¶
GenerateService returns a K8s service struct without writing to the cluster
func GenerateTLSSecret ¶
func GetAllPods ¶
GetAllPods returns a list of pods from the cluster for all namesapces
func GetAllServiceAccounts ¶
func GetAllServiceAccounts() (*corev1.ServiceAccountList, error)
GetAllServiceAccounts returns a list of services accounts for all namespaces.
func GetArchitecture ¶
GetArchitecture returns the cluster system architecture if found or an error if not
func GetAvailablePort ¶
GetAvailablePort retrieves an available port on the host machine. This delegates the port selection to the golang net library by starting a server and then checking the port that the server is using.
func GetNamespaces ¶
func GetNamespaces() (*corev1.NamespaceList, error)
func GetService ¶
GetService returns a Kubernetes service resource in the provided namespace with the given name.
func GetServiceAccount ¶
func GetServiceAccount(namespace, name string) (*corev1.ServiceAccount, error)
GetServiceAccount reutrns a single service account by namespace and name.
func GetServiceAccounts ¶
func GetServiceAccounts(namespace string) (*corev1.ServiceAccountList, error)
GetServiceAccounts returns a list of service accounts in a given namespace
func GetServicesByLabel ¶
func GetServicesByLabel(namespace, label, value string) (*corev1.ServiceList, error)
GetServicesByLabel returns a list of matched services given a label and value. To search all namespaces, pass "" in the namespace arg
func GetServicesByLabelExists ¶
func GetServicesByLabelExists(namespace, label string) (*corev1.ServiceList, error)
GetServicesByLabelExists returns a list of matched services given a label. To search all namespaces, pass "" in the namespace arg
func LoadZarfState ¶
LoadZarfState returns the current zarf/zarf-state secret data or an empty ZarfState
func PrintConnectTable ¶ added in v0.20.0
func PrintConnectTable() error
GenerateConnectionTable will print a table of all zarf connect matches found in the cluster
func ProcessYamlFilesInPath ¶
func ProcessYamlFilesInPath(path string, component types.ZarfComponent) []string
ProcessYamlFilesInPath iterates over all yaml files in a given path and performs Zarf templating + image swapping
func ReplaceConfigmap ¶
func ReplaceConfigmap(namespace, name string, labels map[string]string, data map[string][]byte) (*corev1.ConfigMap, error)
ReplaceConfigmap deletes and recreates a configmap
func ReplaceSecret ¶
func ReplaceService ¶ added in v0.19.0
ReplaceService deletes and re-creates a service
func ReplaceTLSSecret ¶
func ReplaceTLSSecret(namespace, name string, conf types.GeneratedPKI) error
func SaveServiceAccount ¶
func SaveServiceAccount(svcAccount *corev1.ServiceAccount) (*corev1.ServiceAccount, error)
SaveServiceAccount updates the given service account in the cluster
func SaveZarfState ¶
SaveZarfState takes a given state and makepersists it to the zarf/zarf-state secret
func SortImages ¶
SortImages returns a sorted list of images.
func SplitYAML ¶
func SplitYAML(yamlData []byte) ([]*unstructured.Unstructured, error)
SplitYAML splits a YAML file into unstructured objects. Returns list of all unstructured objects found in the yaml. If an error occurs, returns objects that have been parsed so far too. Source: https://github.com/argoproj/gitops-engine/blob/v0.5.2/pkg/utils/kube/kube.go#L286
func StripZarfLabelsAndSecretsFromNamespaces ¶ added in v0.19.6
func StripZarfLabelsAndSecretsFromNamespaces()
func UpdateNamespace ¶ added in v0.19.1
func WaitForHealthyCluster ¶
WaitForHealthyCluster checks for an available K8s cluster every second until timeout.
func WaitForPodsAndContainers ¶
func WaitForPodsAndContainers(target types.ZarfContainerTarget, waitForAllPods bool) []string
WaitForPodsAndContainers holds execution up to 30 seconds waiting for health pods and containers (if specified)
Types ¶
type DockerConfig ¶
type DockerConfig struct {
Auths DockerConfigEntry `json:"auths"`
}
type DockerConfigEntry ¶
type DockerConfigEntry map[string]DockerConfigEntryWithAuth
type DockerConfigEntryWithAuth ¶
type DockerConfigEntryWithAuth struct {
Auth string `json:"auth"`
}
type ImageNodeMap ¶ added in v0.19.4
func GetAllImages ¶
func GetAllImages() (ImageNodeMap, error)
GetAllImages returns a list of images and their nodes found in pods in the cluster.
func GetImagesWithNodes ¶ added in v0.19.4
func GetImagesWithNodes(namespace string) (ImageNodeMap, error)
GetImagesWithNodes returns all images and their nodes in a given namespace.
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
Tunnel is the main struct that configures and manages port forwading tunnels to Kubernetes resources.
func NewTunnel ¶
NewTunnel will create a new Tunnel struct Note that if you use 0 for the local port, an open port on the host system will be selected automatically, and the Tunnel struct will be updated with the selected port.
func NewZarfTunnel ¶
func NewZarfTunnel() *Tunnel
func (*Tunnel) AddSpinner ¶
func (*Tunnel) Close ¶
func (tunnel *Tunnel) Close()
Close disconnects a tunnel connection by closing the StopChan, thereby stopping the goroutine.
func (*Tunnel) EnableAutoOpen ¶
func (tunnel *Tunnel) EnableAutoOpen()
func (*Tunnel) HttpEndpoint ¶ added in v0.20.0
HttpEndpoint returns the tunnel endpoint as a HTTP URL string