flux: add flux as cd
This commit is contained in:
@@ -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
|
|
||||||
|
|
||||||
@@ -9,8 +9,6 @@ Currently hosted on [kubernetes cluster - casa](https://git.limbosolutions.com/m
|
|||||||
- [Music](#music)
|
- [Music](#music)
|
||||||
- [Clients](#clients)
|
- [Clients](#clients)
|
||||||
- [Setup and Deploy](#setup-and-deploy)
|
- [Setup and Deploy](#setup-and-deploy)
|
||||||
- [App](#app)
|
|
||||||
- [Infra](#infra)
|
|
||||||
- [Continuous Deploy](#continuous-deploy)
|
- [Continuous Deploy](#continuous-deploy)
|
||||||
- [Links](#links)
|
- [Links](#links)
|
||||||
|
|
||||||
@@ -52,16 +50,10 @@ systemctl --user enable --now squeezelite.service
|
|||||||
|
|
||||||
## Setup and Deploy
|
## Setup and Deploy
|
||||||
|
|
||||||
### App
|
Using flux for reconciliation.
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
./ops-scripts/apply-app.sh
|
./ops-scripts/apply-flux.sh
|
||||||
```
|
|
||||||
|
|
||||||
### Infra
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
./ops-scripts/apply-infra.sh
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Continuous Deploy
|
### Continuous Deploy
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ apiVersion: traefik.io/v1alpha1
|
|||||||
kind: IngressRoute
|
kind: IngressRoute
|
||||||
metadata:
|
metadata:
|
||||||
name: lyrionmusicserver
|
name: lyrionmusicserver
|
||||||
namespace: lyrionmusicserver
|
|
||||||
spec:
|
spec:
|
||||||
entryPoints:
|
entryPoints:
|
||||||
- websecure
|
- websecure
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
|
namespace: lyrionmusicserver
|
||||||
resources:
|
resources:
|
||||||
- deployment.yaml
|
- deployment.yaml
|
||||||
- service.yaml
|
- service.yaml
|
||||||
- music-pvc.yaml
|
- music-pvc.yaml
|
||||||
- lms-data-pvc.yaml
|
- lms-data-pvc.yaml
|
||||||
- playlists-pvc.yaml
|
- playlists-pvc.yaml
|
||||||
generatorOptions:
|
- ingress.yaml
|
||||||
disableNameSuffixHash: true
|
- music-pv.yaml
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
**
|
||||||
|
!.gitignore
|
||||||
@@ -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
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
kind: Kustomization
|
|
||||||
resources:
|
|
||||||
- namespace.yaml
|
|
||||||
- cd-rbac.yaml
|
|
||||||
- music-pv.yaml
|
|
||||||
- ingress.yaml
|
|
||||||
generatorOptions:
|
|
||||||
disableNameSuffixHash: true
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Namespace
|
|
||||||
metadata:
|
|
||||||
name: lyrionmusicserver
|
|
||||||
labels:
|
|
||||||
name: lyrionmusicserver
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
echo "Executing app deploy."
|
|
||||||
|
|
||||||
kubectl kustomize deploy/app | kubectl apply -f -
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
echo "Executing infra deploy."
|
|
||||||
|
|
||||||
kubectl kustomize deploy/infra | kubectl apply -f -
|
|
||||||
Reference in New Issue
Block a user