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
- type Cluster
- func (c *Cluster) DeleteZarfNamespace()
- func (c *Cluster) DisableRegHPAScaleDown() error
- func (c *Cluster) EnableRegHPAScaleDown() error
- func (c *Cluster) GenerateGitPullCreds(namespace, name string, gitServerInfo types.GitServerInfo) *corev1.Secret
- func (c *Cluster) GenerateRegistryPullCreds(namespace, name string, registryInfo types.RegistryInfo) *corev1.Secret
- func (c *Cluster) GetDeployedPackage(packageName string) (types.DeployedPackage, error)
- func (c *Cluster) GetDeployedZarfPackages() ([]types.DeployedPackage, []error)
- func (c *Cluster) HandleDataInjection(wg *sync.WaitGroup, data types.ZarfDataInjection, ...)
- func (c *Cluster) InitZarfState(initOptions types.ZarfInitOptions) error
- func (c *Cluster) LoadZarfState() (state *types.ZarfState, err error)
- func (c *Cluster) MergeZarfState(oldState *types.ZarfState, initOptions types.ZarfInitOptions, ...) *types.ZarfState
- func (c *Cluster) PrintConnectTable() error
- func (c *Cluster) RecordPackageDeployment(pkg types.ZarfPackage, components []types.DeployedComponent, ...) error
- func (c *Cluster) SaveZarfState(state *types.ZarfState) error
- func (c *Cluster) StartInjectionMadness(tempPath types.TempPaths, injectorSeedTags []string)
- func (c *Cluster) StopInjectionMadness() error
- func (c *Cluster) StripZarfLabelsAndSecretsFromNamespaces()
- func (c *Cluster) UpdateZarfManagedGitSecrets(state *types.ZarfState)
- func (c *Cluster) UpdateZarfManagedImageSecrets(state *types.ZarfState)
- type DockerConfig
- type DockerConfigEntry
- type DockerConfigEntryWithAuth
- type ServiceInfo
- type Tunnel
- func (tunnel *Tunnel) AddSpinner(spinner *message.Spinner)
- func (tunnel *Tunnel) Close()
- func (tunnel *Tunnel) Connect(target string, blocking bool) error
- func (tunnel *Tunnel) EnableAutoOpen()
- func (tunnel *Tunnel) Endpoint() string
- func (tunnel *Tunnel) FullURL() string
- func (tunnel *Tunnel) HTTPEndpoint() string
Constants ¶
const ( ZarfNamespaceName = "zarf" ZarfStateSecretName = "zarf-state" ZarfStateDataKey = "state" ZarfPackageInfoLabel = "package-deploy-info" ZarfInitPackageInfoName = "zarf-package-init" )
Zarf Cluster Constants.
const ( PodResource = "pod" SvcResource = "svc" ZarfRegistry = "REGISTRY" ZarfLogging = "LOGGING" ZarfGit = "GIT" ZarfInjector = "INJECTOR" )
Zarf Tunnel Configuration Constants.
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 ¶
Cluster is a wrapper for the k8s package that provides Zarf-specific cluster management functions.
func NewCluster ¶
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 ¶
NewClusterWithWait creates a new Cluster instance and waits for the given timeout for the cluster to be ready.
func (*Cluster) DeleteZarfNamespace ¶
func (c *Cluster) DeleteZarfNamespace()
DeleteZarfNamespace deletes the Zarf namespace from the connected cluster.
func (*Cluster) DisableRegHPAScaleDown ¶ added in v0.24.0
DisableRegHPAScaleDown disables the HPA scale down for the Zarf Registry.
func (*Cluster) EnableRegHPAScaleDown ¶ added in v0.24.0
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) (types.DeployedPackage, 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) HandleDataInjection ¶
func (c *Cluster) HandleDataInjection(wg *sync.WaitGroup, data types.ZarfDataInjection, componentPath types.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 ¶
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) PrintConnectTable ¶
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) error
RecordPackageDeployment saves metadata about a package that has been deployed to the cluster.
func (*Cluster) SaveZarfState ¶
SaveZarfState takes a given state and persists it to the Zarf/zarf-state secret.
func (*Cluster) StartInjectionMadness ¶ added in v0.24.0
StartInjectionMadness initializes a Zarf injection into the cluster.
func (*Cluster) StopInjectionMadness ¶ added in v0.24.0
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
UpdateZarfManagedGitSecrets updates all Zarf-managed git secrets in all namespaces based on state
func (*Cluster) UpdateZarfManagedImageSecrets ¶ added in v0.29.0
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 ServiceInfo ¶ added in v0.24.0
ServiceInfo contains information necessary for connecting to a cluster service.
func ServiceInfoFromNodePortURL ¶ added in v0.24.0
func ServiceInfoFromNodePortURL(nodePortURL string) (*ServiceInfo, error)
ServiceInfoFromNodePortURL takes a nodePortURL and parses it to find the service info for connecting to the cluster. The string is expected to follow the following format: Example nodePortURL: 127.0.0.1:{PORT}.
func ServiceInfoFromServiceURL ¶ added in v0.24.0
func ServiceInfoFromServiceURL(serviceURL string) (*ServiceInfo, error)
ServiceInfoFromServiceURL takes a serviceURL and parses it to find the service info for connecting to the cluster. The string is expected to follow the following format: Example serviceURL: http://{SERVICE_NAME}.{NAMESPACE}.svc.cluster.local:{PORT}.
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
Tunnel is the main struct that configures and manages port forwarding 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 ¶
NewZarfTunnel will create a new Tunnel struct for the Zarf namespace.
func (*Tunnel) AddSpinner ¶
AddSpinner will add a spinner to the tunnel to show progress.
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()
EnableAutoOpen will automatically open the established tunnel in the default browser when it is ready.
func (*Tunnel) Endpoint ¶
Endpoint returns the tunnel ip address and port (i.e. for docker registries)
func (*Tunnel) FullURL ¶ added in v0.26.3
FullURL returns the tunnel endpoint as a HTTP URL string with the urlSuffix appended.
func (*Tunnel) HTTPEndpoint ¶ added in v0.23.2
HTTPEndpoint returns the tunnel endpoint as a HTTP URL string.