Skip to content

Commit

Permalink
refactor core-apps Helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
ortwinschneider committed Jan 15, 2021
1 parent 5224e96 commit 3022d7a
Show file tree
Hide file tree
Showing 22 changed files with 129 additions and 145 deletions.
35 changes: 24 additions & 11 deletions helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,49 +13,62 @@ All other Helm charts are optional.

## Set up Bobbycar from the Git repo

1. Clone the Bobbycar repo and navigate to helm subfolder
### 1. Clone the Bobbycar repo and navigate to helm subfolder

```sh
git clone https://github.com/sa-mw-dach/bobbycar.git

cd bobbycar/helm/
```

2. Create a namespace
### 2. Create the namespace where you want to install the Bobbycar demo

```sh
oc new-project bobbycar
```

3. Edit the operator-group.yaml to match the correct namespace and apply.
### 3. Edit the operator-group.yaml to match the correct namespace and apply the file.

```sh
oc apply -f operator-group.yaml
```

4. Install *bobbycar-core-infra* chart
### 4. Install the *bobbycar-core-infra* Helm chart

Edit the chart values.yaml and install the chart

**Adjusting these fields to your environement is mandatory:**
- ocpDomain
- namespace

You can leave the others as default values if you like.

Edit the bobbycar-core-infra Helm chart values.yaml, optionally validate the templates and install the chart

``` sh
vi bobbycar-core-infra/values.yaml

helm template bobbycar-core-infra/

helm install bobbycar-core-infra/ -g
```

Wait for around 2 minutes and verify that all components have been successfully installed.

5. Install *bobbycar-core-apps* chart
### 5. Install *bobbycar-core-apps* chart

Edit the bobbycar-core-apps Helm chart values.yaml, optionally validate the templates and install the chart.
Edit the chart values.yaml and install the chart.

**Adjusting these fields to your environement is mandatory:**
- ocpDomain
- ocpApi
- namespace
- datagrid.account.password
- dashboard.config.googleApiKey

Get the datagrid password from the **bobbycar-dg-generated-secret** secret.

You can leave the others as default values if you like.
```sh
vi bobbycar-core-apps/values.yaml

helm template bobbycar-core-apps/

helm install bobbycar-core-apps/ -g
```
Verify that all components have been successfully installed.
Expand Down
2 changes: 1 addition & 1 deletion helm/bobbycar-core-apps/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ version: 0.1.0
# 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: 4.5.18
appVersion: 4.5.24

