v1

package
v0.1.92 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

View Source
const (
	SecretLabel = "secret-type"
	// speical secret of the the registry
	SecretRegistry = "registry"
	// speical secret of the the config
	SecretConfig = "config"
	// speical secret of the the certificate
	SecretCertificate = "certificate"
)

Variables

View Source
var ErrJSONLevelExceedsLimit = fmt.Errorf("the level of json exceeds the max limit (%d)", maxJSONLevel)

ErrJSONLevelExceedsLimit the level of json exceeds the max limit

Functions

This section is empty.

Types

type ActiveRequest added in v0.1.25

type ActiveRequest struct {
	BatchName        string            `yaml:"batchName,omitempty" json:"batchName,omitempty"`
	Namespace        string            `yaml:"namespace,omitempty" json:"namespace,omitempty"`
	FingerprintValue string            `yaml:"fingerprintValue,omitempty" json:"fingerprintValue,omitempty"`
	SecurityType     string            `yaml:"securityType,omitempty" json:"securityType,omitempty"`
	SecurityValue    string            `yaml:"securityValue,omitempty" json:"securityValue,omitempty"`
	PenetrateData    map[string]string `yaml:"penetrateData,omitempty" json:"penetrateData,omitempty"`
}

ActiveRequest body of active request

type ActiveResponse added in v0.1.28

type ActiveResponse struct {
	NodeName    string            `yaml:"nodeName,omitempty" json:"nodeName,omitempty"`
	Namespace   string            `yaml:"namespace,omitempty" json:"namespace,omitempty"`
	Certificate utils.Certificate `yaml:"certificate,omitempty" json:"certificate,omitempty"`
}

ActiveResponse body of active responce

type AppInfo added in v0.1.25

type AppInfo struct {
	Name    string `yaml:"name,omitempty" json:"name,omitempty"`
	Version string `yaml:"version,omitempty" json:"version,omitempty"`
}

AppInfo app info

type AppStats added in v0.1.84

type AppStats struct {
	AppInfo       `yaml:",inline" json:",inline"`
	Status        Status                   `yaml:"status,omitempty" json:"status,omitempty"`
	Cause         string                   `yaml:"cause,omitempty" json:"cause,omitempty"`
	InstanceStats map[string]InstanceStats `yaml:"instances,omitempty" json:"instances,omitempty"`
}

AppStats app statistics

type Application

type Application struct {
	Name              string            `json:"name,omitempty" validate:"resourceName,nonBaetyl"`
	Type              string            `json:"type,omitempty" default:"container"`
	Labels            map[string]string `json:"labels,omitempty"`
	Namespace         string            `json:"namespace,omitempty"`
	CreationTimestamp time.Time         `json:"createTime,omitempty"`
	Version           string            `json:"version,omitempty"`
	Selector          string            `json:"selector,omitempty"`
	Services          []Service         `json:"services,omitempty"`
	Volumes           []Volume          `json:"volumes,omitempty"`
	Description       string            `json:"description,omitempty"`
	System            bool              `json:"system,omitempty"`
}

Application application info

type Configuration

type Configuration struct {
	Name              string            `json:"name,omitempty" validate:"resourceName,nonBaetyl"`
	Namespace         string            `json:"namespace,omitempty"`
	Labels            map[string]string `json:"labels,omitempty"`
	Data              map[string]string `json:"data,omitempty" default:"{}" binding:"required"`
	CreationTimestamp time.Time         `json:"createTime,omitempty"`
	UpdateTimestamp   time.Time         `json:"updateTime,omitempty"`
	Description       string            `json:"description,omitempty"`
	Version           string            `json:"version,omitempty"`
	System            bool              `json:"system,omitempty"`
}

Configuration config info

type ConfigurationObject added in v0.1.58

type ConfigurationObject struct {
	// hex format
	MD5      string            `json:"md5,omitempty" yaml:"md5"`
	Sha256   string            `json:"sha256,omitempty" yaml:"sha256"`
	URL      string            `json:"url,omitempty" yaml:"url"`
	Token    string            `json:"token,omitempty" yaml:"token"`
	Unpack   string            `json:"unpack,omitempty" yaml:"unpack"`
	Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata"`
}

ConfigurationObject extended feature for object configuration

type ContainerPort

