state

package
v0.55.6 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Overview

Package state manages references to a logical zarf deployment in k8s.

Index

Constants

View Source
const (
	ZarfManagedByLabel   = "app.kubernetes.io/managed-by"
	ZarfNamespaceName    = "zarf"
	ZarfStateSecretName  = "zarf-state"
	ZarfStateDataKey     = "state"
	ZarfPackageInfoLabel = "package-deploy-info"
)

Declares secrets and metadata keys and values. TODO(mkcp): Remove Zarf prefix, that's the project name. TODO(mkcp): Provide semantic doccomments for how these are used.

View Source
const (
	RegistryKey     = "registry"
	RegistryReadKey = "registry-readonly"
	GitKey          = "git"
	GitReadKey      = "git-readonly"
	ArtifactKey     = "artifact"
	AgentKey        = "agent"
)

Credential keys TODO(mkcp): Provide semantic doccomments for how these are used.

Variables

This section is empty.

Functions

func DebugPrint

func DebugPrint(ctx context.Context, state *State)

DebugPrint takes a State struct, sanitizes sensitive fields, and prints them.

Types

type MergeOptions

type MergeOptions struct {
	GitServer      types.GitServerInfo
	RegistryInfo   types.RegistryInfo
	ArtifactServer types.ArtifactServerInfo
	Services       []string
}

MergeOptions tracks the user-defined options during cluster initialization. TODO(mkcp): Provide semantic doccomments for how exported fields are used.

type State

type State struct {
	// Indicates if Zarf was initialized while deploying its own k8s cluster
	ZarfAppliance bool `json:"zarfAppliance"`
	// K8s distribution of the cluster Zarf was deployed to
	Distro string `json:"distro"`
	// Machine architecture of the k8s node(s)
	Architecture string `json:"architecture"`
	// Default StorageClass value Zarf uses for variable templating
	StorageClass string `json:"storageClass"`
	// PKI certificate information for the agent pods Zarf manages
	AgentTLS pki.GeneratedPKI `json:"agentTLS"`

	// Information about the repository Zarf is configured to use
	GitServer types.GitServerInfo `json:"gitServer"`
	// Information about the container registry Zarf is configured to use
	RegistryInfo types.RegistryInfo `json:"registryInfo"`
	// Information about the artifact registry Zarf is configured to use
	ArtifactServer types.ArtifactServerInfo `json:"artifactServer"`
}

State is maintained as a secret in the Zarf namespace to track Zarf init data.

func Default

func Default() (*State, error)

Default returns a default State with default values filled in for the registry, git server, and artifact server

func Merge

func Merge(oldState *State, opts MergeOptions) (*State, error)

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

Jump to

Keyboard shortcuts

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