Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shop Platform Helm Chart

Reusable Helm chart for deploying multiple application components with shared structure and environment-based configuration.

Supports:

  • Multiple components
  • Multiple instances per component (production fan-out)
  • Shared global configuration
  • Per-component shared config
  • Per-instance overrides
  • Resource inheritance and overrides

Architecture

Global
  ↓
Component
  ↓
Instance

Configuration order (highest override wins):

global → component → instance

Directory Structure

shop-platform/

├── Chart.yaml
├── templates/
│   ├── deployment.yaml
│   └── configmap.yaml
│
└── values/
    ├── dev.yaml
    ├── preprod.yaml
    └── prod.yaml

Installation

Dev

helm upgrade --install shop-dev . \
  -f values/dev.yaml

Preprod

helm upgrade --install shop-preprod . \
  -f values/preprod.yaml

Prod

helm upgrade --install shop-prod . \
  -f values/prod.yaml

Values Structure

global:

components:
  - componentName:
    image:
    replicas:
    resources:
    commonConfig:
    instances:

Global Configuration

Applies to all deployments generated by the chart.

global:
  annotations:
    prometheus.io/scrape: "true"

  labels:
    team: backend

  imagePullSecrets:
    - name: prod-regcred

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

  nodeSelector:
    workload: backend

Supported global fields

Field Description
annotations Applied to all deployments/pods
labels Shared labels
imagePullSecrets Registry credentials
resources Default resource limits/requests
nodeSelector Scheduling constraints
tolerations Scheduling constraints
affinity Scheduling constraints

Adding a Component

Example: inventory

components:
  - componentName: inventory

    image: ghcr.io/acme/inventory-service:1.0.0

    replicas: 2

    commonConfig:
      DB_PORT: "5432"
      LOG_LEVEL: info

    instances:
      - name: default
        config:
          DB_HOST: inventory-db

Multiple Instances per Component

Example: orders

components:
  - componentName: orders

    image: ghcr.io/acme/orders-service:1.3.0

    replicas: 5

    commonConfig:
      DB_PORT: "5432"
      LOG_LEVEL: warn

    instances:
      - name: eu
        config:
          DB_HOST: postgres-eu
          REGION: eu

      - name: us
        config:
          DB_HOST: postgres-us
          REGION: us

      - name: asia
        config:
          DB_HOST: postgres-asia
          REGION: asia

Generated:

orders-eu
orders-us
orders-asia

ConfigMap Behavior

ConfigMap = merge of:

component.commonConfig
+ instance.config

Example:

commonConfig:
  DB_PORT: "5432"
  LOG_LEVEL: warn

instance:
  config:
    DB_HOST: postgres-eu

Result:

data:
  DB_PORT: "5432"
  LOG_LEVEL: "warn"
  DB_HOST: "postgres-eu"

Resource Handling

Resources are resolved in this order:

global.resources → component.resources → (override)

Global default

global:
  resources:
    requests:
      cpu: 100m
      memory: 128Mi
    limits:
      cpu: 500m
      memory: 512Mi

Component override

components:
  - componentName: orders

    resources:
      requests:
        cpu: 1
        memory: 1Gi
      limits:
        cpu: 4
        memory: 4Gi

Environment Strategy

dev

  • Single instance per component
  • Minimal resources
  • Debug logging

preprod

  • Production-like setup
  • Slightly reduced replicas
  • Stable images (RC tags)

prod

  • Full scaling
  • Multi-instance components (e.g. orders-eu/us/asia)
  • Region-based configuration

Example Production Layout

gateway
orders-eu
orders-us
orders-asia
payments
notifications

Adding a New Environment

  1. Create a new file:
values/staging.yaml
  1. Copy structure from preprod or dev

  2. Adjust:

  • images
  • replicas
  • instance definitions

Run:

helm upgrade --install shop-staging . \
  -f values/staging.yaml

Common Commands

Lint:

helm lint .

Render:

helm template shop . -f values/prod.yaml

Deploy:

helm upgrade --install shop . -f values/prod.yaml

Rollback:

helm rollback shop 1

Best Practices

  • Keep environment differences ONLY in values/*.yaml
  • Keep shared config in global
  • Keep reusable config in component.commonConfig
  • Keep instance differences minimal
  • Avoid duplicating images/resources across instances
  • Always preview before deploy:
helm template .

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages