Skip to content

Commit dd817be

Browse files
Add update nodegroup support (#16)
* Add update nodegroup support * Fix missing fixture in nodegroup test * Update acktest commit * Update acktest commit hash * Fix incorrect assertion in test * Fix key error in nodegroup test * Remove faulty cluster test assertion
1 parent 83fc789 commit dd817be

17 files changed

+1330
-263
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2022-01-07T20:46:14Z"
2+
build_date: "2022-01-09T00:30:18Z"
33
build_hash: 3e184727de8a4dfd4769e3d88f4f52f885858335
4-
go_version: go1.17.5
4+
go_version: go1.17.1
55
version: v0.16.0
66
api_directory_checksum: 18423a5aa90c547e267c460f25ce08e5c0b4aaa6
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.38.67
99
generator_config_info:
10-
file_checksum: f94cfb6bf61dca6a809c8d7cf0dfc1edc561add6
10+
file_checksum: b66d077bc28c12a65378f3eb515c5ab814a93090
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,17 @@ resources:
114114
- MalformedQueryString
115115
- MissingAction
116116
- MissingParameter
117-
- ValidationError
117+
- ValidationError
118+
hooks:
119+
delta_pre_compare:
120+
code: customPreCompare(a, b)
121+
sdk_create_post_set_output:
122+
template_path: hooks/nodegroup/sdk_create_post_set_output.go.tpl
123+
sdk_read_one_post_set_output:
124+
template_path: hooks/nodegroup/sdk_read_one_post_set_output.go.tpl
125+
sdk_delete_pre_build_request:
126+
template_path: hooks/nodegroup/sdk_delete_pre_build_request.go.tpl
127+
sdk_file_end:
128+
template_path: hooks/nodegroup/sdk_file_end.go.tpl
129+
update_operation:
130+
custom_method_name: customUpdate

generator.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,17 @@ resources:
114114
- MalformedQueryString
115115
- MissingAction
116116
- MissingParameter
117-
- ValidationError
117+
- ValidationError
118+
hooks:
119+
delta_pre_compare:
120+
code: customPreCompare(a, b)
121+
sdk_create_post_set_output:
122+
template_path: hooks/nodegroup/sdk_create_post_set_output.go.tpl
123+
sdk_read_one_post_set_output:
124+
template_path: hooks/nodegroup/sdk_read_one_post_set_output.go.tpl
125+
sdk_delete_pre_build_request:
126+
template_path: hooks/nodegroup/sdk_delete_pre_build_request.go.tpl
127+
sdk_file_end:
128+
template_path: hooks/nodegroup/sdk_file_end.go.tpl
129+
update_operation:
130+
custom_method_name: customUpdate

go.local.mod

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ go 1.14
55
replace github.com/aws-controllers-k8s/runtime => ../runtime
66

77
require (
8-
github.com/aws-controllers-k8s/runtime v0.15.2
8+
github.com/aws-controllers-k8s/runtime v0.16.0
99
github.com/aws/aws-sdk-go v1.38.67
10-
github.com/go-logr/logr v0.1.0
10+
github.com/go-logr/logr v1.2.0
1111
github.com/spf13/pflag v1.0.5
12-
k8s.io/api v0.18.2
13-
k8s.io/apimachinery v0.18.6
14-
k8s.io/client-go v0.18.2
15-
sigs.k8s.io/controller-runtime v0.6.0
12+
github.com/stretchr/objx v0.2.0 // indirect
13+
k8s.io/api v0.23.0
14+
k8s.io/apimachinery v0.23.0
15+
k8s.io/client-go v0.23.0
16+
sigs.k8s.io/controller-runtime v0.11.0
1617
)

go.local.sum

Lines changed: 725 additions & 226 deletions
Large diffs are not rendered by default.

pkg/resource/cluster/hook.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ package cluster
1515

1616
import (
1717
"context"
18-
"errors"
1918
"fmt"
2019
"time"
2120

@@ -54,9 +53,7 @@ var (
5453

5554
var (
5655
requeueWaitWhileDeleting = ackrequeue.NeededAfter(
57-
errors.New(
58-
fmt.Sprintf("Cluster in '%s' state, cannot be modified or deleted.", StatusDeleting),
59-
),
56+
fmt.Errorf("cluster in '%s' state, cannot be modified or deleted", StatusDeleting),
6057
ackrequeue.DefaultRequeueAfterDuration,
6158
)
6259
RequeueAfterUpdateDuration = 15 * time.Second
@@ -69,12 +66,9 @@ func requeueWaitUntilCanModify(r *resource) *ackrequeue.RequeueNeededAfter {
6966
return nil
7067
}
7168
status := *r.ko.Status.Status
72-
msg := fmt.Sprintf(
73-
"Cluster in '%s' state, cannot be modified until '%s'.",
74-
status, StatusActive,
75-
)
7669
return ackrequeue.NeededAfter(
77-
errors.New(msg),
70+
fmt.Errorf("cluster in '%s' state, cannot be modified until '%s'",
71+
status, StatusActive),
7872
ackrequeue.DefaultRequeueAfterDuration,
7973
)
8074
}
@@ -84,12 +78,9 @@ func requeueWaitUntilCanModify(r *resource) *ackrequeue.RequeueNeededAfter {
8478
// has (first, started and then) completed and the cluster reaches an active
8579
// status.
8680
func requeueAfterAsyncUpdate() *ackrequeue.RequeueNeededAfter {
87-
msg := fmt.Sprintf(
88-
"Cluster has started asynchronously updating, cannot be modified until '%s'.",
89-
StatusActive,
90-
)
9181
return ackrequeue.NeededAfter(
92-
errors.New(msg),
82+
fmt.Errorf("cluster has started asynchronously updating, cannot be modified until '%s'",
83+
StatusActive),
9384
RequeueAfterUpdateDuration,
9485
)
9586
}

pkg/resource/nodegroup/delta.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)