Skip to content

Commit

Permalink
add grafana and clickhouse deployment file
Browse files Browse the repository at this point in the history
This PR is for adding deployment file and custom plugin for Grafana
configuration and setup for Clickhouse, which are the UI solution
and database solution for flow visibility long term architecture.

Signed-off-by: zyiou <[email protected]>
  • Loading branch information
zyiou committed Jan 11, 2022
1 parent 2ee6ad1 commit 403a5c0
Show file tree
Hide file tree
Showing 17 changed files with 14,033 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build_grafana_plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build, sign and upload grafana sankey plugin

on:
release:
types:
- created
jobs:
build-grafana-sankey-plugin:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Build and sign plugin
env:
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY}}
TAG: ${{ github.ref }}
run: |
cd ./plugins/grafana-sankey-plugin
yarn install --pure-lockfile
yarn build
npx @grafana/toolkit plugin:sign --rootUrls http://localhost:3000
zip grafana-sankey-plugin.zip dist -r
- name: Upload grafana-sankey-plugin zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./plugins/grafana-sankey-plugin/grafana-sankey-plugin.zip
asset_name: 'grafana-sankey-plugin.zip'
asset_content_type: application/zip
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ bin
.idea/
.vscode/
vendor

plugins/grafana-sankey-plugin/node_modules/
plugins/grafana-sankey-plugin/dist/
plugins/grafana-sankey-plugin/coverage/
195 changes: 195 additions & 0 deletions build/yamls/flow-visibility/flow-visibility.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
app: flow-visibility
name: flow-visibility
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: flow-visibility
name: flow-visibility
namespace: flow-visibility
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app: flow-visibility
name: grafana-role
namespace: flow-visibility
rules:
- apiGroups:
- ""
resources:
- services
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app: flow-visibility
name: grafana-role-binding
namespace: flow-visibility
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: grafana-role
subjects:
- kind: ServiceAccount
name: grafana
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: grafana-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Delete
allowVolumeExpansion: True
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: grafana-pvc
namespace: flow-visibility
spec:
storageClassName: grafana-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: grafana-pv
namespace: flow-visibility
spec:
storageClassName: grafana-storage
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/data/grafana"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-datasource
namespace: flow-visibility
data:
datasource.yaml: |-
apiVersion: 1
datasources:
- name: ClickHouse
type: vertamedia-clickhouse-datasource
access: proxy
url: http://clickhouse-clickhouse.flow-visibility.svc:8123
editable: true
jsonData:
useYandexCloudAuthorization: true
xHeaderUser: clickhouse_operator
xHeaderKey: clickhouse_operator_password
---
apiVersion: clickhouse.altinity.com/v1
kind: ClickHouseInstallation
metadata:
name: clickhouse
namespace: flow-visibility
spec:
configuration:
clusters:
- name: clickhouse
layout:
shardsCount: 1
replicasCount: 1
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: grafana
name: grafana
namespace: flow-visibility
spec:
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
securityContext:
fsGroup: 472
supplementalGroups:
- 0
containers:
- name: grafana
image: grafana/grafana:8.3.3
imagePullPolicy: IfNotPresent
env:
- name: GF_INSTALL_PLUGINS
value: "https://github.com/antrea-io/antrea/releases/download/v1.5.0/grafana-sankey-plugin;antreaflowvisibility-grafana-sankey-plugin,vertamedia-clickhouse-datasource"
ports:
- containerPort: 3000
name: http-grafana
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /robots.txt
port: 3000
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 2
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 3000
timeoutSeconds: 1
resources:
requests:
cpu: 250m
memory: 750Mi
volumeMounts:
- mountPath: /data
name: grafana-pv
- mountPath: /etc/grafana/provisioning/datasources
name: grafana-datasources
volumes:
- name: grafana-pv
persistentVolumeClaim:
claimName: grafana-pvc
- name: grafana-datasources
configMap:
name: grafana-datasource
---
apiVersion: v1
kind: Service
metadata:
name: grafana
namespace: flow-visibility
spec:
ports:
- port: 3000
protocol: TCP
targetPort: http-grafana
selector:
app: grafana
sessionAffinity: None
type: LoadBalancer
3 changes: 3 additions & 0 deletions plugins/grafana-sankey-plugin/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require('@grafana/toolkit/src/config/prettier.plugin.config.json'),
};
5 changes: 5 additions & 0 deletions plugins/grafana-sankey-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.0.0 (Unreleased)

Initial release.
Loading

0 comments on commit 403a5c0

Please sign in to comment.