Skip to content

Commit

Permalink
Add ScyllaDBMonitoring controller
Browse files Browse the repository at this point in the history
  • Loading branch information
tnozicka committed Jan 24, 2023
1 parent 358c5b3 commit f20887d
Show file tree
Hide file tree
Showing 54 changed files with 9,379 additions and 85 deletions.
41 changes: 32 additions & 9 deletions .github/actions/run-e2e/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ runs:
env:
ARTIFACTS_DIR: ${{ runner.temp }}/e2e-artifacts
run: |
set -x
set -euExo pipefail
shopt -s inherit_errexit
mkdir "${ARTIFACTS_DIR}"
echo "ARTIFACTS_DIR=${ARTIFACTS_DIR}" | tee -a ${GITHUB_ENV}
- uses: actions/download-artifact@v3
Expand All @@ -45,7 +47,9 @@ runs:
- name: Load image
shell: bash
run: |
set -x
set -euExo pipefail
shopt -s inherit_errexit
unlz4 ~/operatorimage.tar.lz4 - | docker load
# docker looses the registry part on save/load
docker tag "$( echo "${image_repo_ref}:ci" | sed -E -e 's~[^/]+/(.*)~\1~' )" "${image_repo_ref}:ci"
Expand All @@ -57,7 +61,9 @@ runs:
- name: Install tools
shell: bash
run: |
set -x
set -euExo pipefail
shopt -s inherit_errexit
go install github.com/mikefarah/yq/[email protected]
- name: Setup minikube
uses: ./go/src/github.com/scylladb/scylla-operator/.github/actions/setup-minikube
Expand All @@ -67,7 +73,8 @@ runs:
env:
SCYLLA_OPERATOR_FEATURE_GATES: '${{ inputs.featureGates }}'
run: |
set -x
set -euExo pipefail
shopt -s inherit_errexit
timeout 10m ./hack/ci-deploy.sh '${{ env.image_repo_ref }}:ci'
Expand All @@ -83,11 +90,15 @@ runs:
shell: bash
if: ${{ github.event_name != 'pull_request' }}
run: |
set -euExo pipefail
shopt -s inherit_errexit
echo "FLAKE_ATTEMPTS=5" | tee -a ${GITHUB_ENV}
- name: Run e2e
shell: bash
run: |
set -euExo pipefail
shopt -s inherit_errexit
e2e_timeout_minutes='${{ inputs.baseTimeoutMinutes }}'
flake_attempts=0
Expand All @@ -96,7 +107,10 @@ runs:
e2e_timeout_minutes="$(( ${e2e_timeout_minutes} + ${flake_attempts} * 10 ))"
fi
docker run --user="$( id -u ):$( id -g )" --rm \
user="$( id -u )"
group="$( id -g )"
ingress_address="$( kubectl -n haproxy-ingress get svc haproxy-ingress --template='{{ .spec.clusterIP }}' )"
docker run --user="${user}:${group}" --rm \
--entrypoint=/usr/bin/scylla-operator-tests \
-v="${ARTIFACTS_DIR}:${ARTIFACTS_DIR}:rw" \
-v="${HOME}/.kube/config:/kubeconfig:ro" -e='KUBECONFIG=/kubeconfig' \
Expand All @@ -106,13 +120,18 @@ runs:
--artifacts-dir="${ARTIFACTS_DIR}" \
--flake-attempts="${flake_attempts}" \
--timeout="${e2e_timeout_minutes}m" \
--feature-gates='${{ inputs.featureGates }}'
--feature-gates='${{ inputs.featureGates }}' \
--override-ingress-address="${ingress_address}" \
${{ inputs.extraArgs }}
- name: Dump cluster state
if: ${{ always() }}
working-directory: ${{ runner.temp }}
shell: bash
run: timeout 10m ${{ inputs.repositoryPath }}/hack/ci-gather-artifacts.sh
run: |
set -euExo pipefail
shopt -s inherit_errexit
timeout 10m ${{ inputs.repositoryPath }}/hack/ci-gather-artifacts.sh
- name: Get machine logs and info
if: ${{ always() }}
working-directory: ${{ runner.temp }}/e2e-artifacts
Expand Down Expand Up @@ -142,15 +161,19 @@ runs:
working-directory: ${{ runner.temp }}/e2e-artifacts
shell: bash
run: |
set -euEx -o pipefail
set -euExo pipefail
shopt -s inherit_errexit
sudo cat $( ls /var/log/kube-apiserver-audit*.log | sort -n ) > ./kube-apiserver-audit.log
jq -s 'group_by(.user.username) | map({"user": .[0].user.username, "total": length, "verbs": (group_by(.verb) | map({"key":.[0].verb, "value": length}) | from_entries)}) | sort_by(.total) | reverse' ./kube-apiserver-audit.log > ./api-call-stats.json
- name: Compress artifacts
if: ${{ always() }}
working-directory: ${{ runner.temp }}
shell: bash
run: |
set -x
set -euExo pipefail
shopt -s inherit_errexit
tar -c --use-compress-program=lz4 -f ./e2e-artifacts.tar.lz4 "e2e-artifacts/"
- name: Upload artifacts
if: ${{ always() }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: "{{ .name }}"
data:
username: {{ "admin" | toBytes | toBase64 }}
password: {{ .password | toBase64 }}
42 changes: 42 additions & 0 deletions assets/monitoring/grafana/v1alpha1/configs.cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: "{{ .scyllaDBMonitoringName }}-grafana-configs"
data:
grafana.ini: |
[auth]
disable_login_form = false
disable_signout_menu = false
{{ if .enableAnonymousAccess -}}
[auth.anonymous]
enabled = true
{{- end }}
[dashboards]
default_home_dashboard_path = /var/run/dashboards/scylladb/overview.json
[log]
level = error
mode = console
[log.frontend]
enabled = true
[paths]
data = /var/lib/grafana
logs = /var/log/grafana
plugins = /var/lib/grafana/plugins
provisioning = /var/run/configmaps/grafana-provisioning
[security]
admin_user = $__file{/var/run/secrets/grafana-admin-credentials/username}
admin_password = $__file{/var/run/secrets/grafana-admin-credentials/password}
[server]
protocol = https
cert_file = /var/run/secrets/grafana-serving-certs/tls.crt
cert_key = /var/run/secrets/grafana-serving-certs/tls.key
[panels]
disable_sanitize_html = true
Loading

0 comments on commit f20887d

Please sign in to comment.