-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(addon): Add support for PodIdentityAssociations #120
feat(addon): Add support for PodIdentityAssociations #120
Conversation
9c2e7bd
to
714bbbb
Compare
pkg/resource/addon/hooks.go
Outdated
// addonActive returns true if the supplied addib is in an active state | ||
func addonActive(r *resource) bool { | ||
if r.ko.Status.Status == nil { | ||
return false | ||
} | ||
cs := *r.ko.Status.Status | ||
return cs == StatusActive | ||
} | ||
|
||
// addonCreating returns true if the supplied addon is in a creating state | ||
func addonCreating(r *resource) bool { | ||
if r.ko.Status.Status == nil { | ||
return false | ||
} | ||
cs := *r.ko.Status.Status | ||
return cs == StatusCreating | ||
} | ||
|
||
// addonDeleting returns true if the supplied addon is in a deleting state | ||
func addonDeleting(r *resource) bool { | ||
if r.ko.Status.Status == nil { | ||
return false | ||
} | ||
cs := *r.ko.Status.Status | ||
return cs == StatusDeleting | ||
} | ||
|
||
// addonHasTerminalStatus returns true if the supplied addon is in a terminal state | ||
func addonHasTerminalStatus(r *resource) bool { | ||
if r.ko.Status.Status == nil { | ||
return false | ||
} | ||
cs := *r.ko.Status.Status | ||
for _, ts := range TerminalStatuses { | ||
if cs == ts { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
// requeueWaitUntilCanModify returns a `ackrequeue.RequeueNeededAfter` struct | ||
// explaining the addon cannot be modified until it reaches an active status. | ||
func requeueWaitUntilCanModify(r *resource) *ackrequeue.RequeueNeededAfter { | ||
if r.ko.Status.Status == nil { | ||
return nil | ||
} | ||
status := *r.ko.Status.Status | ||
return ackrequeue.NeededAfter( | ||
fmt.Errorf("addon in '%s' state, cannot be modified until '%s'", | ||
status, StatusActive), | ||
ackrequeue.DefaultRequeueAfterDuration, | ||
) | ||
} | ||
|
||
// returnAddonUpdating will set synced to false on the resource and | ||
// return an async requeue error to signify that the resource should be | ||
// forcefully requeued in order to pick up the 'UPDATING' status. | ||
func returnAddonUpdating(r *resource) (*resource, error) { | ||
msg := "Addon is currently being updated" | ||
ackcondition.SetSynced(r, corev1.ConditionFalse, &msg, nil) | ||
return r, ackrequeue.NeededAfter( | ||
fmt.Errorf("addon in '%s' state, cannot be modified until '%s'", | ||
StatusUpdating, StatusActive), | ||
15, | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most of these functions can be easily generated... probably something to attack first before going after the the sdkUpdate
generation
a14aeed
to
804a2d5
Compare
4635e1a
to
b0248fa
Compare
This commit introduces support for `PodIdentityAssociations` in Addons CRD, enhancing the controller's capabilities to manage PIAs directly through the Addon resources. Key changes: - Bump the sdk to v1.54.1 to bring the latest API schema changes - Introduce `PodIdentityAssociations` to the addons spec - Add custom logic for 1/ extracting ServiceAccounts/RoleARNs from a given PIA association ID 2/ properly comparing two arrays of PIAs - Enhanced Addon status checks and requeue logic to ensure proper synchronization - Add some unit tests and e2e tests for Addon.PIAs
b0248fa
to
4acca6d
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: a-hilaly, michaelhtm The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
@a-hilaly: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
This commit introduces support for
PodIdentityAssociations
in Addons CRD,enhancing the controller's capabilities to manage PIAs directly through the
Addon resources.
Key changes:
PodIdentityAssociations
to the addons specServiceAccounts
/RoleARNs
from a given PIA association IDBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.