Skip to content

Commit 818eb1f

Browse files
committed
Switch to new upbound devex
1 parent 04c4b02 commit 818eb1f

34 files changed

+599
-459
lines changed

.github/workflows/ci.yaml

Lines changed: 31 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,69 +4,46 @@ on:
44
push:
55
branches:
66
- main
7-
- release-*
8-
workflow_dispatch: {}
7+
pull_request: {}
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: Package version (e.g. v0.1.0)
12+
required: false
913

1014
env:
11-
DOCKER_BUILDX_VERSION: 'v0.8.2'
12-
13-
XPKG_ACCESS_ID: ${{ secrets.XPKG_ACCESS_ID }}
15+
UP_API_TOKEN: ${{ secrets.UP_API_TOKEN }}
16+
UP_ROBOT_ID: ${{ secrets.UP_ROBOT_ID }}
17+
UP_ORG: ${{ secrets.UP_ORG }}
1418

1519
jobs:
16-
detect-noop:
17-
runs-on: ubuntu-24.04
18-
outputs:
19-
noop: ${{ steps.noop.outputs.should_skip }}
20-
steps:
21-
- name: Detect No-op Changes
22-
id: noop
23-
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1
24-
with:
25-
github_token: ${{ secrets.GITHUB_TOKEN }}
26-
paths_ignore: '["**.md", "**.png", "**.jpg"]'
27-
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
28-
29-
publish-artifacts:
30-
runs-on: ubuntu-24.04
31-
needs: detect-noop
32-
if: needs.detect-noop.outputs.noop != 'true'
33-
20+
deploy:
21+
runs-on: ubuntu-latest
3422
steps:
35-
- name: Setup Docker Buildx
36-
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
37-
with:
38-
version: ${{ env.DOCKER_BUILDX_VERSION }}
39-
install: true
40-
4123
- name: Checkout
42-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
43-
with:
44-
submodules: true
45-
46-
- name: Fetch History
47-
run: git fetch --prune --unshallow
24+
id: checkout
25+
uses: actions/checkout@v4
4826

