Skip to content

Commit 1f3af5b

Browse files
committed
fix terminal addons
1 parent e88fa6e commit 1f3af5b

File tree

6 files changed

+48
-16
lines changed

6 files changed

+48
-16
lines changed

apis/v1alpha1/ack-generate-metadata.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ack_generate_info:
2-
build_date: "2025-07-22T21:59:20Z"
3-
build_hash: b2dc0f44e0b08f041de14c3944a5cc005ba97c8f
2+
build_date: "2025-08-01T19:06:21Z"
3+
build_hash: fc0b91c88a7087d2acd52f8234337378b49d9c93
44
go_version: go1.24.5
5-
version: v0.50.0
5+
version: v0.50.0-2-gfc0b91c
66
api_directory_checksum: fecde869000735952a2e71d711fb5e64d9ee638e
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.36.3

helm/templates/caches-role-binding.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRoleBinding
33
metadata:
4-
name: {{ include "ack-eks-controller.app.fullname" . }}-namespace-caches
4+
name: {{ include "ack-eks-controller.app.fullname" . }}-namespaces-cache
55
labels:
66
app.kubernetes.io/name: {{ include "ack-eks-controller.app.name" . }}
77
app.kubernetes.io/instance: {{ .Release.Name }}
@@ -12,7 +12,7 @@ metadata:
1212
roleRef:
1313
kind: ClusterRole
1414
apiGroup: rbac.authorization.k8s.io
15-
name: {{ include "ack-eks-controller.app.fullname" . }}-namespace-caches
15+
name: {{ include "ack-eks-controller.app.fullname" . }}-namespaces-cache
1616
subjects:
1717
- kind: ServiceAccount
1818
name: {{ include "ack-eks-controller.service-account.name" . }}

pkg/resource/addon/hooks.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ var (
5252
var (
5353
// TerminalStatuses defines the list of statuses that are terminal for an addon
5454
TerminalStatuses = []string{
55-
StatusCreateFailed,
56-
StatusUpdateFailed,
5755
StatusDeleteFailed,
5856
// Still not sure if we should consider DEGRADED as terminal
5957
// StatusDegraded,
@@ -101,6 +99,16 @@ func addonHasTerminalStatus(r *resource) bool {
10199
return false
102100
}
103101

102+
// addonInFailedState returns true if the supplied addon is in a failed state
103+
// that requires retry (CREATE_FAILED or UPDATE_FAILED)
104+
func addonInFailedState(r *resource) bool {
105+
if r.ko.Status.Status == nil {
106+
return false
107+
}
108+
cs := *r.ko.Status.Status
109+
return cs == StatusCreateFailed || cs == StatusUpdateFailed
110+
}
111+
104112
// requeueWaitUntilCanModify returns a `ackrequeue.RequeueNeededAfter` struct
105113
// explaining the addon cannot be modified until it reaches an active status.
106114
func requeueWaitUntilCanModify(r *resource) *ackrequeue.RequeueNeededAfter {

pkg/resource/addon/sdk.go

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/resource/nodegroup/sdk.go

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

templates/hooks/addons/sdk_update_pre_build_request.go.tpl

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
ackcondition.SetSynced(latest, corev1.ConditionFalse, &msg, nil)
44
return latest, requeueWaitWhileDeleting
55
}
6-
if !addonActive(latest) {
6+
7+
// Check if addon is in a failed state that requires retry
8+
inFailedState := addonInFailedState(latest)
9+
10+
if !addonActive(latest) && !inFailedState {
711
msg := "Addon is in '" + *latest.ko.Status.Status + "' status"
812
ackcondition.SetSynced(latest, corev1.ConditionFalse, &msg, nil)
913
if addonHasTerminalStatus(latest) {
@@ -13,16 +17,24 @@
1317
return latest, requeueWaitUntilCanModify(latest)
1418
}
1519

20+
// If addon is in failed state, we need to force an update regardless of delta
21+
if inFailedState {
22+
msg := "Addon is in '" + *latest.ko.Status.Status + "' status, attempting recovery"
23+
ackcondition.SetSynced(latest, corev1.ConditionFalse, &msg, nil)
24+
}
25+
1626
if delta.DifferentAt("Spec.Tags") {
1727
err := syncTags(
18-
ctx, rm.sdkapi, rm.metrics,
19-
string(*desired.ko.Status.ACKResourceMetadata.ARN),
28+
ctx, rm.sdkapi, rm.metrics,
29+
string(*desired.ko.Status.ACKResourceMetadata.ARN),
2030
aws.ToStringMap(desired.ko.Spec.Tags), aws.ToStringMap(latest.ko.Spec.Tags),
2131
)
2232
if err != nil {
2333
return nil, err
2434
}
2535
}
26-
if !delta.DifferentExcept("Spec.Tags"){
27-
return desired, nil
28-
}
36+
// If addon is in failed state, always attempt update to recover
37+
// Otherwise, check if there are differences to update
38+
if !inFailedState && !delta.DifferentExcept("Spec.Tags") {
39+
return desired, nil
40+
}

0 commit comments

Comments
 (0)