randomkeytpr

package module
v0.0.0-...-d30333b Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: Apache-2.0 Imports: 10 Imported by: 28

README

CircleCI

Specification of the third party object used to issue random keys secret for Kubernetes clusters running on the Giantnetes platform from Giant Swarm.

License

randomkeytpr is under the Apache 2.0 license. See the LICENSE file for details.

Documentation

Index

Constants

View Source
const (
	// Name represents the name of the third party resource within Kubernetes.
	Name = "randomkey.giantswarm.io"

	// VersionV1 is the v1 version of this resource.
	VersionV1 = "v1"

	// Description is the description of this resource.
	Description = "Random keys used as secret in the cluster."
)
View Source
const (
	// KeyLabel is the label used in the secret to identify a cluster
	// key.
	KeyLabel string = "clusterKey"
	// ClusterIDLabel is the label used in the secret to identify a cluster.
	ClusterIDLabel string = "clusterID"
)

These constants are used when filtering the secrets, to only retrieve the ones we are interested in.

View Source
const (
	// WatchTimeOut is the time to wait on watches against the Kubernetes API
	// before giving up and throwing an error.
	WatchTimeOut = 90 * time.Second
)

Variables

View Source
var RandomKeyTypes = []Key{
	EncryptionKey,
}

RandomKeyTypes is a slice enumerating all the Random Key assets we need to boot the cluster.

Functions

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsSecretsRetrievalFailed

func IsSecretsRetrievalFailed(err error) bool

IsSecretsRetrievalFailed asserts secretsRetrievalFailedError.

func ValidKey

func ValidKey(el Key) bool

ValidComponent looks for el among the components.

Types

type ClusterComponent

type ClusterComponent string

ClusterComponent represents the individual component of a k8s cluster, e.g. the API server, or etcd These are used when getting a secret from the k8s API, to identify the component the secret belongs to.

func (ClusterComponent) String

func (c ClusterComponent) String() string

type CompactRandomKeyAssets

type CompactRandomKeyAssets struct {
	APIServerEncryptionKey string
}

CompactRandomKeyAssets is a struct used by operators to store stringified Random Key assets.

type CustomObject

type CustomObject struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata" yaml:"metadata"`

	Spec Spec `json:"spec" yaml:"spec"`
}

CustomObject represents the Random Key TPR's custom object. It holds the specifications of the resource the operator is interested in.

type Key

type Key string

Key represents the type of Random Key asset, e.g. a encryption key. These are used when getting a secret from the k8s API, to identify the specific type of Random Key asset that is contained in the secret.

const (
	// EncryptionKey is the key for the kubernetes encryption.
	EncryptionKey Key = "encryption"
)

These constants are used to match each asset in the secret.

func (Key) String

func (c Key) String() string

type List

type List struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata" yaml:"metadata"`

	Items []CustomObject `json:"items" yaml:"items"`
}

List represents a list of CustomObject resources.

type Searcher

type Searcher interface {
	SearchKeys(clusterID string) (map[Key][]byte, error)
	SearchKeysForKeytype(clusterID, keyType string) (map[Key][]byte, error)
}

type Service

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

Service implements the certificate TPR service.

func NewService

func NewService(config ServiceConfig) (*Service, error)

NewService creates a new configured certificate TPR service.

func (*Service) SearchKeys

func (s *Service) SearchKeys(clusterID string) (map[Key][]byte, error)

SearchKeys watches for keys secrets of a cluster

func (*Service) SearchKeysForKeytype

func (s *Service) SearchKeysForKeytype(clusterID, keyType string) (map[Key][]byte, error)

SearchKeysForKeytype watches for keys secrets of a single cluster keytype and returns it as assets bundle.

type ServiceConfig

type ServiceConfig struct {
	// Dependencies.
	K8sClient kubernetes.Interface
	Logger    micrologger.Logger
}

ServiceConfig represents the configuration used to create a certificate TPR service.

func DefaultServiceConfig

func DefaultServiceConfig() ServiceConfig

DefaultServiceConfig provides a default configuration to create a new certificate TPR service by best effort.

type Spec

type Spec struct {
	ClusterComponent string `json:"clusterComponent" yaml:"clusterComponent"`
	ClusterID        string `json:"clusterID" yaml:"clusterID"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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