Skip to content

Commit

Permalink
change the field "telemetryServiceEndpoint" to "telemetrySeriveEndpoint"
Browse files Browse the repository at this point in the history
  • Loading branch information
p-mega committed Feb 29, 2024
1 parent 8a0cc59 commit c50276e
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: push-custom-data
namespace: devices
spec:
telemetrySeriveEndpoint: http://mockserver.devices.svc.cluster.local:11111/custom_data/save
telemetryServiceEndpoint: http://mockserver.devices.svc.cluster.local:11111/custom_data/save
serviceSettings:
HTTPSetting:
username:
Expand All @@ -16,7 +16,7 @@ metadata:
name: push-data
namespace: devices
spec:
telemetrySeriveEndpoint: http://mockserver.devices.svc.cluster.local:11111/data/save
telemetryServiceEndpoint: http://mockserver.devices.svc.cluster.local:11111/data/save
serviceSettings:
HTTPSetting:
username:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: push-endpoint-1
namespace: devices
spec:
telemetrySeriveEndpoint: http://telemetryservice.shifu-service.svc.cluster.local
telemetryServiceEndpoint: http://telemetryservice.shifu-service.svc.cluster.local
serviceSettings:
MQTTSetting:
MQTTServerAddress: 192.168.14.163:1883
Expand All @@ -17,7 +17,7 @@ metadata:
name: push-endpoint-2
namespace: devices
spec:
telemetrySeriveEndpoint: http://telemetryservice.shifu-service.svc.cluster.local
telemetryServiceEndpoint: http://telemetryservice.shifu-service.svc.cluster.local
serviceSettings:
SQLSetting:
serverAddress: 192.168.14.163:6041
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: push-file-mp4
namespace: devices
spec:
telemetrySeriveEndpoint: http://telemetryservice.shifu-service.svc.cluster.local
telemetryServiceEndpoint: http://telemetryservice.shifu-service.svc.cluster.local
serviceSettings:
MinIOSetting:
# or you can specify AccessKey and SecretKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: push-endpoint-1
namespace: devices
spec:
telemetrySeriveEndpoint: http://telemetryservice.shifu-service.svc.cluster.local
telemetryServiceEndpoint: http://telemetryservice.shifu-service.svc.cluster.local
serviceSettings:
MQTTSetting:
MQTTServerAddress: 192.168.14.163:1883
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: push-endpoint-1
namespace: devices
spec:
telemetrySeriveEndpoint: http://telemetryservice.shifu-service.svc.cluster.local
telemetryServiceEndpoint: http://telemetryservice.shifu-service.svc.cluster.local
serviceSettings:
SQLSetting:
serverAddress: 192.168.14.163:6041
Expand Down
10 changes: 5 additions & 5 deletions pkg/deviceshifu/deviceshifubase/pushtelemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func PushTelemetryCollectionService(tss *v1alpha1.TelemetryServiceSpec, spec *v1
}

