Skip to content

Commit 7317bb0

Browse files
Enable termination protection by default for eksctl CFN stacks (#8586)
1 parent ae59e22 commit 7317bb0

File tree

94 files changed

+2857
-745
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2857
-745
lines changed

.github/workflows/greetings.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
steps:
1212
- uses: actions/first-interaction@1c4688942c71f71d4f5502a26ea67c331730fa4d #v3.1.0
1313
with:
14-
repo-token: ${{ secrets.GITHUB_TOKEN }}
15-
issue-message: 'Hello ${{ github.event.issue.user.login }} :wave: Thank you for opening an issue in `eksctl` project. The team will review the issue and aim to respond within 1-5 business days. Meanwhile, please read about the Contribution and Code of Conduct guidelines [here](https://github.com/eksctl-io/eksctl#contributions). You can find out more information about `eksctl` on our [website](https://eksctl.io)'
16-
pr-message: 'Hello ${{ github.event.pull_request.user.login }} :wave: Thank you for opening a Pull Request in `eksctl` project. The team will review the Pull Request and aim to respond within 1-10 business days. Meanwhile, please read about the Contribution and Code of Conduct guidelines [here](https://github.com/eksctl-io/eksctl#contributions). You can find out more information about `eksctl` on our [website](https://eksctl.io)'
14+
repo_token: ${{ secrets.GITHUB_TOKEN }}
15+
issue_message: 'Hello ${{ github.event.issue.user.login }} :wave: Thank you for opening an issue in `eksctl` project. The team will review the issue and aim to respond within 1-5 business days. Meanwhile, please read about the Contribution and Code of Conduct guidelines [here](https://github.com/eksctl-io/eksctl#contributions). You can find out more information about `eksctl` on our [website](https://eksctl.io)'
16+
pr_message: 'Hello ${{ github.event.pull_request.user.login }} :wave: Thank you for opening a Pull Request in `eksctl` project. The team will review the Pull Request and aim to respond within 1-10 business days. Meanwhile, please read about the Contribution and Code of Conduct guidelines [here](https://github.com/eksctl-io/eksctl#contributions). You can find out more information about `eksctl` on our [website](https://eksctl.io)'

.golangci.yml

Lines changed: 166 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,187 @@
11
# options for analysis running
2+
version: "2"
23
run:
3-
go: "1.25"
4+
go: "1.25"
45

5-
# default concurrency is a available CPU number
6-
concurrency: 4
6+
# default concurrency is a available CPU number
7+
concurrency: 4
78

8-
# timeout for analysis, e.g. 30s, 5m, default is 1m
9-
timeout: 10m
9+
# exit code when at least one issue was found, default is 1
10+
issues-exit-code: 1
1011

11-
# exit code when at least one issue was found, default is 1
12-
issues-exit-code: 1
12+
# include test files or not, default is true
13+
tests: true
1314

14-
# include test files or not, default is true
15-
tests: true
16-
17-
# list of build tags, all linters use it. Default is empty list.
18-
build-tags:
19-
- release
20-
- integration
15+
# list of build tags, all linters use it. Default is empty list.
16+
build-tags:
17+
- release
18+
- integration
2119

2220
# output configuration options
2321
output:
24-
formats:
25-
- format: tab
22+
formats:
23+
tab:
24+
# print lines of code with issue, default is true
25+
print-issued-lines: true
2626

27-
# print lines of code with issue, default is true
28-
print-issued-lines: true
27+
# print linter name in the end of issue text, default is true
28+
print-linter-name: true
2929

30-
# print linter name in the end of issue text, default is true
31-
print-linter-name: true
30+
# use colors, default is true
31+
colors: false
3232

33-
# all available settings of specific linters
34-
linters-settings:
33+
linters:
34+
# default set of linters, none disables all linters by default.
35+
default: none
36+
37+
# enable specific linters
38+
enable:
39+
- bodyclose
40+
- errcheck
41+
- govet
42+
- ineffassign
43+
- misspell
44+
- revive
45+
- staticcheck
46+
- unused
47+
48+
# all available settings of specific linters
49+
settings:
50+
dupl:
51+
# tokens count to trigger issue, 150 by default
52+
threshold: 100
3553
errcheck:
36-
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
37-
# default is false: such cases aren't reported by default.
38-
check-type-assertions: false
54+
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
55+
# default is false: such cases aren't reported by default.
56+
check-type-assertions: false
3957

40-
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
41-
# default is false: such cases aren't reported by default.
42-
check-blank: false
43-
revive:
44-
confidence: 0.8
45-
severity: warning
46-
rules:
47-
- name: blank-imports
48-
- name: context-as-argument
49-
- name: context-keys-type
50-
- name: error-return
51-
- name: error-strings
52-
- name: error-naming
53-
- name: exported
54-
- name: if-return
55-
- name: increment-decrement
56-
- name: var-naming
57-
- name: var-declaration
58-
- name: package-comments
59-
- name: range
60-
- name: receiver-naming
61-
- name: time-naming
62-
- name: unexported-return
63-
- name: indent-error-flow
64-
- name: errorf
65-
gofmt:
66-
# simplify code: gofmt with `-s` option, true by default
67-
simplify: false
68-
gocyclo:
69-
# minimal code complexity to report, 30 by default (but we recommend 10-20)
70-
min-complexity: 10
71-
dupl:
72-
# tokens count to trigger issue, 150 by default
73-
threshold: 100
58+
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
59+
# default is false: such cases aren't reported by default.
60+
check-blank: false
7461
goconst:
75-
# minimal length of string constant, 3 by default
76-
min-len: 3
77-
# minimal occurrences count to trigger, 3 by default
78-
min-occurrences: 3
62+
# minimal length of string constant, 3 by default
63+
min-len: 3
64+
65+
# minimal occurrences count to trigger, 3 by default
66+
min-occurrences: 3
67+
gocyclo:
68+
# minimal code complexity to report, 30 by default (but we recommend 10-20)
69+
min-complexity: 10
7970
lll:
80-
# max line length, lines longer will be reported. Default is 120.
81-
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
82-
line-length: 120
83-
# tab width in spaces. Default to 1.
84-
tab-width: 1
85-
unparam:
86-
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
87-
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
88-
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
89-
# with golangci-lint call it on a directory with the changed file.
90-
check-exported: false
71+
# max line length, lines longer will be reported. Default is 120.
72+
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
73+
line-length: 120
74+
75+
# tab width in spaces. Default to 1.
76+
tab-width: 1
9177
nakedret:
92-
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
93-
max-func-lines: 30
94-
prealloc:
95-
# XXX: we don't recommend using this linter before doing performance profiling.
96-
# For most programs usage of prealloc will be a premature optimization.
97-
98-
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
99-
# True by default.
100-
simple: true
101-
range-loops: true # Report preallocation suggestions on range loops, true by default
102-
for-loops: false # Report preallocation suggestions on for loops, false by default
78+
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
79+
max-func-lines: 30
80+
revive:
81+
confidence: 0.8
82+
severity: warning
83+
rules:
84+
- name: blank-imports
85+
- name: context-as-argument
86+
- name: context-keys-type
87+
- name: error-return
88+
- name: error-strings
89+
- name: error-naming
90+
- name: exported
91+
- name: if-return
92+
- name: increment-decrement
93+
- name: var-naming
94+
- name: var-declaration
95+
- name: package-comments
96+
- name: range
97+
- name: receiver-naming
98+
- name: time-naming
99+
- name: unexported-return
100+
- name: indent-error-flow
101+
- name: errorf
103102
staticcheck:
104-
checks:
105-
- all
106-
- '-SA1019' # disable the rule SA1019
107-
103+
checks:
104+
- all
105+
- -QF1001 # disable the rule QF1001: Apply De Morgan’s law
106+
- -SA1019 # disbale the rule SA1019: Using a deprecated function, variable, constant or field
107+
- -ST1001 # disable the rule ST1001: Dot imports are discouraged
108+
- -ST1003 # disbale the rule ST1003: Poorly chosen identifier
109+
- -ST1005 # disbale the rule ST1005: Incorrectly formatted error string
110+
111+
unparam:
112+
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
113+
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
114+
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
115+
# with golangci-lint call it on a directory with the changed file.
116+
check-exported: false
117+
118+
# defines a set of rules to ignore issues.
119+
exclusions:
120+
# Mode of the generated files analysis, lax excludes sources if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.
121+
generated: lax
122+
123+
# Predefined exclusion rules.
124+
presets:
125+
- comments
126+
- common-false-positives
127+
- legacy
128+
- std-error-handling
129+
130+
# excluding configuration per-path, per-linter, per-text and per-source.
131+
rules:
132+
- linters:
133+
- golint
134+
text: should not use dot imports|don't use an underscore in package name
135+
- linters:
136+
- revive
137+
text: avoid meaningless package names
138+
139+
# Which file paths to exclude: they will be analyzed, but issues from them won't be reported.
140+
# "/" will be replaced by the current OS file path separator to properly work on Windows.
141+
# Default: []
142+
paths:
143+
- ^pkg\/nodebootstrap\/assets.go
144+
- .*\/export_test.go
145+
- ^pkg\/cfn\/builder\/fakes\/fake_cfn_template.go
146+
- ^vendor$
147+
- ^build$
148+
- ^pkg\/eks\/mocks$
149+
- ^pkg\/goformation*
150+
- third_party$
151+
- builtin$
152+
- examples$
108153

109154
issues:
110-
max-same-issues: 20
111-
# Excluding configuration per-path, per-linter, per-text and per-source
112-
exclude-rules:
113-
- linters: [golint]
114-
text: "should not use dot imports|don't use an underscore in package name"
115-
116-
# Which dirs to exclude: issues from them won't be reported.
117-
# Can use regexp here: `generated.*`, regexp is applied on full path,
118-
# including the path prefix if one is set.
119-
# Default dirs are skipped independently of this option's value (see exclude-dirs-use-default).
120-
# "/" will be replaced by current OS file path separator to properly work on Windows.
121-
# Default: []
122-
exclude-dirs:
123-
- ^vendor$
124-
- ^build$
125-
- ^pkg\/eks\/mocks$
126-
- ^pkg\/goformation*
127-
128-
# Which files to exclude: they will be analyzed, but issues from them won't be reported.
129-
# There is no need to include all autogenerated files,
130-
# we confidently recognize autogenerated files.
131-
# If it's not, please let us know.
132-
# "/" will be replaced by current OS file path separator to properly work on Windows.
155+
# maximum count of issues with the same text, default is 3
156+
max-same-issues: 20
157+
158+
159+
formatters:
160+
# enable specific formatters
161+
enable:
162+
- gofmt
163+
- goimports
164+
165+
# all available settings of specific formatters.
166+
settings:
167+
gofmt:
168+
# simplify code: gofmt with `-s` option, true by default
169+
simplify: false
170+
exclusions:
171+
# Mode of the generated files analysis, lax excludes sources if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.
172+
generated: lax
173+
174+
# Which file paths to exclude.
175+
# This option is ignored when using `--stdin` as the path is unknown.
133176
# Default: []
134-
exclude-files:
135-
# - ".*\\.my\\.go$"
136-
# - lib/bad.go
137-
- ^pkg\/nodebootstrap\/assets.go
138-
- .*\/export_test.go
139-
- ^pkg\/cfn\/builder\/fakes\/fake_cfn_template.go
140-
141-
linters:
142-
disable-all: true
143-
enable:
144-
- bodyclose
145-
- errcheck
146-
- gofmt
147-
- goimports
148-
- revive
149-
- gosimple
150-
- govet
151-
- ineffassign
152-
- misspell
153-
- staticcheck
154-
- unused
155-
# TODO: enable the below linter in the future
156-
# - maligned
157-
# - prealloc
158-
# - gocyclo
159-
# - lll
160-
# - gosec
177+
paths:
178+
- ^pkg\/nodebootstrap\/assets.go
179+
- .*\/export_test.go
180+
- ^pkg\/cfn\/builder\/fakes\/fake_cfn_template.go
181+
- ^vendor$
182+
- ^build$
183+
- ^pkg\/eks\/mocks$
184+
- ^pkg\/goformation*
185+
- third_party$
186+
- builtin$
187+
- examples$

.requirements

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github.com/maxbrunsfeld/counterfeiter/v6
22
github.com/cloudflare/cfssl/cmd/[email protected]
33
github.com/cloudflare/cfssl/cmd/[email protected]
4-
github.com/golangci/golangci-lint/cmd/golangci-lint
4+
github.com/golangci/golangci-lint/v2/cmd/golangci-lint
55
github.com/onsi/ginkgo/v2/ginkgo
66
github.com/vektra/mockery/v2
77
github.com/github-release/github-release

cmd/ec2geninfo/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,10 @@ func getEC2Instances(region string, instances map[string]InstanceInfo) (map[stri
168168
cpuArch := "unknown"
169169
if inst.ProcessorInfo != nil && inst.ProcessorInfo.SupportedArchitectures != nil {
170170
for _, arch := range inst.ProcessorInfo.SupportedArchitectures {
171-
if arch == types.ArchitectureTypeArm64 || arch == types.ArchitectureTypeArm64Mac {
171+
switch arch {
172+
case types.ArchitectureTypeArm64, types.ArchitectureTypeArm64Mac:
172173
cpuArch = "arm64"
173-
} else if arch == types.ArchitectureTypeX8664 || arch == types.ArchitectureTypeX8664Mac {
174+
case types.ArchitectureTypeX8664, types.ArchitectureTypeX8664Mac:
174175
cpuArch = "x86-64"
175176
}
176177
}

0 commit comments

Comments
 (0)