Skip to content

Commit

Permalink
Provide Helm chart in Ditto repository
Browse files Browse the repository at this point in the history
* initially migrated from IoT Packages project
* however enhanced with a lot more configuration options in order to be the basis for a productive Helm chart
* also added quite advanced ingress configuration

Signed-off-by: Thomas Jäckle <[email protected]>
  • Loading branch information
thjaeckle committed May 15, 2023
1 parent 20f2316 commit a481688
Show file tree
Hide file tree
Showing 66 changed files with 5,969 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Ensure license year for added files is the file's creation year
shell: bash
run: |
included_file_endings=".*\.(java|xml|yml)"
included_file_endings=".*\.(java|xml|yml|yaml)"
current_year=$(date +'%Y')
missing_counter=0
for file in ${{ steps.the-files.outputs.added }}; do
Expand Down
2 changes: 2 additions & 0 deletions deployment/helm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charts/
Chart.lock
19 changes: 19 additions & 0 deletions deployment/helm/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
36 changes: 36 additions & 0 deletions deployment/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) 2023 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
---
apiVersion: v2
name: ditto
description: |
Eclipse Ditto™ is a technology in the IoT implementing a software pattern called “digital twins”.
A digital twin is a virtual, cloud based, representation of his real world counterpart
(real world “Things”, e.g. devices like sensors, smart heating, connected cars, smart grids, EV charging stations etc).
type: application
version: 3.3.0
appVersion: 3.2.1
keywords:
- iot-chart
- digital-twin
- IoT
home: https://www.eclipse.org/ditto
sources:
- https://github.com/eclipse-ditto/ditto
icon: https://www.eclipse.org/ditto/images/ditto.svg
maintainers:
- name: thjaeckle
email: [email protected]
dependencies:
- name: mongodb
repository: https://charts.bitnami.com/bitnami
version: ^12.x
condition: mongodb.enabled
30 changes: 29 additions & 1 deletion deployment/helm/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Eclipse Ditto :: Helm

