Skip to content

Commit

Permalink
Fix YAML serialization.
Browse files Browse the repository at this point in the history
kustomize exposes a version of the YAML libraries, so I guess IntelliJ
decided to auto-import those. (I'm assuming that's what happened.) After
the upgrade, it instead exposes some repackaged YAML libraries. This
broke YAML parsing in a very confusing way.

Specifically, UnmarshalClusterVolumes no longer implemented
yaml.v3/Unmarshaller. Instead it implemented
sigs.k8s.io/yaml/goyaml.v3/Unmarshaller. Which means it just silently
never got called.

None of this is particularly interesting, but it took me at least 8
hours to figure it out, so I wanted to write it down.
  • Loading branch information
plumpy committed Dec 14, 2024
1 parent 1694069 commit 9955513
Show file tree
Hide file tree
Showing 35 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package latest
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/util/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package util
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"
)

// UnmarshalClusterVolumes provides a helper function to
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta11/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta11
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta12/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta12
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta13/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta13
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta14/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta14
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta15/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta15
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta16/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta16
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta17/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta17
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta18/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta18
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta19/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta19
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta20/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta20
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta21/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta21
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta22/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta22
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta23/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta23
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta24/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta24
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta25/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta25
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta26/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta26
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta27/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta27
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta28/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta28
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2beta29/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v2beta29
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v3/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v3
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v3alpha1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v3alpha1
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v4beta1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v4beta1
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v4beta10/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v4beta10
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v4beta11/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v4beta11
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v4beta2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v4beta2
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v4beta3/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v4beta3
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v4beta4/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v4beta4
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v4beta5/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v4beta5
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v4beta6/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v4beta6
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v4beta7/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v4beta7
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v4beta8/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v4beta8
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v4beta9/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package v4beta9
import (
"encoding/json"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/util"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"strings"
"testing"

"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/tools/clientcmd/api"
"sigs.k8s.io/kustomize/kyaml/yaml"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/build/kaniko"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/constants"
Expand Down

0 comments on commit 9955513

Please sign in to comment.