kubernetes

package
v0.0.0-...-0c70d8f Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ResourceKinds = make(map[string]ResourceKind)
)

Functions

This section is empty.

Types

type ApiObject

type ApiObject struct {
	resource.Resource
	Kind     string   `yaml:"kind"`
	Metadata metadata `yaml:"metadata"`
}

type Applier

type Applier interface {
	Apply(namespace string, cs ChangeSet) SyncError
}

Applier is something that will apply a changeset to the cluster.

type ChangeSet

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

func (*ChangeSet) ApplyObj

func (cs *ChangeSet) ApplyObj() []*ApiObject

func (*ChangeSet) DeleteObj

func (cs *ChangeSet) DeleteObj() []*ApiObject

type Cluster

type Cluster struct {
	Client    extendedClient
	Mgrs      *operatorutil.MgrList
	Applier   Applier
	Describer Describer
	Mu        sync.Mutex
	Scaler    Scaler
}

Cluster is a handle to a Kubernetes API server. (Typically, this code is deployed into the same cluster.)

func NewCluster

func NewCluster(
	clientset k8sclient.Interface,
	v1CrdClientSet v1_versioned.Interface,
	mgrs *operatorutil.MgrList,
	applier Applier,
	describer Describer,
	scaler Scaler) *Cluster

NewCluster returns a usable cluster.

func (*Cluster) DescribeResource

func (c *Cluster) DescribeResource(namespace, sourceKind, sourceName string) string

func (*Cluster) Export

func (c *Cluster) Export(namespace string) ([]byte, error)

Export exports cluster resources

func (*Cluster) ScaleResource

func (c *Cluster) ScaleResource(namespace, sourceKind, sourceName, replicas string) error

func (*Cluster) Sync

func (c *Cluster) Sync(namespace string, spec SyncDef) error

Sync performs the given actions on resources. Operations are asynchronous, but serialised.

type Describer

type Describer interface {
	Describe(namespace, sourceKind, sourceName string) string
}

type K8sObject

type K8sObject interface {
	GetName() string
	GetNamespace() string
	GetLabels() map[string]string
	GetAnnotations() map[string]string
}

k8sObject represents an value from which you can obtain typical Kubernetes metadata. These methods are implemented by the Kubernetes API resource types.

type K8sResource

type K8sResource struct {
	K8sObject
	ApiVersion string
	Kind       string
	Name       string
}

type Manifests

type Manifests struct {
}

func (*Manifests) LoadManifests

func (c *Manifests) LoadManifests(namespace string, base, first string, rest ...string) (map[string]resourceutil.Resource, []string, error)

func (*Manifests) ParseManifests

func (c *Manifests) ParseManifests(namespace string, allDefs []byte) (map[string]resourceutil.Resource, error)

type ResourceError

type ResourceError struct {
	resource.Resource
	Error error
}

type ResourceKind

type ResourceKind interface {
	GetResources(c *Cluster, namespace string) ([]K8sResource, error)
}

type Scaler

type Scaler interface {
	Scaler(namespace, sourceKind, sourceName, replicas string) error
}

type SyncAction

type SyncAction struct {
	Delete resource.Resource // ) one of these
	Apply  resource.Resource // )
}

SyncAction represents either the deletion or application (create or update) of a resource.

type SyncDef

type SyncDef struct {
	// The actions to undertake
	Actions []SyncAction
}

type SyncError

type SyncError []ResourceError

func (SyncError) Error

func (err SyncError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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