Skip to content

Added sink connector #5

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

Open
wants to merge 90 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
6ab2ef9
Updated grafana operator
subkanthi Sep 5, 2023
c40e7aa
Added grafana dashboard and data source
subkanthi Sep 5, 2023
a53974d
Changed grafana dashboard apiVersion to v1beta1
subkanthi Sep 5, 2023
032f783
Added grafana dashboards from clickhouse operator.
subkanthi Sep 6, 2023
affe933
Fixed grafana datasource for grafana operator.
subkanthi Sep 6, 2023
bd03621
Fixed grafana datasource for grafana operator.
subkanthi Sep 6, 2023
4d40b19
Fixed crd name in grafana datasource.
subkanthi Sep 6, 2023
eb61a22
Added spec.instanceSelector to all grafana.
subkanthi Sep 6, 2023
7a65433
Added service to clickhouseInstallation so that the datasource can be…
subkanthi Sep 6, 2023
4c573c4
Removed type Loadbalancer for CH service.
subkanthi Sep 6, 2023
f80bba9
Removed type Loadbalancer for CH service.
subkanthi Sep 6, 2023
066af83
Updated clickhouse service endpoint for grafana datasource.
subkanthi Sep 6, 2023
6ae68a1
Updated grafana username/password to non admin user.
subkanthi Sep 6, 2023
4bcc0c7
Update clickhouse service endpoint.
subkanthi Sep 7, 2023
92a3b01
Update clickhouse service endpoint.
subkanthi Sep 7, 2023
0066d21
Removed array as datasource.
subkanthi Sep 7, 2023
3d3bc58
Added authentication to grafana datasource.
subkanthi Sep 7, 2023
fb5a14d
set argocd sync waves to different apps.
subkanthi Sep 7, 2023
6a4aec8
Updated grafana datasource URL and username/password.
subkanthi Sep 8, 2023
013e63d
Added prometheus target and scrape config.
subkanthi Sep 8, 2023
c2d9ae0
Set sync-wave priority to -2 for prometheus operator.
subkanthi Sep 8, 2023
9b9b5b7
Separate out prometheus operator and prometheus manifest files.
subkanthi Sep 8, 2023
4aba6e1
Add prometheus operator CRD helm chart.
subkanthi Sep 8, 2023
f8f2c24
Add prometheus operator CRD helm chart.
subkanthi Sep 8, 2023
927741c
Fixed create-stack.sh
subkanthi Sep 8, 2023
e40379d
Set synch wave priority for prometheus.
subkanthi Sep 8, 2023
36e4786
Add serverSideApply flag for prometheus operator CRD to workaround th…
subkanthi Sep 8, 2023
269a47b
Add argocd annotation to replace long CRD name.
subkanthi Sep 8, 2023
efd5955
fixed namespace in prometheus operator crd.
subkanthi Sep 8, 2023
3328b19
Added kustomization.yaml to install prometheus CRDs
subkanthi Sep 8, 2023
2047f0f
Removed prometheus helm chart.
subkanthi Sep 8, 2023
363fdd4
Added gitignore
subkanthi Sep 10, 2023
91d7f19
Added stripped down CRD for prometheus operator
subkanthi Sep 11, 2023
06a2246
Removed kustomization.yaml for prometheus operator
subkanthi Sep 11, 2023
4100392
enable helm chart and move stripped down crd to templates folder.
subkanthi Sep 12, 2023
ad03e97
Added documentation.
subkanthi Sep 19, 2023
eb94b70
Add prometheus operator argocd application manifest.
subkanthi Sep 20, 2023
db84ffc
Add bundle.yaml to install prometheus operator.
subkanthi Sep 20, 2023
c426e96
Remove CRD definition from prometheus operator manifest.
subkanthi Sep 20, 2023
189fc3e
Added Prometheus operator RBAC settings.
subkanthi Sep 25, 2023
03a3246
Set namespace for prometheus Role binding.
subkanthi Sep 25, 2023
78e52dc
Set namespace for prometheus Role and service account.
subkanthi Sep 25, 2023
0cd2ab4
Set namespace for prometheus Role and service account.
subkanthi Sep 25, 2023
4149939
Set Prometheus datasource in Grafana to prometheus:9090
subkanthi Sep 27, 2023
0a5e7ac
Updated README and delete-stack-apps.sh to include prometheus-rbac.
subkanthi Sep 27, 2023
2d1d09a
Merged changes from main
subkanthi Sep 27, 2023
26eccc1
Added instructions for grafana port-forwarding and opening UI.
subkanthi Sep 27, 2023
0404d5b
Added script to install Argo CD.
subkanthi Sep 27, 2023
637bf7b
Updated instructions in README.md
subkanthi Sep 27, 2023
5c01d47
Removed namespace references in grafana and clickhouse
subkanthi Oct 5, 2023
28298f9
reverted back namespace in prometheus operator
subkanthi Oct 5, 2023
cf9947e
Removed creating prometheus namespace.
subkanthi Oct 5, 2023
dd10948
Reverted namespace back to clickhouse pod metrics and grafana.
subkanthi Oct 5, 2023
1369a38
Removed grafana_crd.yaml
subkanthi Oct 5, 2023
e7ad36e
Removed namespace for prometheus operator.
subkanthi Oct 5, 2023
5c96a08
Removed namespace for prometheus RBAC.
subkanthi Oct 6, 2023
1911df5
Removed namespace for prometheus RBAC.
subkanthi Oct 6, 2023
4818249
reverted back namespace settings in prometheus-rbac.
subkanthi Oct 6, 2023
2b6c578
Updated sync-apps script.
subkanthi Oct 6, 2023
49ae0c5
Add missing namespace for prometeheus-operator
subkanthi Oct 6, 2023
756f78b
updated instructions for create-stack.sh with revision.
subkanthi Oct 6, 2023
bce9f3c
Add mysql operator crds.
subkanthi Oct 10, 2023
e198db8
Updated mysql operator CRDs
subkanthi Oct 10, 2023
8467bee
Updated path of mysql operator CRD
subkanthi Oct 10, 2023
b1caa1c
Created mysql operator application.
subkanthi Oct 10, 2023
2c684d4
Added mysql instance.
subkanthi Oct 11, 2023
e10099e
Added annotation to sync CRD mysql.
subkanthi Oct 11, 2023
7309c57
Added annotation to sync CRD mysql.
subkanthi Oct 11, 2023
73ba397
specify directory recurse to install yaml files for CRD
subkanthi Oct 11, 2023
c768e60
Remove filename in mysql operator
subkanthi Oct 11, 2023
8ab6006
Remove filename in mysql operator
subkanthi Oct 11, 2023
0ba178e
Remove filename in mysql operator
subkanthi Oct 11, 2023
39ef855
Remove filename in mysql operator
subkanthi Oct 11, 2023
10138f5
Remove filename in mysql operator
subkanthi Oct 11, 2023
9ac0493
copy over Mysql operator CRD
subkanthi Oct 11, 2023
9911e06
Added username/password to mysql operator.
subkanthi Oct 12, 2023
4f46a5f
Add explicit namespace to application manifest.
subkanthi Oct 12, 2023
31b46a0
Added mysql operator deploy.
subkanthi Oct 12, 2023
6ef06b1
use sync-waves to install secret for mysql(innodbcluster before insta…
subkanthi Oct 12, 2023
c543b7c
set password and username.
subkanthi Oct 12, 2023
fe2ae84
switched to use bitspoke mysql operator(Oracle operator throws error …
subkanthi Oct 12, 2023
216da53
Add mysql manifest.
subkanthi Oct 16, 2023
10473e7
Change MySQL version to 8.0
subkanthi Oct 17, 2023
58b6c5f
Change mysql docker image to bitnami mysql 8.0
subkanthi Oct 17, 2023
cd5d3be
Added sink connector application manifest, removed mysql operator and…
subkanthi Oct 19, 2023
8a7d030
Add sink connector to create/delete etl scripts.
subkanthi Oct 19, 2023
1e318b3
Set sink connector path and repoUrl.
subkanthi Oct 19, 2023
f898b1b
Add sink connector lightweight helm chart.
subkanthi Oct 19, 2023
ddc4ef2
Update configuration variables for sink connector.
subkanthi Nov 7, 2023
998873f
Set image tag for sink connector
subkanthi Nov 7, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ You'll need a Kubernetes cluster. EKS, GKE, or minikube should all be OK.

Install the following tools in your environment. ArgoCD should be installed
in the argocd namespace.
You can use the script
```
./install-argocd.sh
```

```
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
```
* [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl)
* [argocd](https://argo-cd.readthedocs.io/en/stable/getting_started/)
* [kustomize](https://kubectl.docs.kubernetes.io/installation/kustomize/)
Expand All @@ -21,16 +29,35 @@ kubectl get ns

## Login to ArgoCD

ArgoCD default password can be retrieved from k8s secrets
```
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
```
All commands with argocd require an accessible ArgoCD API endpoint and a
valid token. Get them as follows.
```
kubectl port-forward svc/argocd-server -n argocd 8080:443 &
argocd login localhost:8080 --username=admin --password="yourpassword" --insecure
```

You can also use the script.
```
./login-argocd.sh
```
## Bring up the analytic stack

Run the `create-stack.sh` script in the apps directory.
If you need to the run changes from a specific branch
use the following command
```
./create-stack.sh -b <branch-name>
```

To run the ETL stack with MySQL, Clickhouse sink connector
use the following command
```
./create-stack-mysql-etl.sh -b <branch-name>
```

## Make endpoints accessible

Expand All @@ -48,3 +75,37 @@ following steps to clean up fully.

1. Run 'kubectl edit' on any chi resource and remove the finalizer.
2. Drop the namespace.

### Grafana (Manual steps)
The admin password can be reset by executing the following command on the grafana pod.
```
grafana-cli admin reset-admin-password admin
```

The `admin` password is stored in `grafana-admin-credentials` secret.
```
kubectl get secret grafana-admin-credentials --template={{.data.GF_SECURITY_ADMIN_PASSWORD}} -n ch|base64 -d
```

Open the grafana UI by setting up port-forward on the grafana pod.
```
kubectl port-forward -n ch svc/grafana-service 3000:3000
```
Login as admin and the password retrieved in the previous step.

### Prometheus Operator
ArgoCD has a bug where the prometheus operator CRD cannot be installed
because of the `CRD too long` error.
This is a known issue with ArgoCD. See
https://github.com/prometheus-community/helm-charts/issues/2479
To work around this, stripped down CRDs are used.
`make stripped-down-crd` will generate the stripped down CRDs in prometheus operator.


## ArgoCD SyncWaves
App of Apps pattern
https://codefresh.io/blog/argo-cd-application-dependencies/
https://redhat-scholars.github.io/argocd-tutorial/argocd-tutorial/04-syncwaves-hooks.html

## ToDO (Use sops to encrypt passwords)
https://cloud.redhat.com/blog/a-guide-to-gitops-and-secret-management-with-argocd-operator-and-sops
4 changes: 4 additions & 0 deletions apps/clickhouse-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ version: 0.21.2
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: "1.0"

metadata:
annotations:
argocd.argoproj.io/sync-wave: "0"

dependencies:
- name: altinity-clickhouse-operator
version: 0.21.2
Expand Down
72 changes: 71 additions & 1 deletion apps/clickhouse/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
## Prometheus operator podMonitor
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: clickhouse-metrics
namespace: ch
labels:
app: prometheus
spec:
namespaceSelector:
matchNames:
- test
selector:
matchLabels:
clickhouse.altinity.com/app: chop
podMetricsEndpoints:
- port: "metrics"

---

apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: "argocd"
annotations:
argocd.argoproj.io/sync-wave: "3"
spec:
configuration:
settings:
# listen clickhosue-server embedded prometheus endpoint
prometheus/endpoint: /metrics
prometheus/port: 9363
prometheus/metrics: true
prometheus/events: true
prometheus/asynchronous_metrics: true
prometheus/status_info: true
clusters:
- name: "demo"
layout:
Expand Down Expand Up @@ -32,11 +62,21 @@ spec:
- host: zookeeper
templates:
podTemplates:
- name: pod-template-with-metrics
metadata:
# for `additionalScrapeConfigs`, look https://github.com/Altinity/clickhouse-operator/blob/master/deploy/prometheus/prometheus-template.yaml#L11
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "9363"
- name: server
spec:
containers:
- name: clickhouse
image: altinity/clickhouse-server:23.3.8.22.altinitystable
image: altinity/clickhouse-server:22.3.15.34.altinitystable
ports:
- name: "metrics"
containerPort: 9363
volumeClaimTemplates:
- name: storage
# Do not delete PVC if installation is dropped.
Expand All @@ -47,3 +87,33 @@ spec:
resources:
requests:
storage: 50Gi
---
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: "clickhouse-service"
annotations:
argocd.argoproj.io/sync-wave: "3"
spec:
defaults:
templates:
serviceTemplate: svc-template
configuration:
settings:
http_port: 8124
tcp_port: 9001
interserver_http_port: 9010
templates:
serviceTemplates:
- name: svc-template
generateName: chendpoint-{chi}
metadata:
labels:
custom.label: "custom.value"
spec:
ports:
- name: http
port: 8123
- name: tcp
port: 9000
type: ClusterIP
20 changes: 20 additions & 0 deletions apps/grafana-datasource/datasource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#apiVersion: grafana.integreatly.org/v1beta1
#kind: GrafanaDatasource
#metadata:
# name: clickhouse-grafana-datasource
# namespace: ch
#spec:
# datasource:
# access: proxy
# type: vertamedia-clickhouse-datasource
# jsonData:
# timeInterval: 5s
# tlsSkipVerify: true
# name: clickhouse
# url: http://clickhouse:8123
# instanceSelector:
# matchLabels:
# dashboards: grafana
# plugins:
# - name: vertamedia-clickhouse-datasource
# version: 1.3.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
name: clickhouse-keeper-dashboard
labels:
app: grafana
spec:
instanceSelector:
matchLabels:
dashboards: "grafana"
url: https://raw.githubusercontent.com/Altinity/clickhouse-operator/master/grafana-dashboard/ClickHouseKeeper_dashboard.json
datasources:
- inputName: "DS_PROMETHEUS"
datasourceName: clickhouse-operator-prometheus
# look to https://github.com/integr8ly/grafana-operator/issues/416#issuecomment-849498860, json used as fallback
json: ""
15 changes: 15 additions & 0 deletions apps/grafana-datasource/grafana-dashboard-kafka-cr-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
name: clickhouse-kafka-dashboard
labels:
app: grafana
spec:
instanceSelector:
matchLabels:
dashboards: "grafana"
url: https://raw.githubusercontent.com/Altinity/clickhouse-operator/master/grafana-dashboard/Kafka_dashboard.json
json: ""
datasources:
- inputName: "DS_PROMETHEUS"
datasourceName: clickhouse-operator-prometheus
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
name: "clickhouse-operator-dashboard"
labels:
app: grafana
spec:
instanceSelector:
matchLabels:
dashboards: "grafana"
url: https://raw.githubusercontent.com/Altinity/clickhouse-operator/master/grafana-dashboard/Altinity_ClickHouse_Operator_dashboard.json
# look to https://github.com/integr8ly/grafana-operator/issues/416#issuecomment-849498860, json used as fallback
json: ""
datasources:
- inputName: "DS_PROMETHEUS"
datasourceName: clickhouse-operator-prometheus
# TODO remove this plugin definition after resolve https://github.com/integr8ly/grafana-operator/issues/155
plugins:
- name: "vertamedia-clickhouse-datasource"
version: "2.5.3"
- name: "grafana-piechart-panel"
version: "1.6.2"
19 changes: 19 additions & 0 deletions apps/grafana-datasource/grafana-dashboard-queries-cr-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
name: "clickhouse-queries-dashboard"
labels:
app: grafana
spec:
instanceSelector:
matchLabels:
dashboards: "grafana"
url: https://raw.githubusercontent.com/Altinity/clickhouse-operator/master/grafana-dashboard/ClickHouse_Queries_dashboard.json
# look to https://github.com/integr8ly/grafana-operator/issues/416#issuecomment-849498860, json used as fallback
json: ""
datasources:
- inputName: "DS_PROMETHEUS"
datasourceName: "clickhouse-operator-prometheus"
plugins:
- name: "vertamedia-clickhouse-datasource"
version: "2.5.3"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
name: "zookeeper-dashboard"
labels:
app: grafana
spec:
instanceSelector:
matchLabels:
dashboards: "grafana"
url: https://raw.githubusercontent.com/Altinity/clickhouse-operator/master/grafana-dashboard/Zookeeper_dashboard.json
# look to https://github.com/integr8ly/grafana-operator/issues/416#issuecomment-849498860, json used as fallback
json: ""
datasources:
- inputName: "DS_PROMETHEUS"
datasourceName: "clickhouse-operator-prometheus"
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDatasource
metadata:
name: clickhouse-datasource
spec:
instanceSelector:
matchLabels:
dashboards: "grafana"
datasource:
name: "clickhouse"
type: vertamedia-clickhouse-datasource
access: proxy
url: "http://chi-argocd-demo-0-0:8123"
basicAuth: false
basicAuthUser: "root"
basicAuthPassword: "secretsecret"
isDefault: false
version: 1
editable: true
jsonData:
tlsSkipVerify: true
addCorsHeader: true
defaultDatabase: "default"
usePOST: true
useYandexCloudAuthorization: true
xHeaderUser: "root"
xHeaderKey: "secretsecret"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDatasource
metadata:
name: "clickhouse-grafana-datasource"
spec:
instanceSelector:
matchLabels:
dashboards: "grafana"
datasource:
name: "clickhouse-operator-prometheus"
type: prometheus
access: proxy
url: "http://prometheus:9090"
isDefault: true
version: 1
editable: false
jsonData:
tlsSkipVerify: true
timeInterval: "5s"
14 changes: 7 additions & 7 deletions apps/prometheus/Chart.yaml → apps/grafana-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: prometheus
name: grafana-operator
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
Expand All @@ -15,14 +15,14 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 23.1.0
version: 0.1.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: "1.0"
# It is recommended to use it with quotes.
appVersion: "v5.3.0"

dependencies:
- name: prometheus
version: 23.1.0
repository: https://prometheus-community.github.io/helm-charts/
metadata:
annotations:
argocd.argoproj.io/sync-wave: "4"
Loading