Skip to content

WIP refactor: switch to universal addon #29

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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f7bc273
refactor: switch to universal addon
matejhasul Apr 14, 2025
8132c3a
feat(modules): remove modules dir
matejhasul Apr 14, 2025
7fdbd96
feat(addons): remove oidc
matejhasul Apr 16, 2025
9088ecc
fixup! feat(addons): remove oidc
matejhasul Apr 16, 2025
65199f9
feat(main): initial setup of main
matejhasul Apr 16, 2025
d048715
fix(setup): remove renovate config
matejhasul Apr 25, 2025
6eb1d7b
fixup! fix(setup): remove renovate config
matejhasul Apr 25, 2025
af3aed9
feat(ci): install kubectl
matejhasul Apr 25, 2025
5e936ee
feat(iam): add default irsa policy
matejhasul Apr 25, 2025
8f5dfa0
fix(doc): fix docs after fucked-up rebase
matejhasul Apr 25, 2025
14affe2
fix(ci): remove renovate config
matejhasul Apr 28, 2025
13d0b51
fix(main): change addon name
matejhasul Apr 28, 2025
408a58b
feat(iam): load default policy with datasource instead of file
matejhasul Apr 28, 2025
64cec47
feat(iam): make aws partition configurable
matejhasul Apr 28, 2025
c16d55a
fix(iam): rename default_policy to iam
matejhasul Apr 28, 2025
3270903
feat(pod identity): plumb pod identity
matejhasul Apr 28, 2025
3e7d34f
fix(pod identity): change default value for service_account_namespace
matejhasul Apr 29, 2025
094644b
feat(pod identity): use similiar variables as in addon-irsa
matejhasul Apr 29, 2025
abb4b77
feat(pod identity): finally make all the conditions work
matejhasul Apr 30, 2025
199fcdb
refactor(pod identity): make resources names consistent
matejhasul Apr 30, 2025
58a83b6
doc(examples): fix examples
matejhasul Apr 30, 2025
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
65 changes: 65 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: pre-commit

on:
workflow_dispatch:
pull_request:
branches:
- main
- master

permissions:
contents: read

concurrency:
group: pre-commit-${{ github.ref }}
cancel-in-progress: false

env:
# renovate: datasource=github-releases depName=asdf-vm/asdf
ASDF_VERSION: 31e8c93004abd76253d186b8896785895069749b # v0.15.0 # pragma: allowlist secret

jobs:
pre-commit:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup ASDF
uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3.0.2

- name: Cache ASDF
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
id: asdf-cache
with:
# https://github.com/asdf-vm/asdf/blob/master/.gitignore
path: |
~/.asdf/installs
~/.asdf/plugins
~/.asdf/shims
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-

- name: Install ASDF
uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3.0.2
if: ${{ steps.asdf-cache.outputs.cache-hit != 'true' }}
with:
asdf_branch: ${{ env.ASDF_VERSION }}

- name: Reshim installed ASDF tools
shell: bash
run: asdf reshim

- name: Cache pip
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/.cache/pip/
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt', '.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install pip dependencies
run: pip install -r requirements.txt

- name: Run pre-commit
run: pre-commit run --show-diff-on-failure --color=always --all-files
28 changes: 28 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release drafter

on:
push:
branches:
- main
- master

pull_request:
types:
- opened
- reopened
- synchronize
- labeled

permissions:
contents: write
pull-requests: read

jobs:
release-drafter:
runs-on: ubuntu-24.04
steps:
- uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0
with:
config-name: RELEASE_DRAFTER.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95 changes: 95 additions & 0 deletions .github/workflows/template-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Template sync

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # every day at midnight

permissions: {}

concurrency:
group: pre-commit
cancel-in-progress: false

env:
# renovate: datasource=github-releases depName=asdf-vm/asdf
ASDF_VERSION: 31e8c93004abd76253d186b8896785895069749b # v0.15.0 # pragma: allowlist secret

jobs:
universal-addon:
if: github.repository != 'lablabs/terraform-aws-eks-universal-addon'
runs-on: ubuntu-24.04
steps:
- name: Generate GitHub App token
id: template-sync-app-token
uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
with:
app-id: ${{ secrets.LARA_TEMPLATE_SYNC_APP_ID }}
private-key: ${{ secrets.LARA_TEMPLATE_SYNC_APP_PRIVATE_KEY }}
repositories: ${{ github.event.repository.name }}
owner: ${{ github.repository_owner }}

- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ steps.template-sync-app-token.outputs.token }} # needed for private repositories

- name: Sync universal-addon template
uses: AndreasAugustin/actions-template-sync@bcb94410a4f1dffdfe5eaabc8234c3b8e76ebc5b # v2.5.1
with:
source_gh_token: ${{ steps.template-sync-app-token.outputs.token }}
source_repo_path: lablabs/terraform-aws-eks-universal-addon
upstream_branch: main

target_gh_token: ${{ steps.template-sync-app-token.outputs.token }}

git_remote_pull_params: --allow-unrelated-histories --squash --strategy=recursive --no-tags -X theirs

