types

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package types provides reusable structs and interfaces used across libflexkube, which can also be used by external projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate string

Certificate is a wrapper on string type, which parses it's content as X.509 certificate while unmarshaling. This allows to validate the data during unmarshaling process.

This type should not be used, as it does not allow to produce meaningful error to the user.

func (*Certificate) Pick added in v0.3.0

func (c *Certificate) Pick(values ...Certificate) Certificate

Pick returns first non-empty certificate from given list, including receiver certificate.

This method is a helper, which allows to select the certificate to use from hierarchical configuration.

func (*Certificate) UnmarshalJSON

func (c *Certificate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements encoding/json.Unmarshaler interface and tries to parse obtained data as PEM encoded X.509 certificate.

type PrivateKey

type PrivateKey string

PrivateKey is a wrapper on string type, which parses it's content as private key while unmarshaling. This allows to validate the data during unmarshaling process.

This type should not be used, as it does not allow to produce meaningful error to the user.

func (*PrivateKey) Pick added in v0.3.0

func (p *PrivateKey) Pick(values ...PrivateKey) PrivateKey

Pick returns first non-empty private key from given list, including receiver private key.

This method is a helper, which allows to select the certificate to use from hierarchical configuration.

func (*PrivateKey) UnmarshalJSON

func (p *PrivateKey) UnmarshalJSON(data []byte) error

UnmarshalJSON implements encoding/json.Unmarshaler interface and tries to decode obtained data using PEM format and then tries to parse the private key as PKCS8, PPKCS1 or EC private keys.

type Resource

type Resource interface {
	// StateToYaml converts resource's containers state into YAML format and returns it to the user,
	// so it can be persisted, e.g. to the file.
	StateToYaml() ([]byte, error)

	// CheckCurrentState iterates over containers defined in the state, checks if they exist, are
	// running etc and writes to containers current state. This allows then to compare current state
	// of the containers with desired state, using Containers() method, to check if there are any
	// pending changes to cluster configuration.
	//
	// Calling CheckCurrentState is required before calling Deploy(), to ensure, that Deploy() executes
	// correct actions.
	CheckCurrentState() error

	// Deploy creates configured containers.
	//
	// CheckCurrentState() must be called before calling Deploy(), otherwise error will be returned.
	Deploy() error

	// Containers gives access to the ContainersInterface from the resource, which allows accessing
	// methods like DesiredState() and ToExported(), which can be used to calculate pending changes
	// to the resource configuration.
	Containers() container.ContainersInterface
}

Resource interface defines common functionality between Flexkube resources like kubelet pool or static controlplane, which allows to manage group of containers.

func ResourceFromYaml

func ResourceFromYaml(c []byte, r ResourceConfig) (Resource, error)

ResourceFromYaml allows to create any resource instance from YAML configuration.

type ResourceConfig

type ResourceConfig interface {
	// New creates new Resource object from given configuration and ensures, that the configuration
	// is valid.
	New() (Resource, error)

	// Validate validates the configuration.
	Validate() error
}

ResourceConfig interface defines common functionality between all Flexkube resource configurations.

Jump to

Keyboard shortcuts

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