cluster

package
v0.23.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 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

Package cluster contains zarf-specific cluster management functions

Index

Constants

View Source
const (
	ZarfNamespace       = "zarf"
	ZarfStateSecretName = "zarf-state"
	ZarfStateDataKey    = "state"
)
View Source
const (
	PodResource  = "pod"
	SvcResource  = "svc"
	ZarfRegistry = "REGISTRY"
	ZarfLogging  = "LOGGING"
	ZarfGit      = "GIT"
	ZarfInjector = "INJECTOR"
)

Variables

This section is empty.

Functions

func IsServiceURL

func IsServiceURL(serviceURL string) bool

IsServiceURL will check if the provided string is a valid serviceURL based on if it properly matches a validating regexp

Types

type Cluster

type Cluster struct {
	Kube *k8s.K8s
}

func NewCluster

func NewCluster() (*Cluster, error)

NewCluster creates a new cluster instance without waiting for the cluster to be ready

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) DeleteZarfNamespace

func (c *Cluster) DeleteZarfNamespace()

DeleteZarfNamespace deletes the zarf namespace from the connected cluster.

func (*Cluster) GenerateRegistryPullCreds

func (c *Cluster) GenerateRegistryPullCreds(namespace, name string) (*corev1.Secret, error)

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.

func (*Cluster) HandleDataInjection

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

Wait 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(tempPath types.TempPaths, initOptions types.ZarfInitOptions) error

func (*Cluster) LoadZarfState

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

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

func (*Cluster) PostSeedRegistry

func (c *Cluster) PostSeedRegistry(tempPath types.TempPaths) error

func (*Cluster) PrintConnectTable

func (c *Cluster) PrintConnectTable() error

GenerateConnectionTable 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)

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

func (*Cluster) RunInjectionMadness

func (c *Cluster) RunInjectionMadness(tempPath types.TempPaths)

RunInjectionMadness initializes a zarf injection into the cluster

func (*Cluster) SaveZarfState

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

SaveZarfState takes a given state and makepersists it to the zarf/zarf-state secret

func (*Cluster) StripZarfLabelsAndSecretsFromNamespaces

func (c *Cluster) StripZarfLabelsAndSecretsFromNamespaces()

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

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 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

func NewTunnel(namespace, resourceType, resourceName string, local, remote int) (*Tunnel, error)

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 NewTunnelFromServiceURL

func NewTunnelFromServiceURL(serviceURL string) (*Tunnel, error)

NewTunnelFromServiceURL takes a serviceURL and parses it to create a tunnel to the cluster. The string is expected to follow the following format: Example serviceURL: http://{SERVICE_NAME}.{NAMESPACE}.svc.cluster.local:{PORT}

func NewZarfTunnel

func NewZarfTunnel() (*Tunnel, error)

func (*Tunnel) AddSpinner

func (tunnel *Tunnel) AddSpinner(spinner *message.Spinner)

func (*Tunnel) Close

func (tunnel *Tunnel) Close()

Close disconnects a tunnel connection by closing the StopChan, thereby stopping the goroutine.

func (*Tunnel) Connect

func (tunnel *Tunnel) Connect(target string, blocking bool) error

func (*Tunnel) EnableAutoOpen

func (tunnel *Tunnel) EnableAutoOpen()

func (*Tunnel) Endpoint

func (tunnel *Tunnel) Endpoint() string

Endpoint returns the tunnel endpoint

func (*Tunnel) HttpEndpoint

func (tunnel *Tunnel) HttpEndpoint() string

HttpEndpoint returns the tunnel endpoint as a HTTP URL string

Jump to

Keyboard shortcuts

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