deviceshifubase

package
v0.42.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ConfigmapDriverPropertiesStr                 = "driverProperties"
	ConfigmapInstructionsStr                     = "instructions"
	ConfigmapTelemetriesStr                      = "telemetries"
	ConfigmapCustomizedInstructionsStr           = "customInstructionsPython"
	EdgedeviceResourceStr                        = "edgedevices"
	TelemetryCollectionServiceResourceStr        = "telemetryservices"
	DeviceDefaultPortStr                  string = ":8080"
	DeviceIsHealthyStr                    string = "Device is healthy"
	DeviceConfigmapFolderPath             string = "/etc/edgedevice/config"
	DeviceKubeconfigDoNotLoadStr          string = "NULL"
	DeviceNameSpaceDefault                string = "default"
	KubernetesConfigDefault               string = ""
	DeviceInstructionTimeoutURIQueryStr   string = "timeout"
	DeviceDefaultCMDDoNotExec             string = "issue_cmd"
	DeviceDefaultCMDStubHealth            string = "stub_health"
	PowerShellStubTimeoutStr              string = "cmdTimeout"
	PowerShellStubTimeoutTolerationStr    string = "stub_toleration"
	PythonHandlersModuleName                     = "customized_handlers"
	PythonScriptDir                              = "pythoncustomizedhandlers"
	ControlMsgsConfigStr                         = "controlMsgs"
)

Str and default value

View Source
const (
	DeviceInstructionInitialDelay            int64 = 3000
	DeviceTelemetryTimeoutInMS               int64 = 3000
	DeviceTelemetryUpdateIntervalInMS        int64 = 3000
	DeviceTelemetryInitialDelayInMS          int64 = 3000
	DeviceDefaultConnectionTimeoutInMS       int64 = 3000
	DeviceDefaultRequestTimeoutInMS          int64 = 1000
	DeviceDefaultTelemetryUpdateIntervalInMS int64 = 1000
	DeviceDefaultGlobalTimeoutInSeconds      int64 = 3
	DefaultHTTPServerTimeoutInSeconds        int64 = 0
)

default value

View Source
const (
	PasswordSecretField = "password"
	UsernameSecretField = "username"
	SecretResource      = "secrets"
)

Variables

View Source
var (
	// TelemetryCollectionServiceMap Telemetry Collection Service Map
	TelemetryCollectionServiceMap map[string]v1alpha1.TelemetryServiceSpec
	CustomInstructionsPython      map[string]string
)

Functions

func BindDefaultHandler added in v0.1.1

func BindDefaultHandler(mux *http.ServeMux)

func NewEdgeDevice

func NewEdgeDevice(edgeDeviceConfig *EdgeDeviceConfig) (*v1alpha1.EdgeDevice, *rest.RESTClient, error)

NewEdgeDevice new edgeDevice

func PushTelemetryCollectionService added in v0.4.0

func PushTelemetryCollectionService(tss *v1alpha1.TelemetryServiceSpec, spec *v1alpha1.EdgeDeviceSpec, message *http.Response) error

Types

type DeviceShifu

type DeviceShifu interface {
	Start(stopCh <-chan struct{}) error
	Stop() error
}

DeviceShifu interface of Deviceshifu include start telemetry and stop http server

type DeviceShifuBase

type DeviceShifuBase struct {
	Name              string
	Server            *http.Server
	DeviceShifuConfig *DeviceShifuConfig
	EdgeDevice        *v1alpha1.EdgeDevice
	RestClient        *rest.RESTClient
}

DeviceShifuBase deviceshifu Basic Info

func New

func New(deviceShifuMetadata *DeviceShifuMetaData) (*DeviceShifuBase, *http.ServeMux, error)

New new deviceshifu base

func (*DeviceShifuBase) Start

func (ds *DeviceShifuBase) Start(stopCh <-chan struct{}, fn collectTelemetry) error

Start HTTP server and telemetryCollection

func (*DeviceShifuBase) StartTelemetryCollection

func (ds *DeviceShifuBase) StartTelemetryCollection(fn collectTelemetry) error

StartTelemetryCollection Start TelemetryCollection

func (*DeviceShifuBase) Stop

func (ds *DeviceShifuBase) Stop() error

Stop Stop http server

func (*DeviceShifuBase) UpdateEdgeDeviceResourcePhase

func (ds *DeviceShifuBase) UpdateEdgeDeviceResourcePhase(edPhase v1alpha1.EdgeDevicePhase)

UpdateEdgeDeviceResourcePhase Update device status

type DeviceShifuConfig

type DeviceShifuConfig struct {
	DriverProperties         DeviceShifuDriverProperties
	Instructions             DeviceShifuInstructions
	Telemetries              *DeviceShifuTelemetries
	CustomInstructionsPython map[string]string `yaml:"customInstructionsPython"`
	ControlMsgs              map[string]string `yaml:"controlMsgs,omitempty"`
}

