kubernetes

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeTypeServer = "server"
	NodeTypeAgent  = "agent"
)

Variables

This section is empty.

Functions

func IsIPv6Priority

func IsIPv6Priority(serverConfig ConfigMap) bool

func IsNodeIPSet

func IsNodeIPSet(serverConfig ConfigMap) bool

func ServersCount

func ServersCount(nodes Nodes) int

Types

type Cluster

type Cluster struct {
	// ServerConfig contains the server configurations for a single node cluster
	// or the additional server nodes in a multi node cluster.
	ServerConfig ConfigMap
	// InitServerConfig contains the initial server configurations for a multi node cluster
	InitServerConfig ConfigMap
	// AgentConfig contains the agent configurations in multi node clusters.
	AgentConfig ConfigMap
	// RegistriesConfig contains the configurations for private or embedded registries
	RegistriesConfig ConfigMap
}

func NewCluster

func NewCluster(s *sys.System, kube *Kubernetes) (*Cluster, error)

type Config

type Config struct {
	// AgentFilePath path to agent.yaml rke2 configuration file
	AgentFilePath string
	// ServerFilePath path to server.yaml rke2 configuration file
	ServerFilePath string
	// RegistriesFilePath path to the registries.yaml rke2 configuration file
	RegistriesFilePath string
}

type ConfigMap

type ConfigMap map[string]any

func ParseKubernetesConfig

func ParseKubernetesConfig(s *sys.System, configFile string) (ConfigMap, error)

type Helm

type Helm struct {
	Charts       []*HelmChart      `yaml:"charts" validate:"dive"`
	Repositories []*HelmRepository `yaml:"repositories" validate:"dive"`
}

func (*Helm) ChartRepositories

func (h *Helm) ChartRepositories() map[string]string

func (*Helm) ValueFiles

func (h *Helm) ValueFiles() map[string]string

type HelmChart

type HelmChart struct {
	Name            string `yaml:"name" validate:"required"`
	RepositoryName  string `yaml:"repositoryName" validate:"required"`
	Version         string `yaml:"version" validate:"required"`
	TargetNamespace string `yaml:"targetNamespace" validate:"required"`
	ValuesFile      string `yaml:"valuesFile"`
}

func (*HelmChart) GetInlineValues

func (c *HelmChart) GetInlineValues() map[string]any

func (*HelmChart) GetName

func (c *HelmChart) GetName() string

func (*HelmChart) GetRepositoryName

func (c *HelmChart) GetRepositoryName() string

func (*HelmChart) ToCRD

func (c *HelmChart) ToCRD(values []byte, repository string, hasAuth, skipTLSVerify bool) *helm.CRD

type HelmRepository

type HelmRepository struct {
	Name                  string            `yaml:"name" validate:"required"`
	URL                   string            `yaml:"url" validate:"required,url"`
	Credentials           *auth.Credentials `yaml:"credentials,omitempty"`
	InsecureSkipTLSVerify bool              `yaml:"insecureSkipTLSVerify,omitempty"`
}

type Kubernetes

type Kubernetes struct {
	// RemoteManifests - manifest URLs specified under config/kubernetes/cluster.yaml
	RemoteManifests []string `yaml:"manifests,omitempty" validate:"dive,required,url"`
	// Helm - charts specified under config/kubernetes/cluster.yaml
	Helm *Helm `yaml:"helm,omitempty" validate:"omitempty"`
	// LocalManifests - local manifest files specified under config/kubernetes/manifests
	LocalManifests []string
	Nodes          Nodes   `yaml:"nodes,omitempty" validate:"dive"`
	Network        Network `yaml:"network,omitempty"`
	Config         Config  `yaml:"-"`
}

type Network

type Network struct {
	APIHost string `yaml:"apiHost"`
	APIVIP4 string `yaml:"apiVIP,omitempty" validate:"omitempty"`
	APIVIP6 string `yaml:"apiVIP6,omitempty" validate:"omitempty,ipv6"`
}

func (Network) IsHA

func (n Network) IsHA() bool

type Node

type Node struct {
	Hostname string `yaml:"hostname" validate:"required,hostname"`
	Type     string `yaml:"type" validate:"required,oneof=server agent"`
	Init     bool   `yaml:"init,omitempty"`
}

func FindInitNode

func FindInitNode(nodes Nodes) (*Node, error)

FindInitNode loops through the nodes and returns the first one with init field set to true, or if none found, picks the first server Node.

type Nodes

type Nodes []Node

func FilterNodeType

func FilterNodeType(nodes Nodes, nodeType string) Nodes

func FilterServers

func FilterServers(nodes Nodes) Nodes

Jump to

Keyboard shortcuts

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