From b343a5067083b4d574fa75ce1ac6dfe864dade9e Mon Sep 17 00:00:00 2001 From: Konstantinos Angelopoulos Date: Thu, 9 Dec 2021 15:58:56 +0100 Subject: [PATCH] user lenient decoder for infra status --- pkg/apis/azure/helper/scheme.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/apis/azure/helper/scheme.go b/pkg/apis/azure/helper/scheme.go index ff6b1c3b6..70d5b60d9 100644 --- a/pkg/apis/azure/helper/scheme.go +++ b/pkg/apis/azure/helper/scheme.go @@ -36,6 +36,9 @@ var ( Scheme *runtime.Scheme decoder runtime.Decoder + + // lenientDecoder is a decoder that does not use strict mode. + lenientDecoder runtime.Decoder ) func init() { @@ -43,6 +46,7 @@ func init() { utilruntime.Must(install.AddToScheme(Scheme)) decoder = serializer.NewCodecFactory(Scheme, serializer.EnableStrict).UniversalDecoder() + lenientDecoder = serializer.NewCodecFactory(Scheme).UniversalDecoder() } // InfrastructureConfigFromInfrastructure extracts the InfrastructureConfig from the @@ -63,7 +67,7 @@ func InfrastructureConfigFromInfrastructure(infra *extensionsv1alpha1.Infrastruc func InfrastructureStatusFromInfrastructure(infra *extensionsv1alpha1.Infrastructure) (*api.InfrastructureStatus, error) { config := &api.InfrastructureStatus{} if infra.Status.ProviderStatus != nil && infra.Status.ProviderStatus.Raw != nil { - if _, _, err := decoder.Decode(infra.Status.ProviderStatus.Raw, nil, config); err != nil { + if _, _, err := lenientDecoder.Decode(infra.Status.ProviderStatus.Raw, nil, config); err != nil { return nil, err } return config, nil