Skip to content

Commit

Permalink
chore: Fix CI failures for golang-ci (#6479)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis authored Jul 10, 2024
1 parent 17e0d3b commit dc5efa7
Show file tree
Hide file tree
Showing 33 changed files with 56 additions and 31 deletions.
10 changes: 5 additions & 5 deletions hack/docgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ set -euo pipefail
compatibilitymatrix() {
# versionCount is the number of K8s versions to display in the compatibility matrix
versionCount=7
go run hack/docs/version_compatibility.go hack/docs/compatibility-karpenter.yaml "$(git describe --exact-match --tags || echo "no tag")"
go run hack/docs/compatibilitymetrix_gen_docs.go website/content/en/preview/upgrading/compatibility.md hack/docs/compatibility-karpenter.yaml $versionCount
go run hack/docs/version_compatibility_gen/main.go hack/docs/compatibilitymatrix_gen/compatibility.yaml "$(git describe --exact-match --tags || echo "no tag")"
go run hack/docs/compatibilitymatrix_gen/main.go website/content/en/preview/upgrading/compatibility.md hack/docs/compatibilitymatrix_gen/compatibility.yaml $versionCount
}

CONTROLLER_RUNTIME_DIR=$(go list -m -f '{{ .Dir }}' sigs.k8s.io/controller-runtime)
AWS_SDK_GO_PROMETHEUS_DIR=$(go list -m -f '{{ .Dir }}' github.com/jonathan-innis/aws-sdk-go-prometheus)
OPERATORPKG_DIR=$(go list -m -f '{{ .Dir }}' github.com/awslabs/operatorpkg)

compatibilitymatrix
go run hack/docs/metrics_gen_docs.go pkg/ "${KARPENTER_CORE_DIR}/pkg" "${CONTROLLER_RUNTIME_DIR}/pkg" "${AWS_SDK_GO_PROMETHEUS_DIR}" "${OPERATORPKG_DIR}/metrics" website/content/en/preview/reference/metrics.md
go run hack/docs/instancetypes_gen_docs.go website/content/en/preview/reference/instance-types.md
go run hack/docs/configuration_gen_docs.go website/content/en/preview/reference/settings.md
go run hack/docs/metrics_gen/main.go pkg/ "${KARPENTER_CORE_DIR}/pkg" "${CONTROLLER_RUNTIME_DIR}/pkg" "${AWS_SDK_GO_PROMETHEUS_DIR}" "${OPERATORPKG_DIR}/metrics" website/content/en/preview/reference/metrics.md
go run hack/docs/instancetypes_gen/main.go website/content/en/preview/reference/instance-types.md
go run hack/docs/configuration_gen/main.go website/content/en/preview/reference/settings.md
cd charts/karpenter && helm-docs
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion pkg/apis/v1/ec2nodeclass_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ package v1
import (
"context"

"github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"
"github.com/samber/lo"
"knative.dev/pkg/apis"

"github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"
)

func (in *EC2NodeClass) ConvertTo(ctx context.Context, to apis.Convertible) error {
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/v1/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package v1_test

import (
"context"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"testing"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "knative.dev/pkg/logging/testing"
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/v1beta1/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package v1beta1_test

import (
"context"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"testing"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

Expand Down
3 changes: 2 additions & 1 deletion pkg/cloudprovider/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ import (
"context"
"fmt"
"net"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"strings"
"testing"
"time"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/awslabs/operatorpkg/object"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down
3 changes: 2 additions & 1 deletion pkg/controllers/interruption/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ import (
"context"
"encoding/json"
"fmt"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"testing"
"time"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
servicesqs "github.com/aws/aws-sdk-go/service/sqs"
Expand Down
3 changes: 2 additions & 1 deletion pkg/controllers/nodeclaim/garbagecollection/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ package garbagecollection_test
import (
"context"
"fmt"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"sync"
"testing"
"time"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/awslabs/operatorpkg/object"
Expand Down
3 changes: 2 additions & 1 deletion pkg/controllers/nodeclaim/tagging/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ package tagging_test
import (
"context"
"fmt"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"testing"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/samber/lo"
Expand Down
3 changes: 2 additions & 1 deletion pkg/controllers/nodeclass/hash/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package hash_test

import (
"context"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"testing"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/awslabs/operatorpkg/object"
"github.com/imdario/mergo"
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/nodeclass/status/ami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ var _ = Describe("NodeClass AMI Status Controller", func() {
It("should get error when resolving AMIs and have status condition set to false", func() {
awsEnv.EC2API.NextError.Set(fmt.Errorf("unable to resolve AMI"))
ExpectApplied(ctx, env.Client, nodeClass)
ExpectObjectReconcileFailed(ctx, env.Client, statusController, nodeClass)
_ = ExpectObjectReconcileFailed(ctx, env.Client, statusController, nodeClass)
nodeClass = ExpectExists(ctx, env.Client, nodeClass)
Expect(nodeClass.StatusConditions().IsTrue(v1beta1.ConditionTypeAMIsReady)).To(BeFalse())
})
Expand Down
3 changes: 2 additions & 1 deletion pkg/controllers/nodeclass/status/instanceprofile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ package status_test
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"
"github.com/samber/lo"

"github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"

"github.com/aws/karpenter-provider-aws/pkg/fake"
"github.com/aws/karpenter-provider-aws/pkg/operator/options"

Expand Down
1 change: 1 addition & 0 deletions pkg/controllers/nodeclass/status/subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package status_test
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"

"github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"
"github.com/aws/karpenter-provider-aws/pkg/test"

Expand Down
3 changes: 2 additions & 1 deletion pkg/controllers/nodeclass/status/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package status_test

import (
"context"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"testing"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

coreoptions "sigs.k8s.io/karpenter/pkg/operator/options"
coretest "sigs.k8s.io/karpenter/pkg/test"

Expand Down
3 changes: 2 additions & 1 deletion pkg/controllers/nodeclass/termination/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ package termination_test
import (
"context"
"fmt"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"testing"
"time"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/iam"
Expand Down
3 changes: 2 additions & 1 deletion pkg/controllers/providers/instancetype/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package instancetype_test

import (
"context"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"testing"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

v1 "k8s.io/api/core/v1"
corev1beta1 "sigs.k8s.io/karpenter/pkg/apis/v1beta1"
coreoptions "sigs.k8s.io/karpenter/pkg/operator/options"
Expand Down
3 changes: 2 additions & 1 deletion pkg/controllers/providers/pricing/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ package pricing_test
import (
"context"
"fmt"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"testing"
"time"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
awspricing "github.com/aws/aws-sdk-go/service/pricing"
Expand Down
4 changes: 3 additions & 1 deletion pkg/fake/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ package fake

import (
"context"

"github.com/awslabs/operatorpkg/status"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

providerv1beta1 "github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"
"sigs.k8s.io/karpenter/pkg/apis/v1beta1"
corecloudprovider "sigs.k8s.io/karpenter/pkg/cloudprovider"
"sigs.k8s.io/karpenter/pkg/test"

providerv1beta1 "github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion pkg/operator/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ package operator_test
import (
"context"
"errors"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"testing"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/service/eks"
"github.com/samber/lo"

Expand Down
3 changes: 2 additions & 1 deletion pkg/providers/amifamily/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ package amifamily_test
import (
"context"
"fmt"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"sort"
"sync"
"testing"
"time"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"

Expand Down
3 changes: 2 additions & 1 deletion pkg/providers/instance/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ package instance_test
import (
"context"
"fmt"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"testing"
"time"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/awslabs/operatorpkg/object"
Expand Down
3 changes: 2 additions & 1 deletion pkg/providers/instancetype/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ import (
"math"
"net"
"reflect"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"sort"
"strings"
"sync"
"testing"
"time"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/awslabs/operatorpkg/status"
Expand Down
3 changes: 2 additions & 1 deletion pkg/providers/launchtemplate/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ import (
"fmt"
"net"
"os"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"strconv"
"strings"
"testing"
"time"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/ec2"
Expand Down
3 changes: 2 additions & 1 deletion pkg/providers/securitygroup/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package securitygroup_test

import (
"context"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"sort"
"sync"
"testing"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/samber/lo"
Expand Down
3 changes: 2 additions & 1 deletion pkg/providers/subnet/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package subnet_test

import (
"context"
"sigs.k8s.io/karpenter/pkg/test/v1alpha1"
"sort"
"sync"
"testing"

"sigs.k8s.io/karpenter/pkg/test/v1alpha1"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/samber/lo"
Expand Down
3 changes: 2 additions & 1 deletion pkg/webhooks/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import (
"knative.dev/pkg/webhook/resourcesemantics/defaulting"
"knative.dev/pkg/webhook/resourcesemantics/validation"

"github.com/awslabs/operatorpkg/object"

v1 "github.com/aws/karpenter-provider-aws/pkg/apis/v1"
"github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"
"github.com/awslabs/operatorpkg/object"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions test/suites/expiration/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var _ = Describe("Expiration", func() {
env.Monitor.Reset() // Reset the monitor so that we can expect a single node to be spun up after expiration

// Set the expireAfter value to get the node deleted
nodePool.Spec.Disruption.ExpireAfter = corev1beta1.NillableDuration{Duration: lo.ToPtr(time.Second*15)}
nodePool.Spec.Disruption.ExpireAfter = corev1beta1.NillableDuration{Duration: lo.ToPtr(time.Second * 15)}
env.ExpectUpdated(nodePool)

// Eventually the node will be tainted, which means its actively being disrupted
Expand Down Expand Up @@ -149,7 +149,7 @@ var _ = Describe("Expiration", func() {
env.Monitor.Reset() // Reset the monitor so that we can expect a single node to be spun up after expiration

// Set the expireAfter value to get the node deleted
nodePool.Spec.Disruption.ExpireAfter.Duration = lo.ToPtr(time.Second*15)
nodePool.Spec.Disruption.ExpireAfter.Duration = lo.ToPtr(time.Second * 15)
env.ExpectUpdated(nodePool)

// Eventually the node will be tainted, which means its actively being disrupted
Expand Down
3 changes: 2 additions & 1 deletion test/suites/integration/instance_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package integration_test

import (
"fmt"
"github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"
"time"

"github.com/aws/karpenter-provider-aws/pkg/apis/v1beta1"

"github.com/awslabs/operatorpkg/status"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

Expand Down

0 comments on commit dc5efa7

Please sign in to comment.