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

DBP-1011-add-workflows-for-chart #1

Merged
merged 9 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/check-helm-kics-on-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Kics check on PR
on:
pull_request:
branches:
- main

jobs:
scan_pr:
uses: dBildungsplattform/dbp-github-workflows/.github/workflows/check-helm-kics.yaml@7
permissions:
contents: read
with:
chart_path: "."
26 changes: 26 additions & 0 deletions .github/workflows/helm-chart-release-on-push-status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release Status Chart on branch
on:
push:
branches-ignore:
- 'main'
paths:
- 'status/**'

concurrency:
group: chart-release

jobs:
scan:
uses: dBildungsplattform/dbp-github-workflows/.github/workflows/check-helm-kics.yaml@7
permissions:
contents: read
with:
chart_path: "."
release_helm:
uses: dBildungsplattform/dbp-github-workflows/.github/workflows/chart-release.yaml@7
secrets: inherit
with:
chart_path: "."
chart_name: status
helm_chart_version_generation: ticket_from_branch_timestamp
image_tag_generation: chart_yaml
38 changes: 38 additions & 0 deletions .github/workflows/helm-chart-release-on-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release Charts on Tag
on:
push:
tags:
- '.+-[0-9]+.[0-9]+.[0-9]+'

concurrency:
group: chart-release

jobs:
get_tag:
runs-on: ubuntu-latest
outputs:
chart: ${{ steps.nameTag.outputs.chart }}
version: ${{ steps.nameTag.outputs.version }}
steps:
- name: Filter Tag name
uses: olegtarasov/[email protected]
id: nameTag
with:
tagRegex: "(?<chart>.+?)-(?<version>[0-9]+.[0-9]+.[0-9]+)"

scan:
uses: dBildungsplattform/dbp-github-workflows/.github/workflows/check-helm-kics.yaml@7
permissions:
contents: read
with:
chart_path: "."
release_helm:
needs: get_tag
aimee-889 marked this conversation as resolved.
Show resolved Hide resolved
uses: dBildungsplattform/dbp-github-workflows/.github/workflows/chart-release.yaml@7
secrets: inherit
with:
chart_path: "."
chart_name: ${{ needs.get_tag.outputs.chart }}
helm_chart_version_generation: specified
helm_chart_version: ${{ needs.get_tag.outputs.version }}
image_tag_generation: chart_yaml
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# helm-charts

This is the place for reusable helm charts.
They are published in the [helm-charts-registry](https://github.com/dBildungsplattform/helm-charts-registry) repository when pushing on a branch (Version 0.0.0-\<ticket>-\<timestamp>) or when adding a tag in the format \<chart name>-X.X.X.
5 changes: 1 addition & 4 deletions status/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ description: A Helm chart for Kubernetes
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
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: 0.3.2
version: 0.0.0 # Managed by Tagging

# 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
Expand Down
3 changes: 2 additions & 1 deletion status/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{- end }}
labels:
{{- include "status.selectorLabels" . | nindent 8 }}
spec:

Check warning on line 26 in status/templates/deployment.yaml

View workflow job for this annotation

GitHub Actions / scan_pr / Kics Helm Chart Scan

[MEDIUM] Service Account Token Automount Not Disabled

Service Account Tokens are automatically mounted even if not necessary
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand All @@ -31,10 +31,11 @@
serviceAccountName: {{ include "status.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:

Check warning on line 34 in status/templates/deployment.yaml

View workflow job for this annotation

GitHub Actions / scan_pr / Kics Helm Chart Scan

[MEDIUM] Container Running With Low UID

Check if containers are running with low UID, which might cause conflicts with the host's user table.

Check warning on line 34 in status/templates/deployment.yaml

View workflow job for this annotation

GitHub Actions / scan_pr / Kics Helm Chart Scan

[MEDIUM] NET_RAW Capabilities Not Being Dropped

Containers should drop 'ALL' or at least 'NET_RAW' capabilities

Check warning on line 34 in status/templates/deployment.yaml

View workflow job for this annotation

GitHub Actions / scan_pr / Kics Helm Chart Scan

[MEDIUM] Seccomp Profile Is Not Configured

Containers should be configured with a secure Seccomp profile to restrict potentially dangerous syscalls
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
allowPrivilegeEscalation: false
runAsUser: {{ .Values.runAsUser }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
lifecycle:
Expand Down Expand Up @@ -92,7 +93,7 @@
- name: {{ include "status.fullname" . }}-files
mountPath: /var/www/html/app/seedData.json
subPath: seedData.json
resources:

Check warning on line 96 in status/templates/deployment.yaml

View workflow job for this annotation

GitHub Actions / scan_pr / Kics Helm Chart Scan

[LOW] Container Requests Not Equal To It's Limits

Containers must have the same resource requests set as limits. This is recommended to avoid resource DDoS of the node during spikes and means that 'requests.memory' and 'requests.cpu' must equal 'limits.memory' and 'limits.cpu', respectively
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
Expand All @@ -109,7 +110,7 @@
volumes:
- name: {{ include "status.fullname" . }}-files
configMap:
name: {{ include "status.fullname" . }}-files

Check warning on line 113 in status/templates/deployment.yaml

View workflow job for this annotation

GitHub Actions / scan_pr / Kics Helm Chart Scan

[MEDIUM] Volume Mount With OS Directory Write Permissions

Containers can mount sensitive folders from the hosts, giving them potentially dangerous access to critical host configurations and binaries.
items:
- key: SeederCommand.php
path: SeederCommand.php
Expand Down
8 changes: 1 addition & 7 deletions status/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
# -- Settings for security context of the container
securityContext:
runAsUser: 1001
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
runAsUser: 1001
service:
# -- Kubernetes Service type
type: ClusterIP
Expand Down
Loading