-
Notifications
You must be signed in to change notification settings - Fork 64
[hono] Add support for JDBC device registry #164
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| {{- if and .Values.deviceRegistryExample.enabled ( eq .Values.deviceRegistryExample.type "jdbc" ) }} | ||
| # | ||
| # Copyright (c) 2020 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Eclipse Public License 2.0 which is available at | ||
| # http://www.eclipse.org/legal/epl-2.0 | ||
| # | ||
| # SPDX-License-Identifier: EPL-2.0 | ||
| # | ||
| {{- $args := dict "dot" . "component" "service-device-registry" "name" "service-device-registry" }} | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| {{- include "hono.metadata" $args | nindent 2 }} | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| {{- include "hono.matchLabels" $args | nindent 6 }} | ||
| template: | ||
| metadata: | ||
| {{- include "hono.metadata" $args | nindent 6 }} | ||
| spec: | ||
| containers: | ||
| {{- include "hono.jaeger.agent" . | indent 6 }} | ||
| - image: {{ include "hono.image" ( dict "dot" . "component" .Values.deviceRegistryExample.jdbcBasedDeviceRegistry ) }} | ||
| imagePullPolicy: IfNotPresent | ||
| name: eclipse-hono-service-device-registry | ||
| ports: | ||
| - name: health | ||
| containerPort: {{ .Values.healthCheckPort }} | ||
| protocol: TCP | ||
| - name: http | ||
| containerPort: 8080 | ||
| protocol: TCP | ||
| - name: https | ||
| containerPort: 8443 | ||
| protocol: TCP | ||
| - name: amqps | ||
| containerPort: 5671 | ||
| protocol: TCP | ||
| - name: amqp | ||
| containerPort: 5672 | ||
| protocol: TCP | ||
| env: | ||
| - name: SPRING_CONFIG_LOCATION | ||
| value: file:///etc/hono/ | ||
| - name: SPRING_PROFILES_ACTIVE | ||
| value: registry-adapter,registry-management,tenant-service,dev | ||
| - name: LOGGING_CONFIG | ||
| value: {{ default "classpath:logback-spring.xml" .Values.deviceRegistryExample.loggingConfig | quote }} | ||
| - name: JDK_JAVA_OPTIONS | ||
| value: {{ .Values.deviceRegistryExample.javaOptions | quote }} | ||
| - name: KUBERNETES_NAMESPACE | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: metadata.namespace | ||
| {{- include "hono.jaeger.clientConf" $args | indent 8 }} | ||
| securityContext: | ||
| privileged: false | ||
| volumeMounts: | ||
| {{- include "hono.container.secretVolumeMounts" ( dict "name" $args.name "conf" .Values.deviceRegistryExample ) | indent 8 }} | ||
| {{- with .Values.deviceRegistryExample.resources }} | ||
| resources: | ||
| {{- . | toYaml | nindent 10 }} | ||
| {{- end }} | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /liveness | ||
| port: health | ||
| scheme: HTTPS | ||
| initialDelaySeconds: 180 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /readiness | ||
| port: health | ||
| scheme: HTTPS | ||
| initialDelaySeconds: 100 | ||
| volumes: | ||
| {{- include "hono.pod.secretVolumes" ( dict "releaseName" .Release.Name "name" $args.name "conf" .Values.deviceRegistryExample ) | indent 6 }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| {{- if and .Values.deviceRegistryExample.enabled ( eq .Values.deviceRegistryExample.type "jdbc" ) }} | ||
| # | ||
| # Copyright (c) 2020 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Eclipse Public License 2.0 which is available at | ||
| # http://www.eclipse.org/legal/epl-2.0 | ||
| # | ||
| # SPDX-License-Identifier: EPL-2.0 | ||
| # | ||
| {{- $args := dict "dot" . "component" "service-device-registry" "name" "service-device-registry-conf" }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| {{- include "hono.metadata" $args | nindent 2 }} | ||
| type: Opaque | ||
| stringData: | ||
| application.yml: | | ||
| hono: | ||
| app: | ||
| maxInstances: 1 | ||
| auth: | ||
| {{- if .Values.deviceRegistryExample.hono.auth }} | ||
| {{- .Values.deviceRegistryExample.hono.auth | toYaml | nindent 8 }} | ||
| {{- else }} | ||
| host: {{ printf "%s-service-auth" .Release.Name | quote }} | ||
| port: 5671 | ||
| trustStorePath: "/etc/hono/trusted-certs.pem" | ||
| hostnameVerificationRequired: false | ||
| name: {{ printf "Hono %s" $args.component | quote }} | ||
| supportedSaslMechanisms: "PLAIN" | ||
| validation: | ||
| certPath: "/etc/hono/auth-server-cert.pem" | ||
| connectTimeout: 2000 | ||
| {{- end }} | ||
| registry: | ||
| amqp: | ||
| {{- if .Values.deviceRegistryExample.hono.registry.amqp }} | ||
| {{- .Values.deviceRegistryExample.hono.registry.amqp | toYaml | nindent 10 }} | ||
| {{- else }} | ||
| bindAddress: "0.0.0.0" | ||
| keyPath: "/etc/hono/key.pem" | ||
| certPath: "/etc/hono/cert.pem" | ||
| {{- end }} | ||
| http: | ||
| {{- if .Values.deviceRegistryExample.hono.registry.http }} | ||
| {{- .Values.deviceRegistryExample.hono.registry.http | toYaml | nindent 10 }} | ||
| {{- else }} | ||
| authenticationRequired: false | ||
| bindAddress: "0.0.0.0" | ||
| keyPath: "/etc/hono/key.pem" | ||
| certPath: "/etc/hono/cert.pem" | ||
| insecurePortEnabled: true | ||
| insecurePortBindAddress: "0.0.0.0" | ||
| {{- end }} | ||
| deviceIdPattern: "^[a-zA-Z0-9-_\\.\\:]+$" | ||
| jdbc: | ||
| {{- if .Values.deviceRegistryExample.jdbcBasedDeviceRegistry.registry.jdbc }} | ||
| {{- .Values.deviceRegistryExample.jdbcBasedDeviceRegistry.registry.jdbc | toYaml | nindent 10 }} | ||
| {{- end }} | ||
| tenant: | ||
| jdbc: | ||
| {{- if .Values.deviceRegistryExample.jdbcBasedDeviceRegistry.tenant.jdbc }} | ||
| {{- .Values.deviceRegistryExample.jdbcBasedDeviceRegistry.tenant.jdbc | toYaml | nindent 10 }} | ||
| {{- end }} | ||
| {{- include "hono.healthServerConfig" .Values.deviceRegistryExample.hono.healthCheck | nindent 6 }} | ||
| data: | ||
| key.pem: {{ .Files.Get "example/certs/device-registry-key.pem" | b64enc }} | ||
| cert.pem: {{ .Files.Get "example/certs/device-registry-cert.pem" | b64enc }} | ||
| trusted-certs.pem: {{ .Files.Get "example/certs/trusted-certs.pem" | b64enc }} | ||
| auth-server-cert.pem: {{ .Files.Get "example/certs/auth-server-cert.pem" | b64enc }} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -880,6 +880,8 @@ deviceRegistryExample: | |
| # for additional configuration. | ||
| # - mongodb: MongoDB based device registry. Also refer to the section "mongoDBBasedDeviceRegistry" | ||
| # for additional configuration. | ||
| # - jdbc: JDBC based device registry. Also refer to the section "jdbcBasedDeviceRegistry" | ||
| # for additional configuration. | ||
| type: file | ||
|
|
||
| # addExampleData indicates whether example data is inserted after the device registry is deployed | ||
|
|
@@ -1001,6 +1003,68 @@ deviceRegistryExample: | |
| # The password to use for authenticating to the MongoDB instance. | ||
| # password: | ||
|
|
||
| # jdbcBasedDeviceRegistry contains configuration properties specific to the | ||
| # jdbc based device registry. | ||
| jdbcBasedDeviceRegistry: | ||
| # imageName contains the name (excluding registry) | ||
| # of the container image for the example jdbc based device registry. | ||
| imageName: eclipse/hono-service-device-registry-jdbc | ||
| # imageTag contains the tag of the container image to deploy. | ||
| # If not specified, the value of the honoImagesTag property is used. | ||
| # imageTag: | ||
| # containerRegistry contains the name of the container registry to pull | ||
| # the image from. | ||
| # If not specified, the value of the "honoContainerRegistry" property is used. | ||
| # containerRegistry: | ||
| # registry.jdbc contains the configuration properties for device registry | ||
| # to connect to the database. | ||
| registry: | ||
| jdbc: | ||
| # the jdbc properties for read-only operations | ||
| adapter: | ||
| # The jdbc URL for the database | ||
| url: | ||
| # The jdbc driver class name | ||
| driverClass: | ||
| # The user name to use for authenticating to the database | ||
| username: | ||
| # The password to use for authenticating to the database | ||
| password: | ||
| # the jdbc properties for write operations | ||
| management: | ||
| # The jdbc URL for the database. For SQLServer, ";SelectMethod=Cursor" is required in the management url. | ||
| url: | ||
| # The jdbc driver class name | ||
| driverClass: | ||
| # The user name to use for authenticating to the database | ||
| username: | ||
| # The password to use for authenticating to the database | ||
| password: | ||
| # tenant.jdbc contains the configuration properties for tenant registry | ||
| # to connect to the database. | ||
| tenant: | ||
| jdbc: | ||
| # the jdbc properties for read-only operations | ||
| adapter: | ||
| # The jdbc URL for the database | ||
| url: | ||
| # The jdbc driver class name | ||
| driverClass: | ||
| # The user name to use for authenticating to the database | ||
| username: | ||
| # The password to use for authenticating to the database | ||
| password: | ||
| # the jdbc properties for write operations | ||
| management: | ||
| # The jdbc URL for the database. For SQLServer, ";SelectMethod=Cursor" is required in the management url. | ||
| url: | ||
| # The jdbc driver class name | ||
| driverClass: | ||
| # The user name to use for authenticating to the database | ||
| username: | ||
| # The password to use for authenticating to the database | ||
| password: | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it would be nice to have default configuration for using an in memory H2 DB so that you can simply start the registry and use it, without the need to set a lot of configuration properties ...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. point taken, however setting up h2 using a persistent file would require quite some changes to the helm chart. Would in-memory h2 be ok?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, we can still evolve from there ...
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure I get the issue with persistence. That would be one |
||
| mongodb: | ||
| # createInstance indicates whether a MongoDB database instance should be created, | ||
| # which is to be used by the example MongoDB based device registry. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.