common-app

by bytefm

Helm chartv0.0.2App 0.0.1MITVerified publisher

Shared Helm library chart for deploying applications on Kubernetes.

About this chart

common-app

Shared Helm library chart for deploying applications on Kubernetes.

common-app is a Helm library chart. It is not installed directly; application charts depend on it and call its named templates.

The library renders one primary application workload per release:

  • Deployment
  • optional StatefulSet
  • Service
  • optional Ingress
  • optional ConfigMap
  • optional Secret
  • optional ServiceAccount
  • optional HorizontalPodAutoscaler
  • optional PodDisruptionBudget
  • optional NetworkPolicy
  • optional ServiceMonitor
  • optional PodMonitor

It also centralizes labels, selectors, container commands and arguments, probes, environment variables, service account configuration, pod security context, container security context, resources, node selectors, tolerations, affinity, and extra volumes. Use extraManifests to render additional resources such as PVCs, Jobs, or Deployments.

Usage

Add common-app as a dependency from the ByteFork chart repository or by local path while developing:

dependencies:
  - name: common-app
    version: 0.0.2
    repository: https://bytefork.github.io/helm-charts

Then render all supported resources from an application chart template:

{{ include "common-app.all" . }}

Application charts can also include individual templates such as common-app.deployment, common-app.service, or common-app.ingress.

Render Check

This repository includes a fixture chart at examples/render-chart that depends on common-app by local path. Use it to verify the library renders valid manifests:

helm dependency build charts/common-app/examples/render-chart --skip-refresh
helm template common-app-fixture charts/common-app/examples/render-chart \
  --values charts/common-app/examples/render-chart/ci/values.yaml

Values

The library expects application charts to expose the values they want to support. At minimum, consumers must set image.repository.

