Skip to content

Commit

Permalink
ci: add updated CI
Browse files Browse the repository at this point in the history
  • Loading branch information
diogosilva30 committed Aug 10, 2024
1 parent c45b37c commit d8b441e
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 148 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "CI"
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
default:
runs-on: ubuntu-latest
env:
AUTH_KEY: ${{ secrets.HEADSCALE_PREAUTH_KEY }}
HEADSCALE_API_URL: "https://dsilva-headscale-vpn.fly.dev"
TAILSCALE_UPGRADE: "1"
steps:
# Connect to private network with tailscale
- name: Install tailscale
run: curl -fsSL https://tailscale.com/install.sh | sh

- name: Start Tailscale
run: sudo tailscale up --auth-key $AUTH_KEY --login-server $HEADSCALE_API_URL --accept-routes

- name: Tailscale status
run: tailscale status

- name: Checkout code
uses: actions/checkout@v3

- uses: azure/setup-kubectl@v4
id: kubectl-install
with:
version: 'v1.30.1'

- name: Setup kubeconfig
run: |
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config
- name: Setup ArgoCD OIDC and RBAC
run: |
echo "Setting up ArgoCD OIDC and RBAC"
kubectl -n argocd patch secret argocd-secret -p '{
"stringData": {
"oidc.keycloak.clientSecret": "'$ARGOCD_OIDC_CLIENT_SECRET'"
}
}'
kubectl -n argocd patch cm argocd-cm --type merge --patch "$(cat ./ci-patches/argocd-rbac-patch.yaml)"
env:
ARGOCD_OIDC_CLIENT_SECRET: ${{ secrets.ARGOCD_OIDC_CLIENT_SECRET }}
148 changes: 0 additions & 148 deletions .github/workflows/deploy.yml

This file was deleted.

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
# 👋 Welcome to k3s.dsilva.dev :test_tube:


# Steps:

```shell
export PRIVATEKEY="private.key"
export PUBLICKEY="public.crt"
export NAMESPACE="sealed-secrets"
export SECRETNAME="keys"

openssl req -x509 -days 358000 -nodes -newkey rsa:4096 -keyout "$PRIVATEKEY" -out "$PUBLICKEY" -subj "/CN=sealed-secret/O=sealed-secret"

kubectl create namespace "$NAMESPACE"
kubectl -n "$NAMESPACE" create secret tls "$SECRETNAME" --cert="$PUBLICKEY" --key="$PRIVATEKEY"
kubectl -n "$NAMESPACE" label secret "$SECRETNAME" sealedsecrets.bitnami.com/sealed-secrets-key=active
```

### This open-source repository showcases a fully automated homelab k3s cluster on Proxmox, managed with Terraform and ArgoCD :rocket:

Expand Down
14 changes: 14 additions & 0 deletions ci-patches/argocd-rbac-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Kubeclt patch to sync groups from keycloak
# with ArgoCD roles
# To add a new group, add a new line to the
# policy.csv file using the format
# g, <group name>, role:<role name>
# Where <group name> is the name of the group
# in keycloak and <role name> is the name of
# the role in ArgoCD
# Apply this patch with:
# kubectl -n argocd patch configmap argocd-rbac-cm --patch "$(cat ci-patches/argocd-rbac-patch.yaml)"
data:
policy.csv: |
g, ReadOnly, role:readonly
g, ArgoAdmin, role:admin

0 comments on commit d8b441e

Please sign in to comment.