Skip to content
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

Provide Helm chart in Ditto repository #1635

Merged
merged 11 commits into from
Jun 13, 2023
Merged
20 changes: 20 additions & 0 deletions .github/ct.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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

# consider helm install to be failed after 10 minutes
helm-extra-args: --timeout 10m
check-version-increment: true
debug: true
chart-dirs:
- deployment/helm
chart-repos:
- stable=https://charts.helm.sh/stable
- bitnami=https://charts.bitnami.com/bitnami
37 changes: 37 additions & 0 deletions .github/kubeval.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# 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

#
# use kubeval to validate helm generated kubernetes manifest
#

set -o errexit
set -o pipefail

CHART_DIR=deployment/helm/ditto
KUBEVAL_VERSION="v0.16.1"
SCHEMA_LOCATION="https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/"

# install kubeval
curl --silent --show-error --fail --location --output /tmp/kubeval.tar.gz https://github.com/instrumenta/kubeval/releases/download/"${KUBEVAL_VERSION}"/kubeval-linux-amd64.tar.gz
sudo tar -C /usr/local/bin -xf /tmp/kubeval.tar.gz kubeval

# add helm repos to resolve dependencies
helm repo add stable https://charts.helm.sh/stable
helm repo add bitnami https://charts.bitnami.com/bitnami

# validate chart
echo "helm dependency build..."
helm dependency build "${CHART_DIR}"

echo "kubeval(idating) ${CHART_DIR} chart..."
helm template "${CHART_DIR}" | kubeval --strict --ignore-missing-schemas --kubernetes-version "${KUBERNETES_VERSION#v}" --schema-location "${SCHEMA_LOCATION}"
34 changes: 34 additions & 0 deletions .github/workflows/helm-chart-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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
name: Release and publish Helm chart

on:
workflow_dispatch:
inputs:
chartVersion:
description: 'Helm chart version'
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Package and push Ditto Helm chart to Docker Hub
uses: appany/helm-oci-chart-releaser@v0.3.0
with:
repository: eclipse
name: ditto
tag: ${{ inputs.chartVersion }}
path: deployment/helm/ditto
registry: registry-1.docker.io
registry_username: eclipsedittobot
registry_password: ${{ secrets.DOCKER_HUB_TOKEN }}
129 changes: 129 additions & 0 deletions .github/workflows/helm-chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# 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
name: Lint and test Helm chart

env:
CONFIG_OPTION_CHART_TESTING: "--config .github/ct.yml"
VERSION_CHART_TESTING: "v3.8.0"
VERSION_HELM: "v3.11.2"
VERSION_PYTHON: "3.9"
on:
pull_request:
paths:
- 'deployment/helm/**'
- '.github/workflows/helm-chart.yml'
- '.github/ct.yml'
- '.github/kubeval.sh'

jobs:
lint-chart:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: ${{ env.VERSION_HELM }}
- uses: actions/setup-python@v4
with:
python-version: ${{ env.VERSION_PYTHON }}
check-latest: true
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.4.0
with:
version: ${{ env.VERSION_CHART_TESTING }}
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed ${{ env.CONFIG_OPTION_CHART_TESTING }} --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint ${{ env.CONFIG_OPTION_CHART_TESTING }} --target-branch ${{ github.event.repository.default_branch }}

kubeval-chart:
runs-on: ubuntu-latest
needs: lint-chart
strategy:
matrix:
# the versions supported by kubeval are the ones for
# which a folder exists at
# https://github.com/yannh/kubernetes-json-schema/
k8s:
- v1.25.2
- v1.26.4
- v1.27.1
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch history for chart testing
run: git fetch --prune --unshallow
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: ${{ env.VERSION_HELM }}
- name: Run kubeval
env:
KUBERNETES_VERSION: ${{ matrix.k8s }}
run: .github/kubeval.sh

install-chart:
name: install-chart
runs-on: ubuntu-latest
needs:
- lint-chart
- kubeval-chart
strategy:
matrix:
# the versions supported by chart-testing are the tags
# available for the docker.io/kindest/node image
# https://hub.docker.com/r/kindest/node/tags
k8s:
- v1.25.2
- v1.26.4
- v1.27.1
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch history for chart testing
run: git fetch --prune --unshallow
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: ${{ env.VERSION_HELM }}
- uses: actions/setup-python@v4
with:
python-version: ${{ env.VERSION_PYTHON }}
check-latest: true
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.4.0
with:
version: ${{ env.VERSION_CHART_TESTING }}
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed ${{ env.CONFIG_OPTION_CHART_TESTING }} --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Create kind ${{ matrix.k8s }} cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1.4.0
with:
node_image: kindest/node:${{ matrix.k8s }}
- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install ${{ env.CONFIG_OPTION_CHART_TESTING }} --target-branch ${{ github.event.repository.default_branch }}
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
7 changes: 7 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ on:

# Run build for any PR
pull_request:
paths-ignore:
- 'README.md'
- 'RELEASE.md'
- 'CONTRIBUTING.md'
- 'SECURITY.md'
- 'deployment/**'
- 'documentation/**'

jobs:
build:
Expand Down
6 changes: 4 additions & 2 deletions deployment/docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
worker_processes 1;
worker_processes auto;

events {worker_connections 1024;}
events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
Expand Down
6 changes: 4 additions & 2 deletions deployment/docker/sandbox/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
worker_processes 1;
worker_processes auto;

events {worker_connections 1024;}
events {
worker_connections 1024;
}

http {
charset utf-8;
Expand Down
11 changes: 5 additions & 6 deletions deployment/helm/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# 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 official Ditto Helm chart is managed here, in folder [ditto](ditto/).
It is deployed as "OCI artifact" to Docker Hub at: https://hub.docker.com/r/eclipse/ditto

## Install Ditto via Helm Chart

To install the chart with the release name eclipse-ditto, run the following commands:

```shell script
helm repo add eclipse-iot https://www.eclipse.org/packages/charts/
helm repo update
helm install eclipse-ditto eclipse-iot/ditto
helm install -n ditto my-ditto oci://registry-1.docker.io/eclipse/ditto --version <version> --wait
thjaeckle marked this conversation as resolved.
Show resolved Hide resolved
```

# Uninstall the Helm Chart

To uninstall/delete the eclipse-ditto deployment:
To uninstall/delete the `my-ditto` deployment:

```shell script
helm delete eclipse-ditto
helm uninstall my-ditto
```
2 changes: 2 additions & 0 deletions deployment/helm/ditto/.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/ditto/.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/ditto/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: 0.0.1 # chart version is set by release-job
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: thomas.jaeckle@beyonnex.io
dependencies:
- name: mongodb
repository: https://charts.bitnami.com/bitnami
version: ^12.x
condition: mongodb.enabled