if tss.ServiceSettings.HTTPSetting != nil {
err := pushToHTTPTelemetryCollectionService(message, *tss.TelemetrySeriveEndpoint)
err := pushToHTTPTelemetryCollectionService(message, *tss.TelemetryServiceEndpoint)
if err != nil {
return err
}
Expand All @@ -39,7 +39,7 @@ func PushTelemetryCollectionService(tss *v1alpha1.TelemetryServiceSpec, spec *v1
request := &v1alpha1.TelemetryRequest{
MQTTSetting: tss.ServiceSettings.MQTTSetting,
}
telemetryServicePath := *tss.TelemetrySeriveEndpoint + v1alpha1.TelemetryServiceURIMQTT
telemetryServicePath := *tss.TelemetryServiceEndpoint + v1alpha1.TelemetryServiceURIMQTT
err := pushToShifuTelemetryCollectionService(message, request, telemetryServicePath)
if err != nil {
return err
Expand All @@ -51,7 +51,7 @@ func PushTelemetryCollectionService(tss *v1alpha1.TelemetryServiceSpec, spec *v1
Spec: spec,
SQLConnectionSetting: tss.ServiceSettings.SQLSetting,
}
telemetryServicePath := *tss.TelemetrySeriveEndpoint + v1alpha1.TelemetryServiceURISQL
telemetryServicePath := *tss.TelemetryServiceEndpoint + v1alpha1.TelemetryServiceURISQL
err := pushToShifuTelemetryCollectionService(message, request, telemetryServicePath)
if err != nil {
return err
Expand All @@ -62,7 +62,7 @@ func PushTelemetryCollectionService(tss *v1alpha1.TelemetryServiceSpec, spec *v1
request := &v1alpha1.TelemetryRequest{
MinIOSetting: tss.ServiceSettings.MinIOSetting,
}
telemetryServicePath := *tss.TelemetrySeriveEndpoint + v1alpha1.TelemetryServiceURIMinIO
telemetryServicePath := *tss.TelemetryServiceEndpoint + v1alpha1.TelemetryServiceURIMinIO
err := pushToShifuTelemetryCollectionService(message, request, telemetryServicePath)
if err != nil {
return err
Expand Down Expand Up @@ -194,7 +194,7 @@ func getTelemetryCollectionServiceMap(ds *DeviceShifuBase) (map[string]v1alpha1.
defaultTelemetryCollectionService := ""
defaultTelemetryServiceAddress := ""
defaultTelemetryServiceSpec := &v1alpha1.TelemetryServiceSpec{
TelemetrySeriveEndpoint: &defaultTelemetryServiceAddress,
TelemetryServiceEndpoint: &defaultTelemetryServiceAddress,
}

telemetries := ds.DeviceShifuConfig.Telemetries
Expand Down
32 changes: 16 additions & 16 deletions pkg/deviceshifu/deviceshifubase/pushtelemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TestGetTelemetryCollectionServiceMap(t *testing.T) {
},
},
},
RestClient: mockRestClientFor("{\"spec\": {\"telemetrySeriveEndpoint\": \"http://192.168.15.48:12345/endpoint1\",\"type\": \"HTTP\"}}", t),
RestClient: mockRestClientFor("{\"spec\": {\"telemetryServiceEndpoint\": \"http://192.168.15.48:12345/endpoint1\",\"type\": \"HTTP\"}}", t),
},
expectedMap: map[string]v1alpha1.TelemetryServiceSpec(map[string]v1alpha1.TelemetryServiceSpec{}),
expErrStr: "",
Expand Down Expand Up @@ -153,11 +153,11 @@ func TestGetTelemetryCollectionServiceMap(t *testing.T) {
},
},
},
RestClient: mockRestClientFor("{\"spec\": {\"telemetrySeriveEndpoint\": \"http://192.168.15.48:12345/test_endpoint-1\",\"type\": \"HTTP\"}}", t),
RestClient: mockRestClientFor("{\"spec\": {\"telemetryServiceEndpoint\": \"http://192.168.15.48:12345/test_endpoint-1\",\"type\": \"HTTP\"}}", t),
},
expectedMap: map[string]v1alpha1.TelemetryServiceSpec(map[string]v1alpha1.TelemetryServiceSpec{
"device_healthy": {
TelemetrySeriveEndpoint: unitest.ToPointer(""),
TelemetryServiceEndpoint: unitest.ToPointer(""),
},
}),
expErrStr: "",
Expand All @@ -184,11 +184,11 @@ func TestGetTelemetryCollectionServiceMap(t *testing.T) {
},
},
},
RestClient: mockRestClientFor("{\"spec\": {\"telemetrySeriveEndpoint\": \"http://192.168.15.48:12345/test_endpoint-1\",\"type\": \"HTTP\"}}", t),
RestClient: mockRestClientFor("{\"spec\": {\"telemetryServiceEndpoint\": \"http://192.168.15.48:12345/test_endpoint-1\",\"type\": \"HTTP\"}}", t),
},
expectedMap: map[string]v1alpha1.TelemetryServiceSpec(map[string]v1alpha1.TelemetryServiceSpec{
"device_healthy": {
TelemetrySeriveEndpoint: unitest.ToPointer(""),
TelemetryServiceEndpoint: unitest.ToPointer(""),
},
}),
expErrStr: "",
Expand Down Expand Up @@ -220,11 +220,11 @@ func TestGetTelemetryCollectionServiceMap(t *testing.T) {
},
},
},
RestClient: mockRestClientFor("{\"spec\": {\"telemetrySeriveEndpoint\": \"http://192.168.15.48:12345/test-healthy-endpoint\",\"type\": \"HTTP\"}}", t),
RestClient: mockRestClientFor("{\"spec\": {\"telemetryServiceEndpoint\": \"http://192.168.15.48:12345/test-healthy-endpoint\",\"type\": \"HTTP\"}}", t),
},
expectedMap: map[string]v1alpha1.TelemetryServiceSpec(map[string]v1alpha1.TelemetryServiceSpec{
"device_healthy": {
TelemetrySeriveEndpoint: unitest.ToPointer("http://192.168.15.48:12345/test-healthy-endpoint"),
TelemetryServiceEndpoint: unitest.ToPointer("http://192.168.15.48:12345/test-healthy-endpoint"),
},
}),
expErrStr: "",
Expand Down Expand Up @@ -256,11 +256,11 @@ func TestGetTelemetryCollectionServiceMap(t *testing.T) {
},
},
},
RestClient: mockRestClientFor("{\"spec\": {\"telemetrySeriveEndpoint\": \"http://192.168.15.48:12345/test_endpoint-1\",\"type\": \"HTTP\"}}", t),
RestClient: mockRestClientFor("{\"spec\": {\"telemetryServiceEndpoint\": \"http://192.168.15.48:12345/test_endpoint-1\",\"type\": \"HTTP\"}}", t),
},
expectedMap: map[string]v1alpha1.TelemetryServiceSpec(map[string]v1alpha1.TelemetryServiceSpec{
"device_healthy": {
TelemetrySeriveEndpoint: unitest.ToPointer("http://192.168.15.48:12345/test_endpoint-1"),
TelemetryServiceEndpoint: unitest.ToPointer("http://192.168.15.48:12345/test_endpoint-1"),
},
}),
expErrStr: "",
Expand Down Expand Up @@ -292,7 +292,7 @@ func TestGetTelemetryCollectionServiceMap(t *testing.T) {
},
},
},
RestClient: mockRestClientFor("{\"spec\": {\"telemetrySeriveEndpoint\": \"http://192.168.15.48:12345/test_endpoint-1\",\"type\": \"HTTP\"}}", t),
RestClient: mockRestClientFor("{\"spec\": {\"telemetryServiceEndpoint\": \"http://192.168.15.48:12345/test_endpoint-1\",\"type\": \"HTTP\"}}", t),
},
expectedMap: map[string]v1alpha1.TelemetryServiceSpec(map[string]v1alpha1.TelemetryServiceSpec{}),
expErrStr: "",
Expand Down Expand Up @@ -413,7 +413,7 @@ func TestPushTelemetryCollectionService(t *testing.T) {
{
name: "case0 empty Settings",
spec: &v1alpha1.TelemetryServiceSpec{
TelemetrySeriveEndpoint: unitest.ToPointer(address),
TelemetryServiceEndpoint: unitest.ToPointer(address),
},
message: &http.Response{
Body: io.NopCloser(bytes.NewBufferString("test")),
Expand All @@ -422,7 +422,7 @@ func TestPushTelemetryCollectionService(t *testing.T) {
}, {
name: "case1 http",
spec: &v1alpha1.TelemetryServiceSpec{
TelemetrySeriveEndpoint: unitest.ToPointer(address),
TelemetryServiceEndpoint: unitest.ToPointer(address),
ServiceSettings: &v1alpha1.ServiceSettings{
HTTPSetting: &v1alpha1.HTTPSetting{},
},
Expand All @@ -438,7 +438,7 @@ func TestPushTelemetryCollectionService(t *testing.T) {
MQTTTopic: unitest.ToPointer("/test/topic"),
},
},
TelemetrySeriveEndpoint: unitest.ToPointer(address),
TelemetryServiceEndpoint: unitest.ToPointer(address),
},
message: &http.Response{
Body: io.NopCloser(bytes.NewBufferString("test")),
Expand All @@ -453,7 +453,7 @@ func TestPushTelemetryCollectionService(t *testing.T) {
ServiceSettings: &v1alpha1.ServiceSettings{
SQLSetting: &v1alpha1.SQLConnectionSetting{},
},
TelemetrySeriveEndpoint: unitest.ToPointer(address),
TelemetryServiceEndpoint: unitest.ToPointer(address),
},
message: &http.Response{
Body: io.NopCloser(bytes.NewBufferString("test")),
Expand All @@ -465,7 +465,7 @@ func TestPushTelemetryCollectionService(t *testing.T) {
ServiceSettings: &v1alpha1.ServiceSettings{
MinIOSetting: &v1alpha1.MinIOSetting{},
},
TelemetrySeriveEndpoint: unitest.ToPointer(address),
TelemetryServiceEndpoint: unitest.ToPointer(address),
},
message: &http.Response{
Body: io.NopCloser(bytes.NewBufferString("test")),
Expand All @@ -479,7 +479,7 @@ func TestPushTelemetryCollectionService(t *testing.T) {
MQTTTopic: unitest.ToPointer("/test/topic"),
},
},
TelemetrySeriveEndpoint: unitest.ToPointer(address),
TelemetryServiceEndpoint: unitest.ToPointer(address),
},
message: &http.Response{
Body: io.NopCloser(bytes.NewBufferString("test")),
Expand Down
2 changes: 1 addition & 1 deletion pkg/deviceshifu/deviceshifuhttp/deviceshifuhttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ func (ds *DeviceShifuHTTP) collectHTTPTelemtries() (bool, error) {
}

telemetryCollectionService, exist := deviceshifubase.TelemetryCollectionServiceMap[telemetry]
if exist && *telemetryCollectionService.TelemetrySeriveEndpoint != "" {
if exist && *telemetryCollectionService.TelemetryServiceEndpoint != "" {
resp.Header.Add(DeviceNameHeaderField, deviceName)
err = deviceshifubase.PushTelemetryCollectionService(&telemetryCollectionService, &ds.base.EdgeDevice.Spec, resp)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/deviceshifu/deviceshifuhttp/deviceshifuhttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func TestCollectHTTPTelemtries(t *testing.T) {
}
deviceshifubase.TelemetryCollectionServiceMap = map[string]v1alpha1.TelemetryServiceSpec{
"device_healthy": v1alpha1.TelemetryServiceSpec{
TelemetrySeriveEndpoint: &ms.URL,
TelemetryServiceEndpoint: &ms.URL,
ServiceSettings: &v1alpha1.ServiceSettings{
HTTPSetting: &v1alpha1.HTTPSetting{
Username: &username,
Expand Down
6 changes: 3 additions & 3 deletions pkg/k8s/api/v1alpha1/telemetryservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ type TelemetryServiceSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

TelemetrySeriveEndpoint *string `json:"telemetrySeriveEndpoint,omitempty"`
ServiceSettings *ServiceSettings `json:"serviceSettings,omitempty"`
CustomMetadata *map[string]string `json:"customMetadata,omitempty"`
TelemetryServiceEndpoint *string `json:"telemetryServiceEndpoint,omitempty"`
ServiceSettings *ServiceSettings `json:"serviceSettings,omitempty"`
CustomMetadata *map[string]string `json:"customMetadata,omitempty"`
}

type Type string
Expand Down
4 changes: 2 additions & 2 deletions pkg/k8s/api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ spec:
type: string
type: object
type: object
telemetrySeriveEndpoint:
telemetryServiceEndpoint:
type: string
type: object
status:
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/crd/install/config_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ spec:
type: string
type: object
type: object
telemetrySeriveEndpoint:
telemetryServiceEndpoint:
type: string
type: object
status:
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/crd/install/config_default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ spec:
type: string
type: object
type: object
telemetrySeriveEndpoint:
telemetryServiceEndpoint:
type: string
type: object
status:
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/crd/install/shifu_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ spec:
type: string
type: object
type: object
telemetrySeriveEndpoint:
telemetryServiceEndpoint:
type: string
type: object
status:
Expand Down

0 comments on commit c50276e

Please sign in to comment.