Skip to content

Commit 4dd7161

Browse files
yec-akamaidependabot[bot]zliang-akamai
authored andcommitted
Support new fields for LKE-E node pool (linode#701)
* lke-e node pool * lint build(deps): bump golangci/golangci-lint-action from 6 to 7 (linode#705) * build(deps): bump golangci/golangci-lint-action from 6 to 7 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](golangci/golangci-lint-action@v6...v7) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * golangci-lint migrate --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Zhiwei Liang <[email protected]> Co-authored-by: Zhiwei Liang <[email protected]>
1 parent 23fadd6 commit 4dd7161

File tree

9 files changed

+1747
-62
lines changed

9 files changed

+1747
-62
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
go-version: stable
1818

1919
- name: golangci-lint
20-
uses: golangci/golangci-lint-action@v6
20+
uses: golangci/golangci-lint-action@v7
2121
with:
2222
version: latest
2323

.golangci.yml

Lines changed: 71 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,85 @@
1+
version: "2"
12
run:
23
tests: false
3-
4-
linters-settings:
5-
errcheck:
6-
check-type-assertions: true
7-
check-blank: true
8-
9-
govet:
10-
enable:
11-
- atomicalign
12-
- shadow
13-
enable-all: false
14-
disable-all: false
15-
gocyclo:
16-
min-complexity: 30
17-
gocognit:
18-
min-complexity: 30
19-
dupl:
20-
threshold: 100
21-
224
linters:
23-
enable-all: true
5+
default: all
246
disable:
25-
# deprecated linters
26-
- exportloopref
27-
####################
28-
29-
# conflicted with go fmt
30-
- nolintlint
31-
32-
# workaround to avoid linter failures of getting malformed json
33-
- musttag
34-
35-
- err113
36-
377
- bodyclose
388
- contextcheck
39-
- nilerr
40-
- noctx
41-
- rowserrcheck
42-
- sqlclosecheck
43-
- tparallel
9+
- cyclop
10+
- depguard
11+
- dupl
12+
- durationcheck
13+
- err113
14+
- errcheck
4415
- errname
16+
- errorlint
17+
- exhaustive
18+
- exhaustruct
4519
- forcetypeassert
20+
- gochecknoglobals
21+
- gochecknoinits
4622
- gocyclo
47-
- unparam
48-
- nakedret
49-
- lll
50-
- dupl
23+
- godot
5124
- gosec
52-
- gochecknoinits
53-
- gochecknoglobals
54-
- exhaustruct
25+
- inamedparam
26+
- lll
27+
- musttag
28+
- nakedret
29+
- nilerr
30+
- nlreturn
31+
- noctx
32+
- nolintlint
5533
- nonamedreturns
56-
- errcheck
34+
- perfsprint
35+
- recvcheck
36+
- rowserrcheck
37+
- sqlclosecheck
5738
- staticcheck
58-
- stylecheck
59-
- wsl
60-
- varnamelen
39+
- tagalign
6140
- tagliatelle
62-
- nlreturn
63-
- wrapcheck
41+
- tparallel
42+
- unparam
43+
- varnamelen
6444
- wastedassign
65-
- durationcheck
66-
- errorlint
67-
- cyclop
68-
- godot
69-
- exhaustive
70-
- depguard
71-
- tagalign
72-
- inamedparam
73-
- perfsprint
74-
- recvcheck
75-
fast: false
45+
- wrapcheck
46+
- wsl
47+
settings:
48+
dupl:
49+
threshold: 100
50+
errcheck:
51+
check-type-assertions: true
52+
check-blank: true
53+
gocognit:
54+
min-complexity: 30
55+
gocyclo:
56+
min-complexity: 30
57+
govet:
58+
enable:
59+
- atomicalign
60+
- shadow
61+
enable-all: false
62+
disable-all: false
63+
exclusions:
64+
generated: lax
65+
presets:
66+
- comments
67+
- common-false-positives
68+
- legacy
69+
- std-error-handling
70+
paths:
71+
- third_party$
72+
- builtin$
73+
- examples$
74+
formatters:
75+
enable:
76+
- gci
77+
- gofmt
78+
- gofumpt
79+
- goimports
80+
exclusions:
81+
generated: lax
82+
paths:
83+
- third_party$
84+
- builtin$
85+
- examples$

lke_node_pools.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ const (
1414
LKELinodeNotReady LKELinodeStatus = "not_ready"
1515
)
1616

17+
// LKENodePoolUpdateStrategy constants start with LKENodePool and include
18+
// LKE Node Pool upgrade strategy values
19+
type LKENodePoolUpdateStrategy string
20+
21+
// LKENodePoolUpdateStrategy constants describe the available upgrade strategies for LKE Enterprise only
22+
const (
23+
LKENodePoolRollingUpdate LKENodePoolUpdateStrategy = "rolling_update"
24+
LKENodePoolOnRecycle LKENodePoolUpdateStrategy = "on_recycle"
25+
)
26+
1727
// LKENodePoolDisk represents a Node disk in an LKENodePool object
1828
type LKENodePoolDisk struct {
1929
Size int `json:"size"`
@@ -67,6 +77,11 @@ type LKENodePool struct {
6777

6878
// NOTE: Disk encryption may not currently be available to all users.
6979
DiskEncryption InstanceDiskEncryption `json:"disk_encryption,omitempty"`
80+
81+
// K8sVersion and UpdateStrategy are only for LKE Enterprise to support node pool upgrades.
82+
// It may not currently be available to all users and is under v4beta.
83+
K8sVersion *string `json:"k8s_version,omitempty"`
84+
UpdateStrategy *LKENodePoolUpdateStrategy `json:"update_strategy,omitempty"`
7085
}
7186

7287
// LKENodePoolCreateOptions fields are those accepted by CreateLKENodePool
@@ -79,6 +94,11 @@ type LKENodePoolCreateOptions struct {
7994
Taints []LKENodePoolTaint `json:"taints"`
8095

8196
Autoscaler *LKENodePoolAutoscaler `json:"autoscaler,omitempty"`
97+
98+
// K8sVersion and UpdateStrategy only works for LKE Enterprise to support node pool upgrades.
99+
// It may not currently be available to all users and is under v4beta.
100+
K8sVersion *string `json:"k8s_version,omitempty"`
101+
UpdateStrategy *LKENodePoolUpdateStrategy `json:"update_strategy,omitempty"`
82102
}
83103

84104
// LKENodePoolUpdateOptions fields are those accepted by UpdateLKENodePoolUpdate
@@ -89,6 +109,11 @@ type LKENodePoolUpdateOptions struct {
89109
Taints *[]LKENodePoolTaint `json:"taints,omitempty"`
90110

91111
Autoscaler *LKENodePoolAutoscaler `json:"autoscaler,omitempty"`
112+
113+
// K8sVersion and UpdateStrategy only works for LKE Enterprise to support node pool upgrades.
114+
// It may not currently be available to all users and is under v4beta.
115+
K8sVersion *string `json:"k8s_version,omitempty"`
116+
UpdateStrategy *LKENodePoolUpdateStrategy `json:"update_strategy,omitempty"`
92117
}
93118

94119
// GetCreateOptions converts a LKENodePool to LKENodePoolCreateOptions for
@@ -100,6 +125,8 @@ func (l LKENodePool) GetCreateOptions() (o LKENodePoolCreateOptions) {
100125
o.Labels = l.Labels
101126
o.Taints = l.Taints
102127
o.Autoscaler = &l.Autoscaler
128+
o.K8sVersion = l.K8sVersion
129+
o.UpdateStrategy = l.UpdateStrategy
103130
return
104131
}
105132

@@ -110,6 +137,8 @@ func (l LKENodePool) GetUpdateOptions() (o LKENodePoolUpdateOptions) {
110137
o.Labels = &l.Labels
111138
o.Taints = &l.Taints
112139
o.Autoscaler = &l.Autoscaler
140+
o.K8sVersion = l.K8sVersion
141+
o.UpdateStrategy = l.UpdateStrategy
113142
return
114143
}
115144

0 commit comments

Comments
 (0)