cluster

package
v0.0.3-dev Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2017 License: Apache-2.0 Imports: 2 Imported by: 255

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	// The cluster driver to provision cluster
	Driver Driver `json:"-"`
	// The name of the cluster driver
	DriverName string `json:"driverName,omitempty" yaml:"driver_name,omitempty"`
	// The name of the cluster
	Name string `json:"name,omitempty" yaml:"name,omitempty"`

	// specific info about kubernetes cluster
	// Kubernetes cluster version
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
	// Service account token to access kubernetes API
	ServiceAccountToken string `json:"serviceAccountToken,omitempty" yaml:"service_account_token,omitempty"`
	// Kubernetes API master endpoint
	Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
	// Username for http basic authentication
	Username string `json:"username,omitempty" yaml:"username,omitempty"`
	// Password for http basic authentication
	Password string `json:"password,omitempty" yaml:"password,omitempty"`
	// Root CaCertificate for API server(base64 encoded)
	RootCACert string `json:"rootCACert,omitempty" yaml:"root_ca_cert,omitempty"`
	// Client Certificate(base64 encoded)
	ClientCertificate string `json:"clientCertificate,omitempty" yaml:"client_certificate,omitempty"`
	// Client private key(base64 encoded)
	ClientKey string `json:"clientKey,omitempty" yaml:"client_key,omitempty"`
	// Node count in the cluster
	NodeCount int64 `json:"nodeCount,omitempty" yaml:"node_count,omitempty"`

	// Metadata store specific driver options per cloud provider
	Metadata map[string]string

	PersistStore PersistStore `json:"-" yaml:"-"`

	ConfigGetter ConfigGetter `json:"-" yaml:"-"`
}

Cluster represents a kubernetes cluster

func NewCluster

func NewCluster(driverName, addr, name string, configGetter ConfigGetter, persistStore PersistStore) (*Cluster, error)

NewCluster create a cluster interface to do operations

func (*Cluster) Create

func (c *Cluster) Create() error

Create creates a cluster

func (*Cluster) Remove

func (c *Cluster) Remove() error

Remove removes a cluster

func (*Cluster) Store

func (c *Cluster) Store() error

Store persists cluster information

func (*Cluster) Update

func (c *Cluster) Update() error

Update updates a cluster

type ConfigGetter

type ConfigGetter interface {
	GetConfig() (rpcDriver.DriverOptions, error)
}

ConfigGetter defines the interface for getting the driver options.

type Driver

type Driver interface {
	// Create creates a cluster
	Create() error

	// Update updates a cluster
	Update() error

	// Get a cluster info
	Get() (rpcDriver.ClusterInfo, error)

	// Remove removes a cluster
	Remove() error

	// DriverName returns the driver name
	DriverName() string

	// Get driver create options flags for creating clusters
	GetDriverCreateOptions() (rpcDriver.DriverFlags, error)

	// Get driver update options flags for updating cluster
	GetDriverUpdateOptions() (rpcDriver.DriverFlags, error)

	// Set driver options for cluster driver
	SetDriverOptions(options rpcDriver.DriverOptions) error
}

Driver defines how a cluster should be created and managed. Different drivers represents different providers.

type PersistStore

type PersistStore interface {
	Check(name string) (bool, error)
	Store(cluster Cluster) error
}

PersistStore defines the interface for persist options like check and store

Jump to

Keyboard shortcuts

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