kube

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultCertsPath = "/etc/kubernets/ssl"
)

Default variables for certs.

View Source
const DefaultStoragePrefix = "/kube/"

Variables

View Source
var (
	ErrInvalidRunner = errors.New("provided invalid runner")

	ErrEmptyName = errors.New("empty name")
)

Certs specific errors.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Username string `json:"username"`
	Token    string `json:"token"`
	CA       string `json:"ca"`
	Cert     string `json:"cert"`
	Key      string `json:"key"`
}

Auth holds all possible auth parameters.

type Bundle

type Bundle struct {
	Cert []byte
	Key  []byte
}

Bundler represents a key/certificate pair.

type Certs

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

Certs handles keys and certificates for kube components.

func NewCerts

func NewCerts(path string, r runner.Runner) (*Certs, error)

NewCerts returns a configured Certs.

func (*Certs) BundleFor

func (c *Certs) BundleFor(ctx context.Context, name string) (*Bundle, error)

BundleFor returns keys Bundle for a provided name of the kube component.

type Handler

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

Handler is a http controller for a kube entity.

func NewHandler

func NewHandler(svc Interface) *Handler

NewHandler constructs a Handler for kubes.

func (*Handler) Register

func (h *Handler) Register(r *mux.Router)

Register adds kube handlers to a router.

type Interface

type Interface interface {
	Create(ctx context.Context, k *Kube) error
	Get(ctx context.Context, name string) (*Kube, error)
	ListAll(ctx context.Context) ([]Kube, error)
	Delete(ctx context.Context, name string) error
	ListKubeResources(ctx context.Context, kname string) ([]byte, error)
	GetKubeResources(ctx context.Context, kname, resource, ns, name string) ([]byte, error)
	GetCerts(ctx context.Context, kname, cname string) (*Bundle, error)
}

Interface represents an interface for a kube service.

func NewService

func NewService(prefix string, s storage.Interface) Interface

NewService constructs a Service.

type Kube

type Kube struct {
	Name        string `json:"name" valid:"required"`
	Version     string `json:"version"`
	RBACEnabled bool   `json:"rbacEnabled"`
	AccountName string `json:"accountName"`
	APIAddr     string `json:"apiAddr"`
	Auth        Auth   `json:"auth"`
	SSHUser     string `json:"sshUser"`
	SSHKey      []byte `json:"sshKey"`
}

Kube represents a kubernetes cluster.

type Service

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

Service manages kubernetes clusters.

func (*Service) Create

func (s *Service) Create(ctx context.Context, k *Kube) error

Create stores a kube in the provided storage.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, name string) error

Delete deletes a kube with a specified name.

func (*Service) Get

func (s *Service) Get(ctx context.Context, name string) (*Kube, error)

Get returns a kube with a specified name.

func (*Service) GetCerts

func (s *Service) GetCerts(ctx context.Context, kname, cname string) (*Bundle, error)

GetCerts returns a keys bundle for provided component name.

func (*Service) GetKubeResources

func (s *Service) GetKubeResources(ctx context.Context, kname, resource, ns, name string) ([]byte, error)

GetKubeResources returns raw representation of the kubernetes resources.

func (*Service) ListAll

func (s *Service) ListAll(ctx context.Context) ([]Kube, error)

ListAll returns all kubes.

func (*Service) ListKubeResources

func (s *Service) ListKubeResources(ctx context.Context, kname string) ([]byte, error)

ListKubeResources returns raw representation of the supported kubernetes resources.

Jump to

Keyboard shortcuts

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