pr_labels: kind/sync
pr_branch_name_prefix: "feat/universal-addon-sync"
pr_title: "feat(sync): sync universal-addon changes"
pr_commit_msg: "feat(sync): sync universal-addon changes"

is_pr_cleanup: true

- name: Setup ASDF
uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3.0.2

- name: Cache ASDF
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
id: asdf-cache
with:
# https://github.com/asdf-vm/asdf/blob/master/.gitignore
path: |
~/.asdf/installs
~/.asdf/plugins
~/.asdf/shims
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-

- name: Install ASDF
uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3.0.2
if: ${{ steps.asdf-cache.outputs.cache-hit != 'true' }}
with:
asdf_branch: ${{ env.ASDF_VERSION }}

- name: Reshim installed ASDF tools
shell: bash
run: asdf reshim

- name: Cache pip
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/.cache/pip/
key: ${{ runner.os }}-pip-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Update README.md
run: pre-commit run --show-diff-on-failure --color=always terraform_docs --all-files || true

- name: Commit and push README.md
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
with:
add: README.md
message: "docs: update README.md"
47 changes: 23 additions & 24 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,41 @@ on:
- master

jobs:
versionExtract:
extract-version:
name: Extract min/max Terraform versions
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Extract Terraform min/max versions
id: minMax
uses: clowdhaus/terraform-min-max@main
id: terraform-min-max
uses: clowdhaus/terraform-min-max@f489335873df04c3ce04b5e73f385a726d910039 # v1.3.2
with:
directory: .
outputs:
minVersion: ${{ steps.minMax.outputs.minVersion }}
maxVersion: ${{ steps.minMax.outputs.maxVersion }}
minVersion: ${{ steps.terraform-min-max.outputs.minVersion }}
maxVersion: ${{ steps.terraform-min-max.outputs.maxVersion }}

terraform-validate:
runs-on: ubuntu-22.04
needs: versionExtract
runs-on: ubuntu-24.04
needs: extract-version
strategy:
matrix:
tf_ver:
- ${{ needs.versionExtract.outputs.minVersion }}
- ${{ needs.versionExtract.outputs.maxVersion }}

- ${{ needs.extract-version.outputs.minVersion }}
- ${{ needs.extract-version.outputs.maxVersion }}
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.tf_ver }}

- name: Terraform Init
id: init
run: terraform init

- name: Terraform Validate
id: validate
run: terraform validate
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: ${{ matrix.tf_ver }}

- name: Terraform Init
run: terraform init

- name: Terraform Validate
run: terraform validate
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ override.tf.json
# Ignore CLI configuration files
.terraformrc
terraform.rc

.terraform.lock.hcl
49 changes: 33 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,49 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
args: ["--markdown-linebreak-ext=md"]
- id: check-merge-conflict
- id: detect-aws-credentials
args: ['--allow-missing-credentials']
args: ["--allow-missing-credentials"]
- id: detect-private-key
- id: end-of-file-fixer

- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.83.1
rev: v1.96.3
hooks:
- id: terraform_fmt
- id: terraform_tflint
args:
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
- id: terraform_validate
- id: terraform_checkov
args:
- '--args=--skip-check CKV_TF_1' #CKV_TF_1: "Ensure Terraform module sources use a commit hash"
- id: terraform_docs
args:
- '--args=--config=.terraform-docs.yml'
- id: terraform_validate
- id: terraform_fmt
- id: terraform_providers_lock
args:
- --hook-config=--mode=only-check-is-current-lockfile-cross-platform
- --args=-platform=darwin_amd64
- --args=-platform=darwin_arm64
- --args=-platform=linux_amd64
- id: terraform_tflint
args:
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
- id: terraform_checkov
args:
- "--args=--quiet --skip-check CKV_TF_1" #CKV_TF_1: "Ensure Terraform module sources use a commit hash"
- id: terraform_docs
args:
- "--args=--config=.terraform-docs.yml"

- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
rev: v1.5.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
args: ["--baseline", ".secrets.baseline"]
exclude: terraform.tfstate

- repo: local
hooks:
- id: sync-variables
name: Sync module variables
entry: ./scripts/sync-variables.py
language: system
types: [python]
always_run: true
pass_filenames: false
22 changes: 20 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.3.0",
"version": "1.5.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
Expand All @@ -20,9 +20,15 @@
{
"name": "CloudantDetector"
},
{
"name": "DiscordBotTokenDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"name": "GitLabTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
Expand All @@ -33,6 +39,9 @@
{
"name": "IbmCosHmacDetector"
},
{
"name": "IPPublicDetector"
},
{
"name": "JwtTokenDetector"
},
Expand All @@ -46,9 +55,15 @@
{
"name": "NpmDetector"
},
{
"name": "OpenAIDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "PypiTokenDetector"
},
{
"name": "SendGridDetector"
},
Expand All @@ -64,6 +79,9 @@
{
"name": "StripeDetector"
},
{
"name": "TelegramBotTokenDetector"
},
{
"name": "TwilioKeyDetector"
}
Expand Down Expand Up @@ -109,5 +127,5 @@
}
],
"results": {},
"generated_at": "2022-07-28T10:50:47Z"
"generated_at": "2025-03-28T07:59:49Z"
}
Loading
Loading