Compare commits
6 Commits
master
...
d8e6d72e25
| Author | SHA1 | Date | |
|---|---|---|---|
| d8e6d72e25 | |||
| 1b7b53ddd1 | |||
| ac33cbfc6d | |||
| cf4dd050ca | |||
| 473808832b | |||
| f29285d800 |
45
.gitea/actions/kubectl-setup/action.yml
Normal file
45
.gitea/actions/kubectl-setup/action.yml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
name: Setup kubectl
|
||||||
|
description: "Reads kube config from inputs and sets KUBECONFIG"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
kube_server:
|
||||||
|
description: "Kubernetes API server address"
|
||||||
|
required: true
|
||||||
|
kube_ca_base64:
|
||||||
|
description: "Base64-encoded CA certificate"
|
||||||
|
required: true
|
||||||
|
kube_token:
|
||||||
|
description: "ServiceAccount token"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Create kubeconfig
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
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
|
||||||
|
|
||||||
|
echo "KUBECONFIG=${GITHUB_TEMP}/.kube/config" >> "${GITHUB_ENV}"
|
||||||
@@ -1,48 +1,43 @@
|
|||||||
name: Casa Home Assistant CI/CD Pipeline
|
name: Casa Home Assistant CI/CD Pipeline (testing)
|
||||||
|
|
||||||
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:
|
||||||
deploy:
|
build:
|
||||||
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: 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
|
- name: Setup kubectl
|
||||||
uses: ./.gitea/limbo_actions/kubectl-setup
|
uses: ./.gitea/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 }}
|
||||||
kube_token: ${{ secrets.CASA_VLAN_KUBE_TOKEN }}
|
kube_token: ${{ secrets.casa_vlan_kube_token }}
|
||||||
|
|
||||||
- name: Deploy Home Assistant
|
- name: Deploy Home Assistant
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
|
||||||
ENDPOINT_IP: "${{ secrets.CASA_HOMEASSISTANT_ENDPOINT_IP }}"
|
|
||||||
SERVICE_PORT: "${{ secrets.CASA_HOMEASSISTANT_ENDPOINT_SERVICE_PORT }}"
|
|
||||||
INGRESS_ROUTES_MATCH: "${{ secrets.CASA_HOMEASSISTANT_INGRESS_ROUTES_MATCH }}"
|
|
||||||
INGRESS_TLS_SECRET_NAME: "${{ secrets.CASA_HOMEASSISTANT_INGRESS_TLS_SECRET_NAME }}"
|
|
||||||
run: |
|
run: |
|
||||||
kubectl apply -f ./deploy/deployment.yaml \
|
set -e
|
||||||
&& envsubst < ./deploy/service.template.yaml | kubectl apply -f -
|
kubectl get pods
|
||||||
|
|
||||||
|
# - name: Deploy Home Assistant
|
||||||
|
# shell: bash
|
||||||
|
# run: |
|
||||||
|
# set -e
|
||||||
|
# cd ${{ gitea.workspace }}
|
||||||
|
# export ENDPOINT_IP="${{ secrets.ENDPOINT_IP }}"
|
||||||
|
# export SERVICE_PORT=${{ secrets.SERVICE_PORT }}
|
||||||
|
# export INGRESS_ROUTES_MATCH="${{ secrets.INGRESS_ROUTES_MATCH }}"
|
||||||
|
# export INGRESS_TLS_SECRET_NAME=${{ secrets.INGRESS_TLS_SECRET_NAME }}
|
||||||
|
# kubectl apply -f ./deploy/deployment.yaml
|
||||||
|
# envsubst < ./deploy/service.template.yaml | kubectl apply -f -
|
||||||
|
|
||||||
@@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
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.
|
||||||
Related containers, such as MQTT and speech recognition, are hosted on same cluster.
|
All essential containers, such as MQTT and speech recognition, are hosted on the same server for seamless integration.
|
||||||
|
|
||||||
**Table of Contents:**
|
<!-- omit in toc -->
|
||||||
|
## 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)
|
||||||
|
|
||||||
## cicd RBAC
|
## RBAC
|
||||||
|
|
||||||
```bash { cwd=../ }
|
```bash { cwd=../ }
|
||||||
kubectl apply -f ./deploy/cicd-rbac.yaml
|
kubectl apply -f ./deploy/rbac.yaml
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -33,15 +33,14 @@ 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
|
# delays start so host have time to start on low memory resources
|
||||||
tolerations:
|
# initContainers:
|
||||||
- key: "node-role.kubernetes.io/control-plane" # allow installation on control-plane
|
# - name: delay-start
|
||||||
operator: "Exists"
|
# image: busybox:latest
|
||||||
effect: "NoSchedule"
|
# command: ["sh", "-c", "sleep 60"]
|
||||||
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