cloud

package
v0.0.0-...-a2c64ce Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 7 Imported by: 57

README

Cloud package

The cloud package contains the Reconciler interface and Reconciler implementations for each cloud provider.

Overview

The tasks covered in this package include

  • rendering a universal, cloud-provider agnostic cluster representation into a representation for a specific cloud provider
  • obtaining the expected state of the cluster
  • obtaining the actual state of the cluster
  • comparing expected and actual and applying changes

The Apply function does most of the work, including

  • Building Bootstrap scripts and injecting values at the runtime
  • Creating the appropriate resources for Master node
  • Obtaining needed information for Node creation
  • Creating Nodes
  • Downloading the .kubeconfig file for the cluster from the master node

See the Kubicorn project walkthrough for a more detailed account of these components and how they interrelate.

Adding a Cloud Provider

To add a new cloud provider, please see the document Adding a new cloud provider.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicReconciler

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

func (*AtomicReconciler) Actual

func (r *AtomicReconciler) Actual(known *cluster.Cluster) (actualCluster *cluster.Cluster, err error)

func (*AtomicReconciler) Destroy

func (r *AtomicReconciler) Destroy() (destroyedCluster *cluster.Cluster, err error)

func (*AtomicReconciler) Expected

func (r *AtomicReconciler) Expected(known *cluster.Cluster) (expectedCluster *cluster.Cluster, err error)

func (*AtomicReconciler) Reconcile

func (r *AtomicReconciler) Reconcile(actual, expected *cluster.Cluster) (reconciledCluster *cluster.Cluster, err error)

type Model

type Model interface {

	// Resources returns the mapped resources for the specific cloud implementation.
	Resources() map[int]Resource
}

Model is what maps an API to a set of cloud Resources.

type Reconciler

type Reconciler interface {

	// Actual will audit a cloud and return the API representation of the current resources in the cloud.
	Actual(known *cluster.Cluster) (actual *cluster.Cluster, err error)

	// Expected will audit a state store and return the API representation of the intended resources in the cloud.
	Expected(known *cluster.Cluster) (expected *cluster.Cluster, err error)

	// Reconcile will take an actual and expected API representation and attempt to ensure the intended state.
	Reconcile(actual, expected *cluster.Cluster) (reconciled *cluster.Cluster, err error)

	// Destroy will take an actual API representation and destroy the resources in the cloud.
	Destroy() (destroyed *cluster.Cluster, err error)
}

Reconciler will create and destroy infrastructure based on an intended state. A Reconciler will also audit the expected and actual state.

func NewAtomicReconciler

func NewAtomicReconciler(known *cluster.Cluster, model Model) Reconciler

type Resource

type Resource interface {

	// Actual will return the current existing resource in the cloud if it exists.
	Actual(known *cluster.Cluster) (actual *cluster.Cluster, resource Resource, err error)

	// Expected will return the anticipated cloud resource.
	Expected(known *cluster.Cluster) (expected *cluster.Cluster, resource Resource, err error)

	// Apply will create a cloud resource if needed.
	Apply(actual, expected Resource, expectedCluster *cluster.Cluster) (updatedCluster *cluster.Cluster, resource Resource, err error)

	// Delete will delete a cloud resource if needed.
	Delete(actual Resource, known *cluster.Cluster) (updatedCluster *cluster.Cluster, resource Resource, err error)
}

Resource represents a single cloud level resource that can be mutated. Resources are mapped via a model.

Jump to

Keyboard shortcuts

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