diff --git a/infra/README.md b/infra/README.md index 1f69b97..d25329e 100644 --- a/infra/README.md +++ b/infra/README.md @@ -2,34 +2,42 @@ If you require a private repository access you must create a secret containing Github Deploy Key ``` -oc create secret generic retail-git-ssh-key --from-file=ssh-privatekey=--type=kubernetes.io/ssh-auth +oc create secret generic retail-git-ssh-key --from-file=ssh-privatekey= --type=kubernetes.io/ssh-auth ``` Create BuildConfigs and ImageTags: ``` -$ oc apply -f ocp-buildconfigs.yaml +oc apply -f ocp-buildconfigs.yaml ``` Verify build configs have been created: ``` -$ oc get buildconfigs +oc get buildconfigs +``` +``` NAME TYPE FROM LATEST prediction-service-build Docker Git@develop-pl 0 recommendation-service-build Docker Git@develop-pl 0 ``` Verify ImageTags have been created in your project: +```bash +oc get is +``` ``` -$ oc get is NAME IMAGE REPOSITORY TAGS UPDATED prediction-service default-route-openshift-image-registry.apps.red.ocp.public/retail/prediction-service recommendation-service default-route-openshift-image-registry.apps.red.ocp.public/retail/recommendation-service ``` Manually trigger the images builds: -``` -$ oc start-build prediction-service-build -$ oc start-build recommendation-service-build +```bash +oc start-build customer-simulation-service +oc start-build prediction-service +oc start-build recommendation-service +oc start-build visualization-service ``` Wait for the builds to complete: +```bash +oc get builds --watch +``` ``` -$ oc get builds --watch NAME TYPE FROM STATUS STARTED DURATION prediction-service-build-1 Docker Git@develop-pl Running 5 seconds ago prediction-service-build-1 Docker Git@72d19cf Running 12 seconds ago @@ -44,8 +52,10 @@ prediction-service-build-1 Docker Git@72d19cf Complete About a mi ``` See if the ImageTags have been updated: +```bash +oc get is +``` ``` -$ oc get is NAME IMAGE REPOSITORY TAGS UPDATED prediction-service default-route-openshift-image-registry.apps.red.ocp.public/retail/prediction-service latest 1 minutes ago recommendation-service default-route-openshift-image-registry.apps.red.ocp.public/retail/recommendation-service latest 1 minutes ago @@ -53,12 +63,14 @@ recommendation-service default-route-openshift-image-registry.apps.red.ocp.pub ### Deploy the solution using Helm Charts Edit the `values.yaml` file and configure your workload parameters: -``` -$ vim retail-helm-charts/values.yaml +```bash +vim retail-helm-chart/values.yaml ``` Install the Chart with Helm: +```bash +helm install retail retail-helm-chart/ +``` ``` -helm install retail retail-helm-charts/ NAME: retail LAST DEPLOYED: 2021-04-07 14:52:49.839391 +0000 UTC m=+0.078141486 NAMESPACE: retail @@ -66,8 +78,10 @@ STATUS: deployed ``` Verify all pods are Running and in a Ready: +```bash +oc get all +``` ``` -$ oc get all NAME READY STATUS RESTARTS AGE pod/postgres-5f549f5798-9qz72 1/1 Running 0 68s pod/prediction-6d8d96776c-fpcjn 1/1 Running 0 67s @@ -105,4 +119,4 @@ imagestream.image.openshift.io/recommendation-service default-route-openshift- NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD route.route.openshift.io/prediction-external prediction-external-retail.apps.red.ocp.public prediction-svc prediction-port None route.route.openshift.io/recommendation-external recommendation-external-retail.apps.red.ocp.public recommendation-svc recommendation-port None -``` \ No newline at end of file +``` diff --git a/infra/ocp-buildconfigs.yaml b/infra/ocp-buildconfigs.yaml index e627636..aa3f319 100644 --- a/infra/ocp-buildconfigs.yaml +++ b/infra/ocp-buildconfigs.yaml @@ -112,36 +112,4 @@ spec: local: false --- -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - name: kafka2mqtt-bridge -spec: - source: - type: Git - sourceSecret: - name: retail-git-ssh-key - git: - uri: 'git@github.com:pgrabusz/retailstoreofthefuture.git' - ref: kafka-mqtt-bridge # temporary - contextDir: kafka-mqtt-bridge/ - strategy: - type: Docker - dockerStrategy: - dockerfilePath: src/main/docker/Dockerfile.multistage - env: - - name: "DOCKER_BUILDKIT" - value: "1" - output: - to: - kind: ImageStreamTag - name: 'kafka2mqtt-bridge:latest' ---- -apiVersion: image.openshift.io/v1 -kind: ImageStream -metadata: - name: kafka2mqtt-bridge -spec: - lookupPolicy: - local: false diff --git a/infra/retail-helm-chart/templates/kafka-mqtt-bridge/_bridge_helper.tpl b/infra/retail-helm-chart/templates/kafka-mqtt-bridge/_bridge_helper.tpl deleted file mode 100644 index 6cbae7c..0000000 --- a/infra/retail-helm-chart/templates/kafka-mqtt-bridge/_bridge_helper.tpl +++ /dev/null @@ -1,37 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "bridge.name" -}} -{{- .Values.predictionService.nameOverride | default "bridge" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "bridge.labels" -}} -helm.sh/chart: {{ include "global.chart" . }} -{{ include "bridge.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "bridge.selectorLabels" -}} -app.kubernetes.io/name: {{ include "bridge.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "bridge.serviceAccountName" -}} -{{- if .Values.predictionService.serviceAccount.create }} -{{- .Values.predictionService.serviceAccount.name | default (include "bridge.name" .) }}-serviceaccount -{{- else }} -{{- .Values.predictionService.serviceAccount.name | default "default" }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/infra/retail-helm-chart/templates/kafka-mqtt-bridge/bridge-deployment.yaml b/infra/retail-helm-chart/templates/kafka-mqtt-bridge/bridge-deployment.yaml deleted file mode 100644 index d3b0964..0000000 --- a/infra/retail-helm-chart/templates/kafka-mqtt-bridge/bridge-deployment.yaml +++ /dev/null @@ -1,42 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - {{- include "bridge.labels" . | nindent 4 }} - name: {{ include "bridge.name" . }} -spec: - replicas: 1 - selector: - matchLabels: - {{- include "bridge.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - {{- include "bridge.selectorLabels" . | nindent 8 }} - spec: - serviceAccount: {{ include "bridge.serviceAccountName" . }} - containers: - - name: bridge - image: {{ .Values.kafka2mqttBridge.image }} - env: - - name: KAFKA_BOOTSTRAP_SERVERS - value: {{ join "," .Values.globalInfra.kafka.bootstrapServers | quote }} - - name: KAFKA_TOPIC - value: {{ .Values.globalInfra.kafka.couponPredictionTopic | default "predictionsTopic" | quote }} - - name: MQTT_HOST - value: {{ .Values.globalInfra.mqtt.brokerServer | quote }} - {{- if .Values.globalInfra.mqtt.brokerPort }} - - name: MQTT_PORT - value: {{ .Values.globalInfra.mqtt.brokerPort | quote }} - {{- end }} - ports: - - containerPort: 80 - redinessProbe: - tcpSocket: - port: 80 - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /hello - port: 80 \ No newline at end of file diff --git a/infra/retail-helm-chart/templates/kafka-mqtt-bridge/bridge-sa.yaml b/infra/retail-helm-chart/templates/kafka-mqtt-bridge/bridge-sa.yaml deleted file mode 100644 index f9b4fcb..0000000 --- a/infra/retail-helm-chart/templates/kafka-mqtt-bridge/bridge-sa.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.postgres.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "bridge.serviceAccountName" . }} - labels: - {{- include "bridge.labels" . | nindent 4 }} - {{- with .Values.recommendationService.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/infra/retail-helm-chart/values.yaml b/infra/retail-helm-chart/values.yaml index f1a4100..4318d6e 100644 --- a/infra/retail-helm-chart/values.yaml +++ b/infra/retail-helm-chart/values.yaml @@ -28,7 +28,7 @@ globalInfra: # sslBrokerCaCertPath: "files/broker.pem" # set to true if MQTT requires username, password authentication, default: false - authenticationEnabled: true + authenticationEnabled: false # MQTT client username user: admin @@ -36,10 +36,10 @@ globalInfra: password: password # name or IP address of the MQTT broker - brokerServer: ex-aao-mqtt-1-svc.retail-infra.svc.cluster.local + brokerServer: ex-aao-mqtt-notls-0-svc.retail-infra.svc.cluster.local # port that MQTT broker is listening on, default: 1883 - brokerPort: 8883 + brokerPort: 1883 # MQTT topic for entering events enterTopic: "retail/mqttEntryTopic" @@ -81,7 +81,7 @@ postgres: recommendationService: # recommendation service docker image - image: image-registry.openshift-image-registry.svc:5000/retail-helm/recommendation-service:latest + image: image-registry.openshift-image-registry.svc:5000/rsotf/recommendation-service:latest # number of recommendation service replicas replicas: 2 @@ -123,7 +123,7 @@ recommendationService: predictionService: # prediction service docker image - image: image-registry.openshift-image-registry.svc:5000/retail-helm/prediction-service:latest + image: image-registry.openshift-image-registry.svc:5000/rsotf/prediction-service:latest # number of prediction service replicas replicas: 2 @@ -153,7 +153,7 @@ predictionService: customerSimulationService: # customer simulation service docker image - image: image-registry.openshift-image-registry.svc:5000/retail-helm/customer-simulation-service:latest + image: image-registry.openshift-image-registry.svc:5000/rsotf/customer-simulation-service:latest # number of customer simulations service replicas replicas: 1 @@ -180,7 +180,7 @@ customerSimulationService: visualization: # visualization simulation service docker image - image: image-registry.openshift-image-registry.svc:5000/retail-helm/visualization-service:latest + image: image-registry.openshift-image-registry.svc:5000/rsotf/visualization-service:latest # visualization service type, default: ClusterIP # serviceType: ClusterIP @@ -194,13 +194,3 @@ visualization: # additional service account annotations annotations: {} -kafka2mqttBridge: - # visualization simulation service docker image - image: image-registry.openshift-image-registry.svc:5000/retail-helm/kafka2mqtt-bridge:latest - - serviceAccount: - # create separate service account for customer simulation service - create: true - # additional service account annotations - annotations: {} -