Skip to content

Commit

Permalink
Add values for deployment & and pod labes and & annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Karsten Kraus authored and Karsten Kraus committed Oct 2, 2024
1 parent 740b7cb commit e23d966
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 59 deletions.
3 changes: 1 addition & 2 deletions charts/vault-raft-snapshot-agent/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: vault-raft-snapshot-agent
type: application
version: 0.4.24
version: 0.5.0
appVersion: "v0.11.0"
description: Vault Raft Snapshot Agent takes periodic snapshots of Vault's Raft database and stores them on a local volume or an remote S3 bucket
keywords:
Expand Down Expand Up @@ -29,4 +29,3 @@ annotations:
- linux/arm/v7
artifacthub.io/recommendations: |
- url: https://artifacthub.io/packages/helm/hashicorp/vault
artifacthub.io/containsSecurityUpdates: "false"
46 changes: 28 additions & 18 deletions charts/vault-raft-snapshot-agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
component: snapshot-agent
{{- with .Values.deployment.extraLabels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- with .Values.deployment.extraAnnotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
selector:
matchLabels:
Expand All @@ -17,9 +24,9 @@ spec:
component: snapshot-agent
replicas: 1
strategy:
type: {{ .Values.deployment.strategy.type }}
{{- with .Values.deployment.revisionHistoryLimit }}
revisionHistoryLimit: {{ .Values.deployment.revisionHistoryLimit }}
type: {{ .Values.deployment.spec.strategy.type }}
{{- with .Values.deployment.spec.revisionHistoryLimit }}
revisionHistoryLimit: {{ .Values.deployment.spec.revisionHistoryLimit }}
{{- end }}
template:
metadata:
Expand All @@ -29,29 +36,32 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
component: snapshot-agent
{{- with .Values.deployment.spec.extraLabels }}
{{ toYaml . | indent 8 }}
{{- end }}
annotations:
checksum/config: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- if .Values.deployment.extraAnnotations }}
{{ toYaml .Values.deployment.extraAnnotations | indent 8 }}
{{- with .Values.deployment.spec.extraAnnotations }}
{{ toYaml . | indent 8 }}
{{- end }}
spec:
restartPolicy: Always
serviceAccountName: {{ include "helm.serviceAccountName" . }}
containers:
- name: {{ include "vault-raft-snapshot-agent.name" . }}
{{- with .Values.deployment.image }}
{{- with .Values.deployment.spec.image }}
image: {{ .repo }}:{{ .tag | default $.Chart.AppVersion }}
imagePullPolicy: {{ .pullPolicy }}
{{- end }}
{{- if not (empty .Values.deployment.extraEnv) }}
env: {{ toYaml .Values.deployment.extraEnv | nindent 12 }}
{{- if not (empty .Values.deployment.spec.extraEnv) }}
env: {{ toYaml .Values.deployment.spec.extraEnv | nindent 12 }}
{{- end }}
{{- if not (empty .Values.deployment.extraEnvFrom) }}
envFrom: {{ toYaml .Values.deployment.extraEnvFrom | nindent 12 }}
{{- if not (empty .Values.deployment.spec.extraEnvFrom) }}
envFrom: {{ toYaml .Values.deployment.spec.extraEnvFrom | nindent 12 }}
{{- end }}
{{- if not (and (empty .Values.deployment.resources.limits) (empty .Values.deployment.resources.requests)) }}
{{- if not (and (empty .Values.deployment.spec.resources.limits) (empty .Values.deployment.spec.resources.requests)) }}
resources:
{{- with .Values.deployment.resources.limits }}
{{- with .Values.deployment.spec.resources.limits }}
limits:
{{- with .cpu }}
cpu: {{ . }}
Expand All @@ -60,7 +70,7 @@ spec:
memory: {{ . }}
{{- end }}
{{- end }}
{{- with .Values.deployment.resources.requests }}
{{- with .Values.deployment.spec.resources.requests }}
requests:
{{- with .cpu }}
cpu: {{ . }}
Expand All @@ -78,14 +88,14 @@ spec:
- mountPath: {{ .Values.config.snapshots.storages.local.path }}
name: snapshots
{{- end }}
{{- range $volume := .Values.deployment.extraVolumes }}
{{- range $volume := .Values.deployment.spec.extraVolumes }}
- mountPath: {{ required "volume mountPath is required" $volume.mountPath }}
name: {{ required "volume name is required" $volume.name }}
{{- with $volume.readOnly }}
readOnly: {{ $volume.readOnly }}
{{- end }}
{{- end }}
{{ with .Values.deployment.initContainer }}
{{ with .Values.deployment.spec.initContainer }}
initContainers:
- name: {{ .name | default "initialize-agent" }}
image: {{ .image | default "alpine:3.19.1" }}
Expand All @@ -95,9 +105,9 @@ spec:
{{- with .env }}
env: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with $.Values.deployment.extraVolumes }}
{{- with $.Values.deployment.spec.extraVolumes }}
volumeMounts:
{{- range $volume := $.Values.deployment.extraVolumes }}
{{- range $volume := $.Values.deployment.spec.extraVolumes }}
- mountPath: {{ required "volume mountPath is required" $volume.mountPath }}
name: {{ required "volume name is required" $volume.name }}
{{- with $volume.readOnly }}
Expand All @@ -121,7 +131,7 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- range $volume := .Values.deployment.extraVolumes }}
{{- range $volume := .Values.deployment.spec.extraVolumes }}
- name: {{ required "volume name is required" (get $volume "name") }}
{{- toYaml (omit $volume "name" "mountPath" "readOnly") | nindent 10 }}
{{- end }}
85 changes: 46 additions & 39 deletions charts/vault-raft-snapshot-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,53 @@ fullnameOverride:
nameOverride:

