Skip to content

Commit 653fd43

Browse files
committed
Switch to sigs.k8s.io/yaml to correctly serialize/deserialize objects
Previous yaml package gopkg.in/yaml.v2 does not support json tags on fields. Switch to a yaml package that can correctly serialize/deserialize devfile/api objects. Signed-off-by: Angel Misevski <[email protected]>
1 parent 64cd592 commit 653fd43

File tree

5 files changed

+5
-9
lines changed

5 files changed

+5
-9
lines changed

controllers/workspace/restapis/configmap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ import (
2323
"github.com/devfile/devworkspace-operator/pkg/config"
2424
"github.com/google/go-cmp/cmp"
2525
"github.com/google/go-cmp/cmp/cmpopts"
26-
"gopkg.in/yaml.v2"
2726
corev1 "k8s.io/api/core/v1"
2827
"k8s.io/apimachinery/pkg/api/errors"
2928
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3029
k8sRuntime "k8s.io/apimachinery/pkg/runtime"
3130
"k8s.io/apimachinery/pkg/types"
3231
runtimeClient "sigs.k8s.io/controller-runtime/pkg/client"
3332
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
33+
"sigs.k8s.io/yaml"
3434
)
3535

3636
var configmapDiffOpts = cmp.Options{

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ require (
77
github.com/devfile/api v0.0.0-20200826083800-9e2280a95680
88
github.com/eclipse/che-go-jsonrpc v0.0.0-20200317130110-931966b891fe // indirect
99
github.com/eclipse/che-plugin-broker v3.4.0+incompatible
10-
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
1110
github.com/go-logr/logr v0.1.0
1211
github.com/google/go-cmp v0.4.0
1312
github.com/google/uuid v1.1.1
@@ -16,11 +15,11 @@ require (
1615
github.com/openshift/api v0.0.0-20200205133042-34f0ec8dab87
1716
github.com/operator-framework/operator-sdk v0.17.0
1817
github.com/stretchr/testify v1.6.1
19-
gopkg.in/yaml.v2 v2.3.0
2018
k8s.io/api v0.18.6
2119
k8s.io/apimachinery v0.18.6
2220
k8s.io/client-go v12.0.0+incompatible
2321
sigs.k8s.io/controller-runtime v0.6.2
22+
sigs.k8s.io/yaml v1.2.0
2423
)
2524

2625
// devfile/api requires v12.0.0+incompatible but this causes issues with go commands

pkg/config/cmd_terminal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
devworkspace "github.com/devfile/api/pkg/apis/workspaces/v1alpha1"
2121

22-
"gopkg.in/yaml.v2"
22+
"sigs.k8s.io/yaml"
2323
)
2424

2525
const (

pkg/internal_registry/registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121

2222
"github.com/eclipse/che-plugin-broker/model"
2323
brokerModel "github.com/eclipse/che-plugin-broker/model"
24-
"gopkg.in/yaml.v2"
2524
logf "sigs.k8s.io/controller-runtime/pkg/log"
25+
"sigs.k8s.io/yaml"
2626
)
2727

2828
const (

pkg/library/lifecycle_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ import (
2020

2121
"github.com/devfile/api/pkg/apis/workspaces/v1alpha1"
2222
"github.com/stretchr/testify/assert"
23-
24-
// ghodss/yaml is required instead of the default gopkg.in/yaml.v2 since the latter
25-
// only supports yaml struct tags and the DevWorkspace API only uses json.
26-
"github.com/ghodss/yaml"
23+
"sigs.k8s.io/yaml"
2724
)
2825

2926
type testCase struct {

0 commit comments

Comments
 (0)