flux: add flux as cd

This commit is contained in:
Márcio Fernandes
2026-06-05 22:46:46 +00:00
parent 1b8f537a05
commit be2a2e6ea2
14 changed files with 48 additions and 107 deletions
@@ -1,42 +0,0 @@
name: Casa LMS CI/CD Pipeline
on:
push:
branches:
- fix/*
- main
- master
pull_request:
schedule:
- cron: '0 15 * * 0' # every sunday 3 pm
jobs:
deploy:
runs-on: ["casa-vlan-cicd", "kubectl", "helm", "deploy"]
env:
GITHUB_TEMP: ${{ runner.temp }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Fetch limbo public actions
env:
RUNNER_TEMP: "${{ runner.temp }}"
WORKSPACE: "${{ gitea.workspace }}"
run: |
curl -fsSL https://git.limbosolutions.com/kb/gitea/raw/branch/main/cloud-scripts/setup-limbo-actions.sh | bash 2>&1
- name: Setup kubectl
uses: ./.gitea/limbo_actions/kubectl-setup
with:
kube_server: ${{ secrets.CASA_VLAN_KUBE_SERVER }}
kube_ca_base64: ${{ secrets.CASA_VLAN_KUBE_CA_BASE64 }}
kube_token: ${{ secrets.CASA_VLAN_KUBE_TOKEN }}
- name: Deploy
shell: bash
run: |
./ops-scripts/apply-app.sh
+2 -10
View File
@@ -9,8 +9,6 @@ Currently hosted on [kubernetes cluster - casa](https://git.limbosolutions.com/m
- [Music](#music)
- [Clients](#clients)
- [Setup and Deploy](#setup-and-deploy)
- [App](#app)
- [Infra](#infra)
- [Continuous Deploy](#continuous-deploy)
- [Links](#links)
@@ -52,16 +50,10 @@ systemctl --user enable --now squeezelite.service
## Setup and Deploy
### App
Using flux for reconciliation.
``` bash
./ops-scripts/apply-app.sh
```
### Infra
``` bash
./ops-scripts/apply-infra.sh
./ops-scripts/apply-flux.sh
```
### Continuous Deploy
@@ -2,7 +2,6 @@ apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: lyrionmusicserver
namespace: lyrionmusicserver
spec:
entryPoints:
- websecure
+3 -2
View File
@@ -1,10 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: lyrionmusicserver
resources:
- deployment.yaml
- service.yaml
- music-pvc.yaml
- lms-data-pvc.yaml
- playlists-pvc.yaml
generatorOptions:
disableNameSuffixHash: true
- ingress.yaml
- music-pv.yaml
+2
View File
@@ -0,0 +1,2 @@
**
!.gitignore
+12
View File
@@ -0,0 +1,12 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: app
spec:
interval: 1m
sourceRef:
kind: GitRepository
name: lms
path: deploy/app
prune: true
+11
View File
@@ -0,0 +1,11 @@
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: lms
spec:
interval: 5m0s
url: ssh://git@git.limbosolutions.com:2222/marcio.fernandes/lms.git
ref:
branch: main
secretRef:
name: flux-repo-ssh-credentials
+18
View File
@@ -0,0 +1,18 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- git-repo.yaml
- app-sync.yaml
secretGenerator:
- name: flux-repo-ssh-credentials
namespace: lyrionmusicserver
files:
- "identity=./.env.d/flux-repo-ssh-key"
- "known_hosts=./.env.d/flux-repo-ssh-known_hosts"
- "pubkey=./.env.d/flux-repo-ssh-key.pub"
- name: flux-repo-ssh-credentials
namespace: lyrionmusicserver
files:
- "age.agekey=./.env.d/age.agekey"
generatorOptions:
disableNameSuffixHash: true
-27
View File
@@ -1,27 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: lyrionmusicserver
name: ci-cd # change name to continuous-deploy
rules:
- apiGroups: [""]
resources: ["pods", "services", "secrets", "configmaps", "persistentvolumeclaims", "endpoints"]
verbs: ["get", "watch", "list", "create", "update", "patch", "delete"]
- apiGroups: ["apps"]
resources: ["deployments", "statefulsets"]
verbs: ["get", "watch", "list", "create", "update", "patch", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: ci-cd #change name to continuous-deploy
namespace: lyrionmusicserver
subjects:
- kind: ServiceAccount
name: casa-ci-cd
namespace: home-assistant
roleRef:
kind: Role
name: ci-cd
apiGroup: rbac.authorization.k8s.io
-8
View File
@@ -1,8 +0,0 @@
kind: Kustomization
resources:
- namespace.yaml
- cd-rbac.yaml
- music-pv.yaml
- ingress.yaml
generatorOptions:
disableNameSuffixHash: true
-7
View File
@@ -1,7 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: lyrionmusicserver
labels:
name: lyrionmusicserver
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
set -e
echo "Executing app deploy."
kubectl kustomize deploy/app | kubectl apply -f -
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
set -e
echo "Executing infra deploy."
kubectl kustomize deploy/infra | kubectl apply -f -