cluster

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package cluster contains Zarf-specific cluster management functions.

Package cluster contains Zarf-specific cluster management functions.

Package cluster contains Zarf-specific cluster management functions.

Package cluster contains Zarf-specific cluster management functions.

Package cluster contains Zarf-specific cluster management functions.

Package cluster contains Zarf-specific cluster management functions.

Package cluster contains Zarf-specific cluster management functions.

Package cluster contains Zarf-specific cluster management functions.

Index

Constants

View Source
const (
	ZarfNamespaceName       = "zarf"
	ZarfStateSecretName     = "zarf-state"
	ZarfStateDataKey        = "state"
	ZarfPackageInfoLabel    = "package-deploy-info"
	ZarfInitPackageInfoName = "zarf-package-init"
)

Zarf Cluster Constants.

View Source
const (
	ZarfRegistry = "REGISTRY"
	ZarfLogging  = "LOGGING"
	ZarfGit      = "GIT"
	ZarfInjector = "INJECTOR"

	ZarfInjectorName  = "zarf-injector"
	ZarfInjectorPort  = 5000
	ZarfRegistryName  = "zarf-docker-registry"
	ZarfRegistryPort  = 5000
	ZarfGitServerName = "zarf-gitea-http"
	ZarfGitServerPort = 3000
)

Zarf specific connect strings

View Source
const (
	// DefaultTimeout is the default time to wait for a cluster to be ready.
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	*k8s.K8s
}

Cluster is a wrapper for the k8s package that provides Zarf-specific cluster management functions.

func NewCluster

func NewCluster() (*Cluster, error)

NewCluster creates a new Cluster instance and validates connection to the cluster by fetching the Kubernetes version.

func NewClusterOrDie

func NewClusterOrDie() *Cluster

NewClusterOrDie creates a new Cluster instance and waits up to 30 seconds for the cluster to be ready or throws a fatal error.

func NewClusterWithWait

func NewClusterWithWait(timeout time.Duration) (*Cluster, error)

NewClusterWithWait creates a new Cluster instance and waits for the given timeout for the cluster to be ready.

func (*Cluster) Connect added in v0.30.0

func (c *Cluster) Connect(target string) (*k8s.Tunnel, error)

Connect will establish a tunnel to the specified target.

func (*Cluster) ConnectToZarfRegistryEndpoint added in v0.30.0

func (c *Cluster) ConnectToZarfRegistryEndpoint(registryInfo types.RegistryInfo) (string, *k8s.Tunnel, error)

ConnectToZarfRegistryEndpoint determines if a registry endpoint is in cluster, and if so opens a tunnel to connect to it

func (*Cluster) ConnectTunnelInfo added in v0.30.0

func (c *Cluster) ConnectTunnelInfo(zt TunnelInfo) (*k8s.Tunnel, error)

ConnectTunnelInfo connects to the cluster with the provided TunnelInfo

func (*Cluster) DeleteZarfNamespace

func (c *Cluster) DeleteZarfNamespace()

DeleteZarfNamespace deletes the Zarf namespace from the connected cluster.

func (*Cluster) DisableRegHPAScaleDown added in v0.24.0

func (c *Cluster) DisableRegHPAScaleDown() error

DisableRegHPAScaleDown disables the HPA scale down for the Zarf Registry.

func (*Cluster) EnableRegHPAScaleDown added in v0.24.0

func (c *Cluster) EnableRegHPAScaleDown() error

EnableRegHPAScaleDown enables the HPA scale down for the Zarf Registry.

func (*Cluster) GenerateGitPullCreds added in v0.29.0

func (c *Cluster) GenerateGitPullCreds(namespace, name string, gitServerInfo types.GitServerInfo) *corev1.Secret

GenerateGitPullCreds generates a secret containing the git credentials.

func (*Cluster) GenerateRegistryPullCreds

func (c *Cluster) GenerateRegistryPullCreds(namespace, name string, registryInfo types.RegistryInfo) *corev1.Secret

GenerateRegistryPullCreds generates a secret containing the registry credentials.

func (*Cluster) GetDeployedPackage added in v0.26.0

func (c *Cluster) GetDeployedPackage(packageName string) (deployedPackage *types.DeployedPackage, err error)

GetDeployedPackage gets the metadata information about the package name provided (if it exists in the cluster). We determine what packages have been deployed to the cluster by looking for specific secrets in the Zarf namespace.

func (*Cluster) GetDeployedZarfPackages

func (c *Cluster) GetDeployedZarfPackages() ([]types.DeployedPackage, []error)

GetDeployedZarfPackages gets metadata information about packages that have been deployed to the cluster. We determine what packages have been deployed to the cluster by looking for specific secrets in the Zarf namespace. Returns a list of DeployedPackage structs and a list of errors.

func (*Cluster) GetInstalledChartsForComponent added in v0.30.0

func (c *Cluster) GetInstalledChartsForComponent(packageName string, component types.ZarfComponent) (installedCharts []types.InstalledChart, err error)

