controlplane

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Overview

Package controlplane allows to create and manage static Kubernetes controlplane running in containers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromYaml

func FromYaml(c []byte) (types.Resource, error)

FromYaml allows to restore controlplane state from YAML.

Types

type Common

type Common struct {
	Image                   string            `json:"image,omitempty"`
	KubernetesCACertificate types.Certificate `json:"kubernetesCACertificate,omitempty"`
	FrontProxyCACertificate types.Certificate `json:"frontProxyCACertificate,omitempty"`
}

Common struct contains fields, which are common between all controlplane components.

func (Common) GetImage

func (co Common) GetImage() string

GetImage returns either image defined in common config or Kubernetes default image.

type Controlplane

type Controlplane struct {
	// User-configurable fields.
	// They should be defined here if they are used more than once. Things like serviceCIDR, which is only needed in KubeAPIServer,
	// should be defined directly there.
	Common                *Common               `json:"common,omitempty"`
	SSH                   *ssh.Config           `json:"ssh,omitempty"`
	APIServerAddress      string                `json:"apiServerAddress,omitempty"`
	APIServerPort         int                   `json:"apiServerPort,omitempty"`
	KubeAPIServer         KubeAPIServer         `json:"kubeAPIServer,omitempty"`
	KubeControllerManager KubeControllerManager `json:"kubeControllerManager,omitempty"`
	KubeScheduler         KubeScheduler         `json:"kubeScheduler,omitempty"`
	Hosts                 []host.Host           `json:"hosts,omitempty"`
	Destroy               bool                  `json:"destroy,omitempty"`
	PKI                   *pki.PKI              `json:"pki,omitempty"`

	// Serializable fields.
	State *container.ContainersState `json:"state,omitempty"`
}

Controlplane represents kubernetes controlplane configuration and state from the user.

func (*Controlplane) New

func (c *Controlplane) New() (types.Resource, error)

New validates Controlplane configuration and fills populates all values provided by the users to the structs underneath.

func (*Controlplane) Validate

func (c *Controlplane) Validate() error

Validate validates Controlplane configuration.

type KubeAPIServer

type KubeAPIServer struct {
	Common                   *Common           `json:"common,omitempty"`
	Host                     *host.Host        `json:"host,omitempty"`
	APIServerCertificate     types.Certificate `json:"apiServerCertificate"`
	APIServerKey             types.PrivateKey  `json:"apiServerKey"`
	ServiceAccountPublicKey  string            `json:"serviceAccountPublicKey"`
	BindAddress              string            `json:"bindAddress"`
	AdvertiseAddress         string            `json:"advertiseAddress"`
	EtcdServers              []string          `json:"etcdServers"`
	ServiceCIDR              string            `json:"serviceCIDR"`
	SecurePort               int               `json:"securePort"`
	FrontProxyCertificate    types.Certificate `json:"frontProxyCertificate"`
	FrontProxyKey            types.PrivateKey  `json:"frontProxyKey"`
	KubeletClientCertificate types.Certificate `json:"kubeletClientCertificate"`
	KubeletClientKey         types.PrivateKey  `json:"kubeletClientKey"`
	EtcdCACertificate        types.Certificate `json:"etcdCACertificate"`
	EtcdClientCertificate    types.Certificate `json:"etcdClientCertificate"`
	EtcdClientKey            types.PrivateKey  `json:"etcdClientKey"`
}

KubeAPIServer represents kube-apiserver container configuration.

func (*KubeAPIServer) New

New validates KubeAPIServer configuration and populates default for some fields, if they are empty.

func (*KubeAPIServer) Validate

func (k *KubeAPIServer) Validate() error

Validate validates KubeAPIServer struct.

TODO: Add validation of certificates if specified.

type KubeControllerManager

type KubeControllerManager struct {
	Common                   *Common           `json:"common,omitempty"`
	Host                     *host.Host        `json:"host,omitempty"`
	Kubeconfig               client.Config     `json:"kubeconfig"`
	KubernetesCAKey          types.PrivateKey  `json:"kubernetesCAKey"`
	ServiceAccountPrivateKey types.PrivateKey  `json:"serviceAccountPrivateKey"`
	RootCACertificate        types.Certificate `json:"rootCACertificate"`
	FlexVolumePluginDir      string            `json:"flexVolumePluginDir"`
}

KubeControllerManager represents kube-controller-manager container configuration.

func (*KubeControllerManager) New

New validates KubeControllerManager and returns usable kubeControllerManager.

func (*KubeControllerManager) Validate

func (k *KubeControllerManager) Validate() error

Validate validates KubeControllerManager configuration.

type KubeScheduler

type KubeScheduler struct {
	Common     *Common       `json:"common,omitempty"`
	Host       *host.Host    `json:"host,omitempty"`
	Kubeconfig client.Config `json:"kubeconfig"`
}

KubeScheduler represents kube-scheduler configuration data.

func (*KubeScheduler) New

New validates KubeScheduler struct and returns it's usable version.

func (*KubeScheduler) Validate

func (k *KubeScheduler) Validate() error

Validate validates kube-scheduler configuration.

Jump to

Keyboard shortcuts

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