deployment:
# -- additional annotation to add to the pod's metadata
# -- additional labels to add to the deployment's metadata
extraLabels: {}
# -- additional annotation to add to the deployment's metadata
extraAnnotations: {}
# -- additional environment-variables to add to the pod
extraEnv: []
# -- additional environment-refs to add to the pod
extraEnvFrom: []
# -- additional volumes for the container. configures the pods `volumeMounts` and `volumes`-sections:
# <pre>- name: my-volume<br> mountPath: /my-path<br> emptyDir: {}</pre>
# `name` and `mountPath` are used both in `volumeMounts` and `volumes`, `readOnly` only applies to
# `volumeMounts` and any other key is added to `volumes` only
extraVolumes: []
strategy:
# -- Update-strategy for the agent's pods
# `Recreate` guarantees that no two snapshots get taken at the same time
# `RollingUpdate` ensures that there's always one instance of the agent running
type: "Recreate"
image:
# -- Image that is deployed (change e.g. for private registry-proxy)
repo: ghcr.io/argelbargel/vault-raft-snapshot-agent
# -- (string) the image's tag
# @default -- `.Chart.AppVersion`
tag:
# -- New releases of vault-raft-snapshot-agent always change the
# `.Chart.AppVersion` of this chart thus must only be changed
# if you use another repository than the default
pullPolicy: IfNotPresent
# -- resource limits and requests for the deployment
resources:
# -- resource limits of the deployment
limits: {}
# -- resource requests by the deployment
requests: {}
# -- specify optional init-container. Only properties `name`, `image`, `command` and `env` are used.
# `name` and `image` are optional, by default alpine:3.19.1, which is the agents-base-image, is used as image
# The init-container has access to all extraVolumes.
initContainer: {}
# -- (int) see [kubernetes docs](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#clean-up-policy)
# You might want to change this to a small value to avoid cluttering up the
# UI of a Continuous Delivery Tool like Argo-CD
revisionHistoryLimit:
spec:
# -- additional labels to add to the pods's metadata
extraLabels: {}
# -- additional annotation to add to the pods's metadata
extraAnnotations: {}
extraEnv: []
# -- additional environment-refs to add to the pod
extraEnvFrom: []
# -- additional volumes for the container. configures the pods `volumeMounts` and `volumes`-sections:
# <pre>- name: my-volume<br> mountPath: /my-path<br> emptyDir: {}</pre>
# `name` and `mountPath` are used both in `volumeMounts` and `volumes`, `readOnly` only applies to
# `volumeMounts` and any other key is added to `volumes` only
extraVolumes: []
strategy:
# -- Update-strategy for the agent's pods
# `Recreate` guarantees that no two snapshots get taken at the same time
# `RollingUpdate` ensures that there's always one instance of the agent running
type: "Recreate"
image:
# -- Image that is deployed (change e.g. for private registry-proxy)
repo: ghcr.io/argelbargel/vault-raft-snapshot-agent
# -- (string) the image's tag
# @default -- `.Chart.AppVersion`
tag:
# -- New releases of vault-raft-snapshot-agent always change the
# `.Chart.AppVersion` of this chart thus must only be changed
# if you use another repository than the default
pullPolicy: IfNotPresent
# -- resource limits and requests for the deployment
resources:
# -- resource limits of the deployment
limits: {}
# -- resource requests by the deployment
requests: {}
# -- specify optional init-container. Only properties `name`, `image`, `command` and `env` are used.
# `name` and `image` are optional, by default alpine:3.19.1, which is the agents-base-image, is used as image
# The init-container has access to all extraVolumes.
initContainer: {}
# -- (int) see [kubernetes docs](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#clean-up-policy)
# You might want to change this to a small value to avoid cluttering up the
# UI of a Continuous Delivery Tool like Argo-CD
revisionHistoryLimit:


serviceAccount:
Expand All @@ -68,7 +75,7 @@ serviceAccount:
config:
vault:
nodes:
# -- Urls to the vault-nodes. Recommended to use a single url always pointing to the *leader* of your vault-cluster, e.g. `https?://vault-active.<vault-namespace>.svc.cluster.local:<vault-server service-port>`
# -- Urls to the vault-nodes. Recommended to use a single url always pointing to the *leader* of your vault-cluster, e.g. `https?://vault-active.<vault-namespace>.svc.cluster.local:<vault-server service-port>`
urls:
- http://127.0.0.1:8200
autoDetectLeader: false
Expand Down

0 comments on commit e23d966

Please sign in to comment.