v1beta1

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Overview

Copyright 2021 k0s authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	EtcdStorageType = "etcd"
	KineStorageType = "kine"
)

supported storage types

Variables

This section is empty.

Functions

func IsIPv6String added in v0.11.0

func IsIPv6String(ip string) bool

IsIPv6String returns if ip is IPv6.

Types

type APISpec

type APISpec struct {
	Address         string            `yaml:"address"`
	Port            int               `yaml:"port"`
	K0sAPIPort      int               `yaml:"k0sApiPort,omitempty"`
	ExternalAddress string            `yaml:"externalAddress,omitempty"`
	SANs            []string          `yaml:"sans"`
	ExtraArgs       map[string]string `yaml:"extraArgs,omitempty"`
}

APISpec ...

func DefaultAPISpec

func DefaultAPISpec() *APISpec

DefaultAPISpec default settings for api

func (*APISpec) APIAddress

func (a *APISpec) APIAddress() string

APIAddress ...

func (*APISpec) APIAddressURL added in v0.10.0

func (a *APISpec) APIAddressURL() string

APIAddressURL returns kube-apiserver external URI

func (*APISpec) K0sControlPlaneAPIAddress added in v0.9.0

func (a *APISpec) K0sControlPlaneAPIAddress() string

K0sControlPlaneAPIAddress returns the controller join APIs address

func (*APISpec) Sans added in v0.9.0

func (a *APISpec) Sans() []string

Sans return the given SANS plus all local adresses and externalAddress if given

func (*APISpec) Validate added in v0.11.0

func (a *APISpec) Validate() []error

Validate validates APISpec struct

type CaResponse

type CaResponse struct {
	Key   []byte `json:"key"`
	Cert  []byte `json:"cert"`
	SAKey []byte `json:"saKey"`
	SAPub []byte `json:"saPub"`
}

CaResponse defines the response type for /ca control API

type Calico

type Calico struct {
	Mode                    string `yaml:"mode"`
	VxlanPort               int    `yaml:"vxlanPort"`
	VxlanVNI                int    `yaml:"vxlanVNI"`
	MTU                     int    `yaml:"mtu"`
	EnableWireguard         bool   `yaml:"wireguard"`
	FlexVolumeDriverPath    string `yaml:"flexVolumeDriverPath"`
	WithWindowsNodes        bool   `yaml:"withWindowsNodes"`
	Overlay                 string `yaml:"overlay" validate:"oneof=Always Never CrossSubnet"`
	IPAutodetectionMethod   string `yaml:"ipAutodetectionMethod,omitempty"`
	IPv6AutodetectionMethod string `yaml:"ipV6AutodetectionMethod,omitempty"`
}

Calico defines the calico related config options

func DefaultCalico

func DefaultCalico() *Calico

DefaultCalico returns sane defaults for calico

func (*Calico) UnmarshalYAML

func (c *Calico) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML sets in some sane defaults when unmarshaling the data from yaml

type CalicoImageSpec

type CalicoImageSpec struct {
	CNI             ImageSpec `yaml:"cni"`
	Node            ImageSpec `yaml:"node"`
	KubeControllers ImageSpec `yaml:"kubecontrollers"`
}

CalicoImageSpec config group for calico related image settings

type Chart

type Chart struct {
	Name      string `yaml:"name"`
	ChartName string `yaml:"chartname"`
	Version   string `yaml:"version"`
	Values    string `yaml:"values"`
	TargetNS  string `yaml:"namespace"`
}

Chart single helm addon

type ClusterConfig

type ClusterConfig struct {
	APIVersion string       `yaml:"apiVersion" validate:"eq=k0s.k0sproject.io/v1beta1"`
	Kind       string       `yaml:"kind" validate:"eq=Cluster"`
	Metadata   *ClusterMeta `yaml:"metadata"`
	Spec       *ClusterSpec `yaml:"spec"`
	// contains filtered or unexported fields
}

ClusterConfig cluster manifest

func DefaultClusterConfig

func DefaultClusterConfig(k0sVars constant.CfgVars) *ClusterConfig

DefaultClusterConfig ...

func FromYamlFile added in v0.10.0

