diff --git a/.gitea/workflows/deploy-services.yaml b/.gitea/workflows/casa-services-deploy.yaml similarity index 96% rename from .gitea/workflows/deploy-services.yaml rename to .gitea/workflows/casa-services-deploy.yaml index a5c2b7d..b70be4a 100644 --- a/.gitea/workflows/deploy-services.yaml +++ b/.gitea/workflows/casa-services-deploy.yaml @@ -1,4 +1,4 @@ -name: Deploy services CI/CD Pipeline +name: Deploy Casa services CI/CD Pipeline on: push: diff --git a/.gitea/workflows/monitoring-deploy.yaml b/.gitea/workflows/monitoring-deploy.yaml new file mode 100644 index 0000000..d5f0a81 --- /dev/null +++ b/.gitea/workflows/monitoring-deploy.yaml @@ -0,0 +1,47 @@ +name: Monitoring services 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 + 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 }} + + # secrets.LOKI_URL = https:///loki/api/v1/push + - name: Deploy promtail + shell: bash + run: | + # add repo + helm repo add grafana https://grafana.github.io/helm-charts + # Install & Upgrade + helm upgrade --install promtail grafana/promtail --namespace monitoring \ + --values=./promtail/values.yaml --set config.clients.url=${{ secrets.LOKI_URL }} + diff --git a/monitoring/README.md b/monitoring/README.md new file mode 100644 index 0000000..a91b471 --- /dev/null +++ b/monitoring/README.md @@ -0,0 +1,22 @@ +# monitoring + +## namespace + +``` bash +kubectl create namespace monitoring +``` + +## promtail + +### setup + +``` bash +# add repo +helm repo add grafana https://grafana.github.io/helm-charts +# Install & Upgrade +helm upgrade --install promtail grafana/promtail --namespace monitoring \ +--values=./promtail/values.yaml \ +--values=./promtail//values.local.yaml +``` + +## Continuous Deploy diff --git a/monitoring/cicd-rbac.yaml b/monitoring/cicd-rbac.yaml new file mode 100644 index 0000000..cf73719 --- /dev/null +++ b/monitoring/cicd-rbac.yaml @@ -0,0 +1,34 @@ + + +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + namespace: monitoring + name: ci-cd +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"] +- apiGroups: ["networking.k8s.io"] + resources: ["ingresses"] + verbs: ["get", "watch", "list", "create", "update", "patch", "delete"] +- apiGroups: ["traefik.io"] + resources: ["ingressroutes"] + verbs: ["get", "watch", "list", "create", "update", "patch", "delete"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: ci-cd + namespace: monitoring +subjects: +- kind: ServiceAccount + name: casa-ci-cd + namespace: home-assistant +roleRef: + kind: Role + name: ci-cd + apiGroup: rbac.authorization.k8s.io diff --git a/monitoring/promtail/README.md b/monitoring/promtail/README.md deleted file mode 100644 index ba240b1..0000000 --- a/monitoring/promtail/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Promtail - -``` bash -kubectl get namespace monitoring || kubectl create namespace monitoring - -# add repo -helm repo add grafana https://grafana.github.io/helm-charts -# Install & Upgrade -helm upgrade --install promtail grafana/promtail --namespace monitoring \ ---values=./values.yaml \ ---values=./values.local.yaml -```