adapter

package
v0.0.0-...-4bfcbfc Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOpInvalid = errors.New(errors.ErrOpInvalid, "Invalid operation")
)

Functions

func ErrClientConfig

func ErrClientConfig(err error) error

func ErrClientSet

func ErrClientSet(err error) error

func ErrInstallMesh

func ErrInstallMesh(err error) error

func ErrMeshConfig

func ErrMeshConfig(err error) error

func ErrPortForward

func ErrPortForward(err error) error

func ErrStreamEvent

func ErrStreamEvent(err error) error

func NewDocumentDecoder

func NewDocumentDecoder(r io.ReadCloser) io.ReadCloser

NewDocumentDecoder decodes YAML documents from the provided stream in chunks by converting each document (as defined by the YAML spec) into its own chunk. io.ErrShortBuffer will be returned if the entire buffer could not be read to assist the caller in framing the chunk.

Types

type BaseHandler

type BaseHandler struct {
	Config  config.Handler
	Log     logger.Handler
	Channel *chan interface{}

	KubeClient        *kubernetes.Clientset
	DynamicKubeClient dynamic.Interface
	KubeConfigPath    string
	SmiChart          string
}

func (*BaseHandler) ApplyKubernetesManifest

func (h *BaseHandler) ApplyKubernetesManifest(request OperationRequest, operation Operation, mergeData map[string]string, templatePath string) error

func (*BaseHandler) CreateInstance

func (h *BaseHandler) CreateInstance(kubeconfig []byte, contextName string, ch *chan interface{}) error

func (*BaseHandler) CreateNamespace

func (h *BaseHandler) CreateNamespace(isDelete bool, namespace string) error

creates the namespace unless it is 'default', or it is a delete operation

func (*BaseHandler) GetName

func (h *BaseHandler) GetName() string

func (*BaseHandler) ListOperations

func (h *BaseHandler) ListOperations() (Operations, error)

func (*BaseHandler) StreamErr

func (h *BaseHandler) StreamErr(e *Event, err error)

func (*BaseHandler) StreamInfo

func (h *BaseHandler) StreamInfo(e *Event)

type Event

type Event struct {
	Operationid string `json:"operationid,omitempty"`
	EType       int32  `json:"type,string,omitempty"`
	Summary     string `json:"summary,omitempty"`
	Details     string `json:"details,omitempty"`
}

type Handler

type Handler interface {
	GetName() string
	CreateInstance([]byte, string, *chan interface{}) error
	ApplyOperation(context.Context, OperationRequest) error
	ListOperations() (Operations, error)

	StreamErr(*Event, error)
	StreamInfo(*Event)
}

type Operation

type Operation struct {
	Type       int32             `json:"type,string,omitempty"`
	Properties map[string]string `json:"properties,omitempty"`
}

type OperationRequest

type OperationRequest struct {
	OperationName     string
	Namespace         string
	Username          string
	CustomBody        string
	IsDeleteOperation bool
	OperationID       string
}

type Operations

type Operations map[string]*Operation

type Spec

type Spec struct {
	Name    string `json:"name"`
	Status  string `json:"status"`
	Version string `json:"version"`
}

type YAMLDecoder

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

YAMLDecoder reads chunks of objects and returns ErrShortBuffer if the data is not sufficient. borrowed from APIMachinery

func (*YAMLDecoder) Close

func (d *YAMLDecoder) Close() error

Close closes the decoder

func (*YAMLDecoder) Read

func (d *YAMLDecoder) Read(data []byte) (n int, err error)

Read reads the previous slice into the buffer, or attempts to read the next chunk.

Jump to

Keyboard shortcuts

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