Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
96b5353
Copy slime chart as http-service base
tasuku43 Mar 5, 2026
76edd20
Remove CronJob configuration from http-service values
tasuku43 Mar 5, 2026
0a6b1a6
Rename slime to http-service in Chart.yaml and _helpers.tpl
tasuku43 Mar 5, 2026
41b52f4
Replace free-form containers array with structured single-container c…
tasuku43 Mar 5, 2026
8ea7c82
Remove deployment toggle and set RollingUpdate strategy defaults
tasuku43 Mar 5, 2026
916f96d
Enable PodDisruptionBudget by default with maxUnavailable 1
tasuku43 Mar 5, 2026
fd3c7f6
Split ingress into private and public sections
tasuku43 Mar 5, 2026
61db417
Add gracefulShutdown configuration as required value
tasuku43 Mar 5, 2026
a9889e8
Add nodeAffinity key/value configuration
tasuku43 Mar 5, 2026
3a01256
Add Datadog unified service tags configuration
tasuku43 Mar 5, 2026
2b7c937
Restructure annotations and labels under deployment/pod namespaces
tasuku43 Mar 5, 2026
cd4f122
Clean up slime references in configmaps/secrets samples
tasuku43 Mar 5, 2026
f71dac4
Rename slime to http-service and remove deployment.enabled guard
tasuku43 Mar 5, 2026
a061388
Update values reference paths in deployment template
tasuku43 Mar 5, 2026
11a1a41
Always render strategy in deployment template
tasuku43 Mar 5, 2026
ebed48b
Auto-generate Reloader annotation on Deployment
tasuku43 Mar 5, 2026
86a3722
Auto-generate Datadog unified service tag labels
tasuku43 Mar 5, 2026
5e8e4b9
Replace containers loop with single-container definition
tasuku43 Mar 5, 2026
65c3f9d
Redesign gracefulShutdown with explicit drain and app timeout values
tasuku43 Mar 5, 2026
399401e
Add gracefulShutdown with terminationGracePeriodSeconds and preStop hook
tasuku43 Mar 5, 2026
78457cf
Make startupProbe and livenessProbe required
tasuku43 Mar 5, 2026
dd55293
Simplify affinity to plain passthrough, remove nodeAffinity auto-gene…
tasuku43 Mar 5, 2026
563b6b6
Remove unused Pod spec fields from deployment template
tasuku43 Mar 5, 2026
fc37447
Replace tpl calls with plain toYaml in deployment template
tasuku43 Mar 5, 2026
0b38146
Simplify topologySpreadConstraints to plain passthrough
tasuku43 Mar 5, 2026
47d2b9f
Add tolerations, topologySpreadConstraints, and extraPodSpec
tasuku43 Mar 5, 2026
5055d8d
Rename slime to http-service in Service template
tasuku43 Mar 5, 2026
53d2139
Revert ingress to generic map structure, rename to http-service
tasuku43 Mar 5, 2026
9a8542d
Rename slime to http-service in PDB template, drop v1beta1 compat
tasuku43 Mar 5, 2026
f859272
Rename remaining templates, delete cronjob, drop old API version compat
tasuku43 Mar 5, 2026
3e92ff6
Redesign autoscaling with type-based switching (none/hpa/keda)
tasuku43 Mar 5, 2026
368cf18
Rewrite HPA template with type-based autoscaling and validation
tasuku43 Mar 5, 2026
18785fa
Add KEDA ScaledObject template for type keda autoscaling
tasuku43 Mar 5, 2026
d206edb
Update deployment replicas condition for type-based autoscaling
tasuku43 Mar 5, 2026
6c97870
Validate replicas and autoscaling are mutually exclusive
tasuku43 Mar 5, 2026
956aad5
Add Argo Rollouts support with HPA/KEDA scaleTargetRef switching
tasuku43 Mar 5, 2026
0857372
Remove CronJob example files
tasuku43 Mar 6, 2026
c0f9073
Update example values for new chart structure
tasuku43 Mar 6, 2026
62c75c2
Update Makefile for new example patterns
tasuku43 Mar 6, 2026
e705b3f
Add README for http-service chart
tasuku43 Mar 6, 2026
ba41726
Rename podDisruptionBudget to pod.disruptionBudget
tasuku43 Mar 6, 2026
4c56da5
Move autoscaling.type validation from hpa.yaml to deployment.yaml
tasuku43 Mar 6, 2026
3084735
Remove remaining tpl calls and fix misleading required message
tasuku43 Mar 6, 2026
0a26d43
Extract required checks into variables for readability
tasuku43 Mar 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions http-service/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
5 changes: 5 additions & 0 deletions http-service/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: http-service
description: An opinionated Helm chart for language-agnostic HTTP services with sensible defaults
type: application
version: 0.1.0
60 changes: 60 additions & 0 deletions http-service/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
KUBERNETES_VERSION = $${KUBERNETES_VERSION:-"1.33.0"}
RELEASE = $$(basename $$PWD)

