Documentation
¶
Overview ¶
Package cluster is for the api representation of Cluster
Index ¶
- Constants
- Variables
- type ZarfCluster
- type ZarfClusterConfig
- type ZarfClusterFiles
- type ZarfClusterMetadata
- type ZarfClusterProfiles
- type ZarfClusterRegistries
- type ZarfClusterRegistryAuth
- type ZarfClusterRegistryProxy
- type ZarfClusterSpec
- type ZarfHost
- func (h *ZarfHost) Arch() (string, error)
- func (h *ZarfHost) CheckHTTPStatus(url string, expected ...int) error
- func (h *ZarfHost) DeleteFile(path string) error
- func (h *ZarfHost) Dir(path string) (string, error)
- func (h *ZarfHost) FileChanged(lpath, rpath string) bool
- func (h *ZarfHost) FileExist(path string) bool
- func (h *ZarfHost) IsController() bool
- func (h *ZarfHost) KubeRole() string
- func (h *ZarfHost) OSKind() (string, error)
- func (h *ZarfHost) ReadFile(path string) (string, error)
- func (h *ZarfHost) ResolveConfigurer() error
- func (h *ZarfHost) ServiceName() string
- func (h *ZarfHost) Touch(path string, modTime time.Time, opts ...exec.Option) error
- func (h *ZarfHost) WriteFile(path string, data string, permissions string) error
- type ZarfHostMetadata
- type ZarfHostPort
- type ZarfHosts
- func (hosts ZarfHosts) BatchedParallelEach(ctx context.Context, batchSize int, ...) error
- func (hosts ZarfHosts) Controllers() ZarfHosts
- func (hosts ZarfHosts) Each(ctx context.Context, filters ...func(context.Context, *ZarfHost) error) error
- func (hosts ZarfHosts) Filter(filter func(h *ZarfHost) bool) ZarfHosts
- func (hosts ZarfHosts) Find(filter func(h *ZarfHost) bool) *ZarfHost
- func (hosts ZarfHosts) First() *ZarfHost
- func (hosts ZarfHosts) Last() *ZarfHost
- func (hosts ZarfHosts) ParallelEach(ctx context.Context, filters ...func(context.Context, *ZarfHost) error) error
- func (hosts ZarfHosts) WithRole(s string) ZarfHosts
- func (hosts ZarfHosts) Workers() ZarfHosts
- type ZarfRuntimeMeta
Constants ¶
const ( // RoleController string enum RoleController = "controller" // RoleControllerWorker string enum RoleControllerWorker = "controller+worker" // RoleSingle string enum RoleSingle = "single" // RoleWorker string enum RoleWorker = "worker" // RoleError string enum RoleError = "error" )
Variables ¶
var ErrCommandFailed = errors.New("command failed")
ErrCommandFailed is returned when a command fails
Functions ¶
This section is empty.
Types ¶
type ZarfCluster ¶
type ZarfCluster struct {
APIVersion string `json:"apiVersion,omitempty" jsonschema:"enum=zarf.dev/v1alpha1"`
Kind v1alpha1.ZarfDistroKind `json:"kind" jsonschema:"enum=ZarfCluster"`
Metadata ZarfClusterMetadata `json:"metadata"`
Spec ZarfClusterSpec `json:"spec"`
RuntimeMetadata ZarfRuntimeMeta `json:"-"`
}
ZarfCluster root for a cluster config
type ZarfClusterConfig ¶
type ZarfClusterConfig struct {
LoadBalancer string `json:"loadbalancer" jsonschema:"format=hostname"`
Registries []ZarfClusterRegistries `json:"registries,omitempty"`
Profiles []ZarfClusterProfiles `json:"profiles,omitempty"`
}
ZarfClusterConfig for a cluster
type ZarfClusterFiles ¶
type ZarfClusterFiles struct {
Name string `json:"name"`
Source string `json:"src,omitempty"`
Destination string `json:"dst,omitempty"`
DestinationDirectory string `json:"dstDir,omitempty"`
Permission string `json:"perm,omitempty"`
User string `json:"user,omitempty" jsonschema:"example=root"`
Group string `json:"group,omitempty" jsonschema:"example=root"`
Data string `json:"data,omitempty"`
}
ZarfClusterFiles data
type ZarfClusterMetadata ¶
type ZarfClusterMetadata struct {
Name string `json:"name" jsonschema:"pattern=^[a-z0-9][a-z0-9\\-]*$"`
Description string `json:"description,omitempty"`
Version string `json:"version,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
ZarfClusterMetadata a cluster config
type ZarfClusterProfiles ¶
type ZarfClusterProfiles struct {
Name string `json:"name"`
Kubelet map[string]any `json:"kubeletConfig,omitempty"`
Engine map[string]any `json:"engineConfig,omitempty"`
}
ZarfClusterProfiles for the engine
type ZarfClusterRegistries ¶
type ZarfClusterRegistries struct {
// Name of the registry
Name string `json:"name"`
// Authentication for the registry
Authentication ZarfClusterRegistryAuth `json:"auth,omitempty"`
// Proxy for the registry
Proxy ZarfClusterRegistryProxy `json:"proxy"`
}
ZarfClusterRegistries overrides
type ZarfClusterRegistryAuth ¶
type ZarfClusterRegistryAuth struct {
// Username for the remote registry
Username string `json:"user,omitempty"`
// Password for the remote registry
Password string `json:"pass,omitempty"`
// Token for the remote registry
Token string `json:"token,omitempty"`
}
ZarfClusterRegistryAuth information
type ZarfClusterRegistryProxy ¶
type ZarfClusterRegistryProxy struct {
// URL to the registry that will engine will now pull from
URL string `json:"url"`
}
ZarfClusterRegistryProxy override for the registry information
type ZarfClusterSpec ¶
type ZarfClusterSpec struct {
Config ZarfClusterConfig `json:"config"`
Hosts ZarfHosts `json:"hosts" jsonschema:"minItems=1"`
}
ZarfClusterSpec a cluster config
type ZarfHost ¶
type ZarfHost struct {
rig.Connection `json:",inline"`
//keep-sorted start
Environment map[string]string `json:"environment,omitempty"`
Files []ZarfClusterFiles `json:"files,omitempty"`
Hostname string `json:"hostname,omitempty"`
NodeLabels map[string]string `json:"labels,omitempty"`
NodeTaints []string `json:"taints,omitempty"`
Ports []ZarfHostPort `json:"ports,omitempty" xml:"port"`
PrivateAddress string `json:"privateAddress,omitempty"`
PrivateInterface string `json:"privateInterface,omitempty"`
Profile string `json:"profile,omitempty"`
Role string `json:"role" jsonschema:"enum=controller,enum=controller+worker,enum=single,enum=worker"`
//keep-sorted end
Configurer os.Configurer `json:"-"`
Metadata ZarfHostMetadata `json:"-"`
}
ZarfHost is a remote connection to a node
func (*ZarfHost) CheckHTTPStatus ¶
CheckHTTPStatus will perform a web request to the url and return an error if the http status is not the expected
func (*ZarfHost) DeleteFile ¶
DeleteFile removes a file via the resolved configurer.
func (*ZarfHost) FileChanged ¶
FileChanged returns true when a remote file has a different sha256 checksum or if an error occurs
func (*ZarfHost) IsController ¶
IsController returns true for controller and controller+worker roles
func (*ZarfHost) ResolveConfigurer ¶
ResolveConfigurer assigns a rig-style configurer to the Host (see configurer/)
func (*ZarfHost) ServiceName ¶
ServiceName returns correct service name
type ZarfHostMetadata ¶
type ZarfHostMetadata struct {
//keep-sorted start
Arch string
BinaryTempFile []string
DistroVersion string
EngineUploaded bool
ExistingConfig string
Hostname string
Install func(context.Context, *ZarfHost) error
Installed bool
IsLeader bool
MachineID string
NeedsUpgrade bool
NewConfig string
Ready bool
}
ZarfHostMetadata runtime discovered values
type ZarfHostPort ¶
type ZarfHostPort struct {
Protocol string `json:"protocol" xml:"protocol,attr" jsonschema:"enum=tcp,enum=udp"`
Port string `json:"port" xml:"port,attr" jsonschema:"oneof_type=string;integer"`
}
ZarfHostPort ports that should be opened on the public side of the firewall
type ZarfHosts ¶
type ZarfHosts []*ZarfHost
ZarfHosts are the hosts that will be managed
func (ZarfHosts) BatchedParallelEach ¶
func (hosts ZarfHosts) BatchedParallelEach(ctx context.Context, batchSize int, filter ...func(context.Context, *ZarfHost) error) error
BatchedParallelEach runs a function (or multiple functions chained) on every Host parallelly in groups of batchSize hosts.
func (ZarfHosts) Controllers ¶
Controllers returns hosts with the role "controller"
func (ZarfHosts) Each ¶
func (hosts ZarfHosts) Each(ctx context.Context, filters ...func(context.Context, *ZarfHost) error) error
Each runs a function (or multiple functions chained) on every Host.
func (ZarfHosts) Filter ¶
Filter returns a filtered list of Hosts. The filter function should return true for hosts matching the criteria.
func (ZarfHosts) Find ¶
Find returns the first matching Host. The finder function should return true for a Host matching the criteria.
func (ZarfHosts) ParallelEach ¶
func (hosts ZarfHosts) ParallelEach(ctx context.Context, filters ...func(context.Context, *ZarfHost) error) error
ParallelEach runs a function (or multiple functions chained) on every Host parallelly. Any errors will be concatenated and returned.