Documentation ¶
Index ¶
- Constants
- Variables
- type ActiveRequest
- type ActiveResponse
- type AppInfo
- type AppStats
- type Application
- type Configuration
- type ConfigurationObject
- type ContainerPort
- type CoreInfo
- type Desire
- func (d Desire) AppInfos(isSys bool) []AppInfo
- func (d Desire) AppStats(isSys bool) []AppStats
- func (d Desire) Diff(reported Report) (Desire, error)
- func (d Desire) Merge(desired Desire) error
- func (d Desire) SetAppInfos(isSys bool, apps []AppInfo)
- func (d Desire) SetAppStats(isSys bool, stats []AppStats)
- type DesireRequest
- type DesireResponse
- type Device
- type Environment
- type HostPathVolumeSource
- type InstanceStats
- type Kind
- type Message
- type MessageKind
- type Node
- type NodeInfo
- type NodeStats
- type NodeView
- type ObjectReference
- type Report
- type ReportView
- type ResourceInfo
- type ResourceValue
- type Resources
- type Retry
- type Secret
- type SecurityContext
- type Service
- type ServiceFunction
- type ServiceFunctionConfig
- type Status
- type VariableValue
- type Volume
- type VolumeMount
- type VolumeSource
Constants ¶
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 ¶
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 ¶
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 ¶
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 ¶
type AppInfo struct { Name string `yaml:"name,omitempty" json:"name,omitempty"` Version string `yaml:"version,omitempty" json:"version,omitempty"` }
AppInfo app info
type AppStats ¶
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 ¶
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 Desire ¶
type Desire map[string]interface{}
Desire desire data
func (Desire) SetAppInfos ¶
func (Desire) SetAppStats ¶
type DesireRequest ¶
type DesireRequest struct {
Infos []ResourceInfo `yaml:"infos" json:"infos"`
}
DesireRequest body of request to sync desired data
type DesireResponse ¶
type DesireResponse struct {
Values []ResourceValue `yaml:"values" json:"values"`
}
DesireResponse body of response to sync desired data
type Device ¶
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 ¶
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 Message ¶ added in v2.0.18
type Message struct { Kind string `yaml:"kind" json:"kind"` Metadata map[string]string `yaml:"meta" json:"meta"` Content interface{} `yaml:"content" json:"content"` }
Message general structure for http and ws sync
type MessageKind ¶ added in v2.0.18
type MessageKind string
MessageKind message kind
const ( MessageReport MessageKind = "report" MessageDesire MessageKind = "desire" )
type Node ¶
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
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 ¶
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 ¶
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 ¶
type Report map[string]interface{}
Report report data
func (Report) SetAppInfos ¶
func (Report) SetAppStats ¶
type ReportView ¶
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 ¶
type ResourceValue struct { ResourceInfo `yaml:",inline" json:",inline"` Value VariableValue `yaml:"value,omitempty" json:"value,omitempty"` }
ResourceValue desired value
func (*ResourceValue) App ¶
func (v *ResourceValue) App() *Application
App return app data if its kind is app
func (*ResourceValue) Config ¶
func (v *ResourceValue) Config() *Configuration
Config return config data if its kind is config
func (*ResourceValue) Secret ¶
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 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 ¶
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 ¶
type ServiceFunctionConfig ¶
type VariableValue ¶
type VariableValue struct { Data []byte Value interface{} }
VariableValue variable value which can be app, config or secret
func (*VariableValue) MarshalJSON ¶
func (v *VariableValue) MarshalJSON() ([]byte, error)
MarshalJSON marshal to json data
func (*VariableValue) UnmarshalJSON ¶
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