The Ditto Helm chart is managed at the [Eclipse IoT Packages](https://github.com/eclipse/packages/tree/master/charts/ditto) project.
The Ditto Helm chart sources are managed here.

## Install Ditto via Helm Chart

Expand All @@ -19,3 +19,31 @@ To uninstall/delete the eclipse-ditto deployment:
```shell script
helm delete eclipse-ditto
```

# Working locally with the chart

In order to test / develop the chart locally, this section should be of help.

## Testing templating
For that, no running k8s cluster is necessary - the output will be the rendered k8s deployment descriptors:

```shell
helm template my-ditto . -f values.yaml -f local-values.yaml --debug
```

## Installation
To install the Ditto chart with the name `"my-ditto"`, perform:

```shell
helm install -f values.yaml -f local-values.yaml my-ditto . --wait
kubectl port-forward svc/my-ditto-nginx 8080:8080
```

Now, you can access Ditto on [http://localhost:8080](http://localhost:8080) - have fun.

## Uninstallation
To uninstall the chart again, perform:

```shell
helm uninstall my-ditto
```
154 changes: 154 additions & 0 deletions deployment/helm/local-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Copyright (c) 2023 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
---
# Default values for ditto.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

global:
jwtOnly: false
basicAuthUsers:
ditto:
user: ditto
password: ditto
logging:
customConfigFile:
enabled: true

## ----------------------------------------------------------------------------
## policies configuration
## ref: https://www.eclipse.org/ditto/architecture-services-policies.html
policies:
resources:
cpu: 0.2
memoryMi: 512
jvm:
activeProcessorCount: 2
heapRamPercentage: 50
config:
persistence:
events:
historicalHeadersToPersist:
- "ditto-originator"
- "ditto-origin"
- "correlation-id"

## ----------------------------------------------------------------------------
## things configuration
## ref: https://www.eclipse.org/ditto/architecture-services-things.html
things:
resources:
cpu: 0.2
memoryMi: 512
jvm:
activeProcessorCount: 2
heapRamPercentage: 50
config:
persistence:
events:
historicalHeadersToPersist:
- "ditto-originator"
- "ditto-origin"
- "correlation-id"

## ----------------------------------------------------------------------------
## things-search configuration
## ref: https://www.eclipse.org/ditto/architecture-services-things-search.html
thingsSearch:
resources:
cpu: 0.2
memoryMi: 512
jvm:
activeProcessorCount: 2
heapRamPercentage: 50

## ----------------------------------------------------------------------------
## connectivity configuration
## ref: https://www.eclipse.org/ditto/architecture-services-connectivity.html
connectivity:
resources:
cpu: 0.2
memoryMi: 768
jvm:
activeProcessorCount: 2
heapRamPercentage: 55

## ----------------------------------------------------------------------------
## gateway configuration
## ref: https://www.eclipse.org/ditto/architecture-services-gateway.html
gateway:
resources:
cpu: 0.2
memoryMi: 512
jvm:
activeProcessorCount: 2
heapRamPercentage: 50
config:
authentication:
enablePreAuthentication: true
oauth:
openidConnectIssuers:
example:
issuer: "example.com"
authSubjects:
- "{{ jwt:sub }}"
- "{{ jwt:groups }}"
devops:
## this controls whether /devops resource is secured or not
secured: true
authMethod: "basic"
oauth:
# configure the amount of clock skew in seconds to tolerate when verifying the local time against the exp and nbf claims
allowedClockSkew: 20s
openidConnectIssuers:
example-ops:
issuer: "example.com"
authSubjects:
- "{{ jwt:sub }}"
- "{{ jwt:groups }}"
oauthSubjects:
- "example-ops:devops-admin"
## this controls whether /status resource is secured or not
statusSecured: true
statusAuthMethod: "basic"
# array of strings for subjects authorized to use "/status" API
statusOauthSubjects:
- "example-ops:devops-admin"

## ----------------------------------------------------------------------------
## nginx configuration
nginx:
resources:
cpu: 0.1
memoryMi: 64
initContainers:
waitForGateway:
enabled: false

## ----------------------------------------------------------------------------
## mongodb dependency chart configuration
mongodb:
enabled: false
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 100m
memory: 256Mi
readinessProbe:
enabled: false
livenessProbe:
enabled: false
auth:
enabled: false
persistence:
enabled: false
41 changes: 41 additions & 0 deletions deployment/helm/logback-config/connectivity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2023 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
-->
<configuration>
<appender name="jsonConsoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<excludeMdcKeyName>sourceActorSystem</excludeMdcKeyName>
<excludeMdcKeyName>akkaUid</excludeMdcKeyName>
<excludeMdcKeyName>akkaTimestamp</excludeMdcKeyName>
<mdcKeyFieldName>x-correlation-id=correlation-id</mdcKeyFieldName>
<mdcKeyFieldName>connection-id=ditto-connection-id</mdcKeyFieldName>
<mdcKeyFieldName>connection-type=ditto-connection-type</mdcKeyFieldName>
</encoder>
</appender>

<!-- Do not print INFO cluster messages of mongo driver: -->
<logger name="org.mongodb.driver" level="WARN"/>

<logger name="akka.management.cluster.bootstrap.contactpoint.HttpClusterBootstrapRoutes" level="WARN"/>
<logger name="akka.management.cluster.bootstrap.internal.BootstrapCoordinator" level="WARN"/>
<logger name="akka.actor.CoordinatedShutdown" level="INFO"/>

<logger name="org.apache.kafka" level="WARN"/>

<!-- Log level for the application -->
<logger name="org.eclipse.ditto" level="${LOG_LEVEL_APPLICATION:-INFO}"/>

<root level="${LOG_LEVEL:-INFO}">
<appender-ref ref="jsonConsoleAppender"/>
</root>
</configuration>
37 changes: 37 additions & 0 deletions deployment/helm/logback-config/gateway.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2023 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
-->
<configuration>
<appender name="jsonConsoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<excludeMdcKeyName>sourceActorSystem</excludeMdcKeyName>
<excludeMdcKeyName>akkaUid</excludeMdcKeyName>
<excludeMdcKeyName>akkaTimestamp</excludeMdcKeyName>
<mdcKeyFieldName>x-correlation-id=correlation-id</mdcKeyFieldName>
</encoder>
</appender>

<!-- Do not print INFO cluster messages of mongo driver: -->
<logger name="org.mongodb.driver" level="WARN"/>

<logger name="akka.management.cluster.bootstrap.contactpoint.HttpClusterBootstrapRoutes" level="WARN"/>
<logger name="akka.management.cluster.bootstrap.internal.BootstrapCoordinator" level="WARN"/>
<logger name="akka.actor.CoordinatedShutdown" level="INFO"/>

<!-- Log level for the application -->
<logger name="org.eclipse.ditto" level="${LOG_LEVEL_APPLICATION:-INFO}"/>

<root level="${LOG_LEVEL:-INFO}">
<appender-ref ref="jsonConsoleAppender"/>
</root>
</configuration>
37 changes: 37 additions & 0 deletions deployment/helm/logback-config/policies.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2023 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
-->
<configuration>
<appender name="jsonConsoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<excludeMdcKeyName>sourceActorSystem</excludeMdcKeyName>
<excludeMdcKeyName>akkaUid</excludeMdcKeyName>
<excludeMdcKeyName>akkaTimestamp</excludeMdcKeyName>
<mdcKeyFieldName>x-correlation-id=correlation-id</mdcKeyFieldName>
</encoder>
</appender>

<!-- Do not print INFO cluster messages of mongo driver: -->
<logger name="org.mongodb.driver" level="WARN"/>

<logger name="akka.management.cluster.bootstrap.contactpoint.HttpClusterBootstrapRoutes" level="WARN"/>
<logger name="akka.management.cluster.bootstrap.internal.BootstrapCoordinator" level="WARN"/>
<logger name="akka.actor.CoordinatedShutdown" level="INFO"/>

<!-- Log level for the application -->
<logger name="org.eclipse.ditto" level="${LOG_LEVEL_APPLICATION:-INFO}"/>

<root level="${LOG_LEVEL:-INFO}">
<appender-ref ref="jsonConsoleAppender"/>
</root>
</configuration>
Loading

0 comments on commit a481688

Please sign in to comment.