Compare commits
7 Commits
0fbda77181
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| dbecd67471 | |||
| 2881eb1167 | |||
| 755d68a844 | |||
| f40a899200 | |||
| d30aad3058 | |||
| 6149826bc6 | |||
| 0d2b30a83a |
@@ -1,75 +0,0 @@
|
|||||||
name: Setup kubectl
|
|
||||||
description: "Reads kube config from inputs and sets kube config"
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
kube_server:
|
|
||||||
description: "Kubernetes server address and port. Example (https://serverip:6443)"
|
|
||||||
required: true
|
|
||||||
kube_ca_base64:
|
|
||||||
description: "Base64-encoded Kubernetes cluster CA certificate"
|
|
||||||
required: true
|
|
||||||
kube_token:
|
|
||||||
description: "Kubernetes ServiceAccount token"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Create kubeconfig
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# check arguments
|
|
||||||
ERROR=0
|
|
||||||
|
|
||||||
if [ -z "${{ inputs.kube_server }}" ]; then
|
|
||||||
echo "❌ ERROR: kube_server input is empty or not set"
|
|
||||||
$ERROR=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${{ inputs.kube_ca_base64 }}" ]; then
|
|
||||||
echo "❌ ERROR: kube_ca_base64 input is empty or not set"
|
|
||||||
$ERROR=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${{ inputs.kube_server }}" ]; then
|
|
||||||
echo "❌ ERROR: kube_token input is empty or not set"
|
|
||||||
$ERROR=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$ERROR" != 0 ]; then
|
|
||||||
echo "❌ ERROR code $ERROR"
|
|
||||||
exit "$ERROR"
|
|
||||||
fi
|
|
||||||
# end check arguments
|
|
||||||
|
|
||||||
# creates kube config
|
|
||||||
mkdir -p "${GITHUB_TEMP}/.kube"
|
|
||||||
cat <<EOF > "${GITHUB_TEMP}/.kube/config"
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Config
|
|
||||||
clusters:
|
|
||||||
- cluster:
|
|
||||||
certificate-authority-data: ${{ inputs.kube_ca_base64 }}
|
|
||||||
server: ${{ inputs.kube_server }}
|
|
||||||
name: cluster
|
|
||||||
contexts:
|
|
||||||
- context:
|
|
||||||
cluster: cluster
|
|
||||||
namespace: default
|
|
||||||
user: user
|
|
||||||
name: context
|
|
||||||
current-context: context
|
|
||||||
users:
|
|
||||||
- name: user
|
|
||||||
user:
|
|
||||||
token: ${{ inputs.kube_token }}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# sets KUBECONFIG environment variable
|
|
||||||
echo "KUBECONFIG=${GITHUB_TEMP}/.kube/config" >> "${GITHUB_ENV}"
|
|
||||||
|
|
||||||
# tests communication to server (add v argument if debug is required)
|
|
||||||
curl -kv -cacert <(echo "${{ inputs.kube_ca_base64 }}" | base64 -d) -H "Authorization: Bearer ${{ inputs.kube_token }}" ${{ inputs.kube_server }}/version
|
|
||||||
|
|
||||||
@@ -1,37 +1,35 @@
|
|||||||
name: Casa Home Assistant CI/CD Pipeline (testing)
|
name: Casa Home Assistant CI/CD Pipeline
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- fix/*
|
- fix/*
|
||||||
- main
|
- main
|
||||||
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 16 * * 0' # every sunday 4 pm
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
deploy:
|
||||||
runs-on: casa-vlan-cicd
|
runs-on: casa-vlan-cicd
|
||||||
env:
|
env:
|
||||||
GITHUB_TEMP: ${{ runner.temp }}
|
GITHUB_TEMP: ${{ runner.temp }}
|
||||||
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: setup actions from
|
- name: Fetch limbo public actions
|
||||||
|
env:
|
||||||
|
RUNNER_TEMP: "${{ runner.temp }}"
|
||||||
|
WORKSPACE: "${{ gitea.workspace }}"
|
||||||
run: |
|
run: |
|
||||||
ls -lah ${{ runner.temp }}
|
curl -fsSL https://git.limbosolutions.com/kb/gitea/raw/branch/main/cloud-scripts/setup-limbo-actions.sh | bash 2>&1
|
||||||
|
|
||||||
mkdir -p ${{ runner.temp }}/gitea_src
|
|
||||||
mkdir -p ${{ gitea.workspace }}/.gitea/actions
|
|
||||||
git clone -b main --depth=1 https://git.limbosolutions.com/kb/gitea ${{ runner.temp }}/gitea_src/.gitea
|
|
||||||
ln -s ${{ runner.temp }}/gitea_src/.gitea/actions/kubectl-setup ${{ gitea.workspace }}/.gitea/actions/kubectl-setup
|
|
||||||
ls -lah ${{ gitea.workspace }}/.gitea/actions/kubectl-setup
|
|
||||||
ls -lah ${{ gitea.workspace }}/.gitea/actions/kubectl-setup/*
|
|
||||||
cat ${{ gitea.workspace }}/.gitea/actions/kubectl-setup/action.yml
|
|
||||||
|
|
||||||
- name: Setup kubectl
|
- name: Setup kubectl
|
||||||
uses: ./.gitea/actions/kubectl-setup
|
uses: ./.gitea/limbo_actions/kubectl-setup
|
||||||
with:
|
with:
|
||||||
kube_server: ${{ secrets.CASA_VLAN_KUBE_SERVER }}
|
kube_server: ${{ secrets.CASA_VLAN_KUBE_SERVER }}
|
||||||
kube_ca_base64: ${{ secrets.CASA_VLAN_KUBE_CA_BASE64 }}
|
kube_ca_base64: ${{ secrets.CASA_VLAN_KUBE_CA_BASE64 }}
|
||||||
@@ -45,9 +43,6 @@ jobs:
|
|||||||
INGRESS_ROUTES_MATCH: "${{ secrets.CASA_HOMEASSISTANT_INGRESS_ROUTES_MATCH }}"
|
INGRESS_ROUTES_MATCH: "${{ secrets.CASA_HOMEASSISTANT_INGRESS_ROUTES_MATCH }}"
|
||||||
INGRESS_TLS_SECRET_NAME: "${{ secrets.CASA_HOMEASSISTANT_INGRESS_TLS_SECRET_NAME }}"
|
INGRESS_TLS_SECRET_NAME: "${{ secrets.CASA_HOMEASSISTANT_INGRESS_TLS_SECRET_NAME }}"
|
||||||
run: |
|
run: |
|
||||||
#set -x for debugging
|
kubectl apply -f ./deploy/deployment.yaml \
|
||||||
set -e
|
&& envsubst < ./deploy/service.template.yaml | kubectl apply -f -
|
||||||
cd ${{ gitea.workspace }}
|
|
||||||
kubectl apply -f ./deploy/deployment.yaml
|
|
||||||
envsubst < ./deploy/service.template.yaml | kubectl apply -f -
|
|
||||||
|
|
||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
Welcome to my Home Assistant setup repository.
|
Welcome to my Home Assistant setup repository.
|
||||||
This repository documents and maintains the Home Assistant instance running in my home, hosted on casa server k3s cluster.
|
This repository documents and maintains the Home Assistant instance running in my home, hosted on casa server k3s cluster.
|
||||||
All essential containers, such as MQTT and speech recognition, are hosted on the same server for seamless integration.
|
Related containers, such as MQTT and speech recognition, are hosted on same cluster.
|
||||||
|
|
||||||
<!-- omit in toc -->
|
**Table of Contents:**
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Devices](#devices)
|
- [Devices](#devices)
|
||||||
- [Broadlink - RM4 Pro](#broadlink---rm4-pro)
|
- [Broadlink - RM4 Pro](#broadlink---rm4-pro)
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ All Environment variables requirements as set as secrets.
|
|||||||
|
|
||||||
[gitea workflow](../.gitea/workflows/deploy.yaml)
|
[gitea workflow](../.gitea/workflows/deploy.yaml)
|
||||||
|
|
||||||
## RBAC
|
## cicd RBAC
|
||||||
|
|
||||||
```bash { cwd=../ }
|
```bash { cwd=../ }
|
||||||
kubectl apply -f ./deploy/rbac.yaml
|
kubectl apply -f ./deploy/cicd-rbac.yaml
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -33,9 +33,15 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
dnsPolicy: ClusterFirstWithHostNet # ensures pod uses cluster DNS (CoreDNS) for service discovery even with host networking
|
dnsPolicy: ClusterFirstWithHostNet # ensures pod uses cluster DNS (CoreDNS) for service discovery even with host networking
|
||||||
hostNetwork: true
|
hostNetwork: true
|
||||||
|
nodeName: casa # force deploy to master node cluster
|
||||||
|
tolerations:
|
||||||
|
- key: "node-role.kubernetes.io/control-plane" # allow installation on control-plane
|
||||||
|
operator: "Exists"
|
||||||
|
effect: "NoSchedule"
|
||||||
containers:
|
containers:
|
||||||
- name: home-assistant
|
- name: home-assistant
|
||||||
image: "homeassistant/home-assistant"
|
image: "homeassistant/home-assistant"
|
||||||
|
imagePullPolicy: Always
|
||||||
env:
|
env:
|
||||||
- name: TZ
|
- name: TZ
|
||||||
value: Europe/Lisbon # set timezone
|
value: Europe/Lisbon # set timezone
|
||||||
|
|||||||
Reference in New Issue
Block a user