
This library chart supplies a set of templates that can be included in the application charts.
Contains templates for application components of the following Kubernetes resources:
ConfigMap
Deployment
PersistentVolumeClaim
HorizontalPodAutoscaler
InitContainer
Ingress
Job
Service
ExternalSecret
Meant to be flexible enough to cover every Kubernetes entity that most of the applications requires. This way, multiple applications can be deployed as a different release from the same Helm chart with different sets of values.
Make the charts discoverable by adding the repository to your list:
shellhelm repo add corewide https://solutions.corewide.com/helm/
Chart values (see the table below) can be passed one by one using --set
argument or via
a configuration file. You can create one based on the defaults using the following command:
shellhelm show values corewide/libchart > values.yaml
Install the chart after editing your values.yaml
:
shellhelm repo update
helm install corewide/libchart --version 1.2.1 -f values.yaml
Define Helm provider configuration in your project code, then:
hclresource "helm_release" "libchart" {
name = "libchart"
repository = "oci://oci.corewide.com/helm"
chart = "libchart"
version = "1.2.1"
# define your values as set blocks:
set {
...
}
}
This library chart supplies a set of templates that can be included in the application charts.
Contains templates for application components of the following Kubernetes resources:
ConfigMap
Deployment
PersistentVolumeClaim
HorizontalPodAutoscaler
InitContainer
Ingress
Job
Service
ExternalSecret
Meant to be flexible enough to cover every Kubernetes entity that most of the applications requires. This way, multiple applications can be deployed as a different release from the same Helm chart with different sets of values.
All notable changes to this project are documented here.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Service
using service.enabled
Deployment
and extraDeployments
via PersistentVolumeClaim
resources, configurable through persistence.volumes
initContainers
and extraContainers
using the initContainer.persistence.enabled
and extraContainers[*].persistence.enabled
parametersStable, extensively tested production-ready version with key functionality
Deployments
by means of the extraDeployments
valueBREAKING CHANGE: chart structure was completely re-arranged and transformed to the library chart. Thus it can't be used directly for the release roll-out, instead its templates must be inherited by application chart and use as a dependency, see usage section in the documentation
First stable version of generic Helm chart
Deployment
Job
HorizontalPodAutoscaler
Service
Ingress
ConfigMap
Create a file in the templates/
directory of your application chart (templates/include.yaml
for instance) and include required templates from the library chart:
yaml{{ include "libchart.configmap" . }}
{{ include "libchart.configmap.prerun" . }}
{{ include "libchart.configmap.init" . }}
{{ include "libchart.deployment" . }}
{{ include "libchart.extraDeployments" . }}
{{ include "libchart.hpa" . }}
{{ include "libchart.pvc" . }}
{{ include "libchart.ingress" . }}
{{ include "libchart.job" . }}
{{ include "libchart.service" . }}
{{ include "libchart.externalsecret" . }}
Chart notes can be included in the templates/NOTES.txt
:
yaml{{ include "libchart.notes" . }}
Reference the library chart as a dependency for your application chart in corresponding Chart.yaml
:
yamldependencies:
- name: libchart
version: 1.2.1
repository: "oci://oci.corewide.com/helm"
import-values:
- defaults # inherit library chart values
And fetch the dependency:
bashhelm dependency update [path-to-app-chart]
Prepare the default values file for application chart:
bashtail -n +3 values.yaml | sed -E 's/^([[:blank:]]){4}//' > /path/to/application/chart/values.yaml
Make sure to create a separate secret for sensitive variables (like passwords and keys). Copy the default application chart values.yaml
somewhere, edit the new file accordingly, and proceed with installation. You can always use --set
directive for helm upgrade
or helm install
commands to avoid storing values files in a repository.
Example:
bashcd /path/to/application/chart
cp values.yaml values-custom.yaml
vim values-custom.yaml
kubectl --namespace application-dev apply -f /path/to/microservice-secret.yml # creates a secret
helm --namespace application-dev install microservice helm-chart/ -f values-custom.yaml
Parameter | Type | Description | Default | Required |
---|---|---|---|---|
replicaCount |
int |
Number of Pod replicas | 1 |
no |
customLabels |
map |
Custom labels for all Kubernetes resources | no | |
image |
map |
A block that describes Docker image Pod template in the Deployment configuration | no | |
image.repository |
string |
Docker image repository address | "" |
yes |
image.pullPolicy |
string |
Condition for pulling new container images | Always |
no |
image.tag |
string |
Container image tag to use for running the containers in Pods | latest |
no |
imagePullSecrets |
list |
Reference to the secret with access credentials of Docker image Container Registry | [] |
no |
ingress |
map |
A block that describes Ingress settings configuration | ||
ingress.enabled |
bool |
Whether Ingress resource should be enabled for the Deployment | false |
no |
ingress.ingressClassName |
string |
Ingress Class Name | nginx |
no |
ingress.tls_enabled |
bool |
Whether Ingress resource should have TLS configured | true |
no |
ingress.annotations |
map |
Annotations to attach to the Ingress resource | cert-manager.io/cluster-issuer: letsencrypt |
no |
ingress.hosts |
list(map) |
List of host configurations for Ingress to manage | no | |
ingress.hosts[*].host |
string |
Domain name that Ingress will process connections for | chart-example.local |
no |
ingress.hosts[*].paths |
list(string) |
List of locations (routes) that Ingress will handle | ["/"] |
no |
podAnnotations |
map |
Annotations to attach to Pods deployed by the chart | {} |
no |
podSecurityContext |
map |
Security context parameters to pass to Pods deployed by the chart | {} |
no |
securityContext |
map |
Security context parameters to pass to containers in Pods deployed by the chart | {} |
no |
serviceAccountName |
string |
Name of the ServiceAccount to run the Pod with |
no | |
automountServiceAccountToken |
bool |
Whether SA web identity token must be mounted into the Pod it is used by | true |
no |
service |
map |
A block that describes Service settings configuration | ||
service.enabled |
bool |
Whether Kubernetes Service should be enabled | true |
no |
service.port |
int |
Port to expose the application as a Kubernetes Service | 80 |
no |
service.containerPort |
int |
Port the application is listening on | 80 |
no |
extraPorts |
list |
The list of additional ports to expose for application | [] |
no |
extraPorts.port |
int |
Additional port to expose the application as a Kubernetes Service | no | |
extraPorts.containerPort |
int |
Additional port the application is listening on | no | |
extraPorts.protocol |
string |
Network protocol of the additional port the application is listening on | TCP |
no |
httpProbes |
map |
HTTP probe parameters to use for Readiness and Liveness probes | {} |
no |
resources |
map |
Container resource parameters to pass to the application Pods | {} |
no |
autoscaling |
map |
A block that describes Pod autoscaling conditions | ||
autoscaling.enabled |
bool |
Whether Horizontal Pod Autoscaling should be enabled | false |
no |
autoscaling.minReplicas |
int |
Minimum number of Pod replicas to maintain | 1 |
no |
autoscaling.maxReplicas |
int |
Maximum number of Pod replicas to maintain | 100 |
no |
autoscaling.targetCPUUtilizationPercentage |
int |
CPU utilization percentage to trigger the autoscaling | 75 |
no |
autoscaling.targetMemoryUtilizationPercentage |
int |
Memory utilization percentage to trigger the autoscaling | 80 |
no |
nodeSelector |
map |
Node selector to attach to the Pods deployed by the chart | {} |
no |
tolerations |
list(map) |
List of toleration policies to attach to the Pods deployed by the chart | [] |
no |
affinity |
map |
Set of node affinity parameters for Pods deployed by the chart | {} |
no |
initContainer |
map |
A block of code in the Kubernetes Deployment which describes the init container's configuration | no | |
initContainer.enabled |
bool |
Add init container configuration block to Deployment | false |
no |
initContainer.name |
string |
A name of the init container | init |
no |
initContainer.image |
map |
A set of Docker image usage settings that will be used in init container | no | |
initContainer.image.repository |
string |
Docker image Container Registry address for init container | ghcr.io/groundnuty/k8s-wait-for |
no |
initContainer.image.pullPolicy |
string |
Condition for pulling new container images for init container | Always |
no |
initContainer.image.tag |
string |
Container image tag to use for running the init container | latest |
no |
initContainer.args |
list(string) |
A list of arguments of init container | [] |
no |
initContainer.extraSecretNamesForEnvFrom |
list(string) |
List of secrets (names) to populate init container environment with | [] |
no |
initContainer.env |
map |
Environment variables to pass to the init containers of application Pods | {} |
no |
initContainer.persistence.enabled |
bool |
Mounts volumes defined in .Values.persistence.volumesin the init container | false` |
no | |
job |
map |
Configuration block that describes kubernetes Job. Inherits SecretsProviderClass and env ConfigMap |
no | |
job.ttlSeconds |
string |
Time after which a Completed or Failed Job is deleted |
no | |
job.enabled |
bool |
Defines whether the Job should be created | false |
no |
job.backoffLimit |
int |
How many times the Job can restart before considered as failed | 1 |
no |
job.command |
list(string) |
Command entry point of the Job | [] |
no |
job.args |
list(string) |
A list of arguments for the Job | [] |
no |
job.extraSecretNamesForEnvFrom |
list(string) |
List of secrets (names) to populate Job container environment with | [] |
no |
job.env |
map |
Environment variables to pass to the Job | {} |
no |
terminationGracePeriodSeconds |
int |
TTL in seconds for Pods after Termination (use for graceful application shutdown) | 30 |
no |
extraContainers |
list(map) |
Extra containers to run alongside the main application in the Pod deployed by the chart | [] |
no |
extraContainers[*].persistence.enabled |
bool |
Mounts volumes from .Values.persistence.volumes in the extra container |
false |
no |
env |
map |
Environment variables to pass to the containers of application Pods | {} |
no |
persistence |
map |
A block that defines persistent volume settings for the main Deployment | {} |
no |
persistence.accessMode |
string |
PersistentVolumeClaim access mode |
ReadWriteOnce |
no |
persistence.volumes |
list(map) |
List of volumes definitions to mount in the main container. These volumes can be mounted to other containers if specified explicitly in corresponding blocks | [] |
no |
persistence.volumes[*].name |
string |
Volume name | yes | |
persistence.volumes[*].mountPath |
string |
Path inside container where volume will be mounted | yes | |
persistence.volumes[*].size |
int |
Size of the volume in Gi | 1 |
no |
persistence.volumes[*].storageClass |
string |
Storage class name (null for default, "-" for disabled provisioning) |
null |
no |
extraSecretNamesForEnvFrom |
list(string) |
List of secrets (names) to populate container environment with | [] |
no |
extraConfigMapNamesForEnvFrom |
list(string) |
List of config maps (names) to populate container environment with | [] |
no |
extraDeployments |
list(map) |
List of additional Deployments to run alongside the main application | [] |
no |
extraDeployments[*].name |
string |
Name suffix of the additional Deployment | yes | |
extraDeployments[*].image |
map |
A block that describes Docker image Pod template in the additional Deployment configuration (same as the main one unless explicitly defined) | no | |
extraDeployments[*].replicaCount |
number |
Number of Pod replicas of additional Deployment | 1 |
no |
extraDeployments[*].resources |
map |
Container resource parameters to pass to the application Pods of additional Deployment | {} |
no |
extraDeployments[*].podSecurityContext |
map |
Security context parameters to pass to Pods of additional Deployment | {} |
no |
extraDeployments[*].command |
list(string) |
Command entry point for the Pod of additional Deployment | [] |
no |
extraDeployments[*].args |
list(string) |
A list of arguments for the Pod of additional Deployment | [] |
no |
extraDeployments[*].persistence |
map |
A block that defines persistent volume settings for each extraDeployment | {} |
no |
extraDeployments[*].persistence.accessMode |
string |
PersistentVolume access mode for the extraDeployment | ReadWriteOnce |
no |
extraDeployments[*].persistence.volumes |
list(map) |
List of PVC volumes to mount in the extraDeployment container | [] |
no |
extraDeployments[*].persistence.volumes[*].name |
string |
Volume name | yes | |
extraDeployments[*].persistence.volumes[*].mountPath |
string |
Path inside container where volume will be mounted | yes | |
extraDeployments[*].persistence.volumes[*].size |
int |
Size of the volume in Gi | 1 |
no |
extraDeployments[*].persistence.volumes[*].storageClass |
string |
Storage class name (null for default, "-" for disabled provisioning) |
null |
no |
extraDeployments[*].mountExternalSecrets |
bool |
Whether to assign secrets genereted by the ExternalSecret | false |
no |
externalSecret |
map |
A block that describes ExternalSecret settings configuration. Requires External Secret Operator and its CRDs to be preinstalled | ||
externalSecret.clusterSecretStoreName |
string |
Name of Kubernetes ClusterSecretStore resource to be used in creation of ExternalSecret resources | secrets-manager |
no |
externalSecret.refreshInterval |
string |
Amount of time before the values reading again from the SecretStore provider | 1h |
no |
externalSecret.secretNames |
list(string) |
List of Secrets Manager's secret names to fetch the data from | [] |
no |
externalSecret.reloaderLabels |
map |
A map of labels for the ExternalSecret Reloader | {} |
no |
externalSecret.includeReloaderAnnotation |
bool |
Whether to anotate the workload to enable automatic reload by ExternalSecret Reloader | true |
no |
These components are included as is under the terms of their corresponding licenses.
Component | License |
---|---|
k8s-wait-for | MIT |