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

adding prometheus and grafana instances to iris app #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ set -e

BOOTSTRAP_DIR="bootstrap/overlays/default/"
ARGO_NS=mlops-demo-gitops
GRAFANA_PROMETHEUS_OPERATORS_DIR="components/grafana_prometheus/operators/overlays/default/"
GRAFANA_PROMETHEUS_NS=mlops-demo-dev
GRAFANA_PROMETHEUS_SERVICES_DIR="components/grafana_prometheus/services/overlays/default/"

# check login
check_oc_login(){
Expand All @@ -25,6 +28,28 @@ main(){
echo "https://${route}"
}

grafana_prometheus() {
echo "Applying grafana & prometheus operators to ${GRAFANA_PROMETHEUS_NS}"
kustomize build ${GRAFANA_PROMETHEUS_OPERATORS_DIR} | oc apply -f -

echo "waiting for a minute"
sleep 60

echo ""

echo "Applying grafana & prometheus services to ${GRAFANA_PROMETHEUS_NS}"

kustomize build ${GRAFANA_PROMETHEUS_SERVICES_DIR} | oc apply -f -

echo ""
echo "Grafana Route:
"
route=$(oc get route grafana-route -n ${GRAFANA_PROMETHEUS_NS} -o jsonpath='{.spec.host}')
echo "https://${route}"
}

check_oc_login

main
main

grafana_prometheus
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: grafana-operator
spec:
channel: v4
installPlanApproval: Automatic
name: grafana-operator
source: community-operators
sourceNamespace: openshift-marketplace
10 changes: 10 additions & 0 deletions components/grafana_prometheus/operators/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: mlops-demo-dev

resources:
- operatorgroup.yaml
- seldon-subs.yaml
- prometheus-operator-subs.yaml
- grafana-operator-subs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: mlops-demo-dev
namespace: mlops-demo-dev
spec:
targetNamespaces:
- mlops-demo-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: prometheus
spec:
channel: beta
installPlanApproval: Automatic
name: prometheus
source: community-operators
sourceNamespace: openshift-marketplace
10 changes: 10 additions & 0 deletions components/grafana_prometheus/operators/base/seldon-subs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: seldon-operator-certified
spec:
channel: stable
installPlanApproval: Automatic
name: seldon-operator-certified
source: certified-operators
sourceNamespace: openshift-marketplace
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

bases:
- ../../base
24 changes: 24 additions & 0 deletions components/grafana_prometheus/services/base/grafana-instance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: integreatly.org/v1alpha1
kind: Grafana
metadata:
name: grafana
spec:
config:
auth:
disable_signout_menu: true
auth.anonymous:
enabled: true
log:
level: warn
mode: console
security:
admin_password: secret
admin_user: root
ingress:
enabled: true
dashboardLabelSelector:
- matchExpressions:
- key: app
operator: In
values:
- grafana
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: integreatly.org/v1alpha1
kind: GrafanaDataSource
metadata:
name: prometheus
spec:
datasources:
- access: proxy
editable: true
isDefault: true
jsonData:
timeInterval: 5s
name: prometheus
type: prometheus
url: "http://prometheus-operated:9090"
version: 1
name: mlops-prometheus.yaml
12 changes: 12 additions & 0 deletions components/grafana_prometheus/services/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: mlops-demo-dev

resources:
- prometheus-instance.yaml
- prometheus-route.yaml
- rest-seldon-model-servicemonitor.yaml
- grafana-instance.yaml
- grafana-prometheus-datasource.yaml
- prediction-analytics-seldon-core-1.2.2.yaml
Loading