Skip to content

Commit 31fd259

Browse files
engedaamamanueng
andauthored
fix: make toolchain failing due to deletion of asciicheck for v0.37.x (#8663)
Co-authored-by: engedaam <[email protected]>
1 parent a80b363 commit 31fd259

File tree

24 files changed

+121
-95
lines changed

24 files changed

+121
-95
lines changed

.github/actions/install-deps/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ runs:
1616
# Root path permission workaround for caching https://github.com/actions/cache/issues/845#issuecomment-1252594999
1717
- run: sudo chown "$USER" /usr/local
1818
shell: bash
19-
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
19+
- uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
2020
id: cache-toolchain
2121
with:
2222
path: |

.golangci.yaml

Lines changed: 76 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,94 @@
1-
# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
1+
version: "2"
22
run:
33
tests: true
44
timeout: 5m
55
linters:
66
enable:
77
- asciicheck
88
- bidichk
9-
- errorlint
109
- copyloopvar
10+
- errorlint
11+
- gocyclo
12+
- goheader
1113
- gosec
14+
- misspell
15+
- nilerr
1216
- revive
13-
- stylecheck
17+
- staticcheck
1418
- tparallel
1519
- unconvert
1620
- unparam
17-
- gocyclo
18-
- govet
19-
- goimports
20-
- goheader
21-
- misspell
22-
- nilerr
2321
disable:
2422
- prealloc
25-
linters-settings:
26-
gocyclo:
27-
min-complexity: 11
28-
govet:
29-
enable-all: true
30-
disable:
31-
- fieldalignment
32-
revive:
23+
settings:
24+
gocyclo:
25+
min-complexity: 11
26+
goheader:
27+
template: |-
28+
Licensed under the Apache License, Version 2.0 (the "License");
29+
you may not use this file except in compliance with the License.
30+
You may obtain a copy of the License at
31+
32+
http://www.apache.org/licenses/LICENSE-2.0
33+
34+
Unless required by applicable law or agreed to in writing, software
35+
distributed under the License is distributed on an "AS IS" BASIS,
36+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37+
See the License for the specific language governing permissions and
38+
limitations under the License.
39+
govet:
40+
disable:
41+
- fieldalignment
42+
enable-all: true
43+
misspell:
44+
locale: US
45+
revive:
46+
rules:
47+
- name: dot-imports
48+
disabled: true
49+
staticcheck:
50+
dot-import-whitelist:
51+
- github.com/onsi/ginkgo/v2
52+
- github.com/onsi/gomega
53+
exclusions:
54+
generated: lax
55+
presets:
56+
- comments
57+
- common-false-positives
58+
- legacy
59+
- std-error-handling
3360
rules:
34-
- name: dot-imports
35-
disabled: true
36-
stylecheck:
37-
dot-import-whitelist:
38-
- "github.com/onsi/ginkgo/v2"
39-
- "github.com/onsi/gomega"
40-
misspell:
41-
locale: US
42-
ignore-words: []
43-
goimports:
44-
local-prefixes: github.com/aws/karpenter-provider-aws
45-
goheader:
46-
template: |-
47-
Licensed under the Apache License, Version 2.0 (the "License");
48-
you may not use this file except in compliance with the License.
49-
You may obtain a copy of the License at
50-
51-
http://www.apache.org/licenses/LICENSE-2.0
52-
53-
Unless required by applicable law or agreed to in writing, software
54-
distributed under the License is distributed on an "AS IS" BASIS,
55-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56-
See the License for the specific language governing permissions and
57-
limitations under the License.
61+
- linters:
62+
- goheader
63+
path: zz_(.+)\.go
64+
- path: (.+)\.go$
65+
text: declaration of "(err|ctx)" shadows declaration at
66+
paths:
67+
- tools
68+
- website
69+
- hack
70+
- charts
71+
- designs
72+
- third_party$
73+
- builtin$
74+
- examples$
5875
issues:
5976
fix: true
60-
exclude: ['declaration of "(err|ctx)" shadows declaration at']
61-
exclude-dirs:
62-
- tools
63-
- website
64-
- hack
65-
- charts
66-
- designs
67-
exclude-rules:
68-
- linters:
69-
- goheader
70-
path: 'zz_(.+)\.go'
71-
77+
formatters:
78+
enable:
79+
- goimports
80+
settings:
81+
goimports:
82+
local-prefixes:
83+
- github.com/aws/karpenter-provider-aws
84+
exclusions:
85+
generated: lax
86+
paths:
87+
- tools
88+
- website
89+
- hack
90+
- charts
91+
- designs
92+
- third_party$
93+
- builtin$
94+
- examples$

charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.17.1
6+
controller-gen.kubebuilder.io/version: v0.19.0
77
name: ec2nodeclasses.karpenter.k8s.aws
88
spec:
99
group: karpenter.k8s.aws

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/aws/karpenter-provider-aws
22

3-
go 1.22.11
3+
go 1.23.12
44

55
require (
66
github.com/Pallinder/go-randomdata v1.2.0

hack/toolchain.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ main() {
1111

1212
tools() {
1313
go install github.com/google/go-licenses@latest
14-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
14+
# asciicheck is a dependency of golangci-lint that got removed so golangci changed their go.mod to use the forked version
15+
# fix - https://github.com/golangci/golangci-lint/issues/6017
16+
# change to latest once golangci releases new version with the fix
17+
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@main
1518
go install github.com/google/ko@latest
1619
go install github.com/mikefarah/yq/v4@latest
1720
go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest

pkg/apis/crds/karpenter.k8s.aws_ec2nodeclasses.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.17.1
6+
controller-gen.kubebuilder.io/version: v0.19.0
77
name: ec2nodeclasses.karpenter.k8s.aws
88
spec:
99
group: karpenter.k8s.aws

pkg/cloudprovider/suite_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ var _ = Describe("CloudProvider", func() {
231231
cloudProviderNodeClaim, err := cloudProvider.Create(ctx, nodeClaim)
232232
Expect(err).To(BeNil())
233233
Expect(cloudProviderNodeClaim).ToNot(BeNil())
234-
_, ok := cloudProviderNodeClaim.ObjectMeta.Annotations[v1beta1.AnnotationEC2NodeClassHash]
234+
_, ok := cloudProviderNodeClaim.Annotations[v1beta1.AnnotationEC2NodeClassHash]
235235
Expect(ok).To(BeTrue())
236236
})
237237
It("should expect a strict set of annotation keys", func() {
@@ -247,7 +247,7 @@ var _ = Describe("CloudProvider", func() {
247247
cloudProviderNodeClaim, err := cloudProvider.Create(ctx, nodeClaim)
248248
Expect(err).To(BeNil())
249249
Expect(cloudProviderNodeClaim).ToNot(BeNil())
250-
v, ok := cloudProviderNodeClaim.ObjectMeta.Annotations[v1beta1.AnnotationEC2NodeClassHashVersion]
250+
v, ok := cloudProviderNodeClaim.Annotations[v1beta1.AnnotationEC2NodeClassHashVersion]
251251
Expect(ok).To(BeTrue())
252252
Expect(v).To(Equal(v1beta1.EC2NodeClassHashVersion))
253253
})
@@ -1005,11 +1005,11 @@ var _ = Describe("CloudProvider", func() {
10051005
Expect(isDrifted).To(BeEmpty())
10061006
})
10071007
It("should not return drifted if the NodeClaim's karpenter.k8s.aws/ec2nodeclass-hash-version annotation does not match the EC2NodeClass's", func() {
1008-
nodeClass.ObjectMeta.Annotations = map[string]string{
1008+
nodeClass.Annotations = map[string]string{
10091009
v1beta1.AnnotationEC2NodeClassHash: "test-hash-111111",
10101010
v1beta1.AnnotationEC2NodeClassHashVersion: "test-hash-version-1",
10111011
}
1012-
nodeClaim.ObjectMeta.Annotations = map[string]string{
1012+
nodeClaim.Annotations = map[string]string{
10131013
v1beta1.AnnotationEC2NodeClassHash: "test-hash-222222",
10141014
v1beta1.AnnotationEC2NodeClassHashVersion: "test-hash-version-2",
10151015
}
@@ -1019,10 +1019,10 @@ var _ = Describe("CloudProvider", func() {
10191019
Expect(isDrifted).To(BeEmpty())
10201020
})
10211021
It("should not return drifted if karpenter.k8s.aws/ec2nodeclass-hash-version annotation is not present on the NodeClass", func() {
1022-
nodeClass.ObjectMeta.Annotations = map[string]string{
1022+
nodeClass.Annotations = map[string]string{
10231023
v1beta1.AnnotationEC2NodeClassHash: "test-hash-111111",
10241024
}
1025-
nodeClaim.ObjectMeta.Annotations = map[string]string{
1025+
nodeClaim.Annotations = map[string]string{
10261026
v1beta1.AnnotationEC2NodeClassHash: "test-hash-222222",
10271027
v1beta1.AnnotationEC2NodeClassHashVersion: "test-hash-version-2",
10281028
}
@@ -1036,11 +1036,11 @@ var _ = Describe("CloudProvider", func() {
10361036
Expect(isDrifted).To(BeEmpty())
10371037
})
10381038
It("should not return drifted if karpenter.k8s.aws/ec2nodeclass-hash-version annotation is not present on the NodeClaim", func() {
1039-
nodeClass.ObjectMeta.Annotations = map[string]string{
1039+
nodeClass.Annotations = map[string]string{
10401040
v1beta1.AnnotationEC2NodeClassHash: "test-hash-111111",
10411041
v1beta1.AnnotationEC2NodeClassHashVersion: "test-hash-version-1",
10421042
}
1043-
nodeClaim.ObjectMeta.Annotations = map[string]string{
1043+
nodeClaim.Annotations = map[string]string{
10441044
v1beta1.AnnotationEC2NodeClassHash: "test-hash-222222",
10451045
}
10461046
// should trigger drift

pkg/providers/amifamily/al2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ func (a AL2) DefaultAMIs(version string) []DefaultAMIOutput {
7878
func (a AL2) UserData(kubeletConfig *corev1beta1.KubeletConfiguration, taints []v1.Taint, labels map[string]string, caBundle *string, _ []*cloudprovider.InstanceType, customUserData *string, instanceStorePolicy *v1beta1.InstanceStorePolicy) bootstrap.Bootstrapper {
7979
return bootstrap.EKS{
8080
Options: bootstrap.Options{
81-
ClusterName: a.Options.ClusterName,
82-
ClusterEndpoint: a.Options.ClusterEndpoint,
81+
ClusterName: a.ClusterName,
82+
ClusterEndpoint: a.ClusterEndpoint,
8383
KubeletConfig: kubeletConfig,
8484
Taints: taints,
8585
Labels: labels,

pkg/providers/amifamily/al2023.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ func (a AL2023) DefaultAMIs(version string) []DefaultAMIOutput {
5252
func (a AL2023) UserData(kubeletConfig *corev1beta1.KubeletConfiguration, taints []v1.Taint, labels map[string]string, caBundle *string, _ []*cloudprovider.InstanceType, customUserData *string, instanceStorePolicy *v1beta1.InstanceStorePolicy) bootstrap.Bootstrapper {
5353
return bootstrap.Nodeadm{
5454
Options: bootstrap.Options{
55-
ClusterName: a.Options.ClusterName,
56-
ClusterEndpoint: a.Options.ClusterEndpoint,
57-
ClusterCIDR: a.Options.ClusterCIDR,
55+
ClusterName: a.ClusterName,
56+
ClusterEndpoint: a.ClusterEndpoint,
57+
ClusterCIDR: a.ClusterCIDR,
5858
KubeletConfig: kubeletConfig,
5959
Taints: taints,
6060
Labels: labels,

pkg/providers/amifamily/ami.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (p *DefaultProvider) getAMIs(ctx context.Context, terms []v1beta1.AMISelect
211211
if v, ok := images[reqsHash]; ok {
212212
candidateCreationTime, _ := time.Parse(time.RFC3339, lo.FromPtr(page.Images[i].CreationDate))
213213
existingCreationTime, _ := time.Parse(time.RFC3339, v.CreationDate)
214-
if existingCreationTime == candidateCreationTime && lo.FromPtr(page.Images[i].Name) < v.Name {
214+
if existingCreationTime.Equal(candidateCreationTime) && lo.FromPtr(page.Images[i].Name) < v.Name {
215215
continue
216216
}
217217
if candidateCreationTime.Unix() < existingCreationTime.Unix() {

0 commit comments

Comments
 (0)