Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI Workflow #77

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
192 changes: 192 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
name: dashboard-check
on:
# push:
# branches:
# - "*.*"
# pull_request:
# branches:
# - "master"
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
folders:
description: 'Folders'
required: true
default: 'all'
type: string
kubedb_version:
description: 'KubeDB Version'
required: true
default: 'v2024.8.21' #needs to be dynamic
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-dashboard-check
cancel-in-progress: true
jobs:
config:
name: Configure Inputs
runs-on: label-detector
outputs:
folders: ${{ steps.defaulter.outputs.folders }}
kubedb_version : ${{ steps.defaulter.outputs.kubedb_version }}
steps:
- name: Defaulter
id: defaulter
env:
FOLDERS: "all"
KUBEDB_VERSION: ${{ inputs.kubedb_version }}
run: |
echo "folders=${FOLDERS:-all}" >> $GITHUB_OUTPUT
echo "kubedb_version=${KUBEDB_VERSION:-v2024.8.21}" >> $GITHUB_OUTPUT
test:
name: Test
runs-on: firecracker
needs: config
strategy:
fail-fast: false
matrix:
k8s: [v1.27.3]
steps:
- uses: actions/checkout@v4
with:
ref: workflow

# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# detached: true

- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: '1.22'
id: go

- name: Install Homebrew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

- uses: Homebrew/actions/setup-homebrew@master

- name: Prepare host
run: |
brew instal gh kubectl helm kind

- name: Prepare git
env:
GITHUB_USER: 1gtm
GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
run: |
set -x
git config --global user.name "1gtm"
git config --global user.email "[email protected]"
git config --global \
url."https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com".insteadOf \
"https://github.com"

- name: Create Kubernetes ${{ matrix.k8s }} cluster
id: kind
uses: engineerd/[email protected]
with:
version: v0.20.0
config: hack/kubernetes/kind.yaml
image: kindest/node:${{ matrix.k8s }}

- name: Prepare cluster for testing
id: local-path
run: |
echo "waiting for nodes to be ready ..."
kubectl wait --for=condition=Ready nodes --all --timeout=5m
kubectl get nodes
kubectl wait --for=condition=Ready pods -n kube-system --all --timeout=10m
kubectl get pods -n kube-system

- name: Install cert-manager
run: |
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml

- name: Issue License
env:
BYTEBUILDERS_LICENSE_TOKEN: ${{ secrets.BYTEBUILDERS_LICENSE_TOKEN }}
run: |
export KUBECONFIG="${HOME}/.kube/config"
CLUSTER_UID=$(kubectl get ns kube-system -o=jsonpath='{.metadata.uid}')
curl -X POST -o /tmp/kubedb-license.txt -d "name=1gtm&[email protected]&product=kubedb-enterprise&cluster=${CLUSTER_UID}&tos=true&token=${BYTEBUILDERS_LICENSE_TOKEN}" https://license-issuer.appscode.com/issue-license
curl -X POST -o /tmp/platform-license.txt -d "name=1gtm&[email protected]&product=platform&cluster=${CLUSTER_UID}&tos=true&token=${BYTEBUILDERS_LICENSE_TOKEN}" https://license-issuer.appscode.com/issue-license

- name: Install Longhorn
run: |
helm repo add longhorn https://charts.longhorn.io
helm repo update
helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.6.2 --wait --burst-limit=10000

- name: Install KubeDB
run: |
helm install kubedb oci://ghcr.io/appscode-charts/kubedb \
--version ${{ needs.config.outputs.kubedb_version }} \
--namespace kubedb --create-namespace \
--set-file global.license=/tmp/kubedb-license.txt \
--set global.featureGates.Druid=true \
--set global.featureGates.FerretDB=true \
--set global.featureGates.Memcached=true \
--set global.featureGates.MSSQLServer=true \
--set global.featureGates.PerconaXtraDB=true \
--set global.featureGates.PgBouncer=true \
--set global.featureGates.Pgpool=true \
--set global.featureGates.ProxySQL=true \
--set global.featureGates.RabbitMQ=true \
--set global.featureGates.Singlestore=true \
--set global.featureGates.Solr=true \
--set global.featureGates.ZooKeeper=true \
--wait --burst-limit=10000 --debug

- name: Install KubeDB CLI
run: |
cd ..
git clone https://github.com/kubedb/cli.git
cd cli
go install ./...

- name: Install Prometheus
run: |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring --create-namespace --wait --burst-limit=10000

- name: Install Panopticon
run: |
helm repo add appscode https://charts.appscode.com/stable/
helm repo update
helm install panopticon appscode/panopticon \
-n kubeops --create-namespace \
--set monitoring.agent=prometheus.io/operator \
--set monitoring.serviceMonitor.labels.release=prometheus \
--set-file license=/tmp/kubedb-license.txt \
--wait --burst-limit=10000
sleep 5s
kubectl wait --for=condition=ready pod -l "app.kubernetes.io/name=panopticon,app.kubernetes.io/instance=panopticon" -n kubeops --timeout=10m

