Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
* Use appropriate protocol for registering default tenant

The device registry only exposes the management API via http if
the insecure endpoint is being enabled explicitly. Otherwise,
https needs to be used for registering default data with the
device registry.

* Add example trust store to Dispatch Router container

The Dispatch Router configuration contains references to a
ca.crt file containing trusted CA certificates. The example keys
secret has been extended to contain the example trust store.
  • Loading branch information
sophokles73 committed Oct 13, 2023
1 parent bf3a4fd commit 0a72976
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions charts/hono/example/add_example_data_device_registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
#
# SPDX-License-Identifier: EPL-2.0
#*******************************************************************************
{{- if ( eq .Values.deviceRegistryExample.hono.registry.http.insecurePortEnabled true ) }}
HTTP_BASE_URL="http://{{ include "hono.fullname" . }}-service-device-registry:8080/v1"
{{- else }}
HTTP_BASE_URL="https://{{ include "hono.fullname" . }}-service-device-registry:8443/v1"
{{- end }}

check_status() {
EXIT_STATUS=$1
Expand All @@ -35,7 +39,7 @@ add_tenant(){
HTTP_REQUEST_BODY=$2

echo "Adding tenant [$TENANT_ID]"
HTTP_RESPONSE=$(curl -o /dev/null -sw "%{http_code}" \
HTTP_RESPONSE=$(curl -o /dev/null -sw "%{http_code}" -k \
-X POST "$HTTP_BASE_URL/tenants/$TENANT_ID" \
--header 'Content-Type: application/json' \
--data-raw "$HTTP_REQUEST_BODY")
Expand All @@ -49,7 +53,7 @@ register_device(){
HTTP_REQUEST_BODY=$3

echo "Registering device [$TENANT_ID:$DEVICE_ID]"
HTTP_RESPONSE=$(curl -o /dev/null -sw "%{http_code}" \
HTTP_RESPONSE=$(curl -o /dev/null -sw "%{http_code}" -k \
-X POST "$HTTP_BASE_URL/devices/$TENANT_ID/$DEVICE_ID" \
--header 'Content-Type: application/json' \
--data-raw "$HTTP_REQUEST_BODY")
Expand All @@ -64,7 +68,7 @@ add_credentials(){
HTTP_REQUEST_BODY=$3

echo "Adding credentials [$TENANT_ID:$DEVICE_ID]"
HTTP_RESPONSE=$(curl -o /dev/null -sw "%{http_code}" \
HTTP_RESPONSE=$(curl -o /dev/null -sw "%{http_code}" -k \
-X PUT "$HTTP_BASE_URL/credentials/$TENANT_ID/$DEVICE_ID" \
--header 'Content-Type: application/json' \
--data-raw "$HTTP_REQUEST_BODY")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $amqpEnabled := and ( has "amqp" .Values.messagingNetworkTypes ) .Values.amqpMessagingNetworkExample.enabled -}}
{{- if all $amqpEnabled ( eq .Values.amqpMessagingNetworkExample.dispatchRouter.tlsKeysSecret "example" ) }}
#
# Copyright (c) 2022 Contributors to the Eclipse Foundation
# Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
Expand All @@ -19,6 +19,7 @@ metadata:
{{- include "hono.metadata" $args | nindent 2 }}
type: Opaque
data:
ca.crt: {{ .Files.Get "example/certs/trusted-certs.pem" | b64enc }}
tls.key: {{ .Files.Get "example/certs/qdrouter-key.pem" | b64enc }}
tls.crt: {{ .Files.Get "example/certs/qdrouter-cert.pem" | b64enc }}
{{- end }}

0 comments on commit 0a72976

Please sign in to comment.