service-deployment

by Snowplow

Helm chartv0.44.1Verified publisher

A Helm Chart to setup a generic deployment with optional service/hpa/vpa bindings

About this chart

service-deployment

A Helm Chart to setup a generic deployment with optional service/hpa/vpa bindings

Homepage: https://github.com/snowplow-devops/helm-charts

Maintainers

NameEmailUrl
Andy-Hay[email protected]https://github.com/Andy-Hay
ianarsenault[email protected]https://github.com/ianarsenault
jamesarems[email protected]https://github.com/jamesarems

Source Code

Requirements

RepositoryNameVersion
https://snowplow-devops.github.io/helm-chartscloudserviceaccount0.3.0
https://snowplow-devops.github.io/helm-chartsdockerconfigjson0.1.0

Values

KeyTypeDefaultDescription
affinityobject{}Affinity supports podAffinity, podAntiAffinity, or nodeAffinity
automountServiceAccountTokenboolfalseWhether to mount the service account API token into the pod; set to true only for workloads that call the Kubernetes API
cloudserviceaccount.aws.roleARNstring""IAM Role ARN to bind to the k8s service account
cloudserviceaccount.azure.managedIdentityIdstring""Workload managed identity id to bind to the k8s service account
cloudserviceaccount.deployboolfalseWhether to create a service-account
cloudserviceaccount.gcp.serviceAccountstring""Service Account email to bind to the k8s service account
cloudserviceaccount.namestring"snowplow-sd-service-account"Name of the service-account to create
config.argslist[]
config.commandlist[]
config.envstringnilMap of environment variables to use within the job
config.secretsobject{}Map of secrets that will be exposed as environment variables within the job
config.secretsB64object{}Map of base64-encoded secrets that will be exposed as environment variables within the job
config.sharedNamespaceConfigMapslist[]List of configMaps from other deployments within the same namespace - to reference and mount in the deployment
config.workingDirstring""Optional working directory for the container process. Useful when readOnlyRootFilesystem is true and the app writes to its CWD; point at a writable mount declared via extraVolumes / extraVolumeMounts.
configMapslist[]List of config maps to mount to the deployment
containerSecurityContextobject{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":false,"runAsNonRoot":true,"seccompProfile":{"type":"RuntimeDefault"}}Container security context configuration These defaults follow kubesec.io best practices for hardened deployments. runAsUser / runAsGroup are intentionally not pinned. Different container images bake in different non-root USER directives, and forcing a specific UID can prevent the image's user from accessing its own files. The image's USER directive selects the runtime UID; runAsNonRoot: true still enforces the non-root invariant. Override per-deployment if you need a specific UID. readOnlyRootFilesystem defaults to false so existing deployments are not broken on upgrade; set it to true per-deployment once writable paths (e.g. /tmp) are mounted as emptyDirs.
deployment.kindstring"Deployment"Can be either a "Deployment" or "StatefulSet"
deployment.podAnnotationsobject{}Map of annotations that will be added to each pod in the deployment
deployment.podLabelsobject{}Map of labels that will be added to each pod in the deployment
deployment.replicasint1
deployment.scaleToZeroboolfalseWhen enabled, disables the HPA and scales the deployment to zero replicas
deployment.strategyobject{"rollingUpdate":{"maxSurge":"25%","maxUnavailable":"25%"},"type":"RollingUpdate"}How to replace existing pods with new ones
deployment.strategy.rollingUpdate.maxSurgestring"25%"The maximum number or precent of pods that can be created in addition to the current number of pods during the rolling update. Can be set as number "5" for 5 additional pods
deployment.strategy.rollingUpdate.maxUnavailablestring"25%"The max number or percent of pods that can be unavailable during rolling update. Can be set as number "3" for 3 pods unavailable
deployment.strategy.typestring"RollingUpdate"Change to "Recreate" if all pods should be killed before new ones are created
dockerconfigjson.emailstring""Email address for user of the private repository
dockerconfigjson.namestring"snowplow-sd-dockerhub"Name of the secret to use for the private repository
dockerconfigjson.passwordstring""Password for the private repository
dockerconfigjson.serverstring"https://index.docker.io/v1/"Repository server URL
dockerconfigjson.usernamestring""Username for the private repository
extraObjectslist[]Extra Kubernetes objects to deploy alongside the service This allows for additional resources like Middleware, NetworkPolicy, etc.
extraVolumeMountslist[]Additional volume mounts to attach to the container. Pair with extraVolumes above.
extraVolumeslist[]Additional volumes to attach to the pod spec. Useful with readOnlyRootFilesystem: true — declare writable scratch space (e.g. emptyDir on /tmp) without disabling the hardened default.
fullnameOverridestring""Overrides the full-name given to the deployment resources (default: .Release.Name)
global.cloudstring""Cloud specific bindings (options: aws, gcp , azure)
global.labelsobject{}
hooksobject{}
hpa.behaviorobject{}
hpa.deploybooltrueWhether to deploy HPA rules
hpa.maxReplicasint20Maximum number of pods to deploy
hpa.metricslist[{"resource":{"name":"cpu","target":{"averageUtilization":75,"type":"Utilization"}},"type":"Resource"}]Default average CPU utilization before auto-scaling starts
hpa.minReplicasint1Minimum number of pods to deploy
image.pullPolicystring"IfNotPresent"The image pullPolicy to use
image.repositorystring"nginxinc/nginx-unprivileged"
image.tagstring"stable"
livenessProbeobject{"exec":{"command":[]},"failureThreshold":3,"httpGet":{"path":"","port":null},"initialDelaySeconds":5,"periodSeconds":5,"successThreshold":1,"timeoutSeconds":5}livenessProbe is enabled if httpGet.path or exec.command are present
livenessProbe.exec.commandlist[]Command/arguments to execute to determine liveness
livenessProbe.httpGet.pathstring""Path for health checks to be performed to determine liveness
livenessProbe.httpGet.portstringnilPort for liveness health checks (defaults to service.port when unset)
persistentVolume.accessModeslist["ReadWriteOnce"]Access modes to allow (note: this will impact HPA rules if the volume cannot be bound to all containers when deployment.kind is "Deployment")
persistentVolume.annotationsobject{}Persistent Volume annotations
persistentVolume.enabledboolfalseWhether to deploy a persistent-volume (note: when deployment.kind is "StatefulSet" one volume will be created per replica)
persistentVolume.labelsobject{}Persistent Volume labels
persistentVolume.mountPathstring"/data"Persistent Volume mount root path
persistentVolume.sizestring"8Gi"Persistent Volume size
persistentVolume.statefulSetRetentionPolicyobject{"whenDeleted":"Retain","whenScaled":"Delete"}Sets the retention policies for the volumes created in "StatefulSet" mode
persistentVolume.statefulSetRetentionPolicy.whenDeletedstring"Retain"What to do with volumes when the StatefulSet is deleted
persistentVolume.statefulSetRetentionPolicy.whenScaledstring"Delete"What to do with volumes when scaling occurs
persistentVolume.subPathstring""Subdirectory of Persistent Volume to mount
podDisruptionBudget.enabledboolfalseWhether to deploy a PodDisruptionBudget
podDisruptionBudget.minAvailableint1Minimum number (or percentage) of pods that must remain available. Mutually exclusive with maxUnavailable.
priorityClassNamestring""PriorityClassName for pods
readinessProbeobject{"exec":{"command":[]},"failureThreshold":3,"httpGet":{"path":"","port":null},"initialDelaySeconds":5,"periodSeconds":5,"successThreshold":2,"timeoutSeconds":5}readinessProbe is enabled if httpGet.path or exec.command are present
readinessProbe.exec.commandlist[]Command/arguments to execute to determine readiness
readinessProbe.httpGet.pathstring""Path for health checks to be performed to determine readiness
readinessProbe.httpGet.portstringnilPort for readiness health checks (defaults to service.port when unset)
resourcesobject{}Map of resource constraints for the service
securityContextobject{}Pod security context configuration This is particularly useful when using persistent volumes with non-root container users Setting fsGroup ensures that mounted volumes have the correct group ownership
service.additionalPortslist[]Additional ports to expose on the Kubernetes Service
service.annotationsobject{}Map of annotations to add to the service
service.aws.targetGroupARNstring""EC2 TargetGroup ARN to bind the service onto
service.basicAuthobject{"enabled":false,"users":""}Basic authentication configuration
service.basicAuth.enabledboolfalseEnable basic authentication
service.basicAuth.usersstring""htpasswd-formatted users string (bcrypt hash, e.g. "user:$2y$05$...")
service.buffering.enabledboolfalseEnable request buffering middleware
service.buffering.maxRequestBodyBytesint2097152Maximum request body size in bytes before the request is rejected
service.buffering.memRequestBodyBytesint2097152Request body size in bytes buffered in memory before spilling to disk
service.deploybooltrueWhether to setup service bindings (note: only NodePort is supported)
service.gcp.networkEndpointGroupNamestring""Name of the Network Endpoint Group to bind onto
service.ingressobject{}A map of ingress rules to deploy
service.ingressIPAllowlistlist[]List of IP addresses to restrict ingress traffic to
service.portint8000Port to bind and expose the service on
service.protocolstring"TCP"Protocol that the service leverages (note: TCP or UDP)
service.rateLimitobject{"average":100,"burst":200,"enabled":false,"period":"1m","sourceCriterion":{"enabled":false,"ipStrategy":{"depth":1,"excludedIPs":[]},"requestHeaderName":"","type":"ipStrategy"}}Rate limiting configuration WARNING: These defaults are conservative and intended for testing. For production use, adjust based on your service's expected traffic patterns. Current defaults: 100 requests per minute = ~4.3M requests/month per IP (or total if global)
service.rateLimit.averageint100Average number of requests per period
service.rateLimit.burstint200Burst size - maximum number of requests allowed in a burst
service.rateLimit.enabledboolfalseEnable rate limiting
service.rateLimit.periodstring"1m"Time period for rate limiting (e.g., "1m", "1s", "1h")
service.rateLimit.sourceCriterionobject{"enabled":false,"ipStrategy":{"depth":1,"excludedIPs":[]},"requestHeaderName":"","type":"ipStrategy"}Source-based rate limiting configuration
service.rateLimit.sourceCriterion.enabledboolfalseEnable source-based rate limiting (false = global rate limit for entire service)
service.rateLimit.sourceCriterion.ipStrategyobject{"depth":1,"excludedIPs":[]}Configuration for IP-based rate limiting (when type is "ipStrategy")
service.rateLimit.sourceCriterion.ipStrategy.depthint1Depth of IP extraction for X-Forwarded-For header (1 = direct, 2 = behind 1 proxy)
service.rateLimit.sourceCriterion.ipStrategy.excludedIPslist[]List of IPs/CIDRs that bypass rate limiting entirely (e.g., internal networks, monitoring)
service.rateLimit.sourceCriterion.requestHeaderNamestring""Header name to use for rate limiting (required when type is "requestHeaderName")
service.rateLimit.sourceCriterion.typestring"ipStrategy"Type of source criterion: "ipStrategy" (default), "requestHeaderName", or "requestHost"
service.targetPortint80The Target Port that the actual application is being exposed on
terminationGracePeriodSecondsint60Grace period for termination of the service
tolerationslist[]Allow the scheduler to schedule pods with matching taints more details here: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
topologySpreadConstraintslist[]topologySpreadConstraints control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, and other user-defined topology domains. more details here: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
vpa.enabledboolfalseWhether to deploy VPA rules
vpa.specobject{}VPA resource specification (accepts any valid VPA

Deploy service-deployment with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has service-deployment 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 chartservice-deployment is pinned at v0.44.1 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