types

package
v0.0.0-...-7c77b90 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CurrentStateKey         string = "rsync/state/CurrentState"
	DesiredStateKey         string = "rsync/state/DesiredState"
	PendingTerminateFlagKey string = "rsync/state/PendingTerminateFlag"
	AppContextEventQueueKey string = "rsync/AppContextEventQueue"
	StatusKey               string = "status"
	StopFlagKey             string = "stopflag"
	StatusAppContextIDKey   string = "statusappctxid"
)

Variables

View Source
var StateChanges = map[RsyncEvent]StateChange{

	InstantiateEvent: StateChange{
		SState: []appcontext.StatusValue{
			appcontext.AppContextStatusEnum.Created,
			appcontext.AppContextStatusEnum.Instantiated,
			appcontext.AppContextStatusEnum.InstantiateFailed,
			appcontext.AppContextStatusEnum.Instantiating},
		DState:   appcontext.AppContextStatusEnum.Instantiated,
		CState:   appcontext.AppContextStatusEnum.Instantiating,
		ErrState: appcontext.AppContextStatusEnum.InstantiateFailed,
	},
	TerminateEvent: StateChange{
		SState: []appcontext.StatusValue{
			appcontext.AppContextStatusEnum.InstantiateFailed,
			appcontext.AppContextStatusEnum.Instantiating,
			appcontext.AppContextStatusEnum.Instantiated,
			appcontext.AppContextStatusEnum.TerminateFailed,
			appcontext.AppContextStatusEnum.Terminating},
		DState:   appcontext.AppContextStatusEnum.Terminated,
		CState:   appcontext.AppContextStatusEnum.Terminating,
		ErrState: appcontext.AppContextStatusEnum.TerminateFailed,
	},
	UpdateEvent: StateChange{
		SState: []appcontext.StatusValue{
			appcontext.AppContextStatusEnum.Instantiated},
		DState:   appcontext.AppContextStatusEnum.Updated,
		CState:   appcontext.AppContextStatusEnum.Updating,
		ErrState: appcontext.AppContextStatusEnum.UpdateFailed,
	},
	UpdateModifyEvent: StateChange{
		SState: []appcontext.StatusValue{
			appcontext.AppContextStatusEnum.Created,
			appcontext.AppContextStatusEnum.Updated},
		DState:   appcontext.AppContextStatusEnum.Instantiated,
		CState:   appcontext.AppContextStatusEnum.Instantiating,
		ErrState: appcontext.AppContextStatusEnum.InstantiateFailed,
	},
	ReadEvent: StateChange{
		SState: []appcontext.StatusValue{
			appcontext.AppContextStatusEnum.Created,
			appcontext.AppContextStatusEnum.Instantiated,
			appcontext.AppContextStatusEnum.InstantiateFailed,
			appcontext.AppContextStatusEnum.Instantiating},
		DState:   appcontext.AppContextStatusEnum.Instantiated,
		CState:   appcontext.AppContextStatusEnum.Instantiating,
		ErrState: appcontext.AppContextStatusEnum.InstantiateFailed,
	},
}

StateChanges represent State Machine for the AppContext

Functions

This section is empty.

Types

type App

type App struct {
	Name       string               `json:"name,omitempty"`
	Clusters   map[string]*Cluster  `json:"clusters,omitempty"`
	Dependency map[string]*Criteria `json:"dependency,omitempty"`
	// Needed to suport updates
	Skip bool `json:"bool,omitempty"`
}

App is an app within a composite app

type AppContextQueue

type AppContextQueue struct {
	AcQueue []AppContextQueueElement
}

AppContextQueue per AppContext queue

type AppContextQueueElement

type AppContextQueueElement struct {
	Event RsyncEvent `json:"event"`
	// Only valid in case of update events
	UCID string `json:"uCID,omitempty"`
	// Status - Pending, Done, Error, skip
	Status string `json:"status"`
}

AppContextQueueElement element in per AppContext Queue

type AppResource

type AppResource struct {
	Name       string               `json:"name,omitempty"`
	Data       interface{}          `json:"data,omitempty"`
	Dependency map[string]*Criteria `json:"depenedency,omitempty"`
	// Needed to suport updates
	Skip bool `json:"bool,omitempty"`
}

AppResource represents a resource

type ClientProvider

type ClientProvider interface {
	Apply(content []byte) error
	Delete(content []byte) error
	Get(gvkRes []byte, namespace string) ([]byte, error)
	Approve(name string, sa []byte) error
	IsReachable() error
	TagResource([]byte, string) ([]byte, error)
}

ClientProvider is interface for client

type Cluster

type Cluster struct {
	Name      string                  `json:"name,omitempty"`
	ResOrder  []string                `json:"reorder,omitempty"`
	Resources map[string]*AppResource `json:"resources,omitempty"`
	// Needed to suport updates
	Skip bool `json:"bool,omitempty"`
}

Cluster is a cluster within an App

type CompositeApp

type CompositeApp struct {
	Name         string                      `json:"name,omitempty"`
	CompMetadata appcontext.CompositeAppMeta `json:"compmetadat,omitempty"`
	AppOrder     []string                    `json:"appOrder,omitempty"`
	Apps         map[string]*App             `json:"apps,omitempty"`
}

CompositeApp Structures

type Connector

type Connector interface {
	Init(id interface{}) error
	GetClientInternal(cluster string, level string, namespace string) (ClientProvider, error)
	RemoveClient()
	StartClusterWatcher(cluster string) error
	GetStatusCR(label string) ([]byte, error)
}

Connector is interface for connection to Cluster

type Criteria

type Criteria struct {
	// Ready or deployed
	OpStatus string `json:"opstatus,omitempty"`
	// Wait time in seconds
	Wait string `json:"wait,omitempty"`
}

Criteria for Resource dependency

type Dependency

type Dependency struct {
	Resource Resource `json:"resource,omitempty"`
	// contains filtered or unexported fields
}

Dependency Structures

type Resource

type Resource struct {
	App string                  `json:"app,omitempty"`
	Res string                  `json:"name,omitempty"`
	GVK schema.GroupVersionKind `json:"gvk,omitempty"`
}

Resource Dependency Structures

type ResourceDependency

type ResourceDependency struct {
	Resource Resource     `json:"resource,omitempty"`
	Dep      []Dependency `json:"dependency,omitempty"`
}

ResourceDependency structure

type RsyncEvent

type RsyncEvent string

RsyncEvent is event Rsync handles

const (
	InstantiateEvent     RsyncEvent = "Instantiate"
	TerminateEvent       RsyncEvent = "Terminate"
	ReadEvent            RsyncEvent = "Read"
	AddChildContextEvent RsyncEvent = "AddChildContext"
	UpdateEvent          RsyncEvent = "Update"
	// This is an internal event
	UpdateModifyEvent RsyncEvent = "UpdateModify"
)

Rsync Event types

type RsyncOperation

type RsyncOperation int

RsyncOperation is operation Rsync handles

const (
	OpApply RsyncOperation = iota
	OpDelete
	OpRead
)

Rsync Operations

func (RsyncOperation) String

func (d RsyncOperation) String() string

type StateChange

type StateChange struct {
	// Name of the event
	Event RsyncEvent
	// List of states that can handle this event
	SState []appcontext.StatusValue
	// Dst state if the state transition was successful
	DState appcontext.StatusValue
	// Current state if the state transition was successful
	CState appcontext.StatusValue
	// Error state if the state transition was unsuccessful
	ErrState appcontext.StatusValue
}

StateChange represents a state change rsync handles

Jump to

Keyboard shortcuts

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