Skip to content

Commit

Permalink
fix(Helm): Correcting mapping issues for labels
Browse files Browse the repository at this point in the history
  • Loading branch information
hypery2k committed Jan 29, 2024
1 parent 5175f37 commit 0fe2873
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 18 deletions.
2 changes: 1 addition & 1 deletion charts/keycloak-reporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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.3.0
version: 1.3.1

# 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
2 changes: 1 addition & 1 deletion charts/keycloak-reporter/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# keycloak-reporter

![Version: 1.3.0](https://img.shields.io/badge/Version-1.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.8.7](https://img.shields.io/badge/AppVersion-0.8.7-informational?style=flat-square)
![Version: 1.3.1](https://img.shields.io/badge/Version-1.3.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.8.7](https://img.shields.io/badge/AppVersion-0.8.7-informational?style=flat-square)

Keycloak user and client reporting tool for automated regular access checks.

Expand Down
5 changes: 5 additions & 0 deletions charts/keycloak-reporter/ci.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ env:
secretKeyRef:
key: clientSecret
name: kc-reporter
podLabels:
a: "b"
podAnnotations:
# see https://www.elastic.co/guide/en/beats/filebeat/current/configuration-autodiscover-hints.html
co.elastic.logs/enabled: "true"
keycloak:
config:
url: http://localhost:8080
Expand Down
13 changes: 13 additions & 0 deletions charts/keycloak-reporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "keycloak-reporter.annotations" -}}
net.cst.kc-reporter/config-checksum: {{ include (print $.Template.BasePath "/secret.yaml") $ | sha256sum }}
{{- range $k, $v := .Values.podAnnotations }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}

{{/*
Common labels
*/}}
Expand All @@ -40,6 +50,9 @@ helm.sh/chart: {{ include "keycloak-reporter.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- range $k, $v := .Values.podLabels }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}

{{/*
Expand Down
16 changes: 8 additions & 8 deletions charts/keycloak-reporter/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ printf "%s-job-%s" $fullName $name }}
annotations:
{{- include "keycloak-reporter.annotations" $ | nindent 4 }}
labels:
{{- include "keycloak-reporter.labels" $ | nindent 4 }}
spec:
schedule: {{ $config.schedule }}
jobTemplate:
spec:
template:
{{- with $.Values.podAnnotations }}
annotations:
{{- toYaml $ | nindent 10 }}
{{- end }}
{{- with $.Values.podLabels }}
label:
{{- toYaml $ | nindent 10 }}
{{- end }}
{{- include "keycloak-reporter.annotations" $ | nindent 8 }}
labels:
{{- include "keycloak-reporter.labels" $ | nindent 8 }}
spec:
{{- with $.Values.imagePullSecrets }}
imagePullSecrets:
Expand Down Expand Up @@ -73,4 +73,4 @@ spec:
claimName: {{ $fullName }}-reports
{{- end }}
---
{{- end -}}
{{- end -}}
10 changes: 3 additions & 7 deletions charts/keycloak-reporter/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ metadata:
helm.sh/hook: test
helm.sh/hook-delete-policy: "hook-succeeded,before-hook-creation"
helm.sh/hook-weight: "5"
{{- with $.Values.podAnnotations }}
{{- toYaml $ | nindent 10 }}
{{- end }}
{{- with $.Values.podLabels }}
label:
{{- toYaml $ | nindent 10 }}
{{- end }}
{{- include "keycloak-reporter.annotations" . | nindent 4 }}
labels:
{{- include "keycloak-reporter.labels" . | nindent 4 }}
spec:
containers:
- name: config-test
Expand Down
2 changes: 1 addition & 1 deletion charts/keycloak-reporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ image:
repository: continuoussecuritytooling/keycloak-reporting-cli
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
tag: ''

imagePullSecrets: []
nameOverride: ''
Expand Down
Binary file added keycloak-reporter-1.3.0.tgz
Binary file not shown.

0 comments on commit 0fe2873

Please sign in to comment.