GetInstalledChartsForComponent returns any installed Helm Charts for the provided package component.

func (*Cluster) HandleDataInjection

func (c *Cluster) HandleDataInjection(wg *sync.WaitGroup, data types.ZarfDataInjection, componentPath *layout.ComponentPaths, dataIdx int)

HandleDataInjection waits for the target pod(s) to come up and inject the data into them todo: this currently requires kubectl but we should have enough k8s work to make this native now.

func (*Cluster) InitZarfState

func (c *Cluster) InitZarfState(initOptions types.ZarfInitOptions) error

InitZarfState initializes the Zarf state with the given temporary directory and init configs.

func (*Cluster) LoadZarfState

func (c *Cluster) LoadZarfState() (state *types.ZarfState, err error)

LoadZarfState returns the current zarf/zarf-state secret data or an empty ZarfState.

func (*Cluster) MergeZarfState added in v0.29.0

func (c *Cluster) MergeZarfState(oldState *types.ZarfState, initOptions types.ZarfInitOptions, services []string) *types.ZarfState

MergeZarfState merges init options for provided services into the provided state to create a new state struct

func (*Cluster) PackageSecretNeedsWait added in v0.30.0

func (c *Cluster) PackageSecretNeedsWait(deployedPackage *types.DeployedPackage, component types.ZarfComponent, skipWebhooks bool) (needsWait bool, waitSeconds int, hookName string)

PackageSecretNeedsWait checks if a package component has a running webhook that needs to be waited on.

func (*Cluster) PrintConnectTable

func (c *Cluster) PrintConnectTable() error

PrintConnectTable will print a table of all Zarf connect matches found in the cluster.

func (*Cluster) RecordPackageDeployment

func (c *Cluster) RecordPackageDeployment(pkg types.ZarfPackage, components []types.DeployedComponent, connectStrings types.ConnectStrings, generation int) (deployedPackage *types.DeployedPackage, err error)

RecordPackageDeployment saves metadata about a package that has been deployed to the cluster.

func (*Cluster) RecordPackageDeploymentAndWait added in v0.30.0

func (c *Cluster) RecordPackageDeploymentAndWait(pkg types.ZarfPackage, components []types.DeployedComponent, connectStrings types.ConnectStrings, generation int, component types.ZarfComponent, skipWebhooks bool) (deployedPackage *types.DeployedPackage, err error)

RecordPackageDeploymentAndWait records the deployment of a package to the cluster and waits for any webhooks to complete.

func (*Cluster) SaveZarfState

func (c *Cluster) SaveZarfState(state *types.ZarfState) error

SaveZarfState takes a given state and persists it to the Zarf/zarf-state secret.

func (*Cluster) StartInjectionMadness added in v0.24.0

func (c *Cluster) StartInjectionMadness(tmpDir string, imagesDir string, injectorSeedSrcs []string)

StartInjectionMadness initializes a Zarf injection into the cluster.

func (*Cluster) StopInjectionMadness added in v0.24.0

func (c *Cluster) StopInjectionMadness() error

StopInjectionMadness handles cleanup once the seed registry is up.

func (*Cluster) StripZarfLabelsAndSecretsFromNamespaces

func (c *Cluster) StripZarfLabelsAndSecretsFromNamespaces()

StripZarfLabelsAndSecretsFromNamespaces removes metadata and secrets from existing namespaces no longer manged by Zarf.

func (*Cluster) UpdateZarfManagedGitSecrets added in v0.29.0

func (c *Cluster) UpdateZarfManagedGitSecrets(state *types.ZarfState)

UpdateZarfManagedGitSecrets updates all Zarf-managed git secrets in all namespaces based on state

func (*Cluster) UpdateZarfManagedImageSecrets added in v0.29.0

func (c *Cluster) UpdateZarfManagedImageSecrets(state *types.ZarfState)

UpdateZarfManagedImageSecrets updates all Zarf-managed image secrets in all namespaces based on state

type DockerConfig

type DockerConfig struct {
	Auths DockerConfigEntry `json:"auths"`
}

DockerConfig contains the authentication information from the machine's docker config.

type DockerConfigEntry

type DockerConfigEntry map[string]DockerConfigEntryWithAuth

DockerConfigEntry contains a map of DockerConfigEntryWithAuth for a registry.

type DockerConfigEntryWithAuth

type DockerConfigEntryWithAuth struct {
	Auth string `json:"auth"`
}

DockerConfigEntryWithAuth contains a docker config authentication string.

type TunnelInfo added in v0.30.0

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

TunnelInfo is a struct that contains the necessary info to create a new k8s.Tunnel

func NewTunnelInfo added in v0.30.0

func NewTunnelInfo(namespace, resourceType, resourceName, urlSuffix string, localPort, remotePort int) TunnelInfo

NewTunnelInfo returns a new TunnelInfo object for connecting to a cluster

Jump to

Keyboard shortcuts

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