Skip to content

Commit

Permalink
Feature: manage custom labels
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxerrante committed May 15, 2023
1 parent 15da4e4 commit 6e10b49
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion charts/kapparmor/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ home: https://artifacthub.io
kubeVersion: ">= 1.23.0-0"

# Respect spaces and double quotes since this will be validated by the build-app script.
version: "0.1.3"
version: "0.1.5"
appVersion: "0.1.5"

keywords:
Expand Down
5 changes: 5 additions & 0 deletions charts/kapparmor/templates/cm-profiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ kind: ConfigMap
metadata:
name: kapparmor-profiles
namespace: {{ .Release.Namespace }}
labels:
{{- include "kapparmor.labels" . | nindent 4 }}
{{- with .Values.app.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
data:
{{ (.Files.Glob "profiles/*").AsConfig | indent 2 }}
5 changes: 5 additions & 0 deletions charts/kapparmor/templates/cm-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ kind: ConfigMap
metadata:
name: kapparmor-settings
namespace: {{ .Release.Namespace }}
labels:
{{- include "kapparmor.labels" . | nindent 4 }}
{{- with .Values.app.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
data:
PROFILES_DIR: "{{ .Values.app.profiles_dir }}"
POLL_TIME: "{{ .Values.app.poll_time }}"
9 changes: 7 additions & 2 deletions charts/kapparmor/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ metadata:
name: {{ include "kapparmor.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "kapparmor.labels" . | nindent 4 }}
{{- include "kapparmor.labels" . | nindent 4 }}
{{- with .Values.daemonset.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
Expand All @@ -16,9 +19,11 @@ spec:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}

labels:
{{- include "kapparmor.selectorLabels" . | nindent 8 }}
{{- with .Values.app.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}

spec:
{{- with .Values.imagePullSecrets }}
Expand Down
3 changes: 3 additions & 0 deletions charts/kapparmor/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "kapparmor.labels" . | nindent 4 }}
{{- with .Values.app.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
Expand Down
5 changes: 5 additions & 0 deletions charts/kapparmor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ fullnameOverride: ""
app:
profiles_dir: "/app/profiles"
poll_time: 60
labels:
# costgroup: "test"

serviceAccount:
# Specifies whether a service account should be created
Expand All @@ -22,6 +24,9 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name: ""

daemonset:
labels: {}

podAnnotations: {}

podSecurityContext: {}
Expand Down
2 changes: 1 addition & 1 deletion config/config
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
APP_VERSION=0.1.5
CHART_VERSION=0.1.3
CHART_VERSION=0.1.5
9 changes: 7 additions & 2 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ docker run -it --network host --workdir=/data --volume ~/.kube/config:/root/.kub
/bin/sh -c "git config --global --add safe.directory /data; ct lint --print-config --charts ./charts/kapparmor"

# Replace here a commit id being part of an image tag
export GITHUB_SHA="sha-93d0dc4c597a8ae8a9febe1d68e674daf1fa919a"
helm install --dry-run --atomic --generate-name --timeout 30s --debug --set image.tag=$GITHUB_SHA charts/kapparmor/
export IMAGE_TAG="0.1.4_dev"
helm upgrade kapparmor --install --dry-run \
--atomic \
--timeout 30s \
--debug \
--namespace test \
--set image.tag=$IMAGE_TAG charts/kapparmor/

```

Expand Down

0 comments on commit 6e10b49

Please sign in to comment.