From 1c68773c8099967aae74009346976194592533be Mon Sep 17 00:00:00 2001 From: Raul Negron Date: Mon, 9 Jan 2023 16:23:45 -0400 Subject: [PATCH 1/3] Grafana recipe and readme --- grafana/grafana-configmap.yaml | 21 +++++++++ grafana/grafana-deployment.yaml | 49 ++++++++++++++++++++ grafana/grafana-ingress.yaml | 19 ++++++++ grafana/grafana-pvc.yaml | 25 +++++++++++ grafana/grafana-service.yaml | 16 +++++++ grafana/package.json | 16 +++++++ grafana/readme.md | 79 +++++++++++++++++++++++++++++++++ grafana/run.sh | 59 ++++++++++++++++++++++++ 8 files changed, 284 insertions(+) create mode 100644 grafana/grafana-configmap.yaml create mode 100644 grafana/grafana-deployment.yaml create mode 100644 grafana/grafana-ingress.yaml create mode 100644 grafana/grafana-pvc.yaml create mode 100644 grafana/grafana-service.yaml create mode 100644 grafana/package.json create mode 100644 grafana/readme.md create mode 100755 grafana/run.sh diff --git a/grafana/grafana-configmap.yaml b/grafana/grafana-configmap.yaml new file mode 100644 index 0000000..2ac41aa --- /dev/null +++ b/grafana/grafana-configmap.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: grafana-datasources + namespace: #namespace_name# +data: + prometheus.yaml: |- + { + "apiVersion": 1, + "datasources": [ + { + "access":"proxy", + "editable": true, + "name": "prometheus", + "orgId": 1, + "type": "prometheus", + "url": "http://prometheus-service.monitoring.svc:8080", + "version": 1 + } + ] + } \ No newline at end of file diff --git a/grafana/grafana-deployment.yaml b/grafana/grafana-deployment.yaml new file mode 100644 index 0000000..52501a0 --- /dev/null +++ b/grafana/grafana-deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: grafana + namespace: #namespace_name# +spec: + replicas: 1 + selector: + matchLabels: + app: grafana + template: + metadata: + name: grafana + labels: + app: grafana + spec: + containers: + - name: grafana + image: grafana/grafana:latest + ports: + - name: grafana + containerPort: 3000 + resources: + limits: + memory: "1Gi" + cpu: "1000m" + requests: + memory: 500M + cpu: "500m" + volumeMounts: + - mountPath: /var/lib/grafana + name: grafana-storage + - mountPath: /etc/grafana/provisioning/datasources + name: grafana-datasources + readOnly: false + volumes: + - name: grafana-storage + persistentVolumeClaim: + claimName: grafana-storage + - name: grafana-datasources + persistentVolumeClaim: + claimName: grafana-datasources + initContainers: + - name: volume-mount-hack + image: busybox + command: ["sh", "-c", "chown -R 472:472 /var/lib/grafana"] + volumeMounts: + - name: grafana-storage + mountPath: /var/lib/grafana \ No newline at end of file diff --git a/grafana/grafana-ingress.yaml b/grafana/grafana-ingress.yaml new file mode 100644 index 0000000..40343b6 --- /dev/null +++ b/grafana/grafana-ingress.yaml @@ -0,0 +1,19 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: grafana + namespace: #namespace_name# + annotations: + kubernetes.io/ingress.class: "nginx" +spec: + rules: + - host: grafana.mybento.local + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: grafana + port: + number: 3000 \ No newline at end of file diff --git a/grafana/grafana-pvc.yaml b/grafana/grafana-pvc.yaml new file mode 100644 index 0000000..065dee4 --- /dev/null +++ b/grafana/grafana-pvc.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: grafana-storage + namespace: #namespace_name# +spec: + storageClassName: longhorn + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: grafana-datasources + namespace: #namespace_name# +spec: + storageClassName: longhorn + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi \ No newline at end of file diff --git a/grafana/grafana-service.yaml b/grafana/grafana-service.yaml new file mode 100644 index 0000000..13bfbf0 --- /dev/null +++ b/grafana/grafana-service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: grafana + namespace: #namespace_name# + annotations: + prometheus.io/scrape: 'true' + prometheus.io/port: '3000' +spec: + selector: + app: grafana + type: NodePort + ports: + - port: 3000 + targetPort: 3000 + nodePort: 32309 \ No newline at end of file diff --git a/grafana/package.json b/grafana/package.json new file mode 100644 index 0000000..cb2ec6f --- /dev/null +++ b/grafana/package.json @@ -0,0 +1,16 @@ +{ + "name": "grafana", + "display_name": "grafana", + "description": "grafana", + "parameters": [], + "main": "grafana/run.sh", + "dependencies": [ + "grafana/run.sh", + "utils/cachengo.sh", + "grafana/grafana-configmap.yaml", + "grafana/grafana-deployment.yaml", + "grafana/grafana-ingress.yaml", + "grafana/grafana-pvc.yaml", + "grafana/grafana-service.yaml" + ] + } \ No newline at end of file diff --git a/grafana/readme.md b/grafana/readme.md new file mode 100644 index 0000000..f168e61 --- /dev/null +++ b/grafana/readme.md @@ -0,0 +1,79 @@ +![Grafana logo](https://github.com/grafana/grafana/raw/main/docs/logo-horizontal.png "Grafana Logo") + +## What is Grafana? + +--- + +Grafana allows you to query, visualize, alert on and understand your metrics no matter where they are stored + + +## Features + +--- +-Visualizations: Fast and flexible client side graphs with a multitude of options. Panel plugins offer many different ways to visualize metrics and logs. + +-Dynamic Dashboards: Create dynamic & reusable dashboards with template variables that appear as dropdowns at the top of the dashboard. + +-Explore Metrics: Explore your data through ad-hoc queries and dynamic drilldown. Split view and compare different time ranges, queries and data sources side by side. + +-Explore Logs: Experience the magic of switching from metrics to logs with preserved label filters. Quickly search through all your logs or streaming them live. + +-Alerting: Visually define alert rules for your most important metrics. Grafana will continuously evaluate and send notifications to systems like Slack, PagerDuty, VictorOps, OpsGenie. + +-Mixed Data Sources: Mix different data sources in the same graph! You can specify a data source on a per-query basis. This works for even custom datasources. + +## Installation + +--- + +1. Select the devices to which Grafana will be installed from 'Devices' page. + +2. Navigate to the 'App Marketplace' tab and select the 'Grafana' application. + +3. The 'Install Now' button should now appear near the top of the screen. Select this button. + +4. Give your installation a name and fill all the parameters. Click 'Install Grafana' in the bottom right corner. + +## Required Parameters + +--- + + +## Additional Parameters + +--- + +**Installation Name** + +Here you will put your app name. Although the app name is Grafana on the portal, you can personalize the name that is shown on the device's Applications. + +**NAMESPACE NAME** +Namespace where you want your app to be installed. + +## Using Grafana + +After you have installed Grafana and set up your first dashboard, you will have many options to choose from depending on your requirements. For example, if you want to view weather data and statistics about your smart home, then you can create a playlist. If you are the administrator for an enterprise and are managing Grafana for multiple teams, then you can set up provisioning and authentication. + +If you’re using Grafana Alerting, then you can have alerts sent through a number of different alert notifiers, including PagerDuty, SMS, email, VictorOps, OpsGenie, or Slack. + +## OS Architectures + +--- + +- Arm64 + +## Limitations / Known issues + +--- + +## Grafana Platform Video + +--- + +[![Demo Image](http://img.youtube.com/vi/0n2UNzk2OaI/0.jpg)](https://www.youtube.com/watch?v=0n2UNzk2OaI) + +## Docs + +--- + +For more information: diff --git a/grafana/run.sh b/grafana/run.sh new file mode 100755 index 0000000..a8674af --- /dev/null +++ b/grafana/run.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +source "utils/cachengo.sh" +source "grafana/grafana-configmap.yaml" +source "grafana/grafana-deployment.yaml" +source "grafana/grafana-ingress.yaml" +source "grafana/grafana-pvc.yaml" +source "grafana/grafana-service.yaml" + + +function do_install { + set -e + cachengo-cli updateInstallStatus "$APPID" "Installing" + + if [ -n "$NAMESPACE_NAME" ]; then + + kubectl create namespace $NAMESPACE_NAME + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" grafana/grafana-configmap.yaml + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" grafana/grafana-deployment.yaml + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" grafana/grafana-ingress.yaml + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" grafana/grafana-service.yaml + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" grafana/grafana-pvc.yaml + + + else + + sed -i "s|#namespace_name#|default|g" grafana/grafana-configmap.yaml + sed -i "s|#namespace_name#|default|g" grafana/grafana-deployment.yaml + sed -i "s|#namespace_name#|default|g" grafana/grafana-ingress.yaml + sed -i "s|#namespace_name#|default|g" grafana/grafana-service.yaml + sed -i "s|#namespace_name#|default|g" grafana/grafana-pvc.yaml + + + fi + + + kubectl apply -f grafana/grafana-configmap.yaml + kubectl apply -f grafana/grafana-deployment.yaml + kubectl apply -f grafana/grafana-ingress.yaml + kubectl apply -f grafana/grafana-service.yaml + kubectl apply -f grafana/grafana-pvc.yaml + +} + +function do_uninstall { + cachengo-cli updateInstallStatus "$APPID" "Uninstalling" + + kubectl delete -f grafana/grafana-configmap.yaml + kubectl delete -f grafana/grafana-deployment.yaml + kubectl delete -f grafana/grafana-ingress.yaml + kubectl delete -f grafana/grafana-service.yaml + kubectl delete -f grafana/grafana-pvc.yaml + + cachengo-cli updateInstallStatus "$APPID" "Uninstalled" +} +case "$1" in + install) do_install ;; + uninstall) do_uninstall ;; +esac \ No newline at end of file From f62fc605b518b227e719a1fa85ce6a1ad2929ac8 Mon Sep 17 00:00:00 2001 From: Raul Negron Date: Tue, 31 Jan 2023 17:53:09 -0400 Subject: [PATCH 2/3] corrected grafana files --- grafana/grafana-configmap.yaml | 26 +++++++++++++++- grafana/grafana-deployment.yaml | 54 ++++++++++++++++++++++++++++++++- grafana/grafana-ingress.yaml | 24 ++++++++++++++- grafana/grafana-pvc.yaml | 30 +++++++++++++++++- grafana/grafana-service.yaml | 21 ++++++++++++- grafana/run.sh | 23 ++++++++++++++ utils/docker.sh | 6 ++++ 7 files changed, 179 insertions(+), 5 deletions(-) diff --git a/grafana/grafana-configmap.yaml b/grafana/grafana-configmap.yaml index 2ac41aa..2fcff1b 100644 --- a/grafana/grafana-configmap.yaml +++ b/grafana/grafana-configmap.yaml @@ -1,3 +1,4 @@ +<<<<<<< Updated upstream apiVersion: v1 kind: ConfigMap metadata: @@ -18,4 +19,27 @@ data: "version": 1 } ] - } \ No newline at end of file + } +======= +apiVersion: v1 +kind: ConfigMap +metadata: + name: grafana-datasources + namespace: #namespace_name# +data: + prometheus.yaml: |- + { + "apiVersion": 1, + "datasources": [ + { + "access":"proxy", + "editable": true, + "name": "prometheus", + "orgId": 1, + "type": "prometheus", + "url": "http://prometheus-service.monitoring.svc:8080", + "version": 1 + } + ] + } +>>>>>>> Stashed changes diff --git a/grafana/grafana-deployment.yaml b/grafana/grafana-deployment.yaml index 52501a0..77307a2 100644 --- a/grafana/grafana-deployment.yaml +++ b/grafana/grafana-deployment.yaml @@ -1,3 +1,4 @@ +<<<<<<< Updated upstream apiVersion: apps/v1 kind: Deployment metadata: @@ -46,4 +47,55 @@ spec: command: ["sh", "-c", "chown -R 472:472 /var/lib/grafana"] volumeMounts: - name: grafana-storage - mountPath: /var/lib/grafana \ No newline at end of file + mountPath: /var/lib/grafana +======= +apiVersion: apps/v1 +kind: Deployment +metadata: + name: grafana + namespace: #namespace_name# +spec: + replicas: 1 + selector: + matchLabels: + app: grafana + template: + metadata: + name: grafana + labels: + app: grafana + spec: + containers: + - name: grafana + image: grafana/grafana:9.3.6 + ports: + - name: grafana + containerPort: 3000 + resources: + limits: + memory: "1Gi" + cpu: "1000m" + requests: + memory: 500M + cpu: "500m" + volumeMounts: + - mountPath: /var/lib/grafana + name: grafana-storage + - mountPath: /etc/grafana/provisioning/datasources + name: grafana-datasources + readOnly: false + volumes: + - name: grafana-storage + persistentVolumeClaim: + claimName: grafana-storage + - name: grafana-datasources + persistentVolumeClaim: + claimName: grafana-datasources + initContainers: + - name: volume-mount-hack + image: busybox + command: ["sh", "-c", "chown -R 472:472 /var/lib/grafana"] + volumeMounts: + - name: grafana-storage + mountPath: /var/lib/grafana +>>>>>>> Stashed changes diff --git a/grafana/grafana-ingress.yaml b/grafana/grafana-ingress.yaml index 40343b6..3a309e6 100644 --- a/grafana/grafana-ingress.yaml +++ b/grafana/grafana-ingress.yaml @@ -1,3 +1,4 @@ +<<<<<<< Updated upstream apiVersion: networking.k8s.io/v1 kind: Ingress metadata: @@ -16,4 +17,25 @@ spec: service: name: grafana port: - number: 3000 \ No newline at end of file + number: 3000 +======= +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: grafana + namespace: #namespace_name# + annotations: + kubernetes.io/ingress.class: "nginx" +spec: + rules: + - host: grafana.mybento.local + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: grafana + port: + number: 3000 +>>>>>>> Stashed changes diff --git a/grafana/grafana-pvc.yaml b/grafana/grafana-pvc.yaml index 065dee4..ec6de6e 100644 --- a/grafana/grafana-pvc.yaml +++ b/grafana/grafana-pvc.yaml @@ -1,3 +1,4 @@ +<<<<<<< Updated upstream apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -22,4 +23,31 @@ spec: - ReadWriteOnce resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi +======= +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: grafana-storage + namespace: #namespace_name# +spec: + storageClassName: longhorn + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: grafana-datasources + namespace: #namespace_name# +spec: + storageClassName: longhorn + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +>>>>>>> Stashed changes diff --git a/grafana/grafana-service.yaml b/grafana/grafana-service.yaml index 13bfbf0..65ee977 100644 --- a/grafana/grafana-service.yaml +++ b/grafana/grafana-service.yaml @@ -1,3 +1,4 @@ +<<<<<<< Updated upstream apiVersion: v1 kind: Service metadata: @@ -13,4 +14,22 @@ spec: ports: - port: 3000 targetPort: 3000 - nodePort: 32309 \ No newline at end of file + nodePort: 32309 +======= +apiVersion: v1 +kind: Service +metadata: + name: grafana + namespace: #namespace_name# + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "3000" +spec: + selector: + app: grafana + type: NodePort + ports: + - port: 3000 + targetPort: 3000 + nodePort: 32309 +>>>>>>> Stashed changes diff --git a/grafana/run.sh b/grafana/run.sh index a8674af..c8e0f08 100755 --- a/grafana/run.sh +++ b/grafana/run.sh @@ -1,5 +1,6 @@ #!/bin/bash +<<<<<<< Updated upstream source "utils/cachengo.sh" source "grafana/grafana-configmap.yaml" source "grafana/grafana-deployment.yaml" @@ -8,10 +9,13 @@ source "grafana/grafana-pvc.yaml" source "grafana/grafana-service.yaml" +======= +>>>>>>> Stashed changes function do_install { set -e cachengo-cli updateInstallStatus "$APPID" "Installing" +<<<<<<< Updated upstream if [ -n "$NAMESPACE_NAME" ]; then kubectl create namespace $NAMESPACE_NAME @@ -33,6 +37,15 @@ function do_install { fi +======= + kubectl create namespace $APPID + + sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-configmap.yaml + sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-deployment.yaml + sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-ingress.yaml + sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-service.yaml + sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-pvc.yaml +>>>>>>> Stashed changes kubectl apply -f grafana/grafana-configmap.yaml kubectl apply -f grafana/grafana-deployment.yaml @@ -45,11 +58,21 @@ function do_install { function do_uninstall { cachengo-cli updateInstallStatus "$APPID" "Uninstalling" +<<<<<<< Updated upstream kubectl delete -f grafana/grafana-configmap.yaml kubectl delete -f grafana/grafana-deployment.yaml kubectl delete -f grafana/grafana-ingress.yaml kubectl delete -f grafana/grafana-service.yaml kubectl delete -f grafana/grafana-pvc.yaml +======= + kubectl delete -f grafana/grafana-ingress.yaml -n $APPID + kubectl delete -f grafana/grafana-service.yaml -n $APPID + kubectl delete -f grafana/grafana-deployment.yaml -n $APPID + kubectl delete -f grafana/grafana-pvc.yaml -n $APPID + kubectl delete -f grafana/grafana-configmap.yaml -n $APPID + + kubectl delete namespace $APPID +>>>>>>> Stashed changes cachengo-cli updateInstallStatus "$APPID" "Uninstalled" } diff --git a/utils/docker.sh b/utils/docker.sh index 5820817..7872a31 100644 --- a/utils/docker.sh +++ b/utils/docker.sh @@ -16,4 +16,10 @@ function delete_network { function container_state { echo "$( docker container inspect -f '{{.State.Status}}' $1 )" +} + +function get_host { + HOST_NAME=$(hostname) + + echo "$HOST_NAME" } \ No newline at end of file From 74fb422eb038daab72e8444ed781e66f05b215af Mon Sep 17 00:00:00 2001 From: Raul Negron Date: Tue, 31 Jan 2023 18:42:33 -0400 Subject: [PATCH 3/3] added appid as namespace --- grafana/grafana-configmap.yaml | 24 --------------- grafana/grafana-deployment.yaml | 52 --------------------------------- grafana/grafana-ingress.yaml | 22 -------------- grafana/grafana-pvc.yaml | 28 ------------------ grafana/grafana-service.yaml | 19 ------------ grafana/run.sh | 43 --------------------------- 6 files changed, 188 deletions(-) diff --git a/grafana/grafana-configmap.yaml b/grafana/grafana-configmap.yaml index 2fcff1b..c97998e 100644 --- a/grafana/grafana-configmap.yaml +++ b/grafana/grafana-configmap.yaml @@ -1,26 +1,3 @@ -<<<<<<< Updated upstream -apiVersion: v1 -kind: ConfigMap -metadata: - name: grafana-datasources - namespace: #namespace_name# -data: - prometheus.yaml: |- - { - "apiVersion": 1, - "datasources": [ - { - "access":"proxy", - "editable": true, - "name": "prometheus", - "orgId": 1, - "type": "prometheus", - "url": "http://prometheus-service.monitoring.svc:8080", - "version": 1 - } - ] - } -======= apiVersion: v1 kind: ConfigMap metadata: @@ -42,4 +19,3 @@ data: } ] } ->>>>>>> Stashed changes diff --git a/grafana/grafana-deployment.yaml b/grafana/grafana-deployment.yaml index 77307a2..10d86b7 100644 --- a/grafana/grafana-deployment.yaml +++ b/grafana/grafana-deployment.yaml @@ -1,54 +1,3 @@ -<<<<<<< Updated upstream -apiVersion: apps/v1 -kind: Deployment -metadata: - name: grafana - namespace: #namespace_name# -spec: - replicas: 1 - selector: - matchLabels: - app: grafana - template: - metadata: - name: grafana - labels: - app: grafana - spec: - containers: - - name: grafana - image: grafana/grafana:latest - ports: - - name: grafana - containerPort: 3000 - resources: - limits: - memory: "1Gi" - cpu: "1000m" - requests: - memory: 500M - cpu: "500m" - volumeMounts: - - mountPath: /var/lib/grafana - name: grafana-storage - - mountPath: /etc/grafana/provisioning/datasources - name: grafana-datasources - readOnly: false - volumes: - - name: grafana-storage - persistentVolumeClaim: - claimName: grafana-storage - - name: grafana-datasources - persistentVolumeClaim: - claimName: grafana-datasources - initContainers: - - name: volume-mount-hack - image: busybox - command: ["sh", "-c", "chown -R 472:472 /var/lib/grafana"] - volumeMounts: - - name: grafana-storage - mountPath: /var/lib/grafana -======= apiVersion: apps/v1 kind: Deployment metadata: @@ -98,4 +47,3 @@ spec: volumeMounts: - name: grafana-storage mountPath: /var/lib/grafana ->>>>>>> Stashed changes diff --git a/grafana/grafana-ingress.yaml b/grafana/grafana-ingress.yaml index 3a309e6..32a2315 100644 --- a/grafana/grafana-ingress.yaml +++ b/grafana/grafana-ingress.yaml @@ -1,24 +1,3 @@ -<<<<<<< Updated upstream -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: grafana - namespace: #namespace_name# - annotations: - kubernetes.io/ingress.class: "nginx" -spec: - rules: - - host: grafana.mybento.local - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: grafana - port: - number: 3000 -======= apiVersion: networking.k8s.io/v1 kind: Ingress metadata: @@ -38,4 +17,3 @@ spec: name: grafana port: number: 3000 ->>>>>>> Stashed changes diff --git a/grafana/grafana-pvc.yaml b/grafana/grafana-pvc.yaml index ec6de6e..16b75e6 100644 --- a/grafana/grafana-pvc.yaml +++ b/grafana/grafana-pvc.yaml @@ -1,30 +1,3 @@ -<<<<<<< Updated upstream -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: grafana-storage - namespace: #namespace_name# -spec: - storageClassName: longhorn - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: grafana-datasources - namespace: #namespace_name# -spec: - storageClassName: longhorn - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi -======= apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -50,4 +23,3 @@ spec: resources: requests: storage: 1Gi ->>>>>>> Stashed changes diff --git a/grafana/grafana-service.yaml b/grafana/grafana-service.yaml index 65ee977..60e323f 100644 --- a/grafana/grafana-service.yaml +++ b/grafana/grafana-service.yaml @@ -1,21 +1,3 @@ -<<<<<<< Updated upstream -apiVersion: v1 -kind: Service -metadata: - name: grafana - namespace: #namespace_name# - annotations: - prometheus.io/scrape: 'true' - prometheus.io/port: '3000' -spec: - selector: - app: grafana - type: NodePort - ports: - - port: 3000 - targetPort: 3000 - nodePort: 32309 -======= apiVersion: v1 kind: Service metadata: @@ -32,4 +14,3 @@ spec: - port: 3000 targetPort: 3000 nodePort: 32309 ->>>>>>> Stashed changes diff --git a/grafana/run.sh b/grafana/run.sh index c8e0f08..d220f1c 100755 --- a/grafana/run.sh +++ b/grafana/run.sh @@ -1,43 +1,9 @@ #!/bin/bash -<<<<<<< Updated upstream -source "utils/cachengo.sh" -source "grafana/grafana-configmap.yaml" -source "grafana/grafana-deployment.yaml" -source "grafana/grafana-ingress.yaml" -source "grafana/grafana-pvc.yaml" -source "grafana/grafana-service.yaml" - - -======= ->>>>>>> Stashed changes function do_install { set -e cachengo-cli updateInstallStatus "$APPID" "Installing" -<<<<<<< Updated upstream - if [ -n "$NAMESPACE_NAME" ]; then - - kubectl create namespace $NAMESPACE_NAME - sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" grafana/grafana-configmap.yaml - sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" grafana/grafana-deployment.yaml - sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" grafana/grafana-ingress.yaml - sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" grafana/grafana-service.yaml - sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" grafana/grafana-pvc.yaml - - - else - - sed -i "s|#namespace_name#|default|g" grafana/grafana-configmap.yaml - sed -i "s|#namespace_name#|default|g" grafana/grafana-deployment.yaml - sed -i "s|#namespace_name#|default|g" grafana/grafana-ingress.yaml - sed -i "s|#namespace_name#|default|g" grafana/grafana-service.yaml - sed -i "s|#namespace_name#|default|g" grafana/grafana-pvc.yaml - - - fi - -======= kubectl create namespace $APPID sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-configmap.yaml @@ -45,7 +11,6 @@ function do_install { sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-ingress.yaml sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-service.yaml sed -i "s|#namespace_name#|$APPID|g" grafana/grafana-pvc.yaml ->>>>>>> Stashed changes kubectl apply -f grafana/grafana-configmap.yaml kubectl apply -f grafana/grafana-deployment.yaml @@ -58,13 +23,6 @@ function do_install { function do_uninstall { cachengo-cli updateInstallStatus "$APPID" "Uninstalling" -<<<<<<< Updated upstream - kubectl delete -f grafana/grafana-configmap.yaml - kubectl delete -f grafana/grafana-deployment.yaml - kubectl delete -f grafana/grafana-ingress.yaml - kubectl delete -f grafana/grafana-service.yaml - kubectl delete -f grafana/grafana-pvc.yaml -======= kubectl delete -f grafana/grafana-ingress.yaml -n $APPID kubectl delete -f grafana/grafana-service.yaml -n $APPID kubectl delete -f grafana/grafana-deployment.yaml -n $APPID @@ -72,7 +30,6 @@ function do_uninstall { kubectl delete -f grafana/grafana-configmap.yaml -n $APPID kubectl delete namespace $APPID ->>>>>>> Stashed changes cachengo-cli updateInstallStatus "$APPID" "Uninstalled" }