Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ack_generate_info:
build_date: "2025-12-04T22:22:03Z"
build_hash: 87b3ccf81d5171062be0fbf0d803787bb5de414e
build_date: "2025-12-11T22:27:42Z"
build_hash: 5c8b9050006ef6c7d3a97c279e7b1bc163f20a0a
go_version: go1.25.4
version: v0.56.0-3-g87b3ccf
version: v0.56.0-3-g5c8b905
api_directory_checksum: df9ec56e987fdc93ed2e7f55c55cf0bc3372b109
api_version: v1alpha1
aws_sdk_go_version: v1.40.1
generator_config_info:
file_checksum: 09e8ab62fa9bc1628dd6077670e7a1d1e8214b56
file_checksum: 6d7da86eb8e7c7421bc826b2d2d4bda6dfede164
original_file_name: generator.yaml
last_modification:
reason: API generation
2 changes: 2 additions & 0 deletions apis/v1alpha1/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ resources:
template_path: hooks/pod_identity_association/sdk_update_post_build_request.go.tpl
sdk_read_one_post_set_output:
template_path: hooks/pod_identity_association/sdk_read_one_post_set_output.go.tpl
sdk_read_one_pre_build_request:
template_path: hooks/pod_identity_association/sdk_read_one_pre_build_request.go.tpl
sdk_create_post_set_output:
template_path: hooks/pod_identity_association/sdk_create_post_set_output.go.tpl
fields:
Expand Down
2 changes: 2 additions & 0 deletions generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ resources:
template_path: hooks/pod_identity_association/sdk_update_post_build_request.go.tpl
sdk_read_one_post_set_output:
template_path: hooks/pod_identity_association/sdk_read_one_post_set_output.go.tpl
sdk_read_one_pre_build_request:
template_path: hooks/pod_identity_association/sdk_read_one_pre_build_request.go.tpl
sdk_create_post_set_output:
template_path: hooks/pod_identity_association/sdk_create_post_set_output.go.tpl
fields:
Expand Down
40 changes: 39 additions & 1 deletion pkg/resource/pod_identity_association/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,44 @@

package pod_identity_association

import "github.com/aws-controllers-k8s/eks-controller/pkg/tags"
import (
"context"

"github.com/aws-controllers-k8s/eks-controller/pkg/tags"
ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log"
svcsdk "github.com/aws/aws-sdk-go-v2/service/eks"
)

var syncTags = tags.SyncTags

func (rm *resourceManager) getAssociationID(ctx context.Context, r *resource) (id *string, err error) {
rlog := ackrtlog.FromContext(ctx)
exit := rlog.Trace("rm.getSecretID")
defer func() {
exit(err)
}()

// ClusterName is a required field for ListPodIdentityAssociations operation
// we treat an undefined ClusterName as not found.
if r.ko.Spec.ClusterName == nil {
return nil, nil
}

resp, err := rm.sdkapi.ListPodIdentityAssociations(ctx, &svcsdk.ListPodIdentityAssociationsInput{
ClusterName: r.ko.Spec.ClusterName,
Namespace: r.ko.Spec.Namespace,
ServiceAccount: r.ko.Spec.ServiceAccount,
})
if err != nil {
return nil, err
}

// if more than one are returned, we don't want to manage them
// and treat it as not found
if len(resp.Associations) != 1 {
return nil, nil
}

return resp.Associations[0].AssociationId, nil

}
6 changes: 6 additions & 0 deletions pkg/resource/pod_identity_association/sdk.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if r.ko.Status.AssociationID == nil {
r.ko.Status.AssociationID, err = rm.getAssociationID(ctx, r)
if err != nil {
return nil, err
}
}