Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

a-hilaly
Copy link
Member

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:
    • extracting ServiceAccounts/RoleARNs from a given PIA association ID
    • 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

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

ack-prow bot commented Jul 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a-hilaly

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow ack-prow bot requested review from jlbutler and mikestef9 July 11, 2024 06:48
@ack-prow ack-prow bot added the approved label Jul 11, 2024
@a-hilaly a-hilaly force-pushed the addons/pod-identity-associations branch 2 times, most recently from 9c2e7bd to 714bbbb Compare July 12, 2024 04:12
Comment on lines 63 to 129
// 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,
)
}
Copy link
Member Author

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

@a-hilaly a-hilaly force-pushed the addons/pod-identity-associations branch 14 times, most recently from f15c911 to a14aeed Compare July 16, 2024 19:14
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
@a-hilaly a-hilaly force-pushed the addons/pod-identity-associations branch from a14aeed to 804a2d5 Compare July 16, 2024 20:23
Copy link

ack-prow bot commented Aug 30, 2024

@a-hilaly: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
eks-kind-e2e 804a2d5 link true /test eks-kind-e2e
eks-verify-attribution 804a2d5 link true /test eks-verify-attribution

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant