This is an automated email from the ASF dual-hosted git repository.
ccondit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git
The following commit(s) were added to refs/heads/master by this push:
new d3f50c5b [YUNIKORN-1819] Update yaml dependency (#578)
d3f50c5b is described below
commit d3f50c5bbf2e7febc471b3fa8768ec51248ad9e5
Author: wusamzong <[email protected]>
AuthorDate: Tue Jun 27 12:59:48 2023 -0500
[YUNIKORN-1819] Update yaml dependency (#578)
Closes: #578
Signed-off-by: Craig Condit <[email protected]>
---
go.mod | 2 +-
go.sum | 2 +-
pkg/common/configs/config.go | 7 +++++--
pkg/common/configs/config_test.go | 2 +-
pkg/webservice/handlers.go | 2 +-
pkg/webservice/handlers_test.go | 2 +-
6 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/go.mod b/go.mod
index be048e7e..ee11cace 100644
--- a/go.mod
+++ b/go.mod
@@ -37,7 +37,7 @@ require (
go.uber.org/zap v1.24.0
golang.org/x/net v0.10.0
google.golang.org/grpc v1.56.0
- gopkg.in/yaml.v2 v2.4.0
+ gopkg.in/yaml.v3 v3.0.1
gotest.tools/v3 v3.0.3
)
diff --git a/go.sum b/go.sum
index e3d34ad7..7569e3cb 100644
--- a/go.sum
+++ b/go.sum
@@ -386,10 +386,10 @@ gopkg.in/yaml.v2 v2.2.2/go.mod
h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
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=
gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod
h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/pkg/common/configs/config.go b/pkg/common/configs/config.go
index 581e9cbe..a3a39d25 100644
--- a/pkg/common/configs/config.go
+++ b/pkg/common/configs/config.go
@@ -19,12 +19,13 @@
package configs
import (
+ "bytes"
"crypto/sha256"
"fmt"
"strings"
"go.uber.org/zap"
- "gopkg.in/yaml.v2"
+ "gopkg.in/yaml.v3"
"github.com/apache/yunikorn-core/pkg/log"
)
@@ -164,7 +165,9 @@ func SetChecksum(content []byte, conf *SchedulerConfig) {
func ParseAndValidateConfig(content []byte) (*SchedulerConfig, error) {
conf := &SchedulerConfig{}
- err := yaml.UnmarshalStrict(content, conf)
+ decoder := yaml.NewDecoder(bytes.NewReader(content))
+ decoder.KnownFields(true) // Enable strict unmarshaling behavior
+ err := decoder.Decode(conf)
if err != nil {
log.Log(log.Config).Error("failed to parse queue configuration",
zap.Error(err))
diff --git a/pkg/common/configs/config_test.go
b/pkg/common/configs/config_test.go
index 437d73a4..0b80108c 100644
--- a/pkg/common/configs/config_test.go
+++ b/pkg/common/configs/config_test.go
@@ -27,7 +27,7 @@ import (
"gotest.tools/v3/assert"
- "gopkg.in/yaml.v2"
+ "gopkg.in/yaml.v3"
)
var emptySum = ""
diff --git a/pkg/webservice/handlers.go b/pkg/webservice/handlers.go
index a311d837..8c6bc37a 100644
--- a/pkg/webservice/handlers.go
+++ b/pkg/webservice/handlers.go
@@ -32,7 +32,7 @@ import (
"github.com/julienschmidt/httprouter"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.uber.org/zap"
- "gopkg.in/yaml.v2"
+ "gopkg.in/yaml.v3"
"github.com/apache/yunikorn-core/pkg/common"
"github.com/apache/yunikorn-core/pkg/common/configs"
diff --git a/pkg/webservice/handlers_test.go b/pkg/webservice/handlers_test.go
index 88553973..d15cc2db 100644
--- a/pkg/webservice/handlers_test.go
+++ b/pkg/webservice/handlers_test.go
@@ -31,7 +31,7 @@ import (
"github.com/julienschmidt/httprouter"
"github.com/prometheus/client_golang/prometheus/promhttp"
- "gopkg.in/yaml.v2"
+ "gopkg.in/yaml.v3"
"gotest.tools/v3/assert"
"github.com/apache/yunikorn-core/pkg/common"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]