Skip to content

Commit

Permalink
Fix deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusH authored and amotl committed May 18, 2024
1 parent 63ad40c commit f6019f4
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 150 deletions.
1 change: 1 addition & 0 deletions src/data_generator/examples/grafana_demo_live/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
manifest.yaml
10 changes: 10 additions & 0 deletions src/data_generator/examples/grafana_demo_live/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Deployment

In order for K8s to access the data generator Docker image, the `image-pull-cr8` secret is needed. This is replicated from the `templates` namespace.

The data generator uses the `admin` user and access the corresponding password from the K8s secret.

```console
$ j2cli -c grafana_config_map.yml k8s_deploy_grafana_demo_data.yml > manifest.yaml
$ kubectl --context k8s.westeurope.azure apply -f manifest.yaml
```
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
kubernetes:
name: grafana-demo-data
namespace: 00768a8e-14ea-4daa-bc38-592bf1486d85

version: latest
version: v0.1.2

ID_START: 1
ID_END: 150

db:
crateuri: https://grafana-demo-1.westeurope.azure.cratedb.net:4200

credentials:
username: admin
password_k8s_secret: user-password-35e75e5f-5308-4e98-999d-2be9d2fa47af-0
138 changes: 0 additions & 138 deletions src/data_generator/examples/grafana_demo_live/grafana_demo_model.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,177 @@
---
kind: ConfigMap
apiVersion: v1
metadata:
labels:
k8s-app: datagenerator
app.kubernetes.io/name: "{{ kubernetes.name }}"
name: "datamodel"
namespace: "{{ kubernetes.namespace }}"
data:
grafana_demo_model.json: |
{
"grafana_demo_values": {
"tags": {
"factory": 2,
"machine": 10,
"sensor": "id"
},
"metrics": {
"temperature": {
"key": {
"value": "temperature"
},
"type": {
"value": "FLOAT"
},
"min": {
"value": 50
},
"max": {
"value": 200
},
"mean": {
"value": 125
},
"stdev": {
"value": 5
},
"variance": {
"value": 0.5
},
"error_rate": {
"value": 0.00001
},
"error_length": {
"value": 2.07
}
},
"fluid_level": {
"key": {
"value": "fluid_level"
},
"type": {
"value": "FLOAT"
},
"min": {
"value": 85
},
"max": {
"value": 100
},
"mean": {
"value": 92
},
"stdev": {
"value": 1
},
"variance": {
"value": 0.01
},
"error_rate": {
"value": 0.0001
},
"error_length": {
"value": 2.07
}
},
"humidity": {
"key": {
"value": "humidity"
},
"type": {
"value": "FLOAT"
},
"min": {
"value": 30
},
"max": {
"value": 60
},
"mean": {
"value": 45
},
"stdev": {
"value": 1
},
"variance": {
"value": 0.01
},
"error_rate": {
"value": 0.0001
},
"error_length": {
"value": 2.07
}
},
"pressure": {
"key": {
"value": "pressure"
},
"type": {
"value": "FLOAT"
},
"min": {
"value": 0
},
"max": {
"value": 50
},
"mean": {
"value": 37
},
"stdev": {
"value": 1
},
"variance": {
"value": 0.01
},
"error_rate": {
"value": 0.0001
},
"error_length": {
"value": 5
}
},
"broken": {
"key": {
"value": "broken"
},
"type": {
"value": "BOOL"
},
"true_ratio": {
"value": 0.01
}
}
}
}
}
---
apiVersion: v1
kind: Secret
metadata:
name: image-pull-cr8
namespace: "{{ kubernetes.namespace }}"
labels:
app.kubernetes.io/name: image-pull-cr8
app.kubernetes.io/part-of: cratedb
app.kubernetes.io/managed-by: replicator
annotations:
replicator.v1.mittwald.de/replicate-from: "templates/image-pull-cr8"
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: "e30K" # empty {}

---
apiVersion: batch/v1
kind: Job
metadata:
labels:
k8s-app: datagenerator
app.kubernetes.io/name: {{ kubernetes.name }}
name: dg-{{ ID_START }}
app.kubernetes.io/name: "{{ kubernetes.name }}"
name: "dg-{{ ID_START }}"
namespace: "{{ kubernetes.namespace }}"
spec:
backoffLimit: 0
Expand All @@ -16,13 +183,13 @@ spec:
prometheus.io/path: "/metrics"
labels:
k8s-app: datagenerator
app.kubernetes.io/name: {{ kubernetes.name }}
app.kubernetes.io/name: "{{ kubernetes.name }}"
spec:
imagePullSecrets:
- name: image-pull-cr8
containers:
- name: datagenerator
image: registry.cr8.net/data-generator:{{ version }}
image: "registry.cr8.net/data-generator:{{ version }}"
ports:
- containerPort: 8000
protocol: TCP
Expand All @@ -43,7 +210,7 @@ spec:
- name: ID_END
value: "{{ ID_END }}"
- name: HOST
value: {{ db.crateuri }}
value: "{{ db.crateuri }}"
- name: INGEST_MODE
value: "0"
- name: INGEST_SIZE
Expand All @@ -57,17 +224,17 @@ spec:
- name: SHARDS
value: "4"
- name: USERNAME
valueFrom:
secretKeyRef:
name: datagenerator
key: crate_user
value: "{{ credentials.username }}"
- name: PASSWORD
valueFrom:
secretKeyRef:
name: datagenerator
key: crate_password
name: "{{ credentials.password_k8s_secret }}"
key: password
restartPolicy: Never
volumes:
- name: datamodel
configMap:
name: datamodel
items:
- key: grafana_demo_model.json
path: grafana_demo_model.json

0 comments on commit f6019f4

Please sign in to comment.