49-
- name: Build Artifacts
50-
run: make -j2 build.all
51-
env:
52-
# We're using docker buildx, which doesn't actually load the images it
53-
# builds by default. Specifying --load does so.
54-
BUILD_ARGS: "--load"
55-
56-
- name: Publish Artifacts to GitHub
57-
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
27+
- name: Install and login with up
28+
if: env.UP_API_TOKEN != '' && env.UP_ORG != ''
29+
uses: upbound/action-up@v1
5830
with:
59-
name: output
60-
path: _output/**
31+
api-token: ${{ secrets.UP_API_TOKEN }}
32+
organization: ${{ secrets.UP_ORG }}
6133

62-
- name: Login to Upbound
63-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
64-
if: env.XPKG_ACCESS_ID != ''
34+
# doesn't work with plain token when pushing otherwise
35+
- name: Login to xpkg with robot
36+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
6537
with:
6638
registry: xpkg.upbound.io
67-
username: ${{ secrets.XPKG_ACCESS_ID }}
68-
password: ${{ secrets.XPKG_TOKEN }}
39+
username: ${{ env.UP_ROBOT_ID }}
40+
password: ${{ env.UP_API_TOKEN }}
6941

70-
- name: Publish Artifacts
71-
if: env.XPKG_ACCESS_ID != ''
72-
run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/}
42+
- name: Build and Push Upbound project
43+
if: env.UP_API_TOKEN != ''
44+
uses: upbound/action-up-project@v1
45+
with:
46+
push-project: true
47+
tag: ${{ inputs.version || '' }}
48+
# login-check does `up org list` which doesn't work with a robot-token
49+
skip-login-check: true
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Composition Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request: {}
8+
9+
jobs:
10+
composition-tests:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
id: checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Install up
18+
uses: upbound/action-up@v1
19+
with:
20+
skip-login: true
21+
22+
- name: Build project
23+
run: up project build
24+
25+
- name: Run composition tests
26+
run: up test run tests/*

.github/workflows/e2e.yaml

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,54 @@
11
name: End to End Testing
22

33
on:
4-
issue_comment:
5-
types: [created]
4+
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
5+
# pull_request_target is potentially dangerous target so we keep it strict
6+
# under the label and benefit from secret propagation
7+
pull_request_target:
8+
types:
9+
- synchronize
10+
- labeled
11+
12+
env:
13+
UP_API_TOKEN: ${{ secrets.UP_E2E_API_TOKEN || secrets.UP_API_TOKEN }}
14+
UP_ORG: ${{ secrets.UP_E2E_ORG || secrets.UP_ORG }}
15+
UP_GROUP: ${{ secrets.UP_E2E_GROUP || secrets.UP_GROUP || 'default' }}
16+
UP_ROBOT_ID: ${{ secrets.UP_E2E_ROBOT_ID || secrets.UP_ROBOT_ID }}
617

718
jobs:
819
e2e:
9-
uses: upbound/official-providers-ci/.github/workflows/pr-comment-trigger.yml@main
10-
with:
11-
package-type: configuration
12-
secrets:
13-
UPTEST_CLOUD_CREDENTIALS: ${{ secrets.UPTEST_CLOUD_CREDENTIALS }}
14-
UPTEST_DATASOURCE: ${{ secrets.UPTEST_DATASOURCE }}
20+
if: contains(github.event.pull_request.labels.*.name, 'run-e2e-tests')
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
id: checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Install and login with up
28+
if: env.UP_API_TOKEN != '' && env.UP_ORG != ''
29+
uses: upbound/action-up@v1
30+
with:
31+
api-token: ${{ env.UP_API_TOKEN }}
32+
organization: ${{ env.UP_ORG }}
33+
34+
# doesn't work with plain token when pushing otherwise
35+
- name: Login to xpkg with robot
36+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
37+
with:
38+
registry: xpkg.upbound.io
39+
username: ${{ env.UP_ROBOT_ID }}
40+
password: ${{ env.UP_API_TOKEN }}
41+
42+
- name: Build project
43+
run: up project build
44+
45+
- name: Switch up context
46+
run: up ctx ${{ env.UP_ORG }}/upbound-gcp-us-central-1/${{ env.UP_GROUP }}
47+
48+
- name: Download and install Upbound-enhanced Chainsaw(remove me later)
49+
run: |
50+
curl -L -o /usr/local/bin/chainsaw https://yurychainsaw.blob.core.windows.net/chainsaw/chainsaw
51+
chmod +x /usr/local/bin/chainsaw
52+
53+
- name: Run e2e tests
54+
run: up test run tests/* --e2e

.gitignore

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
/.cache
2-
/.work
3-
/_output
4-
/results
5-
/.idea
6-
/.kclvm
7-
8-
*.xpkg
9-
kubeconfig
10-
11-
# generated by kcl
12-
apis/kcl/composition.yaml
1+
_output
2+
.venv
3+
.up
4+
tests/*/model

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
11
# AWS EKS Pod Identity Configuration
22

