Documentation
¶
Overview ¶
Package state manages references to a logical zarf deployment in k8s.
Index ¶
- Constants
- Variables
- func CheckIfRegistryAddressOrCredsChanged(existing, given RegistryInfo) bool
- func DebugPrint(ctx context.Context, state *State)
- func LocalhostRegistryAddress(ipFamily IPFamily, port int) string
- func RegistryCertFromSecretData(data map[string][]byte) (pki.GeneratedPKI, error)
- func RegistryCertSecretData(certs pki.GeneratedPKI) map[string][]byte
- type AgentInfo
- type ChartStatus
- type ComponentEvent
- type ComponentStatus
- type ConnectString
- type ConnectStrings
- type DeployConfig
- type DeployedComponent
- type DeployedPackage
- func (d *DeployedPackage) AppendEvent(event PackageEvent)
- func (d DeployedPackage) Definition() (api.Package, error)
- func (d *DeployedPackage) GetDeployConfig() (DeployConfig, bool)
- func (d *DeployedPackage) GetPackageConnectivity() PackageConnectivity
- func (d *DeployedPackage) GetSecretName() string
- func (d *DeployedPackage) LastSuccessfulDeploy() (PackageEvent, bool)
- func (d *DeployedPackage) LatestEvent() (PackageEvent, bool)
- func (d *DeployedPackage) SetDeployConfig(config DeployConfig)
- func (d *DeployedPackage) SetDeployedComponents(components []DeployedComponent)
- func (d *DeployedPackage) SetPackageDefinition(definition api.Package) error
- type DeployedPackageOptions
- type EventOutcome
- type EventType
- type GitServerInfo
- type GitServerMode
- type IPFamily
- type InjectorInfo
- type InstalledChart
- type MTLSStrategy
- type MergeOptions
- type MutationPolicy
- type PackageConnectivity
- type PackageEvent
- type RegistryInfo
- func (ri *RegistryInfo) FillInEmptyValues(ipFamily IPFamily) error
- func (ri RegistryInfo) Htpasswd() (string, error)
- func (ri RegistryInfo) IsConfigured() bool
- func (ri RegistryInfo) IsInternal() bool
- func (ri RegistryInfo) KnownPlainHTTP() (plainHTTP bool, known bool)
- func (ri RegistryInfo) ResolvePlainHTTP(ctx context.Context, host string, forcePlainHTTP bool, ...) (bool, error)
- func (ri RegistryInfo) ShouldUseMTLS() bool
- type RegistryMode
- type RemoveConfig
- type ServiceKey
- type ServiceSet
- type State
- type ValuesOverrides
Constants ¶
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.
const ( ZarfGeneratedPasswordLen = 24 ZarfGeneratedSecretLen = 48 ZarfInClusterContainerRegistryNodePort = 31999 ZarfInjectorDefaultHostPort = 5001 ZarfRegistryHostPort = 5000 ZarfRegistryPushUser = "zarf-push" ZarfRegistryPullUser = "zarf-pull" ZarfGitPushUser = "zarf-git-user" ZarfGitReadUser = "zarf-git-read-user" ZarfAgentHost = "agent-hook.zarf.svc" ZarfInClusterGitServiceURL = "http://zarf-gitea-http.zarf.svc.cluster.local:3000" // ZarfRegistryMTLSServerCommonName is the common name for the registry server certificate ZarfRegistryMTLSServerCommonName = "zarf-docker-registry" // ZarfRegistryMTLSClientCommonName is the common name for the registry client certificate ZarfRegistryMTLSClientCommonName = "zarf-registry-client" ZarfRegistryMTLSCASubject = "Zarf Registry CA" )
Values during setup of the initial zarf state
const ( // RegistryServerTLSSecret holds the certificate the registry serves. RegistryServerTLSSecret = "zarf-registry-server-tls" // RegistryClientTLSSecret holds the certificate clients present to the registry. RegistryClientTLSSecret = "zarf-registry-client-tls" RegistrySecretCAPath = "ca.crt" RegistrySecretCertPath = "tls.crt" RegistrySecretKeyPath = "tls.key" )
Secrets holding the registry mTLS certificates, and the keys within them. The keys are the standard kubernetes.io/tls format plus the conventional CA companion.
const IPV6Localhost = "::1"
IPV6Localhost is the IP of localhost in IPv6 (TODO: move to helpers next to IPV4Localhost)
Variables ¶
var DeployedPackageNameRegex = regexp.MustCompile(`^[a-z0-9][a-z0-9\-]*$`).MatchString
DeployedPackageNameRegex is a regex for lowercase, numbers and hyphens that cannot start with a hyphen. https://regex101.com/r/FLdG9G/2
var ZarfRegistryMTLSServerHosts = []string{
"zarf-docker-registry",
"zarf-docker-registry.zarf.svc.cluster.local",
"localhost",
"127.0.0.1",
"[::1]",
}
ZarfRegistryMTLSServerHosts is the list of DNS names and IPs for the registry server certificate
Functions ¶
func CheckIfRegistryAddressOrCredsChanged ¶ added in v0.74.0
func CheckIfRegistryAddressOrCredsChanged(existing, given RegistryInfo) bool
CheckIfRegistryAddressOrCredsChanged compares two RegistryInfo structs and returns true if the creds or address changed
func DebugPrint ¶
DebugPrint takes a State struct, sanitizes sensitive fields, and prints them.
func LocalhostRegistryAddress ¶ added in v0.65.0
LocalhostRegistryAddress builds the IPv4 or IPv6 local address of the Zarf deployed registry.
func RegistryCertFromSecretData ¶ added in v0.83.0
func RegistryCertFromSecretData(data map[string][]byte) (pki.GeneratedPKI, error)
RegistryCertFromSecretData reads a registry mTLS keypair out of the secret data Zarf stores. It is the exact inverse of RegistryCertSecretData, and takes the data map rather than the secret so that deciding *how* to read the secret stays with the caller.
func RegistryCertSecretData ¶ added in v0.83.0
func RegistryCertSecretData(certs pki.GeneratedPKI) map[string][]byte
RegistryCertSecretData lays a registry mTLS keypair out as Kubernetes secret data.
Types ¶
type AgentInfo ¶ added in v0.85.0
type AgentInfo struct {
// TLS contains certificate information for the agent pods Zarf manages.
TLS pki.GeneratedPKI `json:"tls"`
// TLSUserProvided indicates whether the agent TLS certs were provided by the user rather than auto-generated.
TLSUserProvided bool `json:"tlsUserProvided,omitempty"`
// MutationPolicy controls the conditions required for the agent to mutate resources.
MutationPolicy MutationPolicy `json:"mutationPolicy"`
}
AgentInfo contains information Zarf uses to configure the agent.
func (AgentInfo) IsConfigured ¶ added in v0.85.0
IsConfigured returns true when a complete agent TLS bundle is configured.
type ChartStatus ¶ added in v0.63.0
type ChartStatus string
ChartStatus is the status of a Helm Chart release
const ( ChartStatusSucceeded ChartStatus = "Succeeded" ChartStatusFailed ChartStatus = "Failed" )
All status options for a Zarf component chart
type ComponentEvent ¶ added in v1.0.0
type ComponentEvent struct {
Type EventType `json:"type"`
Outcome EventOutcome `json:"outcome"`
Timestamp time.Time `json:"timestamp"`
}
ComponentEvent records a component lifecycle transition.
type ComponentStatus ¶ added in v0.57.0
type ComponentStatus string
ComponentStatus defines the deployment status of a Zarf component within a package.
const ( ComponentStatusSucceeded ComponentStatus = "Succeeded" ComponentStatusFailed ComponentStatus = "Failed" ComponentStatusDeploying ComponentStatus = "Deploying" ComponentStatusRemoving ComponentStatus = "Removing" )
All the different status options for a Zarf Component
type ConnectString ¶ added in v0.57.0
type ConnectString struct {
// Descriptive text that explains what the resource you would be connecting to is used for
Description string `json:"description"`
// URL path that gets appended to the k8s port-forward result
URL string `json:"url"`
}
ConnectString contains information about a connection made with Zarf connect.
type ConnectStrings ¶ added in v0.57.0
type ConnectStrings map[string]ConnectString
ConnectStrings is a map of connect names to connection information.
type DeployConfig ¶ added in v1.0.0
type DeployConfig struct {
SetVariables map[string]string `json:"setVariables,omitempty"`
Values value.Values `json:"values,omitempty"`
NamespaceOverride string `json:"namespaceOverride,omitempty"`
ValuesOverridesMap ValuesOverrides `json:"valuesOverridesMap,omitempty"`
// ComponentSelectors records the normalized, ordered selectors generated by
// Deploy from package filtering. It is provenance, not a deployment input.
ComponentSelectors []string `json:"componentSelectors,omitempty"`
Connectivity PackageConnectivity `json:"connectivity,omitempty"`
}
DeployConfig is the persisted configuration of a successful package deployment.
type DeployedComponent ¶ added in v0.57.0
type DeployedComponent struct {
Name string `json:"name"`
InstalledCharts []InstalledChart `json:"installedCharts"`
// Deprecated: LastEvent is the lifecycle status. Status remains populated for compatibility.
Status ComponentStatus `json:"status"`
LastEvent ComponentEvent `json:"lastEvent,omitempty"`
ObservedGeneration int `json:"observedGeneration"`
}
DeployedComponent contains information about a Zarf Package Component that has been deployed to a cluster.
type DeployedPackage ¶ added in v0.57.0
type DeployedPackage struct {
Name string `json:"name"`
Digest string `json:"digest"`
// Data contains the v1alpha1 definition
Data v1alpha1.ZarfPackage `json:"data"`
// PackageData contains the v1beta1 definition and future definitions
PackageData map[string]json.RawMessage `json:"packageData,omitempty"`
CLIVersion string `json:"cliVersion"`
Generation int `json:"generation"`
DeployedComponents []DeployedComponent `json:"deployedComponents"`
ConnectStrings ConnectStrings `json:"connectStrings,omitempty"`
// Deprecated: derive connectivity from DeployConfig. This field preserves compatibility with older clients.
PackageConnectivity PackageConnectivity `json:"packageConnectivity"`
Events []PackageEvent `json:"events,omitempty"`
// DeployConfig is the last successful deployment snapshot, absent in legacy state.
DeployConfig *DeployConfig `json:"deployConfig,omitempty"`
// [ALPHA] Optional namespace override - exported/json-tag for storage in deployed package state secret
NamespaceOverride string `json:"namespaceOverride,omitempty"`
}
DeployedPackage contains information about a Zarf Package that has been deployed to a cluster This object is saved as the data of a k8s secret within the 'Zarf' namespace (not as part of the ZarfState secret).
func NewDeployedPackage ¶ added in v0.87.0
func NewDeployedPackage(definition api.Package, digest, cliVersion string, components []DeployedComponent, generation int, opts ...DeployedPackageOptions) (*DeployedPackage, error)
NewDeployedPackage creates persisted deployment state from a package definition.
func (*DeployedPackage) AppendEvent ¶ added in v1.0.0
func (d *DeployedPackage) AppendEvent(event PackageEvent)
AppendEvent adds an event, retaining the ten most recent events.
func (DeployedPackage) Definition ¶ added in v0.87.0
func (d DeployedPackage) Definition() (api.Package, error)
Definition returns the latest package definition this Zarf version understands, falling back to the v1alpha1 Data field.
func (*DeployedPackage) GetDeployConfig ¶ added in v1.0.0
func (d *DeployedPackage) GetDeployConfig() (DeployConfig, bool)
GetDeployConfig returns a detached copy of the last successful deployment snapshot. Legacy state without a saved snapshot returns the zero configuration and false; it does not synthesize configuration from legacy fields.
func (*DeployedPackage) GetPackageConnectivity ¶ added in v0.75.0
func (d *DeployedPackage) GetPackageConnectivity() PackageConnectivity
GetPackageConnectivity returns the connectivity mode for the most recent successful deployment. It falls back to the legacy package field for secrets written before DeployConfig was persisted.
func (*DeployedPackage) GetSecretName ¶ added in v0.57.0
func (d *DeployedPackage) GetSecretName() string
GetSecretName returns the k8s secret name for the deployed package
func (*DeployedPackage) LastSuccessfulDeploy ¶ added in v1.0.0
func (d *DeployedPackage) LastSuccessfulDeploy() (PackageEvent, bool)
LastSuccessfulDeploy returns the most recent retained successful deployment event, if one exists.
func (*DeployedPackage) LatestEvent ¶ added in v1.0.0
func (d *DeployedPackage) LatestEvent() (PackageEvent, bool)
LatestEvent returns the most recently recorded package event, if one exists.
func (*DeployedPackage) SetDeployConfig ¶ added in v1.0.0
func (d *DeployedPackage) SetDeployConfig(config DeployConfig)
SetDeployConfig saves a detached snapshot and synchronizes legacy connectivity for older clients.
func (*DeployedPackage) SetDeployedComponents ¶ added in v1.0.0
func (d *DeployedPackage) SetDeployedComponents(components []DeployedComponent)
SetDeployedComponents updates deployed components and their aggregate connection strings.
func (*DeployedPackage) SetPackageDefinition ¶ added in v0.87.0
func (d *DeployedPackage) SetPackageDefinition(definition api.Package) error
SetPackageDefinition records every API version needed to read a deployed package. Data always contains the v1alpha1 form to allow older Zarf clients to read the deployed package secret.
type DeployedPackageOptions ¶ added in v0.57.0
type DeployedPackageOptions func(*DeployedPackage)
DeployedPackageOptions configure a deployed package.
func WithPackageConnectivity
deprecated
added in
v0.75.0
func WithPackageConnectivity(connected bool) DeployedPackageOptions
WithPackageConnectivity sets the legacy connectivity mode for a deployed package.
Deprecated: persist connectivity through DeployConfig instead.
func WithPackageNamespaceOverride ¶ added in v0.57.0
func WithPackageNamespaceOverride(namespaceOverride string) DeployedPackageOptions
WithPackageNamespaceOverride sets the [ALPHA] optional namespace override for a package during deployment
type EventOutcome ¶ added in v1.0.0
type EventOutcome string
EventOutcome identifies the result of a lifecycle operation.
const ( EventOutcomeUnknown EventOutcome = "Unknown" EventOutcomeInProgress EventOutcome = "InProgress" EventOutcomeSucceeded EventOutcome = "Succeeded" EventOutcomeFailed EventOutcome = "Failed" EventOutcomeCancelled EventOutcome = "Cancelled" )
Event outcomes identify lifecycle transitions.
type EventType ¶ added in v1.0.0
type EventType string
EventType identifies the package or component lifecycle operation.
type GitServerInfo ¶ added in v0.56.0
type GitServerInfo struct {
// Username of a user with push access to the git repository
PushUsername string `json:"pushUsername"`
// Password of a user with push access to the git repository
PushPassword string `json:"pushPassword"`
// Username of a user with pull-only access to the git repository. If not provided for an external repository then the push-user is used
PullUsername string `json:"pullUsername"`
// Password of a user with pull-only access to the git repository. If not provided for an external repository then the push-user is used
PullPassword string `json:"pullPassword"`
// URL address of the git server
Address string `json:"address"`
// GitServerMode identifies whether Zarf manages the git server.
GitServerMode GitServerMode `json:"gitServerMode,omitempty"`
}
GitServerInfo contains information Zarf uses to communicate with a git repository to push/pull repositories to.
func (*GitServerInfo) FillInEmptyValues ¶ added in v0.56.0
func (gs *GitServerInfo) FillInEmptyValues() error
FillInEmptyValues sets every necessary value that's currently empty to a reasonable default
func (GitServerInfo) IsConfigured ¶ added in v0.75.0
func (gs GitServerInfo) IsConfigured() bool
IsConfigured returns true if the git server address has been set. clusters initialized before services-gated state https://github.com/zarf-dev/zarf/pull/4832 may report true even without a real git server.
func (GitServerInfo) IsInternal ¶ added in v0.56.0
func (gs GitServerInfo) IsInternal() bool
IsInternal reports whether Zarf manages the git server
type GitServerMode ¶ added in v0.87.0
type GitServerMode string
GitServerMode identifies whether Zarf manages the git server.
const ( // GitServerModeInternal is used for the git server deployed by Zarf. GitServerModeInternal GitServerMode = "internal" // GitServerModeExternal is used for a user-provided git server. GitServerModeExternal GitServerMode = "external" )
type IPFamily ¶ added in v0.65.0
type IPFamily string
IPFamily defines the different possible IPfamilies that can be used in Kubernetes clusters
type InjectorInfo ¶ added in v0.65.0
type InjectorInfo struct {
// The image to be used for the long lived injector
Image string `json:"injectorImage"`
// The number of payload configmaps required
PayLoadConfigMapAmount int `json:"payLoadConfigMapAmount"`
// The PayLoadShaSum for the payload ConfigMaps
PayLoadShaSum string `json:"payLoadShaSum"`
// The port that the injector is exposed through, either hostPort or nodePort
Port int `json:"port"`
}
InjectorInfo contains information on how to run the long lived Daemonset Injector
type InstalledChart ¶ added in v0.57.0
type InstalledChart struct {
Namespace string `json:"namespace"`
ChartName string `json:"chartName"`
ConnectStrings ConnectStrings `json:"connectStrings,omitempty"`
Status ChartStatus `json:"status"`
}
InstalledChart contains information about a Helm Chart that has been deployed to a cluster.
func MergeInstalledChartsForComponent ¶ added in v0.63.0
func MergeInstalledChartsForComponent(existingCharts, installedCharts []InstalledChart, partial bool) []InstalledChart
MergeInstalledChartsForComponent merges the provided existing charts with the provided installed charts.
type MTLSStrategy ¶ added in v0.71.0
type MTLSStrategy string
MTLSStrategy defines the strategy to manage the mTLS certificates for the registry
const ( // MTLSStrategyNone indicates no mTLS certificate management MTLSStrategyNone MTLSStrategy = "none" // MTLSStrategyZarfManaged indicates Zarf is managing the mTLS certificates MTLSStrategyZarfManaged MTLSStrategy = "zarf-managed" )
type MergeOptions ¶
type MergeOptions struct {
GitServer GitServerInfo
RegistryInfo RegistryInfo
Services ServiceSet
// AgentTLS allows providing user-managed TLS certificates for the agent. When nil, certs are auto-generated.
AgentTLS *pki.GeneratedPKI
// AgentMutationPolicy controls whether the agent mutates by default (default-mutate) or only on explicit label (default-ignore).
AgentMutationPolicy MutationPolicy
}
MergeOptions tracks the user-defined options during cluster initialization. TODO(mkcp): Provide semantic doccomments for how exported fields are used.
type MutationPolicy ¶ added in v0.78.0
type MutationPolicy string
MutationPolicy controls the agent's default mutation behavior.
const ( // MutationPolicyAll mutates all resources unless they carry zarf.dev/agent: ignore/skip. MutationPolicyAll MutationPolicy = "all" // MutationPolicyLabeled mutates only resources (or namespaces) labeled zarf.dev/agent: mutate. MutationPolicyLabeled MutationPolicy = "labeled" )
type PackageConnectivity ¶ added in v0.75.0
type PackageConnectivity string
PackageConnectivity defines the connectivity mode of package deployments.
const ( // PackageConnectivityAirGap is the default deploy mode. PackageConnectivityAirGap PackageConnectivity = "airgap" // PackageConnectivityConnected is used when a package is deployed with YOLO or in connected mode. PackageConnectivityConnected PackageConnectivity = "connected" )
func (PackageConnectivity) IsConnected ¶ added in v1.0.0
func (c PackageConnectivity) IsConnected() bool
IsConnected reports whether the connectivity mode uses a connected deployment.
func (PackageConnectivity) IsValid ¶ added in v1.0.0
func (c PackageConnectivity) IsValid() bool
IsValid reports whether the connectivity mode is supported. The empty value is accepted as the default airgap mode.
type PackageEvent ¶ added in v1.0.0
type PackageEvent struct {
Type EventType `json:"type"`
Outcome EventOutcome `json:"outcome"`
Timestamp time.Time `json:"timestamp"`
Version string `json:"version,omitempty"`
Flavor string `json:"flavor,omitempty"`
Digest digest.Digest `json:"digest,omitempty"`
Source string `json:"source,omitempty"`
ConfigDigest digest.Digest `json:"configDigest,omitempty"`
}
PackageEvent records a package lifecycle transition.
type RegistryInfo ¶ added in v0.56.0
type RegistryInfo struct {
// Username of a user with push access to the registry
PushUsername string `json:"pushUsername"`
// Password of a user with push access to the registry
PushPassword string `json:"pushPassword"`
// Username of a user with pull-only access to the registry. If not provided for an external registry than the push-user is used
PullUsername string `json:"pullUsername"`
// Password of a user with pull-only access to the registry. If not provided for an external registry than the push-user is used
PullPassword string `json:"pullPassword"`
// URL address of the registry
Address string `json:"address"`
// Port of the internal registry. In nodeport mode this is a Kubernetes NodePort, in proxy mode it is a host port.
Port int `json:"port"`
// Secret value that the registry was seeded with
Secret string `json:"secret"`
// RegistryMode defines how the registry is accessed (nodeport, proxy, or external)
RegistryMode RegistryMode `json:"registryMode"`
// MTLSStrategy defines who manages the mTLS certificates for the registry (defaults to none)
MTLSStrategy MTLSStrategy `json:"mtlsStrategy,omitempty"`
}
RegistryInfo contains information Zarf uses to communicate with a container registry to push/pull images.
func (*RegistryInfo) FillInEmptyValues ¶ added in v0.56.0
func (ri *RegistryInfo) FillInEmptyValues(ipFamily IPFamily) error
FillInEmptyValues sets every necessary value not already set to a reasonable default
func (RegistryInfo) Htpasswd ¶ added in v0.78.0
func (ri RegistryInfo) Htpasswd() (string, error)
Htpasswd returns an htpasswd-formatted string for the registry's push and pull users. Returns an empty string for external registries.
func (RegistryInfo) IsConfigured ¶ added in v0.75.0
func (ri RegistryInfo) IsConfigured() bool
IsConfigured returns true if the registry info address has been set
func (RegistryInfo) IsInternal ¶ added in v0.56.0
func (ri RegistryInfo) IsInternal() bool
IsInternal reports whether Zarf manages the registry.
func (RegistryInfo) KnownPlainHTTP ¶ added in v0.81.1
func (ri RegistryInfo) KnownPlainHTTP() (plainHTTP bool, known bool)
KnownPlainHTTP reports whether the registry's scheme is already certain without probing. Zarf-managed mTLS implies HTTPS, while Zarf's internal registry without mTLS only serves plain HTTP. known is false when the caller must negotiate the scheme.
func (RegistryInfo) ResolvePlainHTTP ¶ added in v0.83.0
func (ri RegistryInfo) ResolvePlainHTTP(ctx context.Context, host string, forcePlainHTTP bool, probe ocischeme.ProbeOptions) (bool, error)
ResolvePlainHTTP decides whether host should be reached over plain HTTP for this registry. A scheme known from state (KnownPlainHTTP) wins outright; otherwise a localhost registry is probed (unless forcePlainHTTP already forces plain HTTP), and every other host defaults to forcePlainHTTP. This is also the authoritative scheme resolver downstream consumers should call to determine scheme when pushing to a Zarf-deployed registry.
func (RegistryInfo) ShouldUseMTLS ¶ added in v0.71.0
func (ri RegistryInfo) ShouldUseMTLS() bool
ShouldUseMTLS returns true if mTLS should be used for the registry connection.
type RegistryMode ¶ added in v0.65.0
type RegistryMode string
RegistryMode defines how the registry is accessed
const ( // RegistryModeNodePort accesses the registry via NodePort service RegistryModeNodePort RegistryMode = "nodeport" // RegistryModeProxy accesses the registry via DaemonSet proxy RegistryModeProxy RegistryMode = "proxy" // RegistryModeExternal is used when the user has an external registry RegistryModeExternal RegistryMode = "external" )
type RemoveConfig ¶ added in v1.0.0
type RemoveConfig struct {
Values value.Values `json:"values,omitempty"`
NamespaceOverride string `json:"namespaceOverride,omitempty"`
// ComponentSelectors selects components to remove using names, globs, and "-"
// exclusions. Order and repetitions are preserved; the last matching entry wins.
// An empty list selects all eligible removal components.
ComponentSelectors []string `json:"componentSelectors,omitempty"`
}
RemoveConfig is the input configuration for package removal; only its digest is recorded.
type ServiceKey ¶ added in v0.75.1
type ServiceKey string
ServiceKey identifies a Zarf-managed service in state (registry, git, agent).
const ( RegistryKey ServiceKey = "registry" GitKey ServiceKey = "git" AgentKey ServiceKey = "agent" )
Credential keys
func AllServiceKeys ¶ added in v0.75.1
func AllServiceKeys() []ServiceKey
AllServiceKeys is the canonical ordered list of every supported service key.
func ParseServiceKey ¶ added in v0.75.1
func ParseServiceKey(s string) (ServiceKey, error)
ParseServiceKey returns the ServiceKey matching s, or an error if s is not recognized.
type ServiceSet ¶ added in v0.75.1
type ServiceSet map[ServiceKey]struct{}
ServiceSet is an unordered set of ServiceKeys.
func NewServiceSet ¶ added in v0.75.1
func NewServiceSet(keys ...ServiceKey) ServiceSet
NewServiceSet returns a ServiceSet populated with the given keys.
func (ServiceSet) Add ¶ added in v0.75.1
func (s ServiceSet) Add(k ServiceKey)
Add inserts k into the set.
func (ServiceSet) Has ¶ added in v0.75.1
func (s ServiceSet) Has(k ServiceKey) bool
Has reports whether k is in the set.
type State ¶
type State struct {
// ZarfAppliance reports whether Zarf installed the cluster control plane and can run host cleanup on destroy.
ZarfAppliance bool `json:"zarfAppliance"`
// The IP family of the cluster, can be ipv4, ipv6, or dual
IPFamily IPFamily `json:"ipFamily,omitempty"`
// AgentInfo contains information Zarf uses to configure the agent.
AgentInfo AgentInfo `json:"agentInfo"`
InjectorInfo InjectorInfo `json:"injectorInfo"`
// Information about the repository Zarf is configured to use
GitServer GitServerInfo `json:"gitServer"`
// Information about the container registry Zarf is configured to use
RegistryInfo RegistryInfo `json:"registryInfo"`
}
State is maintained as a secret in the Zarf namespace to track Zarf init data.