-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Grafana dashboards and update doc
1. Add Grafana dashboards 2. Change deployment files arrangements and manifest generation and maintenance 3. Add documentation for flow-visibility solution Signed-off-by: heanlan <hanlan@vmware.com>
- Loading branch information
Showing
27 changed files
with
10,211 additions
and
724 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: "clickhouse.altinity.com/v1" | ||
kind: "ClickHouseInstallation" | ||
metadata: | ||
name: clickhouse | ||
labels: | ||
app: clickhouse | ||
spec: | ||
configuration: | ||
clusters: | ||
- name: "clickhouse" | ||
layout: | ||
shardsCount: 1 | ||
replicasCount: 1 | ||
defaults: | ||
templates: | ||
podTemplate: pod-template | ||
templates: | ||
podTemplates: | ||
- name: pod-template | ||
spec: | ||
containers: | ||
- name: clickhouse | ||
image: yandex/clickhouse-server:21.11 | ||
volumeMounts: | ||
- name: clickhouse-configmap-volume | ||
mountPath: /docker-entrypoint-initdb.d | ||
volumes: | ||
- name: clickhouse-configmap-volume | ||
configMap: | ||
name: $(CH_CONF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: flow-visibility | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: grafana | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
labels: | ||
app: flow-visibility | ||
name: grafana-role | ||
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 | ||
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 | ||
spec: | ||
storageClassName: grafana-storage | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: grafana-pv | ||
spec: | ||
storageClassName: grafana-storage | ||
capacity: | ||
storage: 2Gi | ||
accessModes: | ||
- ReadWriteOnce | ||
hostPath: | ||
path: "/data/grafana" | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: clickhouse-secret | ||
type: Opaque | ||
stringData: | ||
username: clickhouse_operator | ||
password: clickhouse_operator_password | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: grafana | ||
name: grafana | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: grafana | ||
template: | ||
metadata: | ||
labels: | ||
app: grafana | ||
spec: | ||
serviceAccountName: grafana | ||
securityContext: | ||
fsGroup: 472 | ||
supplementalGroups: | ||
- 0 | ||
containers: | ||
- name: grafana | ||
image: grafana/grafana:8.3.3 | ||
imagePullPolicy: IfNotPresent | ||
env: | ||
- name: GF_INSTALL_PLUGINS | ||
value: "https://downloads.antrea.io/artifacts/grafana-custom-plugins/grafana-sankey-plugin-1.0.0.zip;antreaflowvisibility-grafana-sankey-plugin,grafana-clickhouse-datasource 0.12.0" | ||
- name: CH_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: clickhouse-secret | ||
key: username | ||
- name: CH_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: clickhouse-secret | ||
key: password | ||
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-datasource-provider | ||
- mountPath: /etc/grafana/provisioning/dashboards | ||
name: grafana-dashboard-provider | ||
- mountPath: /var/lib/grafana/dashboards | ||
name: grafana-dashboard-config | ||
volumes: | ||
- name: grafana-pv | ||
persistentVolumeClaim: | ||
claimName: grafana-pvc | ||
- name: grafana-datasource-provider | ||
configMap: | ||
name: grafana-datasource-provider | ||
- name: grafana-dashboard-provider | ||
configMap: | ||
name: grafana-dashboard-provider | ||
- name: grafana-dashboard-config | ||
configMap: | ||
name: grafana-dashboard-config | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: grafana | ||
spec: | ||
ports: | ||
- port: 3000 | ||
protocol: TCP | ||
targetPort: http-grafana | ||
selector: | ||
app: grafana | ||
sessionAffinity: None | ||
type: LoadBalancer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: flow-visibility | ||
|
||
resources: | ||
- clickhouse.yaml | ||
- grafana.yaml | ||
|
||
configMapGenerator: | ||
- name: grafana-datasource-provider | ||
files: | ||
- provisioning/datasources/datasource_provider.yaml | ||
- name: grafana-dashboard-provider | ||
files: | ||
- provisioning/dashboards/dashboard_provider.yaml | ||
- name: clickhouse-mounted-configmap | ||
namespace: flow-visibility | ||
files: | ||
- provisioning/datasources/create_table.sh | ||
- name: grafana-dashboard-config | ||
files: | ||
- provisioning/dashboards/flow_records_dashboard.json | ||
- provisioning/dashboards/pod_to_pod_dashboard.json | ||
- provisioning/dashboards/pod_to_service_dashboard.json | ||
- provisioning/dashboards/pod_to_external_dashboard.json | ||
- provisioning/dashboards/node_to_node_dashboard.json | ||
- provisioning/dashboards/networkpolicy_allow_dashboard.json | ||
|
||
# CH_CONF exports the value in `metadata.name` from `ConfigMap` named `clickhouse-mounted-configmap`, | ||
# which is used for inserting the value to a CRD for an object of kind `ClickHouseInstallation` | ||
vars: | ||
- name: CH_CONF | ||
objref: | ||
kind: ConfigMap | ||
name: clickhouse-mounted-configmap | ||
apiVersion: v1 | ||
fieldref: | ||
fieldpath: metadata.name | ||
|
||
configurations: | ||
- kustomize-config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This file defines the resource and the field that Kustomize need to look up for | ||
# the value of var `CH_CONF` | ||
varReference: | ||
- path: spec/templates/podTemplates/spec/volumes/configMap/name | ||
kind: ClickHouseInstallation |
8 changes: 8 additions & 0 deletions
8
build/yamls/flow-visibility/base/provisioning/dashboards/dashboard_provider.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: 1 | ||
providers: | ||
- name: grafana-dashboards | ||
folder: '' | ||
type: file | ||
allowUiUpdates: true | ||
options: | ||
path: /var/lib/grafana/dashboards |
Oops, something went wrong.