DeviceShifuConfig data under Configmap, Settings of deviceShifu

func NewDeviceShifuConfig

func NewDeviceShifuConfig(path string) (*DeviceShifuConfig, error)

NewDeviceShifuConfig Read the configuration under the path directory and return configuration

type DeviceShifuDriverProperties

type DeviceShifuDriverProperties struct {
	DriverSku       string `yaml:"driverSku"`
	DriverImage     string `yaml:"driverImage"`
	DriverExecution string `yaml:"driverExecution,omitempty"`
}

DeviceShifuDriverProperties properties of deviceshifuDriver

type DeviceShifuInstruction

type DeviceShifuInstruction struct {
	DeviceShifuInstructionProperties []DeviceShifuInstructionProperty `yaml:"argumentPropertyList,omitempty"`
	DeviceShifuProtocolProperties    map[string]string                `yaml:"protocolPropertyList,omitempty"`
}

DeviceShifuInstruction Instruction of deviceshifu

type DeviceShifuInstructionProperty

type DeviceShifuInstructionProperty struct {
	ValueType    string      `yaml:"valueType"`
	ReadWrite    string      `yaml:"readWrite"`
	DefaultValue interface{} `yaml:"defaultValue"`
}

DeviceShifuInstructionProperty property of instruction

type DeviceShifuInstructionSettings

type DeviceShifuInstructionSettings struct {
	DefaultTimeoutSeconds *int64 `yaml:"defaultTimeoutSeconds,omitempty"`
}

DeviceShifuInstructionSettings Settings of all instructions

type DeviceShifuInstructions

type DeviceShifuInstructions struct {
	Instructions        map[string]*DeviceShifuInstruction `yaml:"instructions"`
	InstructionSettings *DeviceShifuInstructionSettings    `yaml:"instructionSettings,omitempty"`
}

DeviceShifuInstructions Instructions of devicehsifu

type DeviceShifuMetaData

type DeviceShifuMetaData struct {
	Name           string
	ConfigFilePath string
	KubeConfigPath string
	Namespace      string
}

DeviceShifuMetaData Deviceshifu MetaData

type DeviceShifuTelemetries

type DeviceShifuTelemetries struct {
	DeviceShifuTelemetrySettings *DeviceShifuTelemetrySettings    `yaml:"telemetrySettings,omitempty"`
	DeviceShifuTelemetries       map[string]*DeviceShifuTelemetry `yaml:"telemetries,omitempty"`
}

DeviceShifuTelemetries Telemetries of deviceshifu

type DeviceShifuTelemetry

type DeviceShifuTelemetry struct {
	DeviceShifuTelemetryProperties DeviceShifuTelemetryProperties `yaml:"properties,omitempty"`
}

DeviceShifuTelemetry properties of telemetry

type DeviceShifuTelemetryProperties

type DeviceShifuTelemetryProperties struct {
	DeviceInstructionName *string                           `yaml:"instruction"`
	InitialDelayMs        *int64                            `yaml:"initialDelayMs,omitempty"`
	IntervalMs            *int64                            `yaml:"intervalMs,omitempty"`
	PushSettings          *DeviceShifuTelemetryPushSettings `yaml:"pushSettings,omitempty"`
}

DeviceShifuTelemetryProperties properties of Telemetry

type DeviceShifuTelemetryPushSettings

type DeviceShifuTelemetryPushSettings struct {
	DeviceShifuTelemetryCollectionService *string `yaml:"telemetryCollectionService,omitempty"`
	DeviceShifuTelemetryPushToServer      *bool   `yaml:"pushToServer,omitempty"`
}

DeviceShifuTelemetryPushSettings settings of push under telemetry

type DeviceShifuTelemetrySettings

type DeviceShifuTelemetrySettings struct {
	DeviceShifuTelemetryUpdateIntervalInMilliseconds *int64  `yaml:"telemetryUpdateIntervalInMilliseconds,omitempty"`
	DeviceShifuTelemetryTimeoutInMilliseconds        *int64  `yaml:"telemetryTimeoutInMilliseconds,omitempty"`
	DeviceShifuTelemetryInitialDelayInMilliseconds   *int64  `yaml:"telemetryInitialDelayInMilliseconds,omitempty"`
	DeviceShifuTelemetryDefaultPushToServer          *bool   `yaml:"defaultPushToServer,omitempty"`
	DeviceShifuTelemetryDefaultCollectionService     *string `yaml:"defaultTelemetryCollectionService,omitempty"`
}

DeviceShifuTelemetrySettings settings of Telemetry

type EdgeDeviceConfig

type EdgeDeviceConfig struct {
	NameSpace      string
	DeviceName     string
	KubeconfigPath string
}

EdgeDeviceConfig config of EdgeDevice

Jump to

Keyboard shortcuts

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