kubevisor

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ResourceTypeJobs is used for job management
	ResourceTypeJobs = ResourceType("jobs")

	//ResourceTypePods is used for pod inspection
	ResourceTypePods = ResourceType("pods")

	//ResourceTypeDatasets is used for dataset management
	ResourceTypeDatasets = ResourceType("datasets")

	//ResourceTypeEvents is the resource type for event fetching
	ResourceTypeEvents = ResourceType("events")

	//ResourceTypeQuota can be used to retrieve quota information
	ResourceTypeQuota = ResourceType("resourcequotas")

	//ResourceTypeSecrets can be used to get secret information
	ResourceTypeSecrets = ResourceType("secrets")

	//ResourceTypeDeployments is used for deployment management
	ResourceTypeDeployments = ResourceType("deployments")

	//ResourceTypeRoles is used for role management
	ResourceTypeRoles = ResourceType("roles")

	//ResourceTypeRoleBindings is used for role bindings management
	ResourceTypeRoleBindings = ResourceType("rolebindings")

	//ResourceTypeClusterRoles is used for cluster roles management
	ResourceTypeClusterRoles = ResourceType("clusterroles")

	//ResourceTypeClusterRoleBindings is used for cluster role bindings management
	ResourceTypeClusterRoleBindings = ResourceType("clusterrolebindings")

	//ResourceTypeDaemonsets is used for daemonset management
	ResourceTypeDaemonsets = ResourceType("daemonsets")

	//ResourceTypeCustomResourceDefinition is used for crd management
	ResourceTypeCustomResourceDefinition = ResourceType("customresourcedefinitions")
)
View Source
var (
	//MaxLogBytes determines how much logs we're gonna return, we cap it hard at this point
	MaxLogBytes = int64(1024 * 1024) //1MiB
	//DefaultPrefix is used to identify a job created by the cli
	DefaultPrefix = "nlz-nerd"
)

Functions

func IsAlreadyExistsErr

func IsAlreadyExistsErr(err error) bool

IsAlreadyExistsErr indicates that what is attempted to be created already exists

func IsDeadlineErr

func IsDeadlineErr(err error) bool

IsDeadlineErr indicates that a context deadline exceeded

func IsInvalidNameErr

func IsInvalidNameErr(err error) bool

IsInvalidNameErr indicates the provided name was invalid

func IsKubernetesErr

func IsKubernetesErr(err error) bool

IsKubernetesErr is for unexpected kubernetes errors

func IsNamespaceNotExistsErr

func IsNamespaceNotExistsErr(err error) bool

IsNamespaceNotExistsErr indicates that what is attempted to be created already exists

func IsNetworkErr

func IsNetworkErr(err error) bool

IsNetworkErr is for unexpected kubernetes errors

func IsNotExistsErr

func IsNotExistsErr(err error) bool

IsNotExistsErr indicates that what is attempted to be created already exists

func IsServiceUnavailableErr

func IsServiceUnavailableErr(err error) bool

IsServiceUnavailableErr indicates that kubernetes is unhealthy

func IsUnauthorizedErr

func IsUnauthorizedErr(err error) bool

IsUnauthorizedErr indicates that what is attempted to be created already exists

func IsValidationErr

func IsValidationErr(err error) bool

IsValidationErr asserts for a validation error

Types

type ListTranformer

type ListTranformer interface {
	Transform(fn func(in ManagedNames) (out ManagedNames))
	Len() int
}

ListTranformer must be implemented to allow Nerd to transparently manage resource names

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
}

Logger describes the logging dependency the services require

type ManagedNames

type ManagedNames interface {
	GetName() string
	GetLabels() map[string]string
	SetLabels(map[string]string)
	SetName(name string)
	SetGenerateName(name string)
}

ManagedNames allows for Nerd to transparently manage resources based on names and there prefixes

type ResourceType

type ResourceType string

ResourceType is a type of Kubernetes resource

type Visor

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

Visor provides access to Kubernetes resources while transparently filtering, naming and labeling resources that are managed by the CLI.

func NewVisor

func NewVisor(ns, prefix string, api kubernetes.Interface, crd crd.Interface, apiext apiext.Interface, logs Logger) *Visor

NewVisor will setup a Kubernetes visor

func (*Visor) CreateClusterResource

func (k *Visor) CreateClusterResource(ctx context.Context, t ResourceType, v ManagedNames, name string) (err error)

CreateClusterResource will use the kube RESTClient to create a cluster resource while using the context, adding the Nerd prefix and handling errors specific to our domain.

func (*Visor) CreateResource

func (k *Visor) CreateResource(ctx context.Context, t ResourceType, v ManagedNames, name string) (err error)

CreateResource will use the kube RESTClient to create a resource while using the context, adding the Nerd prefix and handling errors specific to our domain.

func (*Visor) DeleteResource

func (k *Visor) DeleteResource(ctx context.Context, t ResourceType, name string) (err error)

DeleteResource will use the kube RESTClient to delete a resource by its name.

func (*Visor) FetchLogs

func (k *Visor) FetchLogs(ctx context.Context, tail int64, w io.Writer, cname, pname string) (err error)

FetchLogs will read logs from container with name 'cname' from pod 'pname' and write it to writer 'w'

func (*Visor) GetClusterResource

func (k *Visor) GetClusterResource(ctx context.Context, t ResourceType, v ManagedNames, name string) (err error)

GetClusterResource will use the kube RESTClient to describe a resource by its name.

func (*Visor) GetResource

func (k *Visor) GetResource(ctx context.Context, t ResourceType, v ManagedNames, name string) (err error)

GetResource will use the kube RESTClient to describe a resource by its name.

func (*Visor) ListResources

func (k *Visor) ListResources(ctx context.Context, t ResourceType, v ListTranformer, lselector, fselector []string) (err error)

ListResources will use the RESTClient to list resources while using the context and transparently filter resources managed by the CLI

func (*Visor) UpdateResource

func (k *Visor) UpdateResource(ctx context.Context, t ResourceType, v ManagedNames, name string) (err error)

UpdateResource will use the kube RESTClient to update a resource while using the context, adding the Nerd prefix and handling errors specific to our domain.

Jump to

Keyboard shortcuts

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