deviceshifubase

package
v0.3.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigmapDriverPropertiesStr                    = "driverProperties"
	ConfigmapInstructionsStr                        = "instructions"
	ConfigmapTelemetriesStr                         = "telemetries"
	ConfigmapCustomizedInstructionsStr              = "customInstructionsPython"
	EdgedeviceResourceStr                           = "edgedevices"
	TelemetryCollectionServiceResourceStr           = "telemetryservices"
	DeviceTelemetryTimeoutInMS               int64  = 3000
	DeviceTelemetryUpdateIntervalInMS        int64  = 3000
	DeviceTelemetryInitialDelayInMS          int64  = 3000
	DeviceDefaultConnectionTimeoutInMS       int64  = 3000
	DeviceDefaultPortStr                     string = ":8080"
	DeviceDefaultRequestTimeoutInMS          int64  = 1000
	DeviceDefaultTelemetryUpdateIntervalInMS int64  = 1000
	DeviceIsHealthyStr                       string = "Device is healthy"
	DeviceConfigmapFolderPath                string = "/etc/edgedevice/config"
	DeviceKubeconfigDoNotLoadStr             string = "NULL"
	DeviceNameSpaceDefault                   string = "default"
	KubernetesConfigDefault                  string = ""
	DeviceInstructionTimeoutURIQueryStr      string = "timeout"
	DeviceDefaultGlobalTimeoutInSeconds      int    = 3
	DefaultHTTPServerTimeoutInSeconds        int    = 0
	DeviceDefaultCMDDoNotExec                string = "issue_cmd"
	DeviceDefaultCMDStubHealth               string = "stub_health"
	PowerShellStubTimeoutStr                 string = "cmdTimeout"
	PowerShellStubTimeoutTolerationStr       string = "stub_toleration"
	PythonHandlersModuleName                        = "customized_handlers"
	PythonScriptDir                                 = "pythoncustomizedhandlers"
)

Str and default value

Variables

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

Functions

func BindDefaultHandler added in v0.1.1

func BindDefaultHandler(mux *http.ServeMux)

func CopyHeader

func CopyHeader(dst, src http.Header)

CopyHeader HTTP header type: type Header map[string][]string

func NewEdgeDevice

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

NewEdgeDevice new edgeDevice

func PushToHTTPTelemetryCollectionService

func PushToHTTPTelemetryCollectionService(telemetryServiceProtocol v1alpha1.Protocol,
	message *http.Response, telemetryCollectionService string)

TODO need to return and handle Error PushToHTTPTelemetryCollectionService push telemetry data to Collection Service

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

func (*DeviceShifuBase) ValidateTelemetryConfig

func (ds *DeviceShifuBase) ValidateTelemetryConfig() error

ValidateTelemetryConfig Validate TelemetryConfig

type DeviceShifuConfig

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

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 *int `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        *int                              `yaml:"initialDelayMs,omitempty"`
	IntervalMs            *int                              `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