k8sinit

package
v0.0.0-...-664ceaa Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddonConfiguration

type AddonConfiguration struct {
	// Name of the addon to configure.
	Name string `yaml:"name"`

	// Disable the addon.
	Disable bool `yaml:"disable"`

	// Arguments is optional arguments passed to the addon enable or disable operation.
	Arguments []string `yaml:"args"`
}

AddonConfiguration specifies an addon to be enabled or disabled.

type AddonRepositoryConfiguration

type AddonRepositoryConfiguration struct {
	// Name of the addon repository.
	Name string `yaml:"name"`
	// URL of the addon repository.
	URL string `yaml:"url"`
	// Reference is an optional reference to check out instead of the default branch.
	Reference string `yaml:"reference"`
}

AddonRepositoryConfiguration specifies an addon repository to be added.

type Configuration

type Configuration struct {
	// Version is the semantic version of the configuration file format.
	Version string `yaml:"version"`

	// AddonRepositories is extra addon repositories to configure on the local node.
	AddonRepositories []AddonRepositoryConfiguration `yaml:"addonRepositories"`

	// Addons is a list of addons to enable and/or disable.
	Addons []AddonConfiguration `yaml:"addons"`

	// ExtraKubeletArgs is a list of extra arguments to add to the local node kubelet.
	// Set a value to null to remove it from the arguments.
	ExtraKubeletArgs map[string]*string `yaml:"extraKubeletArgs"`

	// ExtraKubeAPIServerArgs is a list of extra arguments to add to the local node kube-apiserver.
	// Set a value to null to remove it from the arguments.
	ExtraKubeAPIServerArgs map[string]*string `yaml:"extraKubeAPIServerArgs"`

	// ExtraKubeProxyArgs is a list of extra arguments to add to the local node kube-proxy.
	// Set a value to null to remove it from the arguments.
	ExtraKubeProxyArgs map[string]*string `yaml:"extraKubeProxyArgs"`

	// ExtraKubeControllerManagerArgs is a list of extra arguments to add to the local node kube-controller-manager.
	// Set a value to null to remove it from the arguments.
	ExtraKubeControllerManagerArgs map[string]*string `yaml:"extraKubeControllerManagerArgs"`

	// ExtraKubeSchedulerArgs is a list of extra arguments to add to the local node kube-scheduler.
	// Set a value to null to remove it from the arguments.
	ExtraKubeSchedulerArgs map[string]*string `yaml:"extraKubeSchedulerArgs"`

	// ExtraKubeliteEnv is extra environment variables (e.g. GOFIPS) for the local node Kubernetes services.
	ExtraKubeliteEnv map[string]*string `yaml:"extraKubeliteEnv"`

	// ExtraSANs are a list of extra Subject Alternate Names to add to the local API server.
	ExtraSANs *[]string `yaml:"extraSANs"`

	// ContainerdRegistryConfigs is containerd hosts.toml configurations to configure registries.
	ContainerdRegistryConfigs map[string]string `yaml:"containerdRegistryConfigs"`

	// ExtraContainerdArgs is a list of extra arguments to add to the local node containerd.
	// Set a value to null to remove it from the arguments.
	ExtraContainerdArgs map[string]*string `yaml:"extraContainerdArgs"`

	// ExtraContainerdEnv is extra environment variables (e.g. proxy configuration) for the local node containerd.
	// Set a value to null to remove it from the environment.
	ExtraContainerdEnv map[string]*string `yaml:"extraContainerdEnv"`

	// ExtraDqliteArgs is a list of extra arguments to add to the local node Dqlite.
	// Set a value to null to remove it from the arguments.
	ExtraDqliteArgs map[string]*string `yaml:"extraDqliteArgs"`

	// ExtraDqliteEnv is extra environment variables (e.g. dqlite debug flags) for the local node dqlite.
	// Set a value to null to remove it from the environment.
	ExtraDqliteEnv map[string]*string `yaml:"extraDqliteEnv"`

	// ExtraMicroK8sClusterAgentArgs is a list of extra arguments to add to the local node cluster-agent.
	// Set a value to null to remove it from the arguments.
	ExtraMicroK8sClusterAgentArgs map[string]*string `yaml:"extraMicroK8sClusterAgentArgs"`

	// ExtraMicroK8sClusterAgentEnv is extra environment variables (e.g. GOFIPS) for the local node cluster-agent.
	// Set a value to null to remove it from the environment.
	ExtraMicroK8sClusterAgentEnv map[string]*string `yaml:"extraMicroK8sClusterAgentEnv"`

	// ExtraMicroK8sAPIServerProxyArgs is a list of extra arguments (e.g. --refresh-interval) to add to the local node apiserver-proxy used by worker nodes.
	// Set a value to null to remove it from the arguments.
	ExtraMicroK8sAPIServerProxyArgs map[string]*string `yaml:"extraMicroK8sAPIServerProxyArgs"`

	// ExtraMicroK8sAPIServerProxyEnv is extra environment variables (e.g. GOFIPS) for the local node apiserver-proxy.
	// Set a value to null to remove it from the environment.
	ExtraMicroK8sAPIServerProxyEnv map[string]*string `yaml:"extraMicroK8sAPIServerProxyEnv"`

	// ExtraEtcdArgs is a list of extra arguments to add to the local node etcd.
	// Set a value to null to remove it from the arguments.
	ExtraEtcdArgs map[string]*string `yaml:"extraEtcdArgs"`

	// ExtraEtcdEnv is extra environment variables (e.g. GOFIPS) for the local node etcd.
	// Set a value to null to remove it from the environment.
	ExtraEtcdEnv map[string]*string `yaml:"extraEtcdEnv"`

	// ExtraFlanneldArgs is a list of extra arguments to add to the local node flanneld.
	// Set a value to null to remove it from the arguments.
	ExtraFlanneldArgs map[string]*string `yaml:"extraFlanneldArgs"`

	// ExtraFlanneldEnv is extra environment variables (e.g. GOFIPS) for the local node flanneld.
	// Set a value to null to remove it from the environment.
	ExtraFlanneldEnv map[string]*string `yaml:"extraFlanneldEnv"`

	// ExtraConfigFiles is extra service configuration files to create (e.g. for configuring kube-apiserver encryption at rest).
	// These files will be written at $SNAP_DATA/args/<filename>.
	ExtraConfigFiles map[string]string `yaml:"extraConfigFiles"`

	// PersistentClusterToken is a token that may be used to authentication join requests to the local node.
	PersistentClusterToken string `yaml:"persistentClusterToken"`

	// Join configuration. Setting this will attempt to join the local node to an already existing MicroK8s cluster.
	Join JoinConfiguration `yaml:"join"`

	// ExtraCNIEnv is configuration of network such us IPv4/v6 cluster and service CIDRs.
	ExtraCNIEnv map[string]*string `yaml:"extraCNIEnv"`

	// ExtraFIPSEnv is configuration for MicroK8s to run in FIPS mode.
	ExtraFIPSEnv map[string]*string `yaml:"extraFIPSEnv"`
}

