metaserver

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 20 Imported by: 5

Documentation

Index

Constants

View Source
const (
	MetaServerSource    = "metaserver"
	ApplicationResource = "Application"
	ApplicationResp     = "applicationResponse"
	Ignore              = "ignore"
)

used to set Message.Route

View Source
const WatchAppSync = "watchapp/sync"

Variables

This section is empty.

Functions

func IndexCheck

func IndexCheck(length int, indexes ...*int)

force set index to 0 if out of range

func KeyFunc

func KeyFunc(obj runtime.Object) string

func KeyFuncObj

func KeyFuncObj(obj runtime.Object) (string, error)

KeyFuncObj generated key from obj

func KeyFuncReq

func KeyFuncReq(ctx context.Context, _ string) (string, error)

KeyFuncReq generate key from req context

func KeyRootFunc

func KeyRootFunc(ctx context.Context) string

func MsgToApplications added in v1.13.0

func MsgToApplications(msg model.Message) (map[string]Application, error)

MsgToApplications extract applications in message's Content

func ParseKey

func ParseKey(key string) (gvr schema.GroupVersionResource, namespace string, name string)

ParseKey parse key to group/version/resource, namespace, name Now key format is like below: 0/1 /2 /3 /4 /5

/core/v1/pods/{namespaces}/{name}

0/1 /2/3

/app/v1/deployments

0/1 /2 /3

/core/v1/endpoints

Remember that ParseKey is not responsible for verifying the validity of the content, for example, gvr in key /app/v1111/endpoint will be parsed as {Group:"app", Version:"v1111", Resource:"endpoint"}

func ToBytes added in v1.13.0

func ToBytes(i interface{}) (bytes []byte)

Types

type Application added in v1.13.0

type Application struct {
	// ID is the SHA256 checksum generated from request information
	ID string

	// The following field defines the Application request information
	// Key format: group version resource namespaces name
	Key         string
	Verb        ApplicationVerb
	Nodename    string
	Option      []byte
	ReqBody     []byte
	Subresource string

	// The following field defines the Application response result
	RespBody []byte
	Status   ApplicationStatus
	Reason   string // why in this status
	Error    apierrors.StatusError

	// Timestamp record the last closing time of application, only make sense when count == 0
	Timestamp time.Time
	// contains filtered or unexported fields
}

Application record the resources that are in applying for requesting to be transferred down from the cloud, please: 0.use Agent.Generate to generate application 1.use Agent.Apply to apply application( generate msg and send it to cloud dynamiccontroller)

func MsgToApplication added in v1.13.0

func MsgToApplication(msg model.Message) (*Application, error)

extract application in message's Content

func NewApplication added in v1.13.0

func NewApplication(ctx context.Context, key string, verb ApplicationVerb, nodename, subresource string, option interface{}, reqBody interface{}) (*Application, error)

func (*Application) Add added in v1.13.0

func (a *Application) Add()

func (*Application) Cancel added in v1.13.0

func (a *Application) Cancel()

func (*Application) Close added in v1.13.0

func (a *Application) Close()

Close must be called when applicant no longer using application

func (*Application) GVR added in v1.13.0

func (*Application) GetStatus added in v1.13.0

func (a *Application) GetStatus() ApplicationStatus

func (*Application) Identifier added in v1.13.0

func (a *Application) Identifier() string

func (*Application) LastCloseTime added in v1.13.0

func (a *Application) LastCloseTime() time.Time

func (*Application) Namespace added in v1.13.0

func (a *Application) Namespace() string

func (*Application) OptionTo added in v1.13.0

func (a *Application) OptionTo(i interface{}) error

OptionTo convert application option. Remember `i` must be a pointer to the initialized variable

func (*Application) ReqBodyTo added in v1.13.0

func (a *Application) ReqBodyTo(i interface{}) error

func (*Application) ReqContent added in v1.13.0

func (a *Application) ReqContent() interface{}

func (*Application) Reset added in v1.13.0

func (a *Application) Reset()

func (*Application) RespBodyTo added in v1.13.0

func (a *Application) RespBodyTo(i interface{}) error

func (*Application) RespContent added in v1.13.0

func (a *Application) RespContent() interface{}

func (*Application) String added in v1.13.0

func (a *Application) String() string

func (*Application) Wait added in v1.13.0

func (a *Application) Wait()

Wait the result of application after it is applied by application agent

type ApplicationStatus added in v1.13.0

type ApplicationStatus string
const (
	// set by agent
	PreApplying ApplicationStatus = "PreApplying" // application is waiting to be sent to cloud
	InApplying  ApplicationStatus = "InApplying"  // application is sending to cloud

	// set by center
	InProcessing ApplicationStatus = "InProcessing" // application is in processing by cloud
	Approved     ApplicationStatus = "Approved"     // application is approved by cloud
	Rejected     ApplicationStatus = "Rejected"     // application is rejected by cloud

	// both
	Failed    ApplicationStatus = "Failed"    // failed to get application resp from cloud
	Completed ApplicationStatus = "Completed" // application is completed and waiting to be recycled
)

type ApplicationVerb added in v1.13.0

type ApplicationVerb string
const (
	Get          ApplicationVerb = "get"
	List         ApplicationVerb = "list"
	Watch        ApplicationVerb = "watch"
	Create       ApplicationVerb = "create"
	Delete       ApplicationVerb = "delete"
	Update       ApplicationVerb = "update"
	UpdateStatus ApplicationVerb = "updatestatus"
	Patch        ApplicationVerb = "patch"
)

type PatchInfo added in v1.13.0

type PatchInfo struct {
	Name         string
	PatchType    types.PatchType
	Data         []byte
	Options      v1.PatchOptions
	Subresources []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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