Skip to content

Commit

Permalink
add helm chart (#606)
Browse files Browse the repository at this point in the history
* add Chart manifests

* add minikube example to docs

* add unittest for charts

* add helm linting to code quality pipeline step

* update changelog

* install helm in pipeline

---------

Co-authored-by: dtrai2 <95028228+dtrai2@users.noreply.github.com>
Co-authored-by: djkhl <49399649+djkhl@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 26, 2024
1 parent 567d546 commit 2de1a59
Show file tree
Hide file tree
Showing 35 changed files with 1,819 additions and 81 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ jobs:
with:
fetch-depth: 0

- uses: azure/setup-helm@v4.2.0
with:
version: "latest"
id: install

- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -73,6 +78,10 @@ jobs:
run: |
black --check --diff --config ./pyproject.toml .
- name: lint helm charts
run: |
helm lint --strict ./charts/logprep
- name: lint changed and added files
if: steps.changed-files.outputs.all_changed_files
run: |
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install helm
uses: azure/setup-helm@v4.2.0
with:
version: "latest"
id: install
- name: Install dependencies
run: |
pip install --upgrade pip wheel
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ error_file
experiments
**/_static/*.xlsx
logprep.log
/charts/logprep/charts
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@

* This release limits the maximum python version to `3.12.3` because of the issue
[#612](https://github.com/fkie-cad/Logprep/issues/612).
* Remove `normalizer` processor, as it's functionality was replaced by the `grokker`, `timestamper`
and `field_manager` processors
* Remove `normalizer` processor, as it's functionality was replaced by the `grokker`, `timestamper` and `field_manager` processors

### Features

* add a helm chart to install logprep in kubernetes based environments

### Improvements

* a result object was added which is returned by every processor
* includes generated extra_data, warnings and errors
* add documentation about behavior of the `timestamper` on `ISO8601` and `UNIX` time parsing
* add unit tests for helm chart templates
* add helm to github actions runner

### Bugfix

Expand Down
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ RUN useradd -s /bin/sh -m -c "logprep user" logprep
USER logprep
# Make sure we use the virtualenv:
ENV PATH="/opt/venv/bin:$PATH"
ENV PROMETHEUS_MULTIPROC_DIR=/tmp/logprep/prometheus_multiproc/
ENV TLDEXTRACT_CACHE=/tmp/logprep/tld_extract_cache/
WORKDIR /home/logprep

ENTRYPOINT ["logprep"]
23 changes: 23 additions & 0 deletions charts/logprep/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
15 changes: 15 additions & 0 deletions charts/logprep/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: logprep
description: Logprep helm chart
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: "1.0.0"

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "12.0.0"
77 changes: 77 additions & 0 deletions charts/logprep/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "logprep.name" -}}
{{- printf "%s" .Chart.Name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "logprep.fullname" -}}
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "logprep.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "logprep.release" -}}
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
{{- end }}

{{/*
Common labels
*/}}
{{- define "logprep.labels" -}}
helm.sh/chart: {{ include "logprep.chart" . }}
{{ include "logprep.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/application: {{ include "logprep.name" . }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key}}: {{ $value | quote }}
{{- end }}
{{- end }}

{{/*
{{- end }}

{{/*
Selector labels
*/}}
{{- define "logprep.selectorLabels" -}}
app.kubernetes.io/name: {{ include "logprep.fullname" . }}
app.kubernetes.io/instance: {{ include "logprep.release" . }}
{{- end }}

{{/*
{{- end }}

{{/*
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "logprep.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "logprep.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

14 changes: 14 additions & 0 deletions charts/logprep/templates/artifacts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.artifacts -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "logprep.fullname" . }}-artifacts
labels:
{{- include "logprep.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.artifacts }}
{{ $value.name }}: |
{{- $value.data | nindent 4 }}
{{- end }}
{{- end}}
14 changes: 14 additions & 0 deletions charts/logprep/templates/configurations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "logprep.fullname" . }}-configurations
labels:
{{- include "logprep.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.configurations }}
{{- if $value.data }}
{{ $value.name }}: |-
{{- toYaml $value.data | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit 2de1a59

Please sign in to comment.