kube

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KubernetesAdminUser = "kubernetes-admin"

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

Default variables for certs.

Variables

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

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

Certs specific errors.

View Source
var (
	ErrNoHelmProxy = errors.New("helm proxy constructor not found")
)

Functions

This section is empty.

Types

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 ChartGetter

type ChartGetter interface {
	GetChart(ctx context.Context, repoName, chartName, chartVersion string) (*chart.Chart, error)
}

ChartGetter interface is a wrapper for GetChart function.

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,
	accountService accountGetter,
	profileSvc profileSvc,
	provisioner nodeProvisioner,
	kubeProvisioner kubeProvisioner,
	repo storage.Interface,
	proxies proxy.Container,
) *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 *model.Kube) error
	Get(ctx context.Context, name string) (*model.Kube, error)
	ListAll(ctx context.Context) ([]model.Kube, error)
	Delete(ctx context.Context, name string) error
	KubeConfigFor(ctx context.Context, kname, user string) ([]byte, error)
	ListKubeResources(ctx context.Context, kname string) ([]byte, error)
	GetKubeResources(ctx context.Context, kname, resource, ns, name string) ([]byte, error)
	ListNodes(ctx context.Context, k *model.Kube, role string) ([]corev1.Node, error)
	GetCerts(ctx context.Context, kname, cname string) (*Bundle, error)
	InstallRelease(ctx context.Context, kname string, rls *ReleaseInput) (*release.Release, error)
	ListReleases(ctx context.Context, kname, ns, offset string, limit int) ([]*model.ReleaseInfo, error)
	ReleaseDetails(ctx context.Context, kname, rlsName string) (*release.Release, error)
	DeleteRelease(ctx context.Context, kname, rlsName string, purge bool) (*model.ReleaseInfo, error)
}

Interface represents an interface for a kube service.

type MetricResponse

type MetricResponse struct {
	Status string `json:"status"`
	Data   struct {
		ResultType string `json:"resultType"`
		Result     []struct {
			Metric map[string]string `json:"metric"`
			Value  []interface{}     `json:"value"`
		} `json:"result"`
	} `json:"data"`
}

type ReleaseInput

type ReleaseInput struct {
	Name         string `json:"name"`
	Namespace    string `json:"namespace"`
	ChartName    string `json:"chartName" valid:"required"`
	ChartVersion string `json:"chartVersion"`
	RepoName     string `json:"repoName" valid:"required"`
	Values       string `json:"values"`
}

type ServerResourceGetter

type ServerResourceGetter interface {
	ServerResources() ([]*metav1.APIResourceList, error)
}

type Service

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

Service manages kubernetes clusters.

func NewService

func NewService(prefix string, s storage.Interface, chrtGetter ChartGetter) *Service

NewService constructs a Service.

func (Service) Create

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

Create and stores a kube in the provided storage.

func (Service) Delete

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

Delete deletes a kube with a specified name.

func (Service) DeleteRelease

func (s Service) DeleteRelease(ctx context.Context, kubeID, rlsName string, purge bool) (*model.ReleaseInfo, error)

func (Service) Get

func (s Service) Get(ctx context.Context, kubeID string) (*model.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. TODO: do we need this?

func (Service) GetKubeResources

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

GetKubeResources returns raw representation of the kubernetes resources.

func (Service) InstallRelease

func (s Service) InstallRelease(ctx context.Context, kubeID string, rls *ReleaseInput) (*release.Release, error)

func (Service) KubeConfigFor

func (s Service) KubeConfigFor(ctx context.Context, kubeID, user string) ([]byte, error)

func (Service) ListAll

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

ListAll returns all kubes.

func (Service) ListKubeResources

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

ListKubeResources returns raw representation of the supported kubernetes resources.

func (Service) ListNodes

func (s Service) ListNodes(ctx context.Context, kube *model.Kube, role string) ([]corev1.Node, error)

func (Service) ListReleases

func (s Service) ListReleases(ctx context.Context, kubeID, namespace, offset string, limit int) ([]*model.ReleaseInfo, error)

func (Service) ReleaseDetails

func (s Service) ReleaseDetails(ctx context.Context, kubeID, rlsName string) (*release.Release, error)

type ServiceInfo

type ServiceInfo struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Type      string `json:"type"`
	Namespace string `json:"namespace"`
	ProxyPort string `json:"proxyPort"`
}

Jump to

Keyboard shortcuts

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