type ContainerPort struct {
	HostPort      int32  `json:"hostPort,omitempty"`
	ContainerPort int32  `json:"containerPort,omitempty"`
	Protocol      string `json:"protocol,omitempty"`
	HostIP        string `json:"hostIP,omitempty"`
}

ContainerPort port config in container

type CoreInfo added in v0.1.33

type CoreInfo struct {
	GoVersion   string `yaml:"goVersion,omitempty" json:"goVersion,omitempty"`
	BinVersion  string `yaml:"binVersion,omitempty" json:"binVersion,omitempty"`
	GitRevision string `yaml:"gitRevision,omitempty" json:"gitRevision,omitempty"`
}

type Desire added in v0.1.28

type Desire map[string]interface{}

Desire desire data

func (Desire) AppInfos added in v0.1.28

func (d Desire) AppInfos(isSys bool) []AppInfo

func (Desire) AppStats added in v0.1.67

func (d Desire) AppStats(isSys bool) []AppStats

func (Desire) Diff added in v0.1.28

func (d Desire) Diff(reported Report) (Desire, error)

Diff diff with reported data, return the delta fo desire

func (Desire) Merge added in v0.1.28

func (d Desire) Merge(desired Desire) error

Merge merge new reported data

func (Desire) SetAppInfos added in v0.1.65

func (d Desire) SetAppInfos(isSys bool, apps []AppInfo)

func (Desire) SetAppStats added in v0.1.67

func (d Desire) SetAppStats(isSys bool, stats []AppStats)

type DesireRequest added in v0.1.58

type DesireRequest struct {
	Infos []ResourceInfo `yaml:"infos" json:"infos"`
}

DesireRequest body of request to sync desired data

type DesireResponse added in v0.1.58

type DesireResponse struct {
	Values []ResourceValue `yaml:"values" json:"values"`
}

DesireResponse body of response to sync desired data

type Device added in v0.1.58

type Device struct {
	DevicePath  string `json:"devicePath,omitempty"`
	Policy      string `json:"policy,omitempty"`
	Description string `json:"description,omitempty"`
}

VolumeDevice device volume config

type Environment

type Environment struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

Environment environment config

type HostPathVolumeSource

type HostPathVolumeSource struct {
	Path string `json:"path,omitempty"`
}

HostPathVolumeSource volume source of host path

type InstanceStats added in v0.1.84

type InstanceStats struct {
	Name        string            `yaml:"name,omitempty" json:"name,omitempty"`
	ServiceName string            `yaml:"serviceName,omitempty" json:"serviceName"`
	Usage       map[string]string `yaml:"usage,omitempty" json:"usage,omitempty"`
	Status      Status            `yaml:"status,omitempty" json:"status,omitempty"`
	Cause       string            `yaml:"cause,omitempty" json:"cause,omitempty"`
	CreateTime  time.Time         `yaml:"createTime,omitempty" json:"createTime,omitempty"`
}

InstanceStats instance stats

type Kind added in v0.1.26

type Kind string

Kind app model kind, crd on k8s

const (
	KindNode          Kind = "node"
	KindApp           Kind = "app"
	KindApplication   Kind = "application"
	KindConfig        Kind = "config"
	KindConfiguration Kind = "configuration"
	KindSecret        Kind = "secret"
)

All kinds

type Node added in v0.1.42

type Node struct {
	Namespace         string            `json:"namespace,omitempty"`
	Name              string            `json:"name,omitempty" validate:"omitempty,resourceName"`
	Version           string            `json:"version,omitempty"`
	CreationTimestamp time.Time         `json:"createTime,omitempty"`
	Labels            map[string]string `json:"labels,omitempty" validate:"omitempty,validLabels"`
	Annotations       map[string]string `json:"annotations,omitempty"`
	Report            Report            `json:"report,omitempty"`
	Desire            Desire            `json:"desire,omitempty"`
	Description       string            `json:"description,omitempty"`
}

Node the spec of node

func (*Node) View added in v0.1.47

func (n *Node) View(timeout time.Duration) (*NodeView, error)

type NodeInfo

type NodeInfo struct {
	Hostname         string `yaml:"hostname,omitempty" json:"hostname,omitempty"`
	Address          string `yaml:"address,omitempty" json:"address,omitempty"`
	Arch             string `yaml:"arch,omitempty" json:"arch,omitempty"`
	KernelVersion    string `yaml:"kernelVer,omitempty" json:"kernelVer,omitempty"`
	OS               string `yaml:"os,omitempty" json:"os,omitempty"`
	ContainerRuntime string `yaml:"containerRuntime,omitempty" json:"containerRuntime"`
	MachineID        string `yaml:"machineID,omitempty" json:"machineID"`
	BootID           string `yaml:"bootID,omitempty" json:"bootID"`
	SystemUUID       string `yaml:"systemUUID,omitempty" json:"systemUUID"`
	OSImage          string `yaml:"osImage,omitempty" json:"osImage"`
}

