Skip to content

Commit

Permalink
Added installation and configuration of Ditto Extended API
Browse files Browse the repository at this point in the history
  • Loading branch information
juliarobles committed Feb 6, 2024
1 parent e9e4af6 commit faa6756
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 2 deletions.
50 changes: 50 additions & 0 deletions OpenTwins/templates/extended-api/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{- if and .Values.extendedAPI.enabled (or ((.Values.extendedAPI.ditto).uri) .Values.ditto.enabled) }}

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-ditto-extended-api
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
selector:
matchLabels:
app.kubernetes.io/name: {{ .Release.Name }}-ditto-extended-api
replicas: 1
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Release.Name }}-ditto-extended-api
spec:
containers:
- name: ditto-extended-api
image: ertis/ditto-extended-api:latest
imagePullPolicy: Always
env:
- name: HOST
value: "localhost"
- name: PORT
value: "{{ .Values.extendedAPI.service.port }}"
- name: MONGO_URI_POLICIES
value: {{- if ((.Values.extendedAPI.mongodb).uri) }} {{ .Values.extendedAPI.mongodb.uri }} {{- else }} mongodb://{{ include "opentwins.mongodb.fullname" . }}/policies {{- end }}
- name: DITTO_URI_THINGS
value: {{- if ((.Values.extendedAPI.ditto).uri) }} {{ .Values.extendedAPI.ditto.uri }} {{- else }} http://{{ include "opentwins.ditto.fullname" . }}-nginx:{{ .Values.ditto.nginx.service.port }} {{- end}}
- name: DITTO_USERNAME_API
value: {{ coalesce ((((.Values.extendedAPI.ditto).credentials).basic).user) .Values.ditto.global.basicAuthUsers.ditto.user "ditto" }}
- name: DITTO_PASSWORD_API
value: {{ coalesce ((((.Values.extendedAPI.ditto).credentials).basic).password) .Values.ditto.global.basicAuthUsers.ditto.password "ditto" }}
- name: DITTO_USERNAME_DEVOPS
value: {{ coalesce ((((.Values.extendedAPI.ditto).credentials).devops).user) "devops" }}
- name: DITTO_PASSWORD_DEVOPS
value: {{ coalesce ((((.Values.extendedAPI.ditto).credentials).devops).password) .Values.ditto.gateway.config.authentication.devops.devopsPassword "foobar" }}
- name: ALL_LOGS
value: {{ coalesce .Values.extendedAPI.allLogs false }}
imagePullPolicy: Always
ports:
- containerPort: 8080
protocol: TCP

{{- end }}
20 changes: 20 additions & 0 deletions OpenTwins/templates/extended-api/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if and .Values.extendedAPI.enabled (or ((.Values.extendedAPI.ditto).uri) .Values.ditto.enabled) }}

apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-ditto-extended-api
labels:
app.kubernetes.io/name: {{ .Release.Name }}-ditto-extended-api
spec:
type: NodePort
ports:
- name: http
nodePort: {{ .Values.extendedAPI.service.nodePort }}
port: {{ .Values.extendedAPI.service.port }}
protocol: TCP
targetPort: {{ .Values.extendedAPI.service.port }}
selector:
app.kubernetes.io/name: {{ .Release.Name }}-ditto-extended-api

{{- end }}
2 changes: 2 additions & 0 deletions OpenTwins/templates/secrets/mongodb-connection.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.ditto.enabled}}
{{- if or .Values.mongodb.enabled .Values "OpenTwins-MongoDB" "fullnameOverride" }}
{{- $mongoName := include "opentwins.mongodb.fullname" . -}}

Expand All @@ -19,3 +20,4 @@ data:
policies-uri: {{ .Values.ditto.dbconfig.policies.uri | replace "#{PLACEHOLDER_MONGODB_HOSTNAME}#" $mongoName | b64enc | quote }}

{{- end }}
{{- end }}
31 changes: 29 additions & 2 deletions OpenTwins/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ mosquitto:
# OpenTwins recommended values for Kafka
##################################################################
kafka:
enabled: true
enabled: false



Expand Down Expand Up @@ -247,8 +247,35 @@ mongodb:
enabled: false


# OpenTwins recommended values for Ditto Extended API
##################################################################
extendedAPI:
enabled: true
allLogs: false
service:
port: 8080
nodePort: 30526
# ----------------------------------------------
# If you want to use another instance of Eclipse Ditto or configure it manually
#
# ditto:
# uri: http://research.adabyron.uma.es:8047
# credentials:
# basic:
# user: ditto
# password: ditto
# devops:
# user: devops
# password: foobar
# ----------------------------------------------
# If you use another mongodb and you want to query all the policies
#
# mongodb:
# uri: mongodb://localhost:30185/policies



# OpenTwins recommended values for ertis MongoDB
# OpenTwins recommended values for ERTIS MongoDB
##################################################################
OpenTwins-MongoDB:
enabled: false # Value added by OpenTwins to indicate if this component should be installed or not
Expand Down

0 comments on commit faa6756

Please sign in to comment.