Skip to content

Commit 6aa5659

Browse files
committed
initial revision
Signed-off-by: [email protected] <[email protected]>
0 parents  commit 6aa5659

38 files changed

+6519
-0
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Dockerfile
2+
target
3+
.dockerignore
4+
.github

.github/FUNDING.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
- rustrial
5+
patreon: # Replace with a single Patreon username
6+
open_collective: # Replace with a single Open Collective username
7+
ko_fi: # Replace with a single Ko-fi username
8+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
9+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
10+
liberapay: # Replace with a single Liberapay username
11+
issuehunt: rustrial # Replace with a single IssueHunt username
12+
otechie: # Replace with a single Otechie username
13+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Dependabot has native GitHub Actions support, to enable it on your GitHub repo
2+
# all you need to do is add the .github/dependabot.yml file:
3+
# https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot
4+
version: 2
5+
updates:
6+
# Maintain dependencies for GitHub Actions
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "monthly"

.github/e2e-tests.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
true

.github/install-cr.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
version=v1.1.1
6+
curl -sSLo /tmp/cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/$version/chart-releaser_${version#v}_linux_amd64.tar.gz"
7+
tar -xzvf /tmp/cr.tar.gz -C "/tmp"
8+
rm -f /tmp/cr.tar.gz
9+
10+
mkdir -p .cr-release-packages
11+
12+
mkdir .cr-index

.github/install.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
IMG=test/rustrial-k8s-aws-iam-controller:latest
6+
7+
docker image build -t test/rustrial-k8s-aws-iam-controller:latest .
8+
9+
kind load docker-image test/rustrial-k8s-aws-iam-controller:latest --name "${KIND:-kind}"
10+
11+
helm upgrade k8s-aws-iam-controller charts/k8s-aws-iam-controller \
12+
--install -n kube-system \
13+
--create-namespace \
14+
--set fullnameOverride=k8s-aws-iam-controller \
15+
--set image.repository=test/rustrial-k8s-aws-iam-controller \
16+
--set image.tag=latest
17+
18+
# helm upgrade k8s-aws-iam-controller charts/k8s-aws-iam-controller \
19+
# --install -n default \
20+
# --create-namespace \
21+
# --set fullnameOverride=k8s-aws-iam-controller \
22+
# --set image.repository=test/rustrial-k8s-aws-iam-controller \
23+
# --set image.tag=latest
24+
# --set watchNamespace=default
25+
# --set storageNamespace=default

.github/workflows/build.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: build
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- "*"
9+
workflow_dispatch:
10+
11+
jobs:
12+
build-and-test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
- name: Build
21+
uses: actions-rs/cargo@v1
22+
with:
23+
command: build
24+
- name: Format source
25+
run: "cargo +stable fmt"
26+
- name: Generate Custome Resource Definitions (CRDs)
27+
run: "cargo run --example gen-crds > charts/k8s-aws-iam-controller/crds/crds.yaml"
28+
- name: Check if working tree is dirty
29+
run: |
30+
if [[ $(git diff --stat) != '' ]]; then
31+
git --no-pager diff
32+
echo 'run make test and commit changes'
33+
exit 1
34+
fi
35+
- name: Unit Tests
36+
uses: actions-rs/cargo@v1
37+
with:
38+
command: test
39+
- name: Setup Kubernetes
40+
uses: engineerd/[email protected]
41+
- name: Setup Helm
42+
uses: fluxcd/pkg/actions/helm@main
43+
- name: Setup Kubectl
44+
uses: fluxcd/pkg/actions/kubectl@main
45+
- name: Install from local image
46+
run: ./.github/install.sh
47+
- name: Run e2e tests
48+
run: ./.github/e2e-tests.sh

.github/workflows/publish.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: publish
2+
3+
on:
4+
release:
5+
types:
6+
- "created"
7+
push:
8+
# Sequence of patterns matched against refs/tags
9+
tags:
10+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
11+
12+
jobs:
13+
publish-oci-images:
14+
runs-on: ubuntu-latest
15+
env:
16+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
- name: DockerTag
21+
id: docker-tag
22+
uses: yuya-takeyama/docker-tag-from-github-ref-action@v1
23+
- name: Set up QEMU
24+
id: qemu
25+
uses: docker/setup-qemu-action@v1
26+
with:
27+
image: tonistiigi/binfmt:latest
28+
platforms: all
29+
- name: Available platforms
30+
run: echo ${{ steps.qemu.outputs.platforms }}
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v1
33+
- name: Login to DockerHub
34+
uses: docker/login-action@v1
35+
with:
36+
username: ${{ secrets.DOCKERHUB_USERNAME }}
37+
password: ${{ secrets.DOCKERHUB_TOKEN }}
38+
- name: Build and push
39+
id: docker_build
40+
uses: docker/build-push-action@v2
41+
with:
42+
context: .
43+
file: Dockerfile
44+
platforms: linux/amd64,linux/arm64
45+
push: true
46+
tags: |
47+
rustrial/k8s-aws-iam-controller:${{ steps.docker-tag.outputs.tag }}
48+
test-chart:
49+
name: install-chart
50+
runs-on: ubuntu-latest
51+
needs:
52+
- publish-oci-images
53+
strategy:
54+
matrix:
55+
k8s:
56+
- v1.18.8
57+
- v1.19.1
58+
- v1.20.0
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v1
62+
- name: DockerTag
63+
id: docker-tag
64+
uses: yuya-takeyama/docker-tag-from-github-ref-action@v1
65+
- name: Set up Helm
66+
uses: azure/setup-helm@v1
67+
with:
68+
version: v3.5.0
69+
- name: Run chart-testing (lint)
70+
run: (cd charts/k8s-aws-iam-controller && helm lint .)
71+
- name: Create kind ${{ matrix.k8s }} cluster
72+
uses: helm/[email protected]
73+
with:
74+
node_image: kindest/node:${{ matrix.k8s }}
75+
- name: Install chart
76+
run: (cd charts/k8s-aws-iam-controller && helm install k8s-aws-iam-controller . -n kube-system --create-namespace --wait --set fullnameOverride=k8s-aws-iam-controller --set-string image.tag=${{ steps.docker-tag.outputs.tag }})
77+
- name: Tests
78+
run: ./.github/e2e-tests.sh
79+
create-release:
80+
name: Create Release
81+
needs:
82+
- publish-oci-images
83+
- test-chart
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Checkout code
87+
uses: actions/checkout@v2
88+
with:
89+
fetch-depth: 0
90+
- name: "✏️ Generate release changelog"
91+
id: generate-release-changelog
92+
uses: heinrichreimer/[email protected]
93+
with:
94+
token: ${{ secrets.GITHUB_TOKEN }}
95+
#onlyLastTag: "true"
96+
#stripHeaders: "true"
97+
#stripGeneratorNotice: "true"
98+
- name: Set TAG_NAME
99+
run: echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
100+
- name: "🚀 Create GitHub release"
101+
id: create_release
102+
uses: actions/create-release@v1
103+
env:
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
105+
with:
106+
tag_name: ${{ github.ref }}
107+
release_name: Release ${{ github.ref }}
108+
body: ${{ steps.generate-release-changelog.outputs.changelog }}
109+
draft: false
110+
prerelease: false
111+
publish-chart:
112+
needs:
113+
- publish-oci-images
114+
- test-chart
115+
- create-release
116+
runs-on: ubuntu-latest
117+
env:
118+
CR_OWNER: rustrial
119+
CR_GIT_REPO: k8s-aws-iam-controller
120+
CR_PACKAGE_PATH: .cr-release-packages
121+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
122+
steps:
123+
- name: Checkout
124+
uses: actions/checkout@v2
125+
with:
126+
fetch-depth: 0
127+
- name: Configure Git
128+
run: |
129+
git config user.name "$GITHUB_ACTOR"
130+
git config user.email "[email protected]"
131+
- name: Install Helm
132+
uses: azure/setup-helm@v1
133+
with:
134+
version: v3.5.0
135+
- name: Install CR
136+
run: .github/install-cr.sh
137+
- name: Update Helm Chart versions
138+
run: |
139+
export GIT_TAG="${GITHUB_REF##*/}"
140+
export VERSION="${GIT_TAG#v}"
141+
sed -i "s/version: 0.0.0/version: ${VERSION}/" charts/k8s-aws-iam-controller/Chart.yaml;
142+
sed -i "s/appVersion: 0.0.0/appVersion: ${VERSION}/" charts/k8s-aws-iam-controller/Chart.yaml;
143+
- name: Package Helm Charts
144+
run: /tmp/cr package charts/k8s-aws-iam-controller
145+
- name: Upload Helm Charts
146+
run: /tmp/cr upload -c $GITHUB_SHA
147+
- name: Update Helm Repository index
148+
run: /tmp/cr index -c https://rustrial.github.io/k8s-aws-iam-controller --push

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.cr-release-packages
2+
.kube-config
3+
target

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Contributing
2+
3+
0. Carefully read this (short) contribution guide and agree to the [Contributor License Agreement (CLA)](WAIVER).
4+
1. Fork it!
5+
2. Create your feature branch: `git checkout -b feature/my-feature-name`
6+
3. Format your code using `cargo +stable fmt`
7+
4. Update CRDs by running `cargo run --example gen-crds > charts/k8s-aws-iam-controller/crds/crds.yaml`
8+
5. Commit your changes: `git commit -am 'Add some feature'`
9+
6. Push to the branch: `git push origin feature/my-feature-name`
10+
7. Submit a merge request :D
11+
12+
We use `rustfmt` to keep our codebase consistently formatted. Please ensure that
13+
you have correctly formatted your code (some editors will do this automatically
14+
when saving).
15+
16+
This project only accepts contributions which adhere to our [Contributor License Agreement (CLA)](WAIVER)
17+
and any contribution intentionally submitted for inclusion in the work by you, as defined in the
18+
[Copyfree Open Innovation License](UNLICENSE), without any additional terms or conditions.

0 commit comments

Comments
 (0)