NodeInfo node info

type NodeStats added in v0.1.84

type NodeStats struct {
	Usage    map[string]string `yaml:"usage,omitempty" json:"usage,omitempty"`
	Capacity map[string]string `yaml:"capacity,omitempty" json:"capacity,omitempty"`
	Percent  map[string]string `yaml:"percent,omitempty" json:"percent,omitempty"`
}

NodeStats node statistics

type NodeView added in v0.1.47

type NodeView struct {
	Namespace         string            `json:"namespace,omitempty"`
	Name              string            `json:"name,omitempty"`
	Version           string            `json:"version,omitempty"`
	CreationTimestamp time.Time         `json:"createTime,omitempty"`
	Labels            map[string]string `json:"labels,omitempty"`
	Annotations       map[string]string `json:"annotations,omitempty"`
	Report            *ReportView       `json:"report,omitempty"`
	Desire            Desire            `json:"desire,omitempty"`
	Description       string            `json:"description,omitempty"`
	Ready             bool              `json:"ready"`
}

type ObjectReference

type ObjectReference struct {
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
}

ObjectReference object reference to config or secret

type Report added in v0.1.28

type Report map[string]interface{}

Report report data

func (Report) AppInfos added in v0.1.28

func (r Report) AppInfos(isSys bool) []AppInfo

func (Report) AppStats added in v0.1.67

func (r Report) AppStats(isSys bool) []AppStats

func (Report) Merge added in v0.1.28

func (r Report) Merge(reported Report) error

Merge merge new reported data

func (Report) SetAppInfos added in v0.1.65

func (r Report) SetAppInfos(isSys bool, apps []AppInfo)

func (Report) SetAppStats added in v0.1.67

func (r Report) SetAppStats(isSys bool, stats []AppStats)

type ReportView added in v0.1.47

type ReportView struct {
	Time        *time.Time `json:"time,omitempty"`
	Apps        []AppInfo  `json:"apps,omitempty"`
	SysApps     []AppInfo  `json:"sysapps,omitempty"`
	Core        *CoreInfo  `json:"core,omitempty"`
	AppStats    []AppStats `json:"appstats,omitempty"`
	SysAppStats []AppStats `json:"sysappstats,omitempty"`
	Node        *NodeInfo  `json:"node,omitempty"`
	NodeStats   *NodeStats `json:"nodestats,omitempty"`
}

type ResourceInfo

type ResourceInfo struct {
	Kind    Kind   `yaml:"kind,omitempty" json:"kind,omitempty"`
	Name    string `yaml:"name,omitempty" json:"name,omitempty"`
	Version string `yaml:"version,omitempty" json:"version,omitempty"`
}

ResourceInfo desired info

type ResourceValue added in v0.1.58

type ResourceValue struct {
	ResourceInfo `yaml:",inline" json:",inline"`
	Value        VariableValue `yaml:"value,omitempty" json:"value,omitempty"`
}

ResourceValue desired value

func (*ResourceValue) App added in v0.1.58

func (v *ResourceValue) App() *Application

App return app data if its kind is app

func (*ResourceValue) Config added in v0.1.58

func (v *ResourceValue) Config() *Configuration

Config return config data if its kind is config

func (*ResourceValue) Secret added in v0.1.58

func (v *ResourceValue) Secret() *Secret

Secret return secret data if its kind is secret

type Resources

type Resources struct {
	Limits   map[string]string `json:"limits,omitempty"`
	Requests map[string]string `json:"requests,omitempty"`
}

Resources resources config

type Retry

type Retry struct {
	Max int `json:"max,omitempty"`
}

Retry retry config

type Secret