3-
At a high level, EKS Pod Identity allows you to use the AWS API to define permissions that specific Kubernetes service accounts should have in AWS:
3+
This repository contains an Upbound project, tailored for users establishing their initial control plane with [Upbound](https://cloud.upbound.io). This configuration deploys fully managed AWS EKS Pod Identity resources.
44

5-
## Configuration
6-
This configuration is for implementing AWS EKS Pod Identity, which involves creating the IAM Role and configuring the EKS PodIdentityAssociation.
5+
## Overview
76

8-
```bash
9-
apiVersion: pkg.crossplane.io/v1
10-
kind: Configuration
11-
metadata:
12-
name: configuration-aws-eks-pod-identity
13-
spec:
14-
package: xpkg.upbound.io/upbound/configuration-aws-eks-pod-identity:v0.1.0
15-
```
7+
The core components of a custom API in [Upbound Project](https://docs.upbound.io/learn/control-plane-project/) include:
168

17-
## The How
9+
- **CompositeResourceDefinition (XRD):** Defines the API's structure.
10+
- **Composition(s):** Configures the Functions Pipeline
11+
- **Embedded Function(s):** Encapsulates the Composition logic and implementation within a self-contained, reusable unit
1812

19-
The following step is automatically completed when you install your EKS Cluster using our predefined configuration for AWS EKS - which is installed as dependency per default:
13+
In this specific configuration, the API contains:
2014

21-
```bash
22-
apiVersion: pkg.crossplane.io/v1
23-
kind: Configuration
24-
metadata:
25-
name: configuration-aws-eks
26-
spec:
27-
package: xpkg.upbound.io/upbound/configuration-aws-eks:v0.12.0
28-
```
15+
- **an [AWS EKS Pod Identity](/apis/definition.yaml) custom resource type.**
16+
- **Composition:** Configured in [/apis/composition.yaml](/apis/composition.yaml)
17+
- **Embedded Function:** The Composition logic is encapsulated within [embedded function](/functions/eks-pod-identity/main.k)
18+
19+
## How It Works
20+
21+
At a high level, EKS Pod Identity allows you to use the AWS API to define permissions that specific Kubernetes service accounts should have in AWS:
2922

3023
Setting up Pod Identity starts by installing an add-on:
3124
https://github.com/aws/eks-pod-identity-agent
@@ -45,7 +38,6 @@ eks-pod-identity-agent 2 2 2 2 2 <n
4538
```
4639

4740
![pod-identity](images/s3-access-podidentity.png)
48-
https://github.com/awslabs/crossplane-on-eks
4941

5042
### EKS Pod Identity at a glance
5143

@@ -72,10 +64,9 @@ Here, YourPodRole has the following trust policy:
7264
}
7365
```
7466

75-
Once youve run the commands to configure Pod Identity, any pod that runs under the pod-service-account service account magically has access to AWS resources, through temporary Security Token Service (STS) credentials:
67+
Once you've run the commands to configure Pod Identity, any pod that runs under the pod-service-account service account magically has access to AWS resources, through temporary Security Token Service (STS) credentials:
7668

7769
```bash
78-
7970
$ kubectl apply -f - <<EOF
8071
apiVersion: v1
8172
kind: Pod
@@ -95,7 +86,6 @@ $ kubectl exec pod/pod-with-aws-access -- aws sts get-caller-identity
9586
"Account": "012345678901",
9687
"Arn": "arn:aws:sts::012345678901:assumed-role/YourPodRole/eks-cluster-pod-xxx"
9788
}
98-
9989
```
10090

10191
For a given EKS cluster, you can easily see which pods have access to AWS resources using eks:ListPodIdentityAssociations:
@@ -133,3 +123,26 @@ aws eks describe-pod-identity-association \
133123
}
134124
}
135125
```
126+
127+
## Testing
128+
129+
The configuration can be tested using:
130+
131+
- `up composition render --xrd=apis/definition.yaml apis/composition.yaml examples/pod-identity-xr.yaml` to render the composition
132+
- `up test run tests/*` to run composition tests in `tests/test-eks-pod-identity/`
133+
- `up test run tests/* --e2e` to run end-to-end tests in `tests/e2etest-eks-pod-identity/`
134+
135+
## Deployment
136+
137+
- Execute `up project run`
138+
- Alternatively, install the Configuration from the [Upbound Marketplace](https://marketplace.upbound.io/configurations/upbound/configuration-aws-eks-pod-identity)
139+
- Check [examples](/examples/) for example XR(Composite Resource)
140+
141+
## Next steps
142+
143+
This repository serves as a foundational step. To enhance the configuration, consider:
144+
145+
1. create new API definitions in this same repo
146+
2. editing the existing API definition to your needs
147+
148+
To learn more about how to build APIs for your managed control planes in Upbound, read the guide on [Upbound's docs](https://docs.upbound.io/).

apis/composition.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: apiextensions.crossplane.io/v1
2+
kind: Composition
3+
metadata:
4+
name: xpodidentities.aws.platform.upbound.io
5+
spec:
6+
compositeTypeRef:
7+
apiVersion: aws.platform.upbound.io/v1alpha1
8+
kind: XPodIdentity
9+
mode: Pipeline
10+
pipeline:
11+
- functionRef:
12+
name: upbound-configuration-aws-eks-pod-identityeks-pod-identity
13+
step: eks-pod-identity
14+
- functionRef:
15+
name: crossplane-contrib-function-auto-ready
16+
step: crossplane-contrib-function-auto-ready

apis/definition.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
provider: aws
77
spec:
88
defaultCompositionRef:
9-
name: pat.xpodidentities.aws.platform.upbound.io
9+
name: xpodidentities.aws.platform.upbound.io
1010
group: aws.platform.upbound.io
1111
names:
1212
kind: XPodIdentity

apis/kcl/generate.k

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)