KeyTypeDefaultDescription
replicaCountint1Number of application replicas.
nameOverridestring""Override the chart name used in resource names.
fullnameOverridestring""Override the full generated resource name.
commonLabelsobject{}Labels added to all resources rendered by the library.
commonAnnotationsobject{}Annotations added to all resources rendered by the library.
serviceAccountobject{"annotations":{},"automountServiceAccountToken":false,"create":true,"labels":{},"name":""}ServiceAccount configuration for the workload.
serviceAccount.createbooltrueCreate a ServiceAccount.
serviceAccount.namestring""Name of the ServiceAccount to create or use. Defaults to the chart fullname.
serviceAccount.automountServiceAccountTokenboolfalseWhether pods should automount the ServiceAccount token.
serviceAccount.annotationsobject{}Annotations added to the ServiceAccount.
serviceAccount.labelsobject{}Labels added to the ServiceAccount.
imageobject{"pullPolicy":"IfNotPresent","repository":"","tag":""}Container image configuration.
image.repositorystring""Container image repository. Required by consuming charts.
image.tagstring""Container image tag. Defaults to chart appVersion when empty.
image.pullPolicystring"IfNotPresent"Container image pull policy.
commandlist[]Container command override. Leave empty to use the image entrypoint.
argslist[]Container arguments. Leave empty to use the image defaults.
imagePullSecretslist[]Image pull secrets attached to the pod.
deploymentobject{"annotations":{},"enabled":true,"labels":{}}Deployment configuration.
deployment.enabledbooltrueCreate a Deployment workload.
deployment.annotationsobject{}Annotations added to the Deployment.
deployment.labelsobject{}Labels added to the Deployment.
statefulSetobject{"annotations":{},"enabled":false,"labels":{},"podManagementPolicy":"OrderedReady","serviceName":"","updateStrategy":{"type":"RollingUpdate"},"volumeClaimTemplates":[]}StatefulSet configuration. Enable instead of Deployment for workloads that require stable identity.
statefulSet.enabledboolfalseCreate a StatefulSet workload.
statefulSet.annotationsobject{}Annotations added to the StatefulSet.
statefulSet.labelsobject{}Labels added to the StatefulSet.
statefulSet.serviceNamestring""StatefulSet serviceName. Defaults to the chart fullname.
statefulSet.podManagementPolicystring"OrderedReady"StatefulSet pod management policy.
statefulSet.updateStrategyobject{"type":"RollingUpdate"}StatefulSet update strategy.
statefulSet.volumeClaimTemplateslist[]StatefulSet volume claim templates.
podAnnotationsobject{}Annotations added to workload pods.
podLabelsobject{}Labels added to workload pods.
podSecurityContextobject{"runAsNonRoot":true,"seccompProfile":{"type":"RuntimeDefault"}}Pod security context.
securityContextobject{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true,"runAsNonRoot":true}Container security context.
serviceobject{"annotations":{},"enabled":true,"extraPorts":[],"labels":{},"port":80,"protocol":"TCP","targetPort":"http","type":"ClusterIP"}Service configuration.
service.enabledbooltrueCreate a Service.
service.typestring"ClusterIP"Service type.
service.portint80Service port.
service.targetPortstring"http"Service target port.
service.protocolstring"TCP"Service protocol.
service.extraPortslist[]Additional Service ports appended after the primary http port. Each entry must match the Kubernetes ServicePort shape.
service.annotationsobject{}Annotations added to the Service.
service.labelsobject{}Labels added to the Service.
containerPortint8080Primary container HTTP port.
extraContainerPortslist[]Additional container ports appended after the primary http port. Each entry must match the Kubernetes ContainerPort shape.
ingressobject{"annotations":{},"className":"","enabled":false,"hosts":[],"labels":{},"tls":[]}Ingress configuration.
ingress.enabledboolfalseCreate an Ingress.
ingress.classNamestring""IngressClass name.
ingress.annotationsobject{}Annotations added to the Ingress.
ingress.labelsobject{}Labels added to the Ingress.
ingress.hostslist[]Ingress host rules.
ingress.tlslist[]Ingress TLS configuration.
probesobject{"liveness":{"enabled":true,"failureThreshold":3,"initialDelaySeconds":10,"path":"/healthz","periodSeconds":10,"timeoutSeconds":2},"readiness":{"enabled":true,"failureThreshold":3,"initialDelaySeconds":5,"path":"/healthz","periodSeconds":10,"timeoutSeconds":2}}HTTP probe configuration.
probes.livenessobject{"enabled":true,"failureThreshold":3,"initialDelaySeconds":10,"path":"/healthz","periodSeconds":10,"timeoutSeconds":2}Liveness probe configuration.
probes.liveness.enabledbooltrueEnable the liveness probe.
probes.liveness.pathstring"/healthz"Liveness probe HTTP path.
probes.liveness.initialDelaySecondsint10Liveness probe initial delay in seconds.
probes.liveness.periodSecondsint10Liveness probe period in seconds.
probes.liveness.timeoutSecondsint2Liveness probe timeout in seconds.
probes.liveness.failureThresholdint3Liveness probe failure threshold.
probes.readinessobject{"enabled":true,"failureThreshold":3,"initialDelaySeconds":5,"path":"/healthz","periodSeconds":10,"timeoutSeconds":2}Readiness probe configuration.
probes.readiness.enabledbooltrueEnable the readiness probe.
probes.readiness.pathstring"/healthz"Readiness probe HTTP path.
probes.readiness.initialDelaySecondsint5Readiness probe initial delay in seconds.
probes.readiness.periodSecondsint10Readiness probe period in seconds.
probes.readiness.timeoutSecondsint2Readiness probe timeout in seconds.
probes.readiness.failureThresholdint3Readiness probe failure threshold.
envlist[]Additional Kubernetes env entries.
envMapobject{}Additional literal environment variables rendered as Kubernetes env entries.
envFromlist[]Additional envFrom entries.
configMapobject{"annotations":{},"data":{},"enabled":false,"labels":{},"name":""}ConfigMap configuration.
configMap.enabledboolfalseCreate a ConfigMap.
configMap.namestring""ConfigMap name. Defaults to <fullname>-config.
configMap.annotationsobject{}Annotations added to the ConfigMap.
configMap.labelsobject{}Labels added to the ConfigMap.
configMap.dataobject{}ConfigMap data.
secretobject{"annotations":{},"data":{},"enabled":false,"labels":{},"name":"","stringData":{},"type":"Opaque"}Secret configuration.
secret.enabledboolfalseCreate a Secret.
secret.namestring""Secret name. Defaults to <fullname>-secret.
secret.typestring"Opaque"Secret type.
secret.annotationsobject{}Annotations added to the Secret.
secret.labelsobject{}Labels added to the Secret.
secret.dataobject{}Secret data. Values must be base64-encoded.
secret.stringDataobject{}Secret stringData. Values are encoded by Kubernetes.
serviceMonitorobject{"annotations":{},"enabled":false,"honorLabels":false,"interval":"30s","labels":{},"metricRelabelings":[],"namespaceSelector":{},"path":"/metrics","port":"http","relabelings":[],"scheme":"http","scrapeTimeout":"10s","selector":{}}Prometheus Operator ServiceMonitor configuration.
serviceMonitor.enabledboolfalseCreate a ServiceMonitor.
serviceMonitor.annotationsobject{}Annotations added to the ServiceMonitor.
serviceMonitor.labelsobject{}Labels added to the ServiceMonitor.
serviceMonitor.intervalstring"30s"Scrape interval.
serviceMonitor.scrapeTimeoutstring"10s"Scrape timeout.
serviceMonitor.pathstring"/metrics"Metrics HTTP path.
serviceMonitor.portstring"http"Named service port to scrape.
serviceMonitor.schemestring"http"Metrics scheme.
serviceMonitor.honorLabelsboolfalseHonor labels from scraped metrics.
serviceMonitor.selectorobject{}Additional selector labels.
serviceMonitor.namespaceSelectorobject{}ServiceMonitor namespace selector.
serviceMonitor.metricRelabelingslist[]Metric relabeling rules.
serviceMonitor.relabelingslist[]Relabeling rules.
podMonitorobject{"annotations":{},"enabled":false,"honorLabels":false,"interval":"30s","labels":{},"metricRelabelings":[],"namespaceSelector":{},"path":"/metrics","port":"http","relabelings":[],"scheme":"http","scrapeTimeout":"10s","selector":{}}Prometheus Operator PodMonitor configuration.
podMonitor.enabledboolfalseCreate a PodMonitor.
podMonitor.annotationsobject{}Annotations added to the PodMonitor.
podMonitor.labelsobject{}Labels added to the PodMonitor.
podMonitor.intervalstring"30s"Scrape interval.
podMonitor.scrapeTimeoutstring"10s"Scrape timeout.
podMonitor.pathstring"/metrics"Metrics HTTP path.
podMonitor.portstring"http"Named pod port to scrape.
podMonitor.schemestring"http"Metrics scheme.
podMonitor.honorLabelsboolfalseHonor labels from scraped metrics.
podMonitor.selectorobject{}Additional selector labels.
podMonitor.namespaceSelectorobject{}PodMonitor namespace selector.
podMonitor.metricRelabelingslist[]Metric relabeling rules.
podMonitor.relabelingslist[]Relabeling rules.
autoscalingobject{"annotations":{},"behavior":{},"enabled":false,"labels":{},"maxReplicas":3,"minReplicas":1,"targetCPUUtilizationPercentage":80,"targetMemoryUtilizationPercentage":null}HorizontalPodAutoscaler configuration.
autoscaling.enabledboolfalseCreate a HorizontalPodAutoscaler.
autoscaling.annotationsobject{}Annotations added to the HorizontalPodAutoscaler.
autoscaling.labelsobject{}Labels added to the HorizontalPodAutoscaler.
autoscaling.minReplicasint1Minimum number of replicas.
autoscaling.maxReplicasint3Maximum number of replicas.
autoscaling.targetCPUUtilizationPercentageint80Target average CPU utilization percentage.
autoscaling.targetMemoryUtilizationPercentagestringnilTarget average memory utilization percentage.
autoscaling.behaviorobject{}HorizontalPodAutoscaler behavior configuration.
podDisruptionBudgetobject{"annotations":{},"enabled":false,"labels":{},"maxUnavailable":null,"minAvailable":1}PodDisruptionBudget configuration.
podDisruptionBudget.enabledboolfalseCreate a PodDisruptionBudget.
podDisruptionBudget.annotationsobject{}Annotations added to the PodDisruptionBudget.
podDisruptionBudget.labelsobject{}Labels added to the PodDisruptionBudget.
podDisruptionBudget.minAvailableint1Minimum available pods.
podDisruptionBudget.maxUnavailablestring`nil

Deploy common-app with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has common-app on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcommon-app is pinned at v0.0.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply