Compare commits
23 Commits
master
...
b9295ce120
| Author | SHA1 | Date | |
|---|---|---|---|
| b9295ce120 | |||
| e344b84715 | |||
| fea4db704f | |||
| 7df670bcc2 | |||
| ac2e287429 | |||
| 74dc2068c8 | |||
| 86687012c9 | |||
| 1c6342b2b5 | |||
| 19c564724f | |||
| 7d50ebaf22 | |||
| 0d193bcc7a | |||
| a295f671e4 | |||
| 5d7bc73f2c | |||
| d35544ca2b | |||
| 10f585819d | |||
| 3a3f64a59b | |||
| 160176f905 | |||
| d8e6d72e25 | |||
| 1b7b53ddd1 | |||
| ac33cbfc6d | |||
| cf4dd050ca | |||
| 473808832b | |||
| f29285d800 |
51
.gitea/actions/kubectl-setup/action.yml
Normal file
51
.gitea/actions/kubectl-setup/action.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
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 -x
|
||||
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 "config created - ${GITHUB_TEMP}/.kube/config"
|
||||
ls -lah ${GITHUB_TEMP}/.kube/config
|
||||
echo "KUBECONFIG=${GITHUB_TEMP}/.kube/config" >> "${GITHUB_ENV}"
|
||||
|
||||
# curl -vk \
|
||||
# --cacert ca.crt \
|
||||
# -H "Authorization: Bearer $KUBE_TOKEN" \
|
||||
# https://<server>:6443/version
|
||||
@@ -1,35 +1,23 @@
|
||||
name: Casa Home Assistant CI/CD Pipeline
|
||||
name: Casa Home Assistant CI/CD Pipeline (testing)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- fix/*
|
||||
- main
|
||||
- master
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 16 * * 0' # every sunday 4 pm
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
build:
|
||||
runs-on: casa-vlan-cicd
|
||||
env:
|
||||
GITHUB_TEMP: ${{ runner.temp }}
|
||||
|
||||
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
|
||||
uses: ./.gitea/actions/kubectl-setup
|
||||
with:
|
||||
kube_server: ${{ secrets.CASA_VLAN_KUBE_SERVER }}
|
||||
kube_ca_base64: ${{ secrets.CASA_VLAN_KUBE_CA_BASE64 }}
|
||||
@@ -43,6 +31,12 @@ jobs:
|
||||
INGRESS_ROUTES_MATCH: "${{ secrets.CASA_HOMEASSISTANT_INGRESS_ROUTES_MATCH }}"
|
||||
INGRESS_TLS_SECRET_NAME: "${{ secrets.CASA_HOMEASSISTANT_INGRESS_TLS_SECRET_NAME }}"
|
||||
run: |
|
||||
kubectl apply -f ./deploy/deployment.yaml \
|
||||
&& envsubst < ./deploy/service.template.yaml | kubectl apply -f -
|
||||
|
||||
#set -x for debugging
|
||||
set -e
|
||||
cd ${{ gitea.workspace }}
|
||||
echo "Length ENDPOINT_IP: ${#ENDPOINT_IP}"
|
||||
echo "Length SERVICE_PORT: ${#SERVICE_PORT}"
|
||||
echo "Length INGRESS_ROUTES_MATCH: ${#INGRESS_ROUTES_MATCH}"
|
||||
echo "Length INGRESS_TLS_SECRET_NAME: ${#INGRESS_TLS_SECRET_NAME}"
|
||||
kubectl apply -f ./deploy/deployment.yaml
|
||||
envsubst < ./deploy/service.template.yaml > /root/tmp.yaml
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
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.
|
||||
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)
|
||||
- [Broadlink - RM4 Pro](#broadlink---rm4-pro)
|
||||
|
||||
@@ -44,8 +44,8 @@ All Environment variables requirements as set as secrets.
|
||||
|
||||
[gitea workflow](../.gitea/workflows/deploy.yaml)
|
||||
|
||||
## cicd RBAC
|
||||
## RBAC
|
||||
|
||||
```bash { cwd=../ }
|
||||
kubectl apply -f ./deploy/cicd-rbac.yaml
|
||||
kubectl apply -f ./deploy/rbac.yaml
|
||||
```
|
||||
|
||||
@@ -33,15 +33,14 @@ spec:
|
||||
spec:
|
||||
dnsPolicy: ClusterFirstWithHostNet # ensures pod uses cluster DNS (CoreDNS) for service discovery even with host networking
|
||||
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"
|
||||
# delays start so host have time to start on low memory resources
|
||||
# initContainers:
|
||||
# - name: delay-start
|
||||
# image: busybox:latest
|
||||
# command: ["sh", "-c", "sleep 60"]
|
||||
containers:
|
||||
- name: home-assistant
|
||||
image: "homeassistant/home-assistant"
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: TZ
|
||||
value: Europe/Lisbon # set timezone
|
||||
|
||||
Reference in New Issue
Block a user