Documentation
¶
Overview ¶
Package state manages references to a logical zarf deployment in k8s.
Index ¶
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 ( 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.
const ( ZarfGeneratedPasswordLen = 24 ZarfGeneratedSecretLen = 48 ZarfInClusterContainerRegistryNodePort = 31999 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" ZarfInClusterArtifactServiceURL = ZarfInClusterGitServiceURL + "/api/packages/" + ZarfGitPushUser )
Values during setup of the initial zarf state
Variables ¶
This section is empty.
Functions ¶
func DebugPrint ¶
DebugPrint takes a State struct, sanitizes sensitive fields, and prints them.
Types ¶
type ArtifactServerInfo ¶ added in v0.56.0
type ArtifactServerInfo struct {
// Username of a user with push access to the artifact registry
PushUsername string `json:"pushUsername"`
// Password of a user with push access to the artifact registry
PushToken string `json:"pushPassword"`
// URL address of the artifact registry
Address string `json:"address"`
}
ArtifactServerInfo contains information Zarf uses to communicate with a artifact registry to push/pull repositories to.
func (*ArtifactServerInfo) FillInEmptyValues ¶ added in v0.56.0
func (as *ArtifactServerInfo) FillInEmptyValues()
FillInEmptyValues sets every necessary value that's currently empty to a reasonable default
func (ArtifactServerInfo) IsInternal ¶ added in v0.56.0
func (as ArtifactServerInfo) IsInternal() bool
IsInternal returns true if the artifact server URL is equivalent to the artifact server deployed through the default init package
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"`
}
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) IsInternal ¶ added in v0.56.0
func (gs GitServerInfo) IsInternal() bool
IsInternal returns true if the git server URL is equivalent to a git server deployed through the default init package
type MergeOptions ¶
type MergeOptions struct {
GitServer GitServerInfo
RegistryInfo RegistryInfo
ArtifactServer ArtifactServerInfo
Services []string
}
MergeOptions tracks the user-defined options during cluster initialization. TODO(mkcp): Provide semantic doccomments for how exported fields are used.
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"`
// Nodeport of the registry. Only needed if the registry is running inside the kubernetes cluster
NodePort int `json:"nodePort"`
// Secret value that the registry was seeded with
Secret string `json:"secret"`
}
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() error
FillInEmptyValues sets every necessary value not already set to a reasonable default
func (RegistryInfo) IsInternal ¶ added in v0.56.0
func (ri RegistryInfo) IsInternal() bool
IsInternal returns true if the registry URL is equivalent to the registry deployed through the default init package
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 GitServerInfo `json:"gitServer"`
// Information about the container registry Zarf is configured to use
RegistryInfo RegistryInfo `json:"registryInfo"`
// Information about the artifact registry Zarf is configured to use
ArtifactServer ArtifactServerInfo `json:"artifactServer"`
}
State is maintained as a secret in the Zarf namespace to track Zarf init data.