- name: Apply MetricsConfigurations
run: |
helm repo add appscode https://charts.appscode.com/stable/
helm repo update
helm upgrade -i kubedb-metrics appscode/kubedb-metrics -n kubedb --create-namespace --version=${{ needs.config.outputs.kubedb }} --wait

- name: Prepare smaples
run: |
cd ..
git clone https://github.com/kubedb/samples.git
cd samples
git checkout mssql-monitoring

- name: Check Dashboard Metrics
env:
SINGLESTORE_LICENSE_USERNAME: ${{ secrets.SINGLESTORE_LICENSE_USERNAME }}
SINGLESTORE_LICENSE_PASSWORD: ${{ secrets.SINGLESTORE_LICENSE_PASSWORD }}
FOLDERS: ${{ needs.config.outputs.folders }}
run: |
echo "SINGLESTORE_LICENSE_USERNAME=$(echo $SINGLESTORE_LICENSE_USERNAME)" >> ./hack/scripts/.env
echo "SINGLESTORE_LICENSE_PASSWORD=$(echo $SINGLESTORE_LICENSE_PASSWORD)" >> ./hack/scripts/.env
echo "FOLDERS=$(echo $FOLDERS)" >> ./hack/scripts/.env
bash hack/scripts/check-dashboard.sh
4 changes: 2 additions & 2 deletions connectcluster/connectcluster-connect.json
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@
"targets": [
{
"exemplar": true,
"expr": "kafka_connect_app_info{instance=~\"$instance\",start_time_ms!=\"\"}",
"expr": "kafka_connect_app_info{instance=~\"$instance\"}",
"hide": false,
"interval": "",
"legendFormat": "",
Expand Down Expand Up @@ -781,7 +781,7 @@
"refId": "D"
},
{
"expr": "sum by (pod) (kafka_connect_worker__connector_startup_failure_total{namespace=~\"$namespace\",pod=~\"$app-.+$\"})",
"expr": "sum by (pod) (kafka_connect_worker_connector_startup_failure_total{namespace=~\"$namespace\",pod=~\"$app-.+$\"})",
"format": "table",
"instant": true,
"interval": "",
Expand Down
6 changes: 3 additions & 3 deletions druid/druid_summary_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -2434,7 +2434,7 @@
"targets": [
{
"exemplar": true,
"expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-brokers-\\\\d+$|$app-coordinators-\\\\d+$|$app-historicals-\\\\d+$|$app-middlemanagers-\\\\d+$|$app-routers-\\\\d+$|$app-overlords-\\\\d+$\",namespace=~\"$namespace\"}",
"expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}",
"format": "table",
"instant": true,
"interval": "",
Expand Down Expand Up @@ -2518,7 +2518,7 @@
"targets": [
{
"exemplar": true,
"expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-brokers-\\\\d+$|$app-coordinators-\\\\d+$|$app-historicals-\\\\d+$|$app-middlemanagers-\\\\d+$|$app-routers-\\\\d+$|$app-overlords-\\\\d+$\",namespace=~\"$namespace\"}) )* 100",
"expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100",
"instant": true,
"interval": "",
"legendFormat": "{{pod}}",
Expand Down Expand Up @@ -2602,7 +2602,7 @@
"targets": [
{
"exemplar": true,
"expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-brokers-\\\\d+$|$app-coordinators-\\\\d+$|$app-historicals-\\\\d+$|$app-middlemanagers-\\\\d+$|$app-routers-\\\\d+$|$app-overlords-\\\\d+$\",namespace=~\"$namespace\"}) ",
"expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ",
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{pod}}",
Expand Down
6 changes: 3 additions & 3 deletions elasticsearch/elasticsearch_summary_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -2567,7 +2567,7 @@
"targets": [
{
"exemplar": true,
"expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}",
"expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}",
"format": "table",
"instant": true,
"interval": "",
Expand Down Expand Up @@ -2651,7 +2651,7 @@
"targets": [
{
"exemplar": true,
"expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}) )* 100",
"expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100",
"instant": true,
"interval": "",
"legendFormat": "{{pod}}",
Expand Down Expand Up @@ -2735,7 +2735,7 @@
"targets": [
{
"exemplar": true,
"expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}) ",
"expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ",
"interval": "",
"intervalFactor": 1,
"legendFormat": "{{pod}}",
Expand Down
15 changes: 15 additions & 0 deletions hack/kubernetes/kind.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
metadata:
name: config
apiServer:
extraArgs:
enable-admission-plugins: "NodeRestriction,OwnerReferencesPermissionEnforcement"
- role: worker
- role: worker
Loading