From e183554c44a362cabff0be918b873c3673dd76e3 Mon Sep 17 00:00:00 2001 From: cool-wangtongzhou <1240114611@qq.com> Date: Fri, 20 Oct 2023 15:14:37 +0800 Subject: [PATCH 1/6] update-apimachinery-0.28.3 --- go.mod | 24 +++++----- go.sum | 48 +++++++++---------- .../etc/edgedevice/config/driverProperties | 2 + .../etc/edgedevice/config/instructions | 2 + .../etc/edgedevice/config/telemetries | 2 + pkg/k8s/crd/main.go | 6 +-- 6 files changed, 45 insertions(+), 39 deletions(-) create mode 100644 pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/driverProperties create mode 100644 pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/instructions create mode 100644 pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/telemetries diff --git a/go.mod b/go.mod index a9c5ed84f..709c7389a 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/eclipse/paho.mqtt.golang v1.4.3 github.com/gopcua/opcua v0.4.0 gopkg.in/yaml.v3 v3.0.1 - k8s.io/apimachinery v0.28.1 - k8s.io/client-go v0.28.1 + k8s.io/apimachinery v0.28.3 + k8s.io/client-go v0.28.3 ) require ( @@ -26,7 +26,7 @@ require ( github.com/taosdata/driver-go/v3 v3.5.0 golang.org/x/crypto v0.14.0 knative.dev/pkg v0.0.0-20221010143036-21d3b47e2efe - sigs.k8s.io/controller-runtime v0.15.1 + sigs.k8s.io/controller-runtime v0.16.3 ) require ( @@ -59,7 +59,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/emicklei/go-restful/v3 v3.9.0 // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-logr/logr v1.2.4 // indirect @@ -89,13 +89,13 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.15.1 // indirect + github.com/prometheus/client_golang v1.16.0 // indirect github.com/prometheus/client_model v0.4.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/procfs v0.10.1 // indirect github.com/rs/zerolog v1.28.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - go.uber.org/multierr v1.10.0 // indirect + go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 golang.org/x/net v0.17.0 golang.org/x/oauth2 v0.8.0 // indirect @@ -104,14 +104,14 @@ require ( golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect - gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect + gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/api v0.28.1 - k8s.io/apiextensions-apiserver v0.27.2 // indirect - k8s.io/component-base v0.27.2 // indirect + k8s.io/api v0.28.3 + k8s.io/apiextensions-apiserver v0.28.3 // indirect + k8s.io/component-base v0.28.3 // indirect k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect diff --git a/go.sum b/go.sum index 634008393..181c15996 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/eclipse/paho.mqtt.golang v1.4.3 h1:2kwcUGn8seMUfWndX0hGbvH8r7crgcJguQNCyp70xik= github.com/eclipse/paho.mqtt.golang v1.4.3/go.mod h1:CSYvoAlsMkhYOXh/oKyxa8EcBci6dVkLCbo5tTC1RIE= -github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= -github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= @@ -169,14 +169,14 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= -github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= +github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= +github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= +github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= @@ -211,8 +211,8 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= -go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= @@ -288,8 +288,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gomodules.xyz/jsonpatch/v2 v2.3.0 h1:8NFhfS6gzxNqjLIYnZxg319wZ5Qjnx4m/CcX+Klzazc= -gomodules.xyz/jsonpatch/v2 v2.3.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= +gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= +gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= @@ -310,16 +310,16 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.28.1 h1:i+0O8k2NPBCPYaMB+uCkseEbawEt/eFaiRqUx8aB108= -k8s.io/api v0.28.1/go.mod h1:uBYwID+66wiL28Kn2tBjBYQdEU0Xk0z5qF8bIBqk/Dg= -k8s.io/apiextensions-apiserver v0.27.2 h1:iwhyoeS4xj9Y7v8YExhUwbVuBhMr3Q4bd/laClBV6Bo= -k8s.io/apiextensions-apiserver v0.27.2/go.mod h1:Oz9UdvGguL3ULgRdY9QMUzL2RZImotgxvGjdWRq6ZXQ= -k8s.io/apimachinery v0.28.1 h1:EJD40og3GizBSV3mkIoXQBsws32okPOy+MkRyzh6nPY= -k8s.io/apimachinery v0.28.1/go.mod h1:X0xh/chESs2hP9koe+SdIAcXWcQ+RM5hy0ZynB+yEvw= -k8s.io/client-go v0.28.1 h1:pRhMzB8HyLfVwpngWKE8hDcXRqifh1ga2Z/PU9SXVK8= -k8s.io/client-go v0.28.1/go.mod h1:pEZA3FqOsVkCc07pFVzK076R+P/eXqsgx5zuuRWukNE= -k8s.io/component-base v0.27.2 h1:neju+7s/r5O4x4/txeUONNTS9r1HsPbyoPBAtHsDCpo= -k8s.io/component-base v0.27.2/go.mod h1:5UPk7EjfgrfgRIuDBFtsEFAe4DAvP3U+M8RTzoSJkpo= +k8s.io/api v0.28.3 h1:Gj1HtbSdB4P08C8rs9AR94MfSGpRhJgsS+GF9V26xMM= +k8s.io/api v0.28.3/go.mod h1:MRCV/jr1dW87/qJnZ57U5Pak65LGmQVkKTzf3AtKFHc= +k8s.io/apiextensions-apiserver v0.28.3 h1:Od7DEnhXHnHPZG+W9I97/fSQkVpVPQx2diy+2EtmY08= +k8s.io/apiextensions-apiserver v0.28.3/go.mod h1:NE1XJZ4On0hS11aWWJUTNkmVB03j9LM7gJSisbRt8Lc= +k8s.io/apimachinery v0.28.3 h1:B1wYx8txOaCQG0HmYF6nbpU8dg6HvA06x5tEffvOe7A= +k8s.io/apimachinery v0.28.3/go.mod h1:uQTKmIqs+rAYaq+DFaoD2X7pcjLOqbQX2AOiO0nIpb8= +k8s.io/client-go v0.28.3 h1:2OqNb72ZuTZPKCl+4gTKvqao0AMOl9f3o2ijbAj3LI4= +k8s.io/client-go v0.28.3/go.mod h1:LTykbBp9gsA7SwqirlCXBWtK0guzfhpoW4qSm7i9dxo= +k8s.io/component-base v0.28.3 h1:rDy68eHKxq/80RiMb2Ld/tbH8uAE75JdCqJyi6lXMzI= +k8s.io/component-base v0.28.3/go.mod h1:fDJ6vpVNSk6cRo5wmDa6eKIG7UlIQkaFmZN2fYgIUD8= k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ= @@ -328,8 +328,8 @@ k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrC k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= knative.dev/pkg v0.0.0-20221010143036-21d3b47e2efe h1:mlyaEOLotR3ma5hIN4XP/KE3/SeQvJa6hNd2BNYg2U4= knative.dev/pkg v0.0.0-20221010143036-21d3b47e2efe/go.mod h1:8MLQO2NWHa+1GhEUlogKfOEkyh2T2EWgfSayCA0q2gc= -sigs.k8s.io/controller-runtime v0.15.1 h1:9UvgKD4ZJGcj24vefUFgZFP3xej/3igL9BsOUTb/+4c= -sigs.k8s.io/controller-runtime v0.15.1/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= +sigs.k8s.io/controller-runtime v0.16.3 h1:2TuvuokmfXvDUamSx1SuAOO3eTyye+47mJCigwG62c4= +sigs.k8s.io/controller-runtime v0.16.3/go.mod h1:j7bialYoSn142nv9sCOJmQgDXQXxnroFU4VnX/brVJ0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= diff --git a/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/driverProperties b/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/driverProperties new file mode 100644 index 000000000..9284d1345 --- /dev/null +++ b/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/driverProperties @@ -0,0 +1,2 @@ +driverSku: Edgenesis Mock Device +driverImage: edgenesis/mockdevice:v0.0.1 diff --git a/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/instructions b/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/instructions new file mode 100644 index 000000000..b1a3c3720 --- /dev/null +++ b/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/instructions @@ -0,0 +1,2 @@ +instructions: + cmd: diff --git a/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/telemetries b/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/telemetries new file mode 100644 index 000000000..15ebae80f --- /dev/null +++ b/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/telemetries @@ -0,0 +1,2 @@ +telemetrySettings: + telemetryUpdateIntervalInMilliseconds: 1000 diff --git a/pkg/k8s/crd/main.go b/pkg/k8s/crd/main.go index ddaac94f4..def22f8c5 100644 --- a/pkg/k8s/crd/main.go +++ b/pkg/k8s/crd/main.go @@ -79,9 +79,9 @@ func main() { ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ - Scheme: scheme, - MetricsBindAddress: metricsAddr, - Port: 9443, + Scheme: scheme, + // MetricsBindAddress: metricsAddr, + // Port: 9443, HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, LeaderElectionID: "7ede39d4.edgenesis.io", From 29d66c0e93490a0dbd4e47703c5dd76a8f6be54d Mon Sep 17 00:00:00 2001 From: cool-wangtongzhou <1240114611@qq.com> Date: Mon, 23 Oct 2023 11:30:55 +0800 Subject: [PATCH 2/6] Delete some unnecessary things --- .../deviceshifutcp/etc/edgedevice/config/driverProperties | 2 -- .../deviceshifutcp/etc/edgedevice/config/instructions | 2 -- .../deviceshifutcp/etc/edgedevice/config/telemetries | 2 -- 3 files changed, 6 deletions(-) delete mode 100644 pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/driverProperties delete mode 100644 pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/instructions delete mode 100644 pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/telemetries diff --git a/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/driverProperties b/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/driverProperties deleted file mode 100644 index 9284d1345..000000000 --- a/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/driverProperties +++ /dev/null @@ -1,2 +0,0 @@ -driverSku: Edgenesis Mock Device -driverImage: edgenesis/mockdevice:v0.0.1 diff --git a/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/instructions b/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/instructions deleted file mode 100644 index b1a3c3720..000000000 --- a/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/instructions +++ /dev/null @@ -1,2 +0,0 @@ -instructions: - cmd: diff --git a/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/telemetries b/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/telemetries deleted file mode 100644 index 15ebae80f..000000000 --- a/pkg/deviceshifu/deviceshifutcp/etc/edgedevice/config/telemetries +++ /dev/null @@ -1,2 +0,0 @@ -telemetrySettings: - telemetryUpdateIntervalInMilliseconds: 1000 From aa21bbbe989cb9b6f6988e08291b1a89df04addc Mon Sep 17 00:00:00 2001 From: cool-wangtongzhou <1240114611@qq.com> Date: Tue, 24 Oct 2023 10:25:36 +0800 Subject: [PATCH 3/6] Delete some unused lines --- pkg/k8s/crd/main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/k8s/crd/main.go b/pkg/k8s/crd/main.go index def22f8c5..a6c9274f8 100644 --- a/pkg/k8s/crd/main.go +++ b/pkg/k8s/crd/main.go @@ -79,9 +79,7 @@ func main() { ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ - Scheme: scheme, - // MetricsBindAddress: metricsAddr, - // Port: 9443, + Scheme: scheme, HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, LeaderElectionID: "7ede39d4.edgenesis.io", From 857241511ab0cb6891a843613ae5bf951419c32f Mon Sep 17 00:00:00 2001 From: cool-wangtongzhou <1240114611@qq.com> Date: Tue, 24 Oct 2023 10:27:29 +0800 Subject: [PATCH 4/6] Delete some unused lines --- pkg/k8s/crd/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/k8s/crd/main.go b/pkg/k8s/crd/main.go index a6c9274f8..090633b76 100644 --- a/pkg/k8s/crd/main.go +++ b/pkg/k8s/crd/main.go @@ -79,7 +79,8 @@ func main() { ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ - Scheme: scheme, + Scheme: scheme, + HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, LeaderElectionID: "7ede39d4.edgenesis.io", From 043361e538d5bac503c5c68460344f4cec5d0a4c Mon Sep 17 00:00:00 2001 From: Tom Qin Date: Tue, 24 Oct 2023 22:20:39 +0800 Subject: [PATCH 5/6] Update main.go to remove empty line --- pkg/k8s/crd/main.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/k8s/crd/main.go b/pkg/k8s/crd/main.go index 090633b76..52d41c973 100644 --- a/pkg/k8s/crd/main.go +++ b/pkg/k8s/crd/main.go @@ -80,7 +80,6 @@ func main() { mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ Scheme: scheme, - HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, LeaderElectionID: "7ede39d4.edgenesis.io", From 88498fba5d23da59cd21f732b5f7ce64be078853 Mon Sep 17 00:00:00 2001 From: Tom Qin Date: Tue, 24 Oct 2023 14:31:32 +0000 Subject: [PATCH 6/6] sync with main --- azure-pipelines/azure-pipelines.yml | 7 ++++-- .../telemetryservice/mysql/checkoutput.sh | 17 ++++--------- .../telemetryservice/sqlserver/checkoutput.sh | 24 ++++++------------- go.mod | 2 +- go.sum | 4 ++-- .../deviceshifuopcua/deviceshifuopcua.go | 12 ++++++---- 6 files changed, 27 insertions(+), 39 deletions(-) diff --git a/azure-pipelines/azure-pipelines.yml b/azure-pipelines/azure-pipelines.yml index 79dce289f..af30f214c 100644 --- a/azure-pipelines/azure-pipelines.yml +++ b/azure-pipelines/azure-pipelines.yml @@ -384,13 +384,16 @@ stages: displayName: docker run tdengine and checkoutput - script: | set -e - docker run -itd --network host --name mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:8.1.0 + docker run -itd --network host --name mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ + --health-cmd='mysqladmin ping -h localhost -uroot' --health-interval=5s --health-timeout=5s --health-retries=20 \ + mysql:8.1.0 bash $(System.DefaultWorkingDirectory)/examples/telemetryservice/mysql/checkoutput.sh displayName: docker run mysql and checkoutput - script: | set -e docker run -itd --network host --name sqlserver -e ACCEPT_EULA=Y -e SA_PASSWORD=Some_Strong_Password \ - mcr.microsoft.com/mssql/server:2022-CU7-ubuntu-20.04 + --health-cmd="/opt/mssql-tools/bin/sqlcmd -U sa -P Some_Strong_Password -Q 'select name from sys.databases'" --health-interval=5s --health-timeout=5s --health-retries=20 \ + mcr.microsoft.com/mssql/server:2022-CU7-ubuntu-20.04 bash $(System.DefaultWorkingDirectory)/examples/telemetryservice/sqlserver/checkoutput.sh displayName: docker run sqlserver and checkoutput diff --git a/examples/telemetryservice/mysql/checkoutput.sh b/examples/telemetryservice/mysql/checkoutput.sh index 00044cf25..15878b2f6 100644 --- a/examples/telemetryservice/mysql/checkoutput.sh +++ b/examples/telemetryservice/mysql/checkoutput.sh @@ -1,19 +1,10 @@ #!/bin/bash MySQLOutput=2 -sleep 3 -for i in {1..50} -do - output=$(docker exec mysql mysql -u root -e "Show databases;" 2>&1 | grep 'ERROR' | wc -l) - #echo $output - if [[ $output -eq 0 ]] - then - echo $output - break - elif [[ $i -eq 50 ]] - then - exit 1 - fi +echo "Waiting for MySQL to be ready..." +while [[ "$(docker inspect --format='{{.State.Health.Status}}' mysql)" != "healthy" ]]; do + sleep 5 done +echo "MySQL is ready." # init MySQL Table docker exec mysql mysql -u root \ diff --git a/examples/telemetryservice/sqlserver/checkoutput.sh b/examples/telemetryservice/sqlserver/checkoutput.sh index 33fa39068..48ea9386f 100644 --- a/examples/telemetryservice/sqlserver/checkoutput.sh +++ b/examples/telemetryservice/sqlserver/checkoutput.sh @@ -1,29 +1,19 @@ #!bin/bash SQLServerOutput=2 -sleep 6 -for i in {1..50} -do - output=$(docker exec sqlserver /opt/mssql-tools/bin/sqlcmd \ - -S localhost -U sa -P Some_Strong_Password \ - -Q "select name from sys.databases" | grep 'Error' | wc -l) - echo $output - if [[ $output -eq 0 ]] - then - break - elif [[ $i -eq 50 ]] - then - exit 1 - fi +echo "Waiting for SQL Server to be ready..." +while [[ "$(docker inspect --format='{{.State.Health.Status}}' sqlserver)" != "healthy" ]]; do + sleep 5 done +echo "SQL Server is ready." # init SQLServer Table -docker exec sqlserver /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Some_Strong_Password \ +docker exec sqlserver /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Some_Strong_Password \ -Q "Create database shifu;" -docker exec sqlserver /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Some_Strong_Password \ +docker exec sqlserver /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Some_Strong_Password \ -d shifu -Q "CREATE TABLE testTable ( TelemetryID INT IDENTITY(1,1) PRIMARY KEY, DeviceName VARCHAR(255), TelemetryData TEXT, TelemetryTimeStamp DATETIME );" -docker exec sqlserver /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Some_Strong_Password \ +docker exec sqlserver /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Some_Strong_Password \ -d shifu -Q "Select * from shifu.dbo.testTable;" for i in {1..30} diff --git a/go.mod b/go.mod index 709c7389a..e3cc482b8 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/apache/plc4x/plc4go v0.0.0-20220929155823-14e7d8450c87 github.com/eclipse/paho.mqtt.golang v1.4.3 - github.com/gopcua/opcua v0.4.0 + github.com/gopcua/opcua v0.5.2 gopkg.in/yaml.v3 v3.0.1 k8s.io/apimachinery v0.28.3 k8s.io/client-go v0.28.3 diff --git a/go.sum b/go.sum index 181c15996..d00549752 100644 --- a/go.sum +++ b/go.sum @@ -91,8 +91,8 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJY github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopcua/opcua v0.4.0 h1:Pr0PMFViNOzvkcvmzP3yTKqtLFVL1OUgav3tDj+hpqQ= -github.com/gopcua/opcua v0.4.0/go.mod h1:6BsaYGu33RhVRxnK+EqHWwSG+hYCSAMjyIjx3RGV1PQ= +github.com/gopcua/opcua v0.5.2 h1:VPBnxA2a+F4IEIpKKE3j80itgWDPTSerC88q+HZoBDI= +github.com/gopcua/opcua v0.5.2/go.mod h1:nrVl4/Rs3SDQRhNQ50EbAiI5JSpDrTG6Frx3s4HLnw4= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= diff --git a/pkg/deviceshifu/deviceshifuopcua/deviceshifuopcua.go b/pkg/deviceshifu/deviceshifuopcua/deviceshifuopcua.go index e8e2a76d6..f00dd6c76 100644 --- a/pkg/deviceshifu/deviceshifuopcua/deviceshifuopcua.go +++ b/pkg/deviceshifu/deviceshifuopcua/deviceshifuopcua.go @@ -166,7 +166,11 @@ func establishOPCUAConnection(ctx context.Context, address string, setting *v1al } options = append(options, opcua.SecurityFromEndpoint(ep, ua.UserTokenTypeFromString(*setting.AuthenticationMode))) - opcuaClient := opcua.NewClient(address, options...) + opcuaClient, err := opcua.NewClient(address, options...) + if err != nil { + logger.Errorf("Failed to create a new OPC UA client, error: %v", err) + return nil, err + } if err := opcuaClient.Connect(ctx); err != nil { logger.Errorf("Unable to connect to OPC UA server, error: %v", err) return nil, err @@ -250,7 +254,7 @@ func (handler DeviceCommandHandlerOPCUA) readByNodeId(ctx context.Context, nodeI ctx, cancel := context.WithTimeout(ctx, time.Duration(*handler.timeout)*time.Millisecond) defer cancel() - return handler.client.ReadWithContext(ctx, req) + return handler.client.Read(ctx, req) } type WriteRequest struct { @@ -324,7 +328,7 @@ func (handler DeviceCommandHandlerOPCUA) write(w http.ResponseWriter, r *http.Re ctx, cancel := context.WithTimeout(ctx, time.Duration(*handler.timeout)*time.Millisecond) defer cancel() - writeResponse, err := handler.client.WriteWithContext(ctx, opcuaRequest) + writeResponse, err := handler.client.Write(ctx, opcuaRequest) if err != nil { http.Error(w, "Failed to write message to Server, error: "+err.Error(), http.StatusBadRequest) logger.Errorf("Write failed: %s", err) @@ -366,7 +370,7 @@ func (ds *DeviceShifu) requestOPCUANodeID(nodeID string) error { ctx, cancel := context.WithTimeout(ctx, time.Duration(deviceshifubase.DeviceDefaultRequestTimeoutInMS)*time.Millisecond) defer cancel() - resp, err := ds.opcuaClient.ReadWithContext(ctx, req) + resp, err := ds.opcuaClient.Read(ctx, req) if err != nil { logger.Errorf("Failed to read message from Server, error: %v " + err.Error()) return err