From 2acf4b1f07d656a4e11549fe5e4ebcf907b2904a Mon Sep 17 00:00:00 2001 From: Jason Deal Date: Mon, 16 Oct 2023 11:18:22 -0700 Subject: [PATCH] migrate injection --- pkg/apis/apis.go | 3 --- pkg/cloudprovider/cloudprovider.go | 3 --- pkg/operator/options/options.go | 5 +++++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/apis/apis.go b/pkg/apis/apis.go index 056b23b0bf15..0ec568fb4c0c 100644 --- a/pkg/apis/apis.go +++ b/pkg/apis/apis.go @@ -24,13 +24,11 @@ import ( "github.com/aws/karpenter-core/pkg/operator/scheme" "github.com/aws/karpenter/pkg/apis/settings" "github.com/aws/karpenter/pkg/apis/v1beta1" - "github.com/aws/karpenter/pkg/operator/options" "github.com/samber/lo" "github.com/aws/karpenter-core/pkg/apis" coresettings "github.com/aws/karpenter-core/pkg/apis/settings" - coreoptions "github.com/aws/karpenter-core/pkg/operator/options" "github.com/aws/karpenter-core/pkg/utils/functional" "github.com/aws/karpenter/pkg/apis/v1alpha1" ) @@ -44,7 +42,6 @@ var ( // AddToScheme may be used to add all resources defined in the project to a Scheme AddToScheme = Builder.AddToScheme Settings = []coresettings.Injectable{&settings.Settings{}} - Options = []coreoptions.Injectable{&options.Options{}} ) //go:generate controller-gen crd object:headerFile="../../hack/boilerplate.go.txt" paths="./..." output:crd:artifacts:config=crds diff --git a/pkg/cloudprovider/cloudprovider.go b/pkg/cloudprovider/cloudprovider.go index b2f8231da176..cb9fd4d5c1a3 100644 --- a/pkg/cloudprovider/cloudprovider.go +++ b/pkg/cloudprovider/cloudprovider.go @@ -27,14 +27,12 @@ import ( corev1beta1 "github.com/aws/karpenter-core/pkg/apis/v1beta1" "github.com/aws/karpenter-core/pkg/events" - coreoptions "github.com/aws/karpenter-core/pkg/operator/options" "github.com/aws/karpenter-core/pkg/utils/functional" machineutil "github.com/aws/karpenter-core/pkg/utils/machine" nodepoolutil "github.com/aws/karpenter-core/pkg/utils/nodepool" "github.com/aws/karpenter/pkg/apis" "github.com/aws/karpenter/pkg/apis/v1alpha1" "github.com/aws/karpenter/pkg/apis/v1beta1" - "github.com/aws/karpenter/pkg/operator/options" "github.com/aws/karpenter/pkg/utils" nodeclassutil "github.com/aws/karpenter/pkg/utils/nodeclass" @@ -65,7 +63,6 @@ func init() { v1alpha5.NormalizedLabels = lo.Assign(v1alpha5.NormalizedLabels, map[string]string{"topology.ebs.csi.aws.com/zone": v1.LabelTopologyZone}) corev1beta1.NormalizedLabels = lo.Assign(corev1beta1.NormalizedLabels, map[string]string{"topology.ebs.csi.aws.com/zone": v1.LabelTopologyZone}) coreapis.Settings = append(coreapis.Settings, apis.Settings...) - coreoptions.Injectables = append(coreoptions.Injectables, &options.Options{}) } var _ cloudprovider.CloudProvider = (*CloudProvider)(nil) diff --git a/pkg/operator/options/options.go b/pkg/operator/options/options.go index e67c2e15c41f..e248416544e0 100644 --- a/pkg/operator/options/options.go +++ b/pkg/operator/options/options.go @@ -25,10 +25,15 @@ import ( "k8s.io/apimachinery/pkg/util/sets" + coreoptions "github.com/aws/karpenter-core/pkg/operator/options" "github.com/aws/karpenter-core/pkg/utils/env" "github.com/aws/karpenter/pkg/apis/settings" ) +func init() { + coreoptions.Injectables = append(coreoptions.Injectables, &Options{}) +} + type optionsKey struct{} type Options struct {