.PHONY: install
install:
helm upgrade -i -f examples/deployment.yaml --wait $(RELEASE) .

.PHONY: lint
lint: lint-deployment lint-deployment-hpa lint-deployment-ingress lint-deployment-keda lint-deployment-rollout

.PHONY: lint-deployment
lint-deployment:
@echo "=> Linting examples/deployment.yaml"
helm lint --strict -f examples/deployment.yaml
@echo "=> Validating examples/deployment.yaml"
helm template -f examples/deployment.yaml . | kubeval --strict --ignore-missing-schemas --additional-schema-locations https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/ --kubernetes-version $(KUBERNETES_VERSION) --exit-on-error

.PHONY: lint-deployment-hpa
lint-deployment-hpa:
@echo "=> Linting examples/deployment-hpa.yaml"
helm lint --strict -f examples/deployment-hpa.yaml
@echo "=> Validating examples/deployment-hpa.yaml"
helm template -f examples/deployment-hpa.yaml . | kubeval --strict --ignore-missing-schemas --additional-schema-locations https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/ --kubernetes-version $(KUBERNETES_VERSION) --exit-on-error

.PHONY: lint-deployment-ingress
lint-deployment-ingress:
@echo "=> Linting examples/deployment-ingress.yaml"
helm lint --strict -f examples/deployment-ingress.yaml
@echo "=> Validating examples/deployment-ingress.yaml"
helm template -f examples/deployment-ingress.yaml . | kubeval --strict --ignore-missing-schemas --additional-schema-locations https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/ --kubernetes-version $(KUBERNETES_VERSION) --exit-on-error

.PHONY: lint-deployment-keda
lint-deployment-keda:
@echo "=> Linting examples/deployment-keda.yaml"
helm lint --strict -f examples/deployment-keda.yaml
@echo "=> Validating examples/deployment-keda.yaml"
helm template -f examples/deployment-keda.yaml . | kubeval --strict --ignore-missing-schemas --additional-schema-locations https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/ --kubernetes-version $(KUBERNETES_VERSION) --exit-on-error

.PHONY: lint-deployment-rollout
lint-deployment-rollout:
@echo "=> Linting examples/deployment-rollout.yaml"
helm lint --strict -f examples/deployment-rollout.yaml
@echo "=> Validating examples/deployment-rollout.yaml"
helm template -f examples/deployment-rollout.yaml . | kubeval --strict --ignore-missing-schemas --additional-schema-locations https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/ --kubernetes-version $(KUBERNETES_VERSION) --exit-on-error

.PHONY: test
test: test-deployment

.PHONY: test-deployment
test-deployment:
@if helm ls | grep -v "NAME" | cut -f1 | grep -e "^$(RELEASE)$$" > /dev/null; then helm uninstall $(RELEASE); fi
@echo "=> Testing examples/deployment.yaml"
helm upgrade -i --wait -f examples/deployment.yaml $(RELEASE)-deployment .
sleep 30
helm test $(RELEASE)-deployment --logs
helm uninstall $(RELEASE)-deployment

.PHONY: uninstall
uninstall:
@if helm ls | grep -v "NAME" | cut -f1 | grep -e "^$(RELEASE)$$" > /dev/null; then helm uninstall $(RELEASE); fi
82 changes: 82 additions & 0 deletions http-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# http-service

An opinionated Helm chart for language-agnostic HTTP services with sensible defaults.

## Install