Configuration is the top-level definition for MicroK8s configuration files.

func ParseConfiguration

func ParseConfiguration(input []byte) (*Configuration, error)

ParseConfiguration tries to parse a Configuration object from YAML data.

type JoinConfiguration

type JoinConfiguration struct {
	// URL is the URL passed to the microk8s join command.
	URL string `yaml:"url"`

	// Worker is true when joining the cluster as a worker-only node.
	Worker bool `yaml:"worker"`
}

JoinConfiguration is configuration to join the local node to an existing MicroK8s cluster.

type Launcher

type Launcher struct {
	// contains filtered or unexported fields
}

Launcher is used to apply launch configurations to the MicroK8s cluster.

func NewLauncher

func NewLauncher(s snap.Snap, preInit bool) *Launcher

NewLauncher creates a new launcher instance. preInit is true when applying the configuration prior to any of the services running.

func (*Launcher) Apply

Apply applies a multi-part configuration to the local MicroK8s node.

type MultiPartConfiguration

type MultiPartConfiguration struct {
	// Parts are configuration objects that are meant to be applied in order.
	Parts []*Configuration
}

MultiPartConfiguration is a configuration split into multiple parts.

func ParseMultiPartConfiguration

func ParseMultiPartConfiguration(b []byte) (MultiPartConfiguration, error)

ParseMultiPartConfiguration parses a multiple YAML configuration objects into a MultiPartConfiguration.

Jump to

Keyboard shortcuts

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