types

package
v0.42.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Overview

Package types contains all the types used by Zarf.

Package types contains all the types used by Zarf.

Package types contains all the types used by Zarf.

Index

Constants

View Source
const (
	ZarfGeneratedPasswordLen               = 24
	ZarfGeneratedSecretLen                 = 48
	ZarfInClusterContainerRegistryNodePort = 31999
	ZarfRegistryPushUser                   = "zarf-push"
	ZarfRegistryPullUser                   = "zarf-pull"

	ZarfGitPushUser = "zarf-git-user"
	ZarfGitReadUser = "zarf-git-read-user"

	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

This section is empty.

Types

type ArtifactServerInfo

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

func (as *ArtifactServerInfo) FillInEmptyValues()

FillInEmptyValues sets every necessary value that's currently empty to a reasonable default

func (ArtifactServerInfo) IsInternal added in v0.38.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 ComponentStatus

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

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

type ConnectStrings map[string]ConnectString

ConnectStrings is a map of connect names to connection information.

type DeployedComponent

type DeployedComponent struct {
	Name            string           `json:"name"`
	InstalledCharts []InstalledChart `json:"installedCharts"`
}

DeployedComponent contains information about a Zarf Package Component that has been deployed to a cluster.

type DeployedPackage

type DeployedPackage struct {
	Name               string               `json:"name"`
	Data               v1alpha1.ZarfPackage `json:"data"`
	CLIVersion         string               `json:"cliVersion"`
	DeployedComponents []DeployedComponent  `json:"deployedComponents"`
	ConnectStrings     ConnectStrings       `json:"connectStrings,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).

type DifferentialData

type DifferentialData struct {
	DifferentialImages         map[string]bool
	DifferentialRepos          map[string]bool
	DifferentialPackageVersion string
}

DifferentialData contains image and repository information about the package a Differential Package is Based on.

type GeneratedPKI

type GeneratedPKI struct {
	CA   []byte `json:"ca"`
	Cert []byte `json:"cert"`
	Key  []byte `json:"key"`
}

GeneratedPKI is a struct for storing generated PKI data.

type GitServerInfo

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

func (gs *GitServerInfo) FillInEmptyValues() error

FillInEmptyValues sets every necessary value that's currently empty to a reasonable default

func (GitServerInfo) IsInternal added in v0.38.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 InstalledChart

type InstalledChart struct {
	Namespace      string         `json:"namespace"`
	ChartName      string         `json:"chartName"`
	ConnectStrings ConnectStrings `json:"connectStrings,omitempty"`
}

InstalledChart contains information about a Helm Chart that has been deployed to a cluster.

type PackagerConfig

type PackagerConfig struct {
	// Context provides deadlines, cancellations, and values throughout the API.
	// NOTE(mkcp): Storing ctx on structs is not recommended, but this is intended as a temporary workaround.
	Context context.Context

	// CreateOpts tracks the user-defined options used to create the package
	CreateOpts ZarfCreateOptions

	// PkgOpts tracks user-defined options
	PkgOpts ZarfPackageOptions

	// DeployOpts tracks user-defined values for the active deployment
	DeployOpts ZarfDeployOptions

	// MirrorOpts tracks user-defined values for the active mirror
	MirrorOpts ZarfMirrorOptions

	// InitOpts tracks user-defined values for the active Zarf initialization.
	InitOpts ZarfInitOptions

	// InspectOpts tracks user-defined options used to inspect the package
	InspectOpts ZarfInspectOptions

	// PublishOpts tracks user-defined options used to publish the package
	PublishOpts ZarfPublishOptions

	// PullOpts tracks user-defined options used to pull packages
	PullOpts ZarfPullOptions

	// FindImagesOpts tracks user-defined options used to find images
	FindImagesOpts ZarfFindImagesOptions

	// GenerateOpts tracks user-defined values for package generation.
	GenerateOpts ZarfGenerateOptions

	// The package data
	Pkg v1alpha1.ZarfPackage
}

PackagerConfig is the main struct that the packager uses to hold high-level options.

type RegistryInfo

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

func (ri *RegistryInfo) FillInEmptyValues() error

FillInEmptyValues sets every necessary value not already set to a reasonable default

func (RegistryInfo) IsInternal added in v0.38.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 ZarfCommonOptions

type ZarfCommonOptions struct {
	// Verify that Zarf should perform an action
	Confirm bool
	// Allow insecure connections for remote packages
	Insecure bool
	// Disable checking the server TLS certificate for validity
	InsecureSkipTLSVerify bool
	// Force connections to be over http instead of https
	PlainHTTP bool
	// Path to use to cache images and git repos on package create
	CachePath string
	// Location Zarf should use as a staging ground when managing files and images for package creation and deployment
	TempDirectory string
	// Number of concurrent layer operations to perform when interacting with a remote package
	OCIConcurrency int
}

ZarfCommonOptions tracks the user-defined preferences used across commands.

type ZarfCreateOptions

type ZarfCreateOptions struct {
	// Disable the generation of SBOM materials during package creation
	SkipSBOM bool
	// Location where the Zarf package will be created from
	BaseDir string
	// Location where the finalized Zarf package will be placed
	Output string
	// Whether to pause to allow for viewing the SBOM post-creation
	ViewSBOM bool
	// Location to output an SBOM into after package creation
	SBOMOutputDir string
	// Key-Value map of variable names and their corresponding values that will be used to template against the Zarf package being used
	SetVariables map[string]string
	// Size of chunks to use when splitting a zarf package into multiple files in megabytes
	MaxPackageSizeMB int
	// Location where the private key component of a cosign key-pair can be found
	SigningKeyPath string
	// Password to the private key signature file that will be used to sigh the created package
	SigningKeyPassword string
	// Path to a previously built package used as the basis for creating a differential package
	DifferentialPackagePath string
	// A map of domains to override on package create when pulling images
	RegistryOverrides map[string]string
	// An optional variant that controls which components will be included in a package
	Flavor string
	// Whether to create a skeleton package
	IsSkeleton bool
	// Whether to create a YOLO package
	NoYOLO bool
}

ZarfCreateOptions tracks the user-defined options used to create the package.

type ZarfDeployOptions

type ZarfDeployOptions struct {
	// Whether to adopt any pre-existing K8s resources into the Helm charts managed by Zarf
	AdoptExistingResources bool
	// Timeout for performing Helm operations
	Timeout time.Duration
	// [Library Only] A map of component names to chart names containing Helm Chart values to override values on deploy
	ValuesOverridesMap map[string]map[string]map[string]interface{}
	// [Dev Deploy Only] Manual override for ###ZARF_REGISTRY###
	RegistryURL string
}

ZarfDeployOptions tracks the user-defined preferences during a package deploy.

type ZarfFindImagesOptions

type ZarfFindImagesOptions struct {
	// Path to the helm chart directory
	RepoHelmChartPath string
	// Kubernetes version to use for the helm chart
	KubeVersionOverride string
	// Manual override for ###ZARF_REGISTRY###
	RegistryURL string
	// Find the location of the image given as an argument and print it to the console
	Why string
	// Optionally skip lookup of cosign artifacts when finding images
	SkipCosign bool
}

ZarfFindImagesOptions tracks the user-defined preferences during a prepare find-images search.

type ZarfGenerateOptions

type ZarfGenerateOptions struct {
	// Name of the package being generated
	Name string
	// URL to the source git repository
	URL string
	// Version of the chart to use
	Version string
	// Relative path to the chart in the git repository
	GitPath string
	// Location where the finalized zarf.yaml will be placed
	Output string
}

ZarfGenerateOptions tracks the user-defined options during package generation.

type ZarfInitOptions

type ZarfInitOptions struct {
	// Indicates if Zarf was initialized while deploying its own k8s cluster
	ApplianceMode bool
	// Information about the repository Zarf is going to be using
	GitServer GitServerInfo
	// Information about the container registry Zarf is going to be using
	RegistryInfo RegistryInfo
	// Information about the artifact registry Zarf is going to be using
	ArtifactServer ArtifactServerInfo
	// StorageClass of the k8s cluster Zarf is initializing
	StorageClass string
}

ZarfInitOptions tracks the user-defined options during cluster initialization.

type ZarfInspectOptions

type ZarfInspectOptions struct {
	// View SBOM contents while inspecting the package
	ViewSBOM bool
	// Location to output an SBOM into after package inspection
	SBOMOutputDir string
	// ListImages will list the images in the package
	ListImages bool
}

ZarfInspectOptions tracks the user-defined preferences during a package inspection.

type ZarfMirrorOptions

type ZarfMirrorOptions struct {
	// Whether to skip adding a Zarf checksum to image references
	NoImgChecksum bool
}

ZarfMirrorOptions tracks the user-defined preferences during a package mirror.

type ZarfPackageOptions

type ZarfPackageOptions struct {
	// The SHA256 checksum of the package
	Shasum string
	// Location where a Zarf package can be found
	PackageSource string
	// Comma separated list of optional components
	OptionalComponents string
	// Location where the public key component of a cosign key-pair can be found
	SGetKeyPath string
	// Key-Value map of variable names and their corresponding values that will be used to template manifests and files in the Zarf package
	SetVariables map[string]string
	// Location where the public key component of a cosign key-pair can be found
	PublicKeyPath string
	// The number of retries to perform for Zarf deploy operations like image pushes or Helm installs
	Retries int
	// Skip validating the signature of the Zarf package
	SkipSignatureValidation bool
}

ZarfPackageOptions tracks the user-defined preferences during common package operations.

type ZarfPublishOptions

type ZarfPublishOptions struct {
	// Location where the Zarf package will be published to
	PackageDestination string
	// Password to the private key signature file that will be used to sign the published package
	SigningKeyPassword string
	// Location where the private key component of a cosign key-pair can be found
	SigningKeyPath string
}

ZarfPublishOptions tracks the user-defined preferences during a package publish.

type ZarfPullOptions

type ZarfPullOptions struct {
	// Location where the pulled Zarf package will be placed
	OutputDirectory string
}

ZarfPullOptions tracks the user-defined preferences during a package pull.

type ZarfSplitPackageData

type ZarfSplitPackageData struct {
	// The sha256sum of the package
	Sha256Sum string
	// The size of the package in bytes
	Bytes int64
	// The number of parts the package is split into
	Count int
}

ZarfSplitPackageData contains info about a split package.

type ZarfState

type ZarfState 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 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"`
}

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

Jump to

Keyboard shortcuts

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