crossplane-contrib / crossplane-contrib/function-kcl

Support pulling OCI sources from a private AWS ECR with the pod's AWS identity

Closed
#452 0 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
Go
Stars
87
Forks
44
Avg merge
10h 43m
Merged PRs (30d)
18

Description

### What problem are you facing?

As part of my current activities, I have been working on porting EKS features into a Composition. I decided to use KCL, since it is kind of similar to the stack we use at Close. I also decided to use OCI packaging for the Composition to use versioning, and I was also very interested in how it works.

I found that the current `function-kc`l implementation can pull a KCL package from a private registry using static credentials. I also noticed that for GCP it uses a Workload Identity provider, and I was missing that feature for ECR repositories.

### How could this Function help solve your problem?

IRSA (or EKS Pod Identity) already gives the pod an AWS identity, but function-kcl's OCI client cannot use it directly: pulling from an ECR registry needs a registry token from `ecr:GetAuthorizationToken`, and the client does not know how to get one. The "aws" provider adds those two capabilites - it uses the pod's IRSA / Pod Identity to get a ECR registry token, so the pull works with no static credential.

```yaml
spec:
source: oci://.dkr.ecr..amazonaws.com/
credentials:
url: .dkr.ecr..amazonaws.com
provider: aws
```

Details:
- `url` is the ECR registry host; the region is read from it.
- Works with both IRSA and EKS Pod Identity, since both resolve through the standard AWS
credential chain - nothing extra selects between them.
- The function needs only `ecr:GetAuthorizationToken` privilege; the pull itself is authorized by the ECR repository policy.

I have a working implementation and and I am about to open the PR with working change that has been successfully validated on our dev environment.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at function-kcl's OCI client and credentials provider path, comparing the existing static-credential flow with the GCP Workload Identity provider. The change is done when the documented aws provider can obtain an ECR token through the pod's standard AWS credential chain and pull the specified private OCI source without static credentials.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, go
Domain
cloud, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.