Skip to content

Commit

Permalink
add grafana and clickhoue deployment file
Browse files Browse the repository at this point in the history
  • Loading branch information
zyiou committed Nov 30, 2021
1 parent 363f2d8 commit 8be8ec8
Show file tree
Hide file tree
Showing 16 changed files with 13,621 additions and 0 deletions.
14 changes: 14 additions & 0 deletions build/yamls/flow-visibility/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Altinity Clickhouse operator is used to handle deployment of Clickhouse, run following command to create components for operator:

```shell script
kubectl apply -f https://raw.githubusercontent.com/Altinity/clickhouse-operator/master/deploy/operator/clickhouse-operator-install-bundle.yaml
```

Then we are able to create deployments for Clickhouse and Grafana:

```shell script
kubectl apply -f build/yamls/flow-visibility/flow-visibility.yaml
```

Grafana dashboard is exposed as a Nodeport Service, which can be accessed via
`http://[NodeIP]: [ServicePort]`.
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:7.5.2
imagePullPolicy: IfNotPresent
env:
- name: GF_INSTALL_PLUGINS
value: "https://github.com/zyiou/grafana-custom-plugin/releases/download/1.0.5/grafana-custom-plugin.zip;dewyeo-grafana-custom-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
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 8be8ec8

Please sign in to comment.