Skip to content

Commit

Permalink
update tools to latest versions (#4126)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwagner5 committed Jun 27, 2023
1 parent 353f637 commit 207f058
Show file tree
Hide file tree
Showing 19 changed files with 34 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export K8S_VERSION ?= 1.23.x
export K8S_VERSION ?= 1.27.x
export KUBEBUILDER_ASSETS ?= ${HOME}/.kubebuilder/bin
CLUSTER_NAME ?= $(shell kubectl config view --minify -o jsonpath='{.clusters[].name}' | rev | cut -d"/" -f1 | rev | cut -d"." -f1)

Expand Down
20 changes: 10 additions & 10 deletions hack/toolchain.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

K8S_VERSION="${K8S_VERSION:="1.23.x"}"
K8S_VERSION="${K8S_VERSION:="1.27.x"}"
KUBEBUILDER_ASSETS="${KUBEBUILDER_ASSETS:="${HOME}/.kubebuilder/bin"}"

main() {
Expand All @@ -10,16 +10,16 @@ main() {
}

tools() {
go install github.com/google/go-licenses@v1.6.0
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1
go install github.com/google/ko@v0.11.2
go install github.com/mikefarah/yq/v4@v4.30.8
go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.0
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20230213155330-c98b7fd9183a
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.11.3
go install github.com/sigstore/cosign/cmd/cosign@v1.13.1
go install github.com/google/go-licenses@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/google/ko@latest
go install github.com/mikefarah/yq/v4@latest
go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
go install sigs.k8s.io/controller-tools/cmd/controller-gen@latest
go install github.com/sigstore/cosign/cmd/cosign@latest
go install -tags extended github.com/gohugoio/hugo@v0.110.0
go install golang.org/x/vuln/cmd/govulncheck@v0.0.0-20230217165152-67742527d09b
go install golang.org/x/vuln/cmd/govulncheck@latest
go install github.com/onsi/ginkgo/v2/ginkgo@latest

if ! echo "$PATH" | grep -q "${GOPATH:-undefined}/bin\|$HOME/go/bin"; then
Expand Down
3 changes: 1 addition & 2 deletions pkg/apis/crds/karpenter.k8s.aws_awsnodetemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
name: awsnodetemplates.karpenter.k8s.aws
spec:
group: karpenter.k8s.aws
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/v1alpha1/awsnodetemplate_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ import (
)

// SetDefaults for the AWSNodeTemplate
func (a *AWSNodeTemplate) SetDefaults(ctx context.Context) {
func (a *AWSNodeTemplate) SetDefaults(_ context.Context) {
}
4 changes: 2 additions & 2 deletions pkg/apis/v1alpha5/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (p *Provisioner) SupportedVerbs() []admissionregistrationv1.OperationType {
}
}

func (p *Provisioner) Validate(ctx context.Context) (errs *apis.FieldError) {
func (p *Provisioner) Validate(_ context.Context) (errs *apis.FieldError) {
if p.Spec.Provider == nil {
return nil
}
Expand All @@ -49,7 +49,7 @@ func (p *Provisioner) Validate(ctx context.Context) (errs *apis.FieldError) {
return provider.Validate()
}

func (p *Provisioner) SetDefaults(ctx context.Context) {
func (p *Provisioner) SetDefaults(_ context.Context) {
requirements := scheduling.NewNodeSelectorRequirements(p.Spec.Requirements...)

// default to linux OS
Expand Down
4 changes: 2 additions & 2 deletions pkg/batcher/batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (b *Batcher[T, U]) Add(ctx context.Context, input *T) Result[U] {
}

// DefaultHasher will hash the entire input
func DefaultHasher[T input](ctx context.Context, input *T) uint64 {
func DefaultHasher[T input](_ context.Context, input *T) uint64 {
hash, err := hashstructure.Hash(input, hashstructure.FormatV2, &hashstructure.HashOptions{SlicesAsSets: true})
if err != nil {
panic("error hashing")
Expand All @@ -125,7 +125,7 @@ func DefaultHasher[T input](ctx context.Context, input *T) uint64 {
}

// OneBucketHasher will return a constant hash and should be used when there is only one type of request
func OneBucketHasher[T input](ctx context.Context, input *T) uint64 {
func OneBucketHasher[T input](_ context.Context, _ *T) uint64 {
return 0
}

Expand Down
5 changes: 1 addition & 4 deletions pkg/cloudprovider/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,7 @@ func (c *CloudProvider) Get(ctx context.Context, providerID string) (*v1alpha5.M
}

func (c *CloudProvider) LivenessProbe(req *http.Request) error {
if err := c.instanceTypeProvider.LivenessProbe(req); err != nil {
return err
}
return nil
return c.instanceTypeProvider.LivenessProbe(req)
}

// GetInstanceTypes returns all available InstanceTypes
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/nodetemplate/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (c *Controller) Name() string {
return "awsnodetemplate"
}

func (c *Controller) Builder(ctx context.Context, m manager.Manager) corecontroller.Builder {
func (c *Controller) Builder(_ context.Context, m manager.Manager) corecontroller.Builder {
return corecontroller.Adapt(controllerruntime.
NewControllerManagedBy(m).
For(&v1alpha1.AWSNodeTemplate{}).
Expand Down
6 changes: 3 additions & 3 deletions pkg/fake/ec2api.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func (e *EC2API) DescribeLaunchTemplatesWithContext(_ context.Context, input *ec
return output, nil
}

func (e *EC2API) DescribeSubnetsWithContext(ctx context.Context, input *ec2.DescribeSubnetsInput, opts ...request.Option) (*ec2.DescribeSubnetsOutput, error) {
func (e *EC2API) DescribeSubnetsWithContext(_ context.Context, input *ec2.DescribeSubnetsInput, _ ...request.Option) (*ec2.DescribeSubnetsOutput, error) {
if !e.NextError.IsNil() {
defer e.NextError.Reset()
return nil, e.NextError.Get()
Expand Down Expand Up @@ -411,7 +411,7 @@ func (e *EC2API) DescribeSubnetsWithContext(ctx context.Context, input *ec2.Desc
return &ec2.DescribeSubnetsOutput{Subnets: FilterDescribeSubnets(subnets, input.Filters)}, nil
}

func (e *EC2API) DescribeSecurityGroupsWithContext(ctx context.Context, input *ec2.DescribeSecurityGroupsInput, opts ...request.Option) (*ec2.DescribeSecurityGroupsOutput, error) {
func (e *EC2API) DescribeSecurityGroupsWithContext(_ context.Context, input *ec2.DescribeSecurityGroupsInput, _ ...request.Option) (*ec2.DescribeSecurityGroupsOutput, error) {
if !e.NextError.IsNil() {
defer e.NextError.Reset()
return nil, e.NextError.Get()
Expand Down Expand Up @@ -590,7 +590,7 @@ func (e *EC2API) DescribeInstanceTypeOfferingsPagesWithContext(_ context.Context
return nil
}

func (e *EC2API) DescribeSpotPriceHistoryPagesWithContext(_ aws.Context, in *ec2.DescribeSpotPriceHistoryInput, fn func(*ec2.DescribeSpotPriceHistoryOutput, bool) bool, opts ...request.Option) error {
func (e *EC2API) DescribeSpotPriceHistoryPagesWithContext(_ aws.Context, in *ec2.DescribeSpotPriceHistoryInput, fn func(*ec2.DescribeSpotPriceHistoryOutput, bool) bool, _ ...request.Option) error {
e.DescribeSpotPriceHistoryInput.Set(in)
if !e.NextError.IsNil() {
defer e.NextError.Reset()
Expand Down
2 changes: 1 addition & 1 deletion pkg/fake/pricingapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (p *PricingAPI) Reset() {
p.GetProductsOutput.Reset()
}

func (p *PricingAPI) GetProductsPagesWithContext(_ aws.Context, inp *pricing.GetProductsInput, fn func(*pricing.GetProductsOutput, bool) bool, opts ...request.Option) error {
func (p *PricingAPI) GetProductsPagesWithContext(_ aws.Context, _ *pricing.GetProductsInput, fn func(*pricing.GetProductsOutput, bool) bool, _ ...request.Option) error {
if !p.NextError.IsNil() {
return p.NextError.Get()
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/fake/ssmapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type SSMAPI struct {
WantErr error
}

func (a SSMAPI) GetParameterWithContext(ctx context.Context, input *ssm.GetParameterInput, opts ...request.Option) (*ssm.GetParameterOutput, error) {
func (a SSMAPI) GetParameterWithContext(_ context.Context, input *ssm.GetParameterInput, _ ...request.Option) (*ssm.GetParameterOutput, error) {
if a.WantErr != nil {
return nil, a.WantErr
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func NewOperator(ctx context.Context, operator *operator.Operator) (context.Cont
)
amiProvider := amifamily.NewProvider(operator.GetClient(), operator.KubernetesInterface, ssm.New(sess), ec2api,
cache.New(awscache.DefaultTTL, awscache.DefaultCleanupInterval), cache.New(awscache.DefaultTTL, awscache.DefaultCleanupInterval), cache.New(awscache.DefaultTTL, awscache.DefaultCleanupInterval))
amiResolver := amifamily.New(operator.GetClient(), amiProvider)
amiResolver := amifamily.New(amiProvider)
launchTemplateProvider := launchtemplate.NewProvider(
ctx,
cache.New(awscache.DefaultTTL, awscache.DefaultCleanupInterval),
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/amifamily/al2.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (a AL2) DefaultAMIs(version string) []DefaultAMIOutput {
// even if elements of those inputs are in differing orders,
// guaranteeing it won't cause spurious hash differences.
// AL2 userdata also works on Ubuntu
func (a AL2) UserData(kubeletConfig *v1alpha5.KubeletConfiguration, taints []v1.Taint, labels map[string]string, caBundle *string, instanceTypes []*cloudprovider.InstanceType, customUserData *string) bootstrap.Bootstrapper {
func (a AL2) UserData(kubeletConfig *v1alpha5.KubeletConfiguration, taints []v1.Taint, labels map[string]string, caBundle *string, _ []*cloudprovider.InstanceType, customUserData *string) bootstrap.Bootstrapper {
containerRuntime := aws.String("containerd")
if kubeletConfig != nil && kubeletConfig.ContainerRuntime != nil {
containerRuntime = kubeletConfig.ContainerRuntime
Expand Down
3 changes: 1 addition & 2 deletions pkg/providers/amifamily/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/samber/lo"
core "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/aws/karpenter/pkg/apis/v1alpha1"
"github.com/aws/karpenter/pkg/providers/amifamily/bootstrap"
Expand Down Expand Up @@ -108,7 +107,7 @@ func (d DefaultFamily) FeatureFlags() FeatureFlags {
}

// New constructs a new launch template Resolver
func New(kubeClient client.Client, amiProvider *Provider) *Resolver {
func New(amiProvider *Provider) *Resolver {
return &Resolver{
amiProvider: amiProvider,
}
Expand Down
5 changes: 1 addition & 4 deletions pkg/providers/instancetype/instancetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ func (p *Provider) LivenessProbe(req *http.Request) error {
if err := p.subnetProvider.LivenessProbe(req); err != nil {
return err
}
if err := p.pricingProvider.LivenessProbe(req); err != nil {
return err
}
return nil
return p.pricingProvider.LivenessProbe(req)
}

func (p *Provider) createOfferings(ctx context.Context, instanceType *ec2.InstanceTypeInfo, zones sets.String) []cloudprovider.Offering {
Expand Down
4 changes: 2 additions & 2 deletions pkg/providers/pricing/pricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func NewAPI(sess *session.Session, region string) pricingiface.PricingAPI {
return pricing.New(sess, &aws.Config{Region: aws.String(pricingAPIRegion)})
}

func NewProvider(ctx context.Context, pricing pricingiface.PricingAPI, ec2Api ec2iface.EC2API, region string) *Provider {
func NewProvider(_ context.Context, pricing pricingiface.PricingAPI, ec2Api ec2iface.EC2API, region string) *Provider {
p := &Provider{
region: region,
ec2: ec2Api,
Expand Down Expand Up @@ -384,7 +384,7 @@ func (p *Provider) UpdateSpotPricing(ctx context.Context) error {
return nil
}

func (p *Provider) LivenessProbe(req *http.Request) error {
func (p *Provider) LivenessProbe(_ *http.Request) error {
// ensure we don't deadlock and nolint for the empty critical section
p.mu.Lock()
//nolint: staticcheck
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/subnet/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (p *Provider) UpdateInflightIPs(createFleetInput *ec2.CreateFleetInput, cre
}
}

func (p *Provider) LivenessProbe(req *http.Request) error {
func (p *Provider) LivenessProbe(_ *http.Request) error {
p.Lock()
//nolint: staticcheck
p.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion pkg/test/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func NewEnvironment(ctx context.Context, env *coretest.Environment) *Environment
subnetProvider := subnet.NewProvider(ec2api, subnetCache)
securityGroupProvider := securitygroup.NewProvider(ec2api, securityGroupCache)
amiProvider := amifamily.NewProvider(env.Client, env.KubernetesInterface, ssmapi, ec2api, ssmCache, ec2Cache, kubernetesVersionCache)
amiResolver := amifamily.New(env.Client, amiProvider)
amiResolver := amifamily.New(amiProvider)
instanceTypesProvider := instancetype.NewProvider("", instanceTypeCache, ec2api, subnetProvider, unavailableOfferingsCache, pricingProvider)
launchTemplateProvider :=
launchtemplate.NewProvider(
Expand Down
4 changes: 2 additions & 2 deletions pkg/webhooks/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewWebhooks() []knativeinjection.ControllerConstructor {
}
}

func NewCRDDefaultingWebhook(ctx context.Context, w configmap.Watcher) *controller.Impl {
func NewCRDDefaultingWebhook(ctx context.Context, _ configmap.Watcher) *controller.Impl {
return defaulting.NewAdmissionController(ctx,
"defaulting.webhook.karpenter.k8s.aws",
"/default/karpenter.k8s.aws",
Expand All @@ -47,7 +47,7 @@ func NewCRDDefaultingWebhook(ctx context.Context, w configmap.Watcher) *controll
)
}

func NewCRDValidationWebhook(ctx context.Context, w configmap.Watcher) *controller.Impl {
func NewCRDValidationWebhook(ctx context.Context, _ configmap.Watcher) *controller.Impl {
return validation.NewAdmissionController(ctx,
"validation.webhook.karpenter.k8s.aws",
"/validate/karpenter.k8s.aws",
Expand Down

0 comments on commit 207f058

Please sign in to comment.