diff --git a/pkg/apis/workload/v1alpha1/types.go b/pkg/apis/workload/v1alpha1/types.go index d0622e0..2b1351e 100644 --- a/pkg/apis/workload/v1alpha1/types.go +++ b/pkg/apis/workload/v1alpha1/types.go @@ -50,22 +50,13 @@ type ServiceProfileDescriptor struct { // DecodeNestedObjects decodes extended indicator for known types. func (c *ServiceProfileDescriptor) DecodeNestedObjects(d runtime.Decoder) error { - var strictDecodingErrs []error for i := range c.Spec.ExtendedIndicator { indicator := &c.Spec.ExtendedIndicator[i] err := indicator.decodeNestedObjects(d) if err != nil { - decodingErr := fmt.Errorf("decoding .spec.extendedIndicator[%d]: %w", i, err) - if runtime.IsStrictDecodingError(err) { - strictDecodingErrs = append(strictDecodingErrs, decodingErr) - } else { - return decodingErr - } + return fmt.Errorf("decoding .spec.extendedIndicator[%d]: %w", i, err) } } - if len(strictDecodingErrs) > 0 { - return runtime.NewStrictDecodingError(strictDecodingErrs) - } return nil } @@ -140,21 +131,15 @@ func (c *ServiceExtendedIndicatorSpec) decodeNestedObjects(d runtime.Decoder) er return nil } - var strictDecodingErr error obj, parsedGvk, err := d.Decode(c.Indicators.Raw, &gvk, nil) if err != nil { - decodingArgsErr := fmt.Errorf("decoding extended indicators %s: %w", c.Name, err) - if obj != nil && runtime.IsStrictDecodingError(err) { - strictDecodingErr = runtime.NewStrictDecodingError([]error{decodingArgsErr}) - } else { - return decodingArgsErr - } - } - if parsedGvk.GroupKind() != gvk.GroupKind() { + return fmt.Errorf("decoding extended indicators %s: %w", c.Name, err) + } else if parsedGvk.GroupKind() != gvk.GroupKind() { return fmt.Errorf("indicators for %s were not of type %s, got %s", c.Name, gvk.GroupKind(), parsedGvk.GroupKind()) } + c.Indicators.Object = obj - return strictDecodingErr + return nil } func (c *ServiceExtendedIndicatorSpec) encodeNestedObjects(e runtime.Encoder) error { diff --git a/pkg/protocol/evictionplugin/v1alpha1/api.pb.go b/pkg/protocol/evictionplugin/v1alpha1/api.pb.go index b6ad5a7..00a3795 100644 --- a/pkg/protocol/evictionplugin/v1alpha1/api.pb.go +++ b/pkg/protocol/evictionplugin/v1alpha1/api.pb.go @@ -1820,10 +1820,7 @@ func (m *Empty) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -1976,10 +1973,7 @@ func (m *Condition) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -2176,10 +2170,7 @@ func (m *ThresholdMetResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -2314,10 +2305,7 @@ func (m *GetTopEvictionPodsRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -2437,10 +2425,7 @@ func (m *GetTopEvictionPodsResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -2646,10 +2631,7 @@ func (m *EvictPod) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -2733,10 +2715,7 @@ func (m *GetEvictPodsRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -2856,10 +2835,7 @@ func (m *GetEvictPodsResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -2941,10 +2917,7 @@ func (m *GetTokenResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -3013,10 +2986,7 @@ func (m *DeletionOptions) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { diff --git a/pkg/protocol/reporterplugin/v1alpha1/api.pb.go b/pkg/protocol/reporterplugin/v1alpha1/api.pb.go index a5d5385..60c9b0f 100644 --- a/pkg/protocol/reporterplugin/v1alpha1/api.pb.go +++ b/pkg/protocol/reporterplugin/v1alpha1/api.pb.go @@ -784,10 +784,7 @@ func (m *Empty) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -907,10 +904,7 @@ func (m *ReportContent) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -1045,10 +1039,7 @@ func (m *ReportField) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l { @@ -1132,10 +1123,7 @@ func (m *GetReportContentResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthApi - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthApi } if (iNdEx + skippy) > l {