func FromYamlFile(filename string, k0sVars constant.CfgVars) (*ClusterConfig, error)

FromYamlFile ...

func FromYamlPipe added in v0.10.0

func FromYamlPipe(r io.Reader, k0sVars constant.CfgVars) (*ClusterConfig, error)

FromYamlPipe

func FromYamlString added in v0.10.0

func FromYamlString(yml string, k0sVars constant.CfgVars) (*ClusterConfig, error)

FromYamlString

func (*ClusterConfig) UnmarshalYAML

func (c *ClusterConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML sets in some sane defaults when unmarshaling the data from yaml

func (*ClusterConfig) Validate

func (c *ClusterConfig) Validate() []error

Validate validates cluster config

type ClusterExtensions

type ClusterExtensions struct {
	Helm *HelmExtensions `yaml:"helm"`
}

ClusterExtensions specifies cluster extensions

type ClusterImages

type ClusterImages struct {
	Konnectivity  ImageSpec `yaml:"konnectivity"`
	MetricsServer ImageSpec `yaml:"metricsserver"`
	KubeProxy     ImageSpec `yaml:"kubeproxy"`
	CoreDNS       ImageSpec `yaml:"coredns"`

	Calico     CalicoImageSpec     `yaml:"calico"`
	KubeRouter KubeRouterImageSpec `yaml:"kuberouter"`

	Repository        string `yaml:"repository,omitempty"`
	DefaultPullPolicy string `yaml:"default_pull_policy,omitempty"`
}

ClusterImages sets docker images for addon components

func DefaultClusterImages

func DefaultClusterImages() *ClusterImages

DefaultClusterImages default image settings

func (*ClusterImages) UnmarshalYAML

func (ci *ClusterImages) UnmarshalYAML(unmarshal func(interface{}) error) error

type ClusterMeta

type ClusterMeta struct {
	Name string `yaml:"name" validate:"required"`
}

ClusterMeta ...

type ClusterSpec

type ClusterSpec struct {
	API               *APISpec               `yaml:"api"`
	ControllerManager *ControllerManagerSpec `yaml:"controllerManager,omitempty"`
	Scheduler         *SchedulerSpec         `yaml:"scheduler,omitempty"`
	Storage           *StorageSpec           `yaml:"storage"`
	Network           *Network               `yaml:"network"`
	PodSecurityPolicy *PodSecurityPolicy     `yaml:"podSecurityPolicy"`
	WorkerProfiles    WorkerProfiles         `yaml:"workerProfiles,omitempty"`
	Telemetry         *ClusterTelemetry      `yaml:"telemetry"`
	Install           *InstallSpec           `yaml:"installConfig,omitempty"`
	Images            *ClusterImages         `yaml:"images"`
	Extensions        *ClusterExtensions     `yaml:"extensions,omitempty"`
	Konnectivity      *KonnectivitySpec      `yaml:"konnectivity,omitempty"`
}

ClusterSpec ...

func DefaultClusterSpec

func DefaultClusterSpec(k0sVars constant.CfgVars) *ClusterSpec

DefaultClusterSpec default settings

type ClusterTelemetry

type ClusterTelemetry struct {
	Interval time.Duration `yaml:"interval"`
	Enabled  bool          `yaml:"enabled"`
}

ClusterTelemetry holds telemetry related settings

func DefaultClusterTelemetry

func DefaultClusterTelemetry() *ClusterTelemetry

DefaultClusterTelemetry default settings

type ControllerManagerSpec

type ControllerManagerSpec struct {
	ExtraArgs map[string]string `yaml:"extraArgs,omitempty"`
}

ControllerManagerSpec ...

func (*ControllerManagerSpec) IsZero added in v0.10.0

func (c *ControllerManagerSpec) IsZero() bool

IsZero needed to omit empty object from yaml output

type DualStack added in v0.10.0

type DualStack struct {
	Enabled         bool   `yaml:"enabled,omitempty"`
	IPv6PodCIDR     string `yaml:"IPv6podCIDR,omitempty"`
	IPv6ServiceCIDR string `yaml:"IPv6serviceCIDR,omitempty"`
}

DualStack defines network configuration for ipv4\ipv6 mixed cluster setup

func DefaultDualStack added in v0.10.0

func DefaultDualStack() DualStack

DefaultDualStack builds default values

func (DualStack) EnableDualStackFeatureGate added in v0.10.0

func (ds DualStack) EnableDualStackFeatureGate(args map[string]string)

EnableDualStackFeatureGate adds ipv6 feature gate to the given args colllection

type EtcdConfig

type EtcdConfig struct {
	PeerAddress string `yaml:"peerAddress"`
}

EtcdConfig defines etcd related config options

func DefaultEtcdConfig

func DefaultEtcdConfig() *EtcdConfig

DefaultEtcdConfig creates EtcdConfig with sane defaults

type EtcdRequest

type EtcdRequest struct {
	Node        string `json:"node"`
	PeerAddress string `json:"peerAddress"`
}

EtcdRequest defines the etcd control api request structure

func (*EtcdRequest) Validate

func (e *EtcdRequest) Validate() error

Validate validates the request

type EtcdResponse

type EtcdResponse struct {
	CA             CaResponse `json:"ca"`
	InitialCluster []string   `json:"initialCluster"`
}

EtcdResponse defines the etcd control api response structure

type HelmExtensions

type HelmExtensions struct {
	Repositories []Repository `yaml:"repositories"`
	Charts       []Chart      `yaml:"charts"`
}

HelmExtensions specifies settings for cluster helm based extensions

type ImageSpec

type ImageSpec struct {
	Image   string `yaml:"image"`
	Version string `yaml:"version"`
}

ImageSpec container image settings

func (ImageSpec) URI

func (is ImageSpec) URI() string

URI build image uri

type InstallSpec added in v0.9.0

type InstallSpec struct {
	SystemUsers *SystemUser `yaml:"users,omitempty"`
}

InstallSpec defines the required fields for the `k0s install` command

func DefaultInstallSpec added in v0.9.0

func DefaultInstallSpec() *InstallSpec

DefaultInstallSpec ...

type KineConfig

type KineConfig struct {
	DataSource string `yaml:"dataSource"`
}

KineConfig defines the Kine related config options

func DefaultKineConfig

func DefaultKineConfig(dataDir string) *KineConfig

DefaultKineConfig creates KineConfig with sane defaults

type KonnectivitySpec added in v0.13.0

type KonnectivitySpec struct {
	AgentPort int64 `yaml:"agentPort,omitempty"`
	AdminPort int64 `yaml:"adminPort,omitempty"`
}

KonnectivitySpec ...

func DefaultKonnectivitySpec added in v0.13.0

func DefaultKonnectivitySpec() *KonnectivitySpec

DefaultKonnectivitySpec builds default KonnectivitySpec

type KubeRouter added in v0.13.0

type KubeRouter struct {
	MTU            int    `yaml:"mtu"`
	PeerRouterIPs  string `yaml:"peerRouterIPs"`
	PeerRouterASNs string `yaml:"peerRouterASNs"`
	AutoMTU        bool   `yaml:"autoMTU"`
}

KubeRouter defines the kube-router related config options

func DefaultKubeRouter added in v0.13.0

func DefaultKubeRouter() *KubeRouter

DefaultKubeRouter returns the default config for kube-router

type KubeRouterImageSpec added in v0.13.0

type KubeRouterImageSpec struct {
	CNI          ImageSpec `yaml:"cni"`
	CNIInstaller ImageSpec `yaml:"cniInstaller"`
}

KubeRouterImageSpec config group for kube-router related images

type Network

type Network struct {
	PodCIDR     string      `yaml:"podCIDR"`
	ServiceCIDR string      `yaml:"serviceCIDR"`
	Provider    string      `yaml:"provider"`
	Calico      *Calico     `yaml:"calico"`
	KubeRouter  *KubeRouter `yaml:"kuberouter"`
	DualStack   DualStack   `yaml:"dualStack,omitempty"`
}

Network defines the network related config options

func DefaultNetwork

func DefaultNetwork() *Network

DefaultNetwork creates the Network config struct with sane default values

func (*Network) BuildPodCIDR added in v0.10.0

func (n *Network) BuildPodCIDR() string

BuildPodCIDR returns actual argument value for pod cidr

func (*Network) BuildServiceCIDR added in v0.10.0

func (n *Network) BuildServiceCIDR(addr string) string

BuildServiceCIDR returns actual argument value for service cidr

func (*Network) DNSAddress

func (n *Network) DNSAddress() (string, error)

DNSAddress calculates the 10th address of configured service CIDR block.

func (*Network) InternalAPIAddresses added in v0.11.0

func (n *Network) InternalAPIAddresses() ([]string, error)

InternalAPIAddresses calculates the internal API address of configured service CIDR block.

func (*Network) UnmarshalYAML

func (n *Network) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML sets in some sane defaults when unmarshaling the data from yaml

func (*Network) Validate

func (n *Network) Validate() []error

Validate validates all the settings make sense and should work

type PodSecurityPolicy

type PodSecurityPolicy struct {
	DefaultPolicy string `yaml:"defaultPolicy"`
}

PodSecurityPolicy defines the config options for setting system level default PSP

func DefaultPodSecurityPolicy

func DefaultPodSecurityPolicy() *PodSecurityPolicy

DefaultPodSecurityPolicy creates new PodSecurityPolicy with sane defaults

func (*PodSecurityPolicy) Validate added in v0.11.0

func (p *PodSecurityPolicy) Validate() []error

Validate check that the given psp is one of the built-in ones

type Repository

type Repository struct {
	Name     string `yaml:"name"`
	URL      string `yaml:"url"`
	CAFile   string `yaml:"caFile"`
	CertFile string `yaml:"certFile"`
	Insecure bool   `yaml:"insecure"`
	KeyFile  string `yaml:"keyfile"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

Repository describes single repository entry. Fields map to the CLI flags for the "helm add" command

type SchedulerSpec

type SchedulerSpec struct {
	ExtraArgs map[string]string `yaml:"extraArgs,omitempty"`
}

SchedulerSpec ...

func (*SchedulerSpec) IsZero added in v0.10.0

func (s *SchedulerSpec) IsZero() bool

IsZero needed to omit empty object from yaml output

type StorageSpec

type StorageSpec struct {
	Type string      `yaml:"type"`
	Kine *KineConfig `yaml:"kine,omitempty"`
	Etcd *EtcdConfig `yaml:"etcd"`
}

StorageSpec defines the storage related config options

func DefaultStorageSpec

func DefaultStorageSpec(k0sVars constant.CfgVars) *StorageSpec

DefaultStorageSpec creates StorageSpec with sane defaults

func (*StorageSpec) IsJoinable

func (s *StorageSpec) IsJoinable() bool

IsJoinable returns true only if the storage config is such that another controller can join the cluster

func (*StorageSpec) UnmarshalYAML

func (s *StorageSpec) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML sets in some sane defaults when unmarshaling the data from yaml

func (*StorageSpec) Validate added in v0.11.0

func (s *StorageSpec) Validate() []error

Validate validates storage specs correctness

type SystemUser added in v0.9.0

type SystemUser struct {
	Etcd          string `yaml:"etcdUser,omitempty"`
	Kine          string `yaml:"kineUser,omitempty"`
	Konnectivity  string `yaml:"konnectivityUser,omitempty"`
	KubeAPIServer string `yaml:"kubeAPIserverUser,omitempty"`
	KubeScheduler string `yaml:"kubeSchedulerUser,omitempty"`
}

SystemUser defines the user to use for each component

func DefaultSystemUsers added in v0.9.0

func DefaultSystemUsers() *SystemUser

DefaultSystemUsers returns the default system users to be used for the different components

type WorkerProfile

type WorkerProfile struct {
	Name   string                 `yaml:"name"`
	Values map[string]interface{} `yaml:"values"`
}

WorkerProfile worker profile

func (*WorkerProfile) Validate

func (wp *WorkerProfile) Validate() error

Validate validates instance

type WorkerProfiles

type WorkerProfiles []WorkerProfile

WorkerProfiles profiles collection

func (WorkerProfiles) Validate

func (wps WorkerProfiles) Validate() []error

Validate validates all profiles

Jump to

Keyboard shortcuts

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