\`\`\`sh
helm repo add chatwork https://chatwork.github.io/charts
helm install my-service chatwork/http-service -f values.yaml
\`\`\`

## Opinionated defaults

| Concern | Default | Rationale |
|---------|---------|-----------|
| Strategy | \`RollingUpdate\` (maxSurge 25%, maxUnavailable 1) | Zero-downtime deploys |
| PDB | \`pod.disruptionBudget.enabled: true\`, \`maxUnavailable: 1\` | Protect availability during node drain |
| Reloader | \`enabled: true\` | Auto-restart on ConfigMap/Secret changes |
| Datadog tags | \`enabled: true\` | Unified service tags (\`env\`, \`service\`, \`version\`) on Deployment and Pod |
| Graceful shutdown | Required (\`trafficDrainSeconds\` + \`appShutdownTimeoutSeconds\`) | Prevent traffic loss during termination |
| Probes | \`startupProbe\` and \`livenessProbe\` required, \`readinessProbe\` optional | Enforce health check discipline |

## Required values

The following values must be provided — the template will fail with an explicit error if they are missing:

- \`image.repository\` / \`image.tag\`
- \`gracefulShutdown.trafficDrainSeconds\` — seconds to sleep in preStop, waiting for LB deregistration
- \`gracefulShutdown.appShutdownTimeoutSeconds\` — seconds the app gets after SIGTERM
- \`startupProbe\`
- \`livenessProbe\`
- \`datadog.env\` / \`datadog.service\` / \`datadog.version\` (when \`datadog.enabled: true\`)

## Autoscaling

Controlled by \`autoscaling.type\`:

| Type | Description |
|------|-------------|
| \`none\` | Fixed replicas (set \`replicas\` value) |
| \`hpa\` | Kubernetes-native HorizontalPodAutoscaler |
| \`keda\` | KEDA ScaledObject (manages HPA internally) |

When \`autoscaling.type\` is \`hpa\` or \`keda\`, setting \`replicas\` will cause a template error to prevent conflicts.

## Argo Rollouts

Set \`rollout.enabled: true\` to create a Rollout resource that references the Deployment via \`workloadRef\`. The HPA/KEDA \`scaleTargetRef\` automatically switches to target the Rollout.

\`rollout.strategy\` is required when enabled.

## Graceful shutdown

The chart auto-generates \`terminationGracePeriodSeconds\` and a preStop hook:

\`\`\`
|-- terminationGracePeriodSeconds (drain + app) --|
|-- preStop sleep (drain) --|-- app shutdown ------|
^
SIGTERM
\`\`\`

The preStop sleep holds the container alive while the load balancer finishes deregistering the Pod.

## Examples

See [\`examples/\`](examples/) for values files covering common patterns:

| File | Pattern |
|------|---------|
| \`deployment.yaml\` | Basic deployment with fixed replicas |
| \`deployment-hpa.yaml\` | HPA autoscaling |
| \`deployment-ingress.yaml\` | Ingress with ALB |
| \`deployment-keda.yaml\` | KEDA autoscaling |
| \`deployment-rollout.yaml\` | Argo Rollouts canary |

## Lint & test

\`\`\`sh
make lint # lint all examples
make test # deploy + helm test (requires cluster)
\`\`\`
64 changes: 64 additions & 0 deletions http-service/examples/deployment-hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Deployment with HPA autoscaling
image:
repository: nginx
tag: latest

containerPort: 80

gracefulShutdown:
trafficDrainSeconds: 25
appShutdownTimeoutSeconds: 30

startupProbe:
httpGet:
path: /
port: 80
failureThreshold: 5
initialDelaySeconds: 10
periodSeconds: 1

livenessProbe:
httpGet:
path: /
port: 80
failureThreshold: 2
periodSeconds: 10

resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 100m
memory: 128Mi

datadog:
enabled: true
env: production
service: nginx-example-hpa
version: "1.0.0"

autoscaling:
type: hpa
minReplicas: 2
maxReplicas: 10
hpa:
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
behavior:
scaleDown:
stabilizationWindowSeconds: 300

service:
enabled: true
type: ClusterIP
ports:
http:
targetPort: 80
port: 80
protocol: TCP
65 changes: 65 additions & 0 deletions http-service/examples/deployment-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Deployment with Ingress
image:
repository: nginx
tag: latest

containerPort: 80

replicas: 2

gracefulShutdown:
trafficDrainSeconds: 25
appShutdownTimeoutSeconds: 30

startupProbe:
httpGet:
path: /
port: 80
failureThreshold: 5
initialDelaySeconds: 10
periodSeconds: 1

livenessProbe:
httpGet:
path: /
port: 80
failureThreshold: 2
periodSeconds: 10

resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 100m
memory: 128Mi

datadog:
enabled: true
env: production
service: nginx-example-ingress
version: "1.0.0"

service:
enabled: true
type: ClusterIP
ports:
http:
targetPort: 80
port: 80
protocol: TCP

ingress:
enabled: true
ingresses:
main:
ingressClassName: alb
annotations:
alb.ingress.kubernetes.io/scheme: internal
alb.ingress.kubernetes.io/target-type: ip
hosts:
- host: example.com
paths:
- path: "/*"
pathType: ImplementationSpecific
portNumber: 80
61 changes: 61 additions & 0 deletions http-service/examples/deployment-keda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Deployment with KEDA autoscaling
image:
repository: nginx
tag: latest

containerPort: 80

gracefulShutdown:
trafficDrainSeconds: 25
appShutdownTimeoutSeconds: 30

startupProbe:
httpGet:
path: /
port: 80
failureThreshold: 5
initialDelaySeconds: 10
periodSeconds: 1

livenessProbe:
httpGet:
path: /
port: 80
failureThreshold: 2
periodSeconds: 10

resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 100m
memory: 128Mi

datadog:
enabled: true
env: production
service: nginx-example-keda
version: "1.0.0"

autoscaling:
type: keda
minReplicas: 2
maxReplicas: 10
keda:
pollingInterval: 30
cooldownPeriod: 300
triggers:
- type: cpu
metadata:
type: Utilization
value: "50"

service:
enabled: true
type: ClusterIP
ports:
http:
targetPort: 80
port: 80
protocol: TCP
Loading