type Secret struct {
	Name              string            `json:"name,omitempty" validate:"resourceName,nonBaetyl"`
	Namespace         string            `json:"namespace,omitempty"`
	Labels            map[string]string `json:"labels,omitempty"`
	Annotations       map[string]string `json:"annotations,omitempty"`
	Data              map[string][]byte `json:"data,omitempty"`
	CreationTimestamp time.Time         `json:"createTime,omitempty"`
	UpdateTimestamp   time.Time         `json:"updateTime,omitempty"`
	Description       string            `json:"description,omitempty"`
	Version           string            `json:"version,omitempty"`
	System            bool              `json:"system,omitempty"`
}

Secret secret info

type SecurityContext added in v0.1.58

type SecurityContext struct {
	Privileged bool `json:"privileged,omitempty"`
}

type Service

type Service struct {
	// specifies the unique name of the service
	Name string `json:"name,omitempty" binding:"required" validate:"omitempty,resourceName"`
	// specifies the hostname of the service
	Hostname string `json:"hostname,omitempty"`
	// specifies the image of the service, usually using the Docker image name
	Image string `json:"image,omitempty" binding:"required"`
	// specifies the number of instances started
	Replica int `json:"replica,omitempty" binding:"required" default:"1"`
	// specifies the storage volumes that the service needs, map the storage volume to the directory in the container
	VolumeMounts []VolumeMount `json:"volumeMounts,omitempty"`
	// specifies the port bindings which exposed by the service, only for Docker container mode
	Ports []ContainerPort `json:"ports,omitempty"`
	// specifies the device bindings which used by the service, only for Docker container mode
	Devices []Device `json:"devices,omitempty"`
	// specifies the startup arguments of the service program, but does not include `arg[0]`
	Args []string `json:"args,omitempty"`
	// specifies the environment variable of the service program
	Env []Environment `json:"env,omitempty"`
	// specifies resource limits for a single instance of the service,  only for Docker container mode
	Resources *Resources `json:"resources,omitempty"`
	// specifies runtime to use, only for Docker container mode
	Runtime string `json:"runtime,omitempty"`
	// labels
	Labels map[string]string `json:"labels,omitempty"`
	// specifies the security context of service
	SecurityContext *SecurityContext `json:"security,omitempty"`
	// specifies host network mode of service
	HostNetwork bool `json:"hostNetwork,omitempty"`
	// specifies function config of service
	FunctionConfig *ServiceFunctionConfig `json:"functionConfig,omitempty"`
	// specifies functions of service
	Functions []ServiceFunction `json:"functions,omitempty"`
}

Service service config1ma1

type ServiceFunction added in v0.1.76

type ServiceFunction struct {
	Name    string `json:"name,omitempty"`
	Handler string `json:"handler,omitempty"`
	CodeDir string `json:"codedir,omitempty"`
}

type ServiceFunctionConfig added in v0.1.76

type ServiceFunctionConfig struct {
	Name    string `json:"name,omitempty" validate:"resourceName"`
	Runtime string `json:"runtime,omitempty"`
}

type Status added in v0.1.86

type Status string
const (
	Pending Status = "Pending"
	Failed  Status = "Failed"
	Running Status = "Running"
	Unknown Status = "Unknown"
)

type VariableValue added in v0.1.28

type VariableValue struct {
	Data  []byte
	Value interface{}
}

VariableValue variable value which can be app, config or secret

func (*VariableValue) MarshalJSON added in v0.1.28

func (v *VariableValue) MarshalJSON() ([]byte, error)

MarshalJSON marshal to json data

func (*VariableValue) UnmarshalJSON added in v0.1.28

func (v *VariableValue) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshal from json data

type Volume

type Volume struct {
	// specified name of the volume
	Name string `json:"name,omitempty" binding:"required" validate:"omitempty,resourceName"`
	// specified driver for the storage volume
	VolumeSource `json:",inline"`
}

Volume volume config

type VolumeMount

type VolumeMount struct {
	// specifies name of volume
	Name string `json:"name,omitempty"`
	// specifies mount path of volume
	MountPath string `json:"mountPath,omitempty"`
	// specifies if the volume is read-only
	ReadOnly bool `json:"readOnly,omitempty"`
	// specifies if the volumeMount is immutable
	Immutable bool `json:"immutable,omitempty"`
}

VolumeMount volume mount config

type VolumeSource

type VolumeSource struct {
	HostPath *HostPathVolumeSource `json:"hostPath,omitempty"`
	Config   *ObjectReference      `json:"config,omitempty"`
	Secret   *ObjectReference      `json:"secret,omitempty"`
}

VolumeSource volume source, include empty directory, host path, config and secret

Jump to

Keyboard shortcuts

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