sources:
- https://github.com/sa-mw-dach/bobbycar
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: camel.apache.org/v1
kind: Integration
metadata:
name: {{ .Values.cacheService.name }}
name: cache-service
labels:
app.kubernetes.io/part-of: {{ .Values.appName }}
spec:
configuration:
- type: secret
value: {{ .Values.cacheService.name }}-secret
value: cache-service-secret
dependencies:
- 'camel:undertow'
- 'camel:infinispan'
Expand Down
8 changes: 4 additions & 4 deletions helm/bobbycar-core-apps/templates/cacheService-route.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: {{ .Values.cacheService.name }}
name: cache-service
labels:
camel.apache.org/integration: {{ .Values.cacheService.name }}
camel.apache.org/integration: cache-service
spec:
host: {{ .Values.cacheService.name }}-{{ .Values.namespace }}.{{ .Values.ocpDomain }}
host: cache-service-{{ .Values.namespace }}.{{ .Values.ocpDomain }}
to:
kind: Service
name: {{ .Values.cacheService.name }}
name: cache-service
weight: 100
port:
targetPort: http
Expand Down
12 changes: 6 additions & 6 deletions helm/bobbycar-core-apps/templates/cacheService-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
kind: Secret
apiVersion: v1
metadata:
name: {{ .Values.cacheService.name }}-secret
name: cache-service-secret
stringData:
application.properties: |-
com.redhat.bobbycar.camelk.dg.car.cacheName: {{ .Values.kafka2datagrid.datagrid.cache.car }}
com.redhat.bobbycar.camelk.dg.zone.cacheName: {{ .Values.kafka2datagrid.datagrid.cache.zone }}
com.redhat.bobbycar.camelk.dg.host: {{ .Values.kafka2datagrid.datagrid.account.host }}
com.redhat.bobbycar.camelk.dg.password: {{ .Values.kafka2datagrid.datagrid.account.password }}
com.redhat.bobbycar.camelk.dg.user: {{ .Values.kafka2datagrid.datagrid.account.user }}
com.redhat.bobbycar.camelk.dg.car.cacheName: {{ .Values.datagrid.cache.car }}
com.redhat.bobbycar.camelk.dg.zone.cacheName: {{ .Values.datagrid.cache.zone }}
com.redhat.bobbycar.camelk.dg.host: bobbycar-dg
com.redhat.bobbycar.camelk.dg.password: {{ .Values.datagrid.account.password }}
com.redhat.bobbycar.camelk.dg.user: {{ .Values.datagrid.account.user }}
type: Opaque
6 changes: 3 additions & 3 deletions helm/bobbycar-core-apps/templates/cacheService-svc.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
kind: Service
apiVersion: v1
metadata:
name: {{ .Values.cacheService.name }}
name: cache-service
labels:
camel.apache.org/generation: '1'
camel.apache.org/integration: {{ .Values.cacheService.name }}
camel.apache.org/integration: cache-service
camel.apache.org/service.type: user
spec:
ports:
Expand All @@ -13,6 +13,6 @@ spec:
port: 80
targetPort: http
selector:
camel.apache.org/integration: {{ .Values.cacheService.name }}
camel.apache.org/integration: cache-service
type: ClusterIP
sessionAffinity: None
16 changes: 8 additions & 8 deletions helm/bobbycar-core-apps/templates/car-simulator-dc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,23 @@ spec:
- name: mp.messaging.incoming.zonechange.type
value: 'smallrye-mqtt'
- name: mp.messaging.incoming.zonechange.topic
value: {{ .Values.carSimulator.config.mqttZoneChangeTopic | quote }}
value: {{ .Values.mqtt.topic.mqttZoneChangeTopic | quote }}
- name: mp.messaging.incoming.zonechange.host
value: {{ .Values.carSimulator.config.mqttHost | quote }}
value: 'bobbycar-amq-mqtt-all-0-svc'
- name: mp.messaging.incoming.zonechange.port
value: {{ .Values.carSimulator.config.mqttPort | quote }}
value: '61616'
- name: com.redhat.bobbycar.carsim.datagrid.url
value: 'http://{{ .Values.cacheService.name }}-{{ .Values.namespace }}.{{ .Values.ocpDomain }}'
value: 'http://cache-service-{{ .Values.namespace }}.{{ .Values.ocpDomain }}'
- name: com.redhat.bobbycar.carsim.kafka.url
value: 'http://{{ .Values.carSimulator.config.kafkaBridgeServiceUrl }}'
value: 'http://bobbycar-{{ .Values.namespace }}.{{ .Values.ocpDomain }}'
- name: mp.messaging.outgoing.enginemetrics.type
value: 'smallrye-mqtt'
- name: mp.messaging.outgoing.enginemetrics.topic
value: {{ .Values.carSimulator.config.mqttMetricsTopic | quote }}
value: {{ .Values.mqtt.topic.mqttMetricsTopic | quote }}
- name: mp.messaging.outgoing.enginemetrics.host
value: {{ .Values.carSimulator.config.mqttHost | quote }}
value: 'bobbycar-amq-mqtt-all-0-svc'
- name: mp.messaging.outgoing.enginemetrics.port
value: {{ .Values.carSimulator.config.mqttPort | quote }}
value: '61616'
ports:
- containerPort: 8080
name: http
Expand Down
4 changes: 2 additions & 2 deletions helm/bobbycar-core-apps/templates/dashboard-bc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
labels:
app: {{ .Values.dashboard.name }}
name: {{ .Values.dashboard.name }}
app: dashboard
name: dashboard
namespace: {{ .Values.namespace }}
spec:
failedBuildsHistoryLimit: 5
Expand Down
8 changes: 4 additions & 4 deletions helm/bobbycar-core-apps/templates/dashboard-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ data:
"GOOGLE_API_KEY": "{{ .Values.dashboard.config.googleApiKey }}",
"BOBBYCAR_API_KEY": "{{ .Values.dashboard.config.threeScaleApiKey }}",
"SSE_ENDPOINT": "",
"CAR_EVENTS_ENDPOINT": "ws://{{ .Values.dashboardService.name }}-{{ .Values.namespace }}.{{ .Values.ocpDomain }}/api/carevents?sendToAll=true",
"CAR_METRICS_ENDPOINT": "ws://{{ .Values.dashboardService.name }}-{{ .Values.namespace }}.{{ .Values.ocpDomain }}/api/carmetrics?sendToAll=true",
"CAR_ZONECHANGE_ENDPOINT": "ws://{{ .Values.dashboardService.name }}-{{ .Values.namespace }}.{{ .Values.ocpDomain }}/api/zonechange?sendToAll=true",
"CACHE_ENDPOINT": "http://{{ .Values.cacheService.name }}-{{ .Values.namespace }}.{{ .Values.ocpDomain }}"
"CAR_EVENTS_ENDPOINT": "ws://dashboard-streaming-service-{{ .Values.namespace }}.{{ .Values.ocpDomain }}/api/carevents?sendToAll=true",
"CAR_METRICS_ENDPOINT": "ws://dashboard-streaming-service-{{ .Values.namespace }}.{{ .Values.ocpDomain }}/api/carmetrics?sendToAll=true",
"CAR_ZONECHANGE_ENDPOINT": "ws://dashboard-streaming-service-{{ .Values.namespace }}.{{ .Values.ocpDomain }}/api/zonechange?sendToAll=true",
"CACHE_ENDPOINT": "http://cache-service-{{ .Values.namespace }}.{{ .Values.ocpDomain }}"
}
12 changes: 6 additions & 6 deletions helm/bobbycar-core-apps/templates/dashboard-dc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ kind: DeploymentConfig
metadata:
labels:
app.kubernetes.io/part-of: {{ .Values.appName }}
name: {{ .Values.dashboard.name }}
name: dashboard
namespace: {{ .Values.namespace }}
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
component: {{ .Values.dashboard.name }}
deploymentconfig: {{ .Values.dashboard.name }}
component: dashboard
deploymentconfig: dashboard
strategy:
activeDeadlineSeconds: 21600
resources: {}
Expand All @@ -24,13 +24,13 @@ spec:
template:
metadata:
labels:
component: {{ .Values.dashboard.name }}
deploymentconfig: {{ .Values.dashboard.name }}
component: dashboard
deploymentconfig: dashboard
spec:
containers:
- image: dashboard:latest
#imagePullPolicy: Always
name: {{ .Values.dashboard.name }}
name: dashboard
ports:
- containerPort: 8080
protocol: TCP
Expand Down
4 changes: 2 additions & 2 deletions helm/bobbycar-core-apps/templates/dashboard-is.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
labels:
app: {{ .Values.dashboard.name }}
name: {{ .Values.dashboard.name }}
app: dashboard
name: dashboard
namespace: {{ .Values.namespace }}
spec:
lookupPolicy:
Expand Down
8 changes: 4 additions & 4 deletions helm/bobbycar-core-apps/templates/dashboard-route.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ apiVersion: route.openshift.io/v1
kind: Route
metadata:
labels:
app: {{ .Values.dashboard.name }}
name: {{ .Values.dashboard.name }}
app: dashboard
name: dashboard
namespace: {{ .Values.namespace }}
spec:
host: {{ .Values.dashboard.name }}-{{ .Values.namespace }}.{{ .Values.ocpDomain }}
host: dashboard-{{ .Values.namespace }}.{{ .Values.ocpDomain }}
port:
targetPort: 8080-tcp
to:
kind: Service
name: {{ .Values.dashboard.name }}
name: dashboard
weight: 100
wildcardPolicy: None
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apiVersion: camel.apache.org/v1
kind: Integration
metadata:
name: {{ .Values.dashboardService.name }}
name: dashboard-streaming-service
labels:
app.kubernetes.io/part-of: {{ .Values.appName }}
spec:
profile: OpenShift
configuration:
- type: secret
value: {{ .Values.dashboardService.name }}-secret
value: dashboard-streaming-service-secret
sources:
- content: {{`"package com.redhat.bobbycar.routes;\nimport org.apache.camel.builder.RouteBuilder;\n\npublic class KafkaSseRoute extends RouteBuilder {\n\t\n\t@Override\n\tpublic void configure() throws Exception {\n\n\t\t// expose Bobbycar GPS positions from Kafka as Websocket\n\t\tfrom(\"kafka:{{com.redhat.bobbycar.camelk.kafka.topic.gps}}?clientId=kafkaSseCamelClient&brokers={{com.redhat.bobbycar.camelk.kafka.brokers}}\")\n\t\t\t.log(\"GPS position received from Kafka : ${body}\")\n\t\t\t.to(\"undertow:ws://0.0.0.0:8080/api/carevents?sendToAll=true\");\n\t\tfrom(\"undertow:ws://0.0.0.0:8080/api/carevents?sendToAll=true\")\n\t\t\t.log(\"Message received from Websocket : ${body}\");\n\n\t\t// expose Bobbycar engine metrics from Kafka as Websocket\n\t\tfrom(\"kafka:{{com.redhat.bobbycar.camelk.kafka.topic.metrics}}?clientId=kafkaSseMetricsClient&brokers={{com.redhat.bobbycar.camelk.kafka.brokers}}\")\n\t\t\t.log(\"Metric received from Kafka : ${body}\")\n\t\t\t.to(\"undertow:ws://0.0.0.0:8080/api/carmetrics?sendToAll=true\");\n\t\tfrom(\"undertow:ws://0.0.0.0:8080/api/carmetrics?sendToAll=true\")\n\t\t\t.log(\"Message received from Websocket : ${body}\");\n\n\t\t// expose Bobbycar zone change events from Kafka as Websocket\n\t\tfrom(\"kafka:{{com.redhat.bobbycar.camelk.kafka.topic.zonechange}}?clientId=kafkaSseZoneChangeClient&brokers={{com.redhat.bobbycar.camelk.kafka.brokers}}\")\n\t\t\t\t.log(\"Zone change event received from Kafka : ${body}\")\n\t\t\t\t.to(\"undertow:ws://0.0.0.0:8080/api/zonechange?sendToAll=true\");\n\t\tfrom(\"undertow:ws://0.0.0.0:8080/api/zonechange?sendToAll=true\")\n\t\t\t\t.log(\"Message received from Websocket : ${body}\");\n\t\t\n\t}\n\t\n\t\n}\n"`}}
name: KafkaSseRoute.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: {{ .Values.dashboardService.name }}
name: dashboard-streaming-service
labels:
camel.apache.org/integration: {{ .Values.dashboardService.name }}
camel.apache.org/integration: dashboard-streaming-service
spec:
host: {{ .Values.dashboardService.name }}-{{ .Values.namespace }}.{{ .Values.ocpDomain }}
host: dashboard-streaming-service-{{ .Values.namespace }}.{{ .Values.ocpDomain }}
to:
kind: Service
name: {{ .Values.dashboardService.service.name }}
name: dashboard-streaming-service
weight: 100
port:
targetPort: http
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
kind: Secret
apiVersion: v1
metadata:
name: {{ .Values.dashboardService.name }}-secret
name: dashboard-streaming-service-secret
stringData:
application.properties: |-
com.redhat.bobbycar.camelk.kafka.brokers: {{ .Values.dashboardService.kafka.host }}
com.redhat.bobbycar.camelk.kafka.topic.gps: {{ .Values.dashboardService.kafka.topicGps }}
com.redhat.bobbycar.camelk.kafka.topic.metrics: {{ .Values.dashboardService.kafka.topicMetrics }}
com.redhat.bobbycar.camelk.kafka.topic.zonechange: {{ .Values.dashboardService.kafka.topicZoneChange }}
com.redhat.bobbycar.camelk.kafka.brokers: bobbycar-cluster-kafka-brokers:9092
com.redhat.bobbycar.camelk.kafka.topic.gps: {{ .Values.kafka.topic.gps }}
com.redhat.bobbycar.camelk.kafka.topic.metrics: {{ .Values.kafka.topic.metrics }}
com.redhat.bobbycar.camelk.kafka.topic.zonechange: {{ .Values.kafka.topic.zonechange }}
type: Opaque


Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
kind: Service
apiVersion: v1
metadata:
name: {{ .Values.dashboardService.service.name }}
name: dashboard-streaming-service
labels:
camel.apache.org/generation: '1'
camel.apache.org/integration: {{ .Values.dashboardService.name }}
camel.apache.org/integration: dashboard-streaming-service
camel.apache.org/service.type: user
spec:
ports:
Expand All @@ -13,6 +13,6 @@ spec:
port: 80
targetPort: http
selector:
camel.apache.org/integration: {{ .Values.dashboardService.name }}
camel.apache.org/integration: dashboard-streaming-service
type: ClusterIP
sessionAffinity: None
6 changes: 3 additions & 3 deletions helm/bobbycar-core-apps/templates/dashboard-svc.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.dashboard.name }}
name: dashboard
namespace: {{ .Values.namespace }}
spec:
ports:
Expand All @@ -10,7 +10,7 @@ spec:
protocol: TCP
targetPort: 8080
selector:
component: {{ .Values.dashboard.name }}
deploymentconfig: {{ .Values.dashboard.name }}
component: dashboard
deploymentconfig: dashboard
sessionAffinity: None
type: ClusterIP
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: camel.apache.org/v1
kind: Integration
metadata:
name: {{ .Values.kafka2datagrid.name }}
name: kafka2datagrid
labels:
app.kubernetes.io/part-of: {{ .Values.appName }}
spec:
Expand Down
Loading

0 comments on commit 3022d7a

Please sign in to comment.