Skip to content

Commit

Permalink
Deserialize custom resources with EnableStrict (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
stoyanr authored Apr 1, 2021
1 parent c14d7ae commit d48d906
Show file tree
Hide file tree
Showing 472 changed files with 3,013 additions and 41,587 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
############# builder
FROM golang:1.15.8 AS builder
FROM golang:1.16.2 AS builder

WORKDIR /go/src/github.com/gardener/gardener-extension-provider-aws
COPY . .
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
module github.com/gardener/gardener-extension-provider-aws

go 1.15
go 1.16

require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/ahmetb/gen-crd-api-reference-docs v0.2.0
github.com/aws/aws-sdk-go v1.23.13
github.com/coreos/go-systemd/v22 v22.1.0
github.com/frankban/quicktest v1.9.0 // indirect
github.com/gardener/etcd-druid v0.3.0
github.com/gardener/gardener v1.19.0
github.com/gardener/gardener v1.19.1-0.20210401122359-e16e6ec0002e
github.com/gardener/machine-controller-manager v0.36.0
github.com/go-logr/logr v0.3.0
github.com/gobuffalo/packr/v2 v2.8.1
github.com/golang/mock v1.5.0
github.com/golang/snappy v0.0.2 // indirect
github.com/mitchellh/copystructure v1.1.1 // indirect
github.com/nwaples/rardecode v1.1.0 // indirect
github.com/onsi/ginkgo v1.14.1
github.com/onsi/ginkgo v1.14.2
github.com/onsi/gomega v1.10.5
github.com/pierrec/lz4 v2.4.1+incompatible // indirect
github.com/pkg/errors v0.9.1
Expand Down
72 changes: 36 additions & 36 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/admission/validator/cloudprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type cloudProfile struct {

// InjectScheme injects the given scheme into the validator.
func (cp *cloudProfile) InjectScheme(scheme *runtime.Scheme) error {
cp.decoder = serializer.NewCodecFactory(scheme).UniversalDecoder()
cp.decoder = serializer.NewCodecFactory(scheme, serializer.EnableStrict).UniversalDecoder()
return nil
}

Expand Down
10 changes: 6 additions & 4 deletions pkg/admission/validator/shoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ func NewShootValidator() extensionswebhook.Validator {
}

type shoot struct {
client client.Client
decoder runtime.Decoder
client client.Client
decoder runtime.Decoder
lenientDecoder runtime.Decoder
}

// InjectScheme injects the given scheme into the validator.
func (s *shoot) InjectScheme(scheme *runtime.Scheme) error {
s.decoder = serializer.NewCodecFactory(scheme).UniversalDecoder()
s.decoder = serializer.NewCodecFactory(scheme, serializer.EnableStrict).UniversalDecoder()
s.lenientDecoder = serializer.NewCodecFactory(scheme).UniversalDecoder()
return nil
}

Expand Down Expand Up @@ -143,7 +145,7 @@ func (s *shoot) validateShootUpdate(ctx context.Context, oldShoot, shoot *core.S
return field.InternalError(infraConfigFldPath, errors.New("InfrastructureConfig is not available on old shoot"))
}

oldInfraConfig, err := decodeInfrastructureConfig(s.decoder, oldShoot.Spec.Provider.InfrastructureConfig, infraConfigFldPath)
oldInfraConfig, err := decodeInfrastructureConfig(s.lenientDecoder, oldShoot.Spec.Provider.InfrastructureConfig, infraConfigFldPath)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/aws/helper/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func init() {
Scheme = runtime.NewScheme()
utilruntime.Must(install.AddToScheme(Scheme))

decoder = serializer.NewCodecFactory(Scheme).UniversalDecoder()
decoder = serializer.NewCodecFactory(Scheme, serializer.EnableStrict).UniversalDecoder()
}

// InfrastructureConfigFromInfrastructure extracts the InfrastructureConfig from the
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/worker/machines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ var _ = Describe("Machines", func() {
scheme = runtime.NewScheme()
_ = api.AddToScheme(scheme)
_ = apiv1alpha1.AddToScheme(scheme)
decoder = serializer.NewCodecFactory(scheme).UniversalDecoder()
decoder = serializer.NewCodecFactory(scheme, serializer.EnableStrict).UniversalDecoder()

workerPoolHash1, _ = worker.WorkerPoolHash(w.Spec.Pools[0], cluster, strconv.FormatBool(volumeEncrypted), fmt.Sprintf("%dGi", dataVolume1Size), dataVolume1Type, strconv.FormatBool(dataVolume1Encrypted), fmt.Sprintf("%dGi", dataVolume2Size), dataVolume2Type, strconv.FormatBool(dataVolume2Encrypted))
workerPoolHash2, _ = worker.WorkerPoolHash(w.Spec.Pools[1], cluster)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/infrastructure/infrastructure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ var _ = Describe("Infrastructure tests", func() {
})
Expect(err).NotTo(HaveOccurred())
Expect(c).NotTo(BeNil())
decoder = serializer.NewCodecFactory(mgr.GetScheme()).UniversalDecoder()
decoder = serializer.NewCodecFactory(mgr.GetScheme(), serializer.EnableStrict).UniversalDecoder()

flag.Parse()
validateFlags()
Expand Down
25 changes: 2 additions & 23 deletions vendor/github.com/Masterminds/goutils/cryptorandomstringutils.go

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

24 changes: 2 additions & 22 deletions vendor/github.com/Masterminds/goutils/randomstringutils.go

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

16 changes: 16 additions & 0 deletions vendor/github.com/Masterminds/goutils/stringutils.go

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

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

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

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

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

Loading

0 comments on commit d48d906

Please sign in to comment.