Skip to content

Commit

Permalink
chore: Deprecate functional library in favor of lo and operatorpkg (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ellistarn authored Jul 8, 2024
1 parent 70fdfa4 commit e674d28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions pkg/apis/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ package apis
import (
_ "embed"

"github.com/awslabs/operatorpkg/object"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"

"github.com/samber/lo"

"sigs.k8s.io/karpenter/pkg/apis"
"sigs.k8s.io/karpenter/pkg/utils/functional"
)

//go:generate controller-gen crd object:headerFile="../../hack/boilerplate.go.txt" paths="./..." output:crd:artifacts:config=crds
Expand All @@ -32,6 +30,6 @@ var (
//go:embed crds/karpenter.k8s.aws_ec2nodeclasses.yaml
EC2NodeClassCRD []byte
CRDs = append(apis.CRDs,
lo.Must(functional.Unmarshal[apiextensionsv1.CustomResourceDefinition](EC2NodeClassCRD)),
object.Unmarshal[apiextensionsv1.CustomResourceDefinition](EC2NodeClassCRD),
)
)
5 changes: 2 additions & 3 deletions pkg/cloudprovider/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
corev1beta1 "sigs.k8s.io/karpenter/pkg/apis/v1beta1"
"sigs.k8s.io/karpenter/pkg/events"
"sigs.k8s.io/karpenter/pkg/scheduling"
"sigs.k8s.io/karpenter/pkg/utils/functional"
"sigs.k8s.io/karpenter/pkg/utils/resources"

"github.com/aws/karpenter-provider-aws/pkg/apis"
Expand Down Expand Up @@ -322,8 +321,8 @@ func (c *CloudProvider) instanceToNodeClaim(i *instance.Instance, instanceType *
}
return true
}
nodeClaim.Status.Capacity = functional.FilterMap(instanceType.Capacity, resourceFilter)
nodeClaim.Status.Allocatable = functional.FilterMap(instanceType.Allocatable(), resourceFilter)
nodeClaim.Status.Capacity = lo.PickBy(instanceType.Capacity, resourceFilter)
nodeClaim.Status.Allocatable = lo.PickBy(instanceType.Allocatable(), resourceFilter)
}
labels[v1.LabelTopologyZone] = i.Zone
// Attempt to resolve the zoneID from the instance's EC2NodeClass' status condition.
Expand Down

0 comments on commit e674d28

Please sign in to comment.