From 868114a41de7b9175788b5af467c1701befe08bc Mon Sep 17 00:00:00 2001 From: Steve Kuznetsov Date: Mon, 18 Dec 2023 13:37:40 -0700 Subject: [PATCH] k8s.io/code-generator: include all metav1 applyconfigs When users of `applyconfiguration-gen` use any of the `metav1` types in their own types, they expect to have correct apply configurations generated without having to explicitly pass anything to the tool. In the same way that we used to include `metav1.ObjectMeta` and `metav1.TypeMeta`, we now include all of the `metav1` types that have apply-configurations generated for them in `client-go`. There's no downside to loading these types, so there's no reason to omit any. Signed-off-by: Steve Kuznetsov --- .../cmd/applyconfiguration-gen/args/args.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go b/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go index 78f364841f2..c7e873d3fa5 100644 --- a/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go +++ b/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go @@ -49,10 +49,15 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) { genericArgs := args.Default().WithoutDefaultFlagParsing() customArgs := &CustomArgs{ ExternalApplyConfigurations: map[types.Name]string{ - // Always include TypeMeta and ObjectMeta. They are sufficient for the vast majority of use cases. - {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "TypeMeta"}: "k8s.io/client-go/applyconfigurations/meta/v1", - {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ObjectMeta"}: "k8s.io/client-go/applyconfigurations/meta/v1", - {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "OwnerReference"}: "k8s.io/client-go/applyconfigurations/meta/v1", + // Always include the applyconfigurations we've generated in client-go. They are sufficient for the vast majority of use cases. + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "Condition"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "DeleteOptions"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "LabelSelector"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "LabelSelectorRequirement"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ManagedFieldsEntry"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ObjectMeta"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "OwnerReference"}: "k8s.io/client-go/applyconfigurations/meta/v1", + {Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "TypeMeta"}: "k8s.io/client-go/applyconfigurations/meta/v1", }, } genericArgs.CustomArgs = customArgs