Skip to content

Commit

Permalink
Merge pull request #38 from companyinfo/add-pvc-template
Browse files Browse the repository at this point in the history
Add PVC template & update dependencies
  • Loading branch information
atkrad authored Jan 10, 2025
2 parents bb83af4 + 6b180ab commit 280db31
Show file tree
Hide file tree
Showing 18 changed files with 169 additions and 141 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Useful Helm Client Commands:

## License

Copyright © 2022 Company.info
Copyright © 2025 Company.info

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions charts/helmet/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
version: 2.6.0
digest: sha256:b729437099044744a7ed5decf9e458569558e9a7a1f084bba521fd0edc084fd4
generated: "2023-07-25T12:04:37.195150444+02:00"
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.29.0
digest: sha256:824fbf9084fc3bf5c0407a389ed657a833141809bdcc0273e0cce0eafb1fd12d
generated: "2025-01-10T14:10:24.569071763+01:00"
8 changes: 4 additions & 4 deletions charts/helmet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: helmet
description: Helmet is a library Helm Chart for grouping common logics. This chart is not deployable by itself.
home: https://github.com/companyinfo/helm-charts/blob/main/charts/helmet
type: library
version: "0.11.0"
appVersion: "0.11.0"
version: "0.12.0"
appVersion: "0.12.0"
keywords:
- common
- helper
Expand All @@ -15,5 +15,5 @@ maintainers:
url: https://company.info
dependencies:
- name: common
version: "2.6.0"
repository: "https://charts.bitnami.com/bitnami"
version: "2.29.0"
repository: "oci://registry-1.docker.io/bitnamicharts"
4 changes: 2 additions & 2 deletions charts/helmet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependency on what we call the `Helmet` library.

## Prerequisites

- Kubernetes 1.19+
- Kubernetes 1.23+
- Helm 3.9.0+

## Getting started
Expand All @@ -32,7 +32,7 @@ dependency on what we call the `Helmet` library.

dependencies:
- name: helmet
version: 0.11.0
version: 0.12.0
repository: https://charts.companyinfo.dev
import-values: # <== It is mandatory if you want to import the Helmet default values.
- defaults
Expand Down
2 changes: 2 additions & 0 deletions charts/helmet/templates/_app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
{{ include "helmet.deployment" . }}
{{- end }}

{{ include "helmet.persistence" . }}

{{ include "helmet.hpa" . }}
{{ include "helmet.ingress" . }}

