Skip to content

Commit

Permalink
wip: convert deployment of grafana to kustomize
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Hiller <[email protected]>
  • Loading branch information
dhiller committed Dec 20, 2024
1 parent 7037fe3 commit 0ba90a3
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 13 deletions.
4 changes: 4 additions & 0 deletions github/ci/services/grafana/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace: monitoring

resources:
- manifests/grafana.yaml
71 changes: 58 additions & 13 deletions github/ci/services/grafana/hack/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,65 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright the KubeVirt Authors.
#
#

set -eo pipefail
set -e
set -u
set -o pipefail

main() {
local environment=${1}
set -x

bazelisk run //github/ci/services/grafana:$environment.apply

bazelisk run //github/ci/services/common/k8s/cmd/wait -- -namespace monitoring -selector grafana-deployment -kind deployment

kubectl wait --timeout 60s --for=jsonpath='{.status.stage}'=complete -n monitoring grafana grafana

if [ "$environment" != "testing" ]; then
kubectl apply -n monitoring -f ./github/ci/services/grafana/manifests/ingress.yaml
fi
WORK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BASE_DIR="$(cd "${WORK_DIR}/.." && pwd)"

function usage {
cat <<EOF
usage: $0 [-d] <environment>
EOF
}

main "${@}"
dry_run=false
while getopts "d" opt; do
case "${opt}" in
d )
dry_run="true"
shift
;;
\? )
usage
exit 1
;;
esac
done

environment="${1}"
[ -d "${BASE_DIR}/overlays/${environment}" ] || exit 1

cd "${BASE_DIR}"

if [ "$dry_run" = "true" ]; then
kubectl kustomize "./overlays/${environment}"
exit 0
fi

kubectl apply -k "./overlays/${environment}"

go run ../common/k8s/cmd/wait -- -namespace monitoring -selector grafana-deployment -kind deployment

kubectl wait --timeout 60s --for=jsonpath='{.status.stage}'=complete -n monitoring grafana grafana
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- ../../base
- ./manifests/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- ../../base
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test123
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
admin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
client-id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
client-secret
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

0 comments on commit 0ba90a3

Please sign in to comment.