Expand Down
20 changes: 5 additions & 15 deletions charts/helmet/templates/_configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,11 @@ kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.configMap.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.configMap.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.configMap.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.configMap.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.configMap.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- $labels := include "common.tplvalues.merge" (dict "values" .Values.configMap.labels .Values.commonLabels "context" .) | fromYaml }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.configMap.annotations .Values.commonAnnotations "context" .) | fromYaml }}
{{- if $annotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.configMap.data }}
data:
Expand Down
56 changes: 28 additions & 28 deletions charts/helmet/templates/_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,31 @@ kind: Deployment
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.annotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- $labels := include "common.tplvalues.merge" (dict "values" .Values.labels .Values.commonLabels "context" .) | fromYaml }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.annotations .Values.commonAnnotations "context" .) | fromYaml }}
{{- if $annotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
{{- $podLabels := include "common.tplvalues.merge" (dict "values" .Values.podLabels .Values.commonLabels "context" .) | fromYaml }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
{{- if .Values.updateStrategy }}
strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
{{- end }}
template:
metadata:
annotations:
{{- if .Values.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
{{- end }}
helm.sh/revision: {{ .Release.Revision | quote }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
{{- if .Values.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
spec:
{{- if .Values.initContainers }}
initContainers: {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
Expand Down Expand Up @@ -94,7 +82,7 @@ spec:
{{- if .Values.resources }}
resources: {{- toYaml .Values.resources | nindent 12 }}
{{- end }}
{{- if or .Values.configMap.mounted .Values.extraVolumeMounts }}
{{- if or .Values.configMap.mounted .Values.extraVolumeMounts .Values.persistence.enabled }}
volumeMounts:
{{- if .Values.configMap.mounted }}
- name: {{ include "common.names.fullname" . }}
Expand All @@ -103,25 +91,37 @@ spec:
subPath: {{ .Values.configMap.subPath }}
{{- end }}
{{- end }}
{{- if .Values.persistence.enabled }}
- name: data
mountPath: {{ .Values.persistence.mountPath }}
{{- if .Values.persistence.subPath }}
subPath: {{ .Values.persistence.subPath }}
{{- end }}
{{- end }}
{{- if .Values.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.sidecars }}
{{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 8 }}
{{- end }}
{{- if or .Values.configMap.mounted .Values.extraVolumes }}
{{- if or .Values.configMap.mounted .Values.extraVolumes .Values.persistence.enabled }}
volumes:
{{- if .Values.configMap.mounted }}
- name: {{ include "common.names.fullname" . }}
configMap:
name: {{ include "common.names.fullname" . }}
{{- end }}
{{- if .Values.persistence.enabled }}
- name: data
persistentVolumeClaim:
claimName: {{ default (include "common.names.fullname" .) .Values.persistence.existingClaim }}
{{- end }}
{{- if .Values.extraVolumes }}
{{- include "common.tplvalues.render" ( dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- end }}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image) "context" $) | indent 6 }}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image) "context" $) | nindent 6 }}
{{- if .Values.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }}
{{- end }}
Expand All @@ -130,10 +130,10 @@ spec:
{{- else if or .Values.podAffinityPreset .Values.podAntiAffinityPreset .Values.nodeAffinityPreset.type }}
affinity:
{{- if not (empty .Values.podAffinityPreset) }}
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }}
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "customLabels" $podLabels "context" $) | nindent 10 }}
{{- end }}
{{- if not (empty .Values.podAntiAffinityPreset) }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "customLabels" $podLabels "context" $) | nindent 10 }}
{{- end }}
{{- if not (empty .Values.nodeAffinityPreset.type) }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
Expand Down
5 changes: 1 addition & 4 deletions charts/helmet/templates/_hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ kind: HorizontalPodAutoscaler
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
Expand Down
16 changes: 4 additions & 12 deletions charts/helmet/templates/_ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@ kind: Ingress
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.ingress.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.ingress.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.ingress.annotations "context" $) | nindent 4 }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.ingress.annotations .Values.commonAnnotations "context" .) | fromYaml }}
{{- if $annotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
Expand Down
14 changes: 5 additions & 9 deletions charts/helmet/templates/_podmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ metadata:
{{- else }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.podMonitor.labels }}
{{- include "common.tplvalues.render" (dict "value" .Values.podMonitor.labels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- $labels := include "common.tplvalues.merge" (dict "values" .Values.podMonitor.labels .Values.commonLabels "context" .) | fromYaml }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.podMonitor.annotations .Values.commonAnnotations "context" .) | fromYaml }}
{{- if $annotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.podMonitor.jobLabel }}
Expand Down
30 changes: 30 additions & 0 deletions charts/helmet/templates/_pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- define "helmet.persistence" -}}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if or .Values.persistence.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" (list .Values.persistence.annotations .Values.commonAnnotations) "context" .) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.selector "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.persistence.dataSource }}
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.dataSource "context" $) | nindent 4 }}
{{- end }}
{{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) | nindent 2 }}
{{- end -}}
{{- end -}}
20 changes: 5 additions & 15 deletions charts/helmet/templates/_secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,11 @@ kind: Secret
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.secret.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.secret.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.secret.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.secret.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.secret.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- $labels := include "common.tplvalues.merge" (dict "values" .Values.secret.labels .Values.commonLabels "context" .) | fromYaml }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.secret.annotations .Values.commonAnnotations "context" .) | fromYaml }}
{{- if $annotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
type: {{ .Values.secret.type }}
{{- if .Values.secret.data }}
Expand Down
19 changes: 6 additions & 13 deletions charts/helmet/templates/_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,10 @@ kind: Service
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.service.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.service.annotations .Values.commonAnnotations "context" .) | fromYaml }}
{{- if $annotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
Expand All @@ -39,5 +31,6 @@ spec:
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
{{- end }}
ports: {{- include "common.tplvalues.render" (dict "value" .Values.service.ports "context" $) | nindent 4 }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
{{- $podLabels := include "common.tplvalues.merge" (dict "values" .Values.podLabels .Values.commonLabels "context" .) | fromYaml }}
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
{{- end -}}
20 changes: 5 additions & 15 deletions charts/helmet/templates/_serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@ kind: ServiceAccount
metadata:
name: {{ include "helmet.serviceAccountName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.serviceAccount.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.serviceAccount.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.serviceAccount.annotations }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.serviceAccount.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.serviceAccount.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- $labels := include "common.tplvalues.merge" (dict "values" .Values.serviceAccount.labels .Values.commonLabels "context" .) | fromYaml }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
{{- $annotations := include "common.tplvalues.merge" (dict "values" .Values.serviceAccount.annotations .Values.commonAnnotations "context" .) | fromYaml }}
{{- if $annotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- end }}
Expand Down
Loading

0 comments on commit 280db31

Please sign in to comment.