There are tons of resources and helm charts to deploy in several environment (dev, stage, production...).
Configuring YAML files according to the complex requirments takes a considerable amount of time and is easy to make a mistake.
To improve this, decapod-base-yaml
and decapod-site
is designed to maintain base resources and site values seperately.
product # product name is a root directory.
├── base
│ ├── kustomization.yaml
│ ├── resources.yaml # All resources are defined with default values.
│ └── site-values.yaml # patch of values overrided depending on environment.
└── overlay_type_name # e.g. network, storage, plugin...
└── overlay-values.yaml # patch of values
Suppose some assumptions:
- Here's a helm chart called
prometheus-operator
. - Requirements:
- deploy chart in several environment(dev, stage, production).
nodeSelector
is set toenvironment_name: 1
.replicas
is flexible according to environment.
Original YAML file:
apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
metadata:
labels:
name: prometheus-operator
name: prometheus-operator
spec:
chart:
repository: https://prometheus-community.github.io/helm-charts
name: prometheus-operator
version: 9.3.2
releaseName: prometheus-operator
values:
nodeSelector:
kubernetes.io/hostname: localhost
replicas: 2
base/resources.yaml:
apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
metadata:
labels:
name: prometheus-operator
name: prometheus-operator
spec:
chart:
repository: https://prometheus-community.github.io/helm-charts
name: prometheus-operator
version: 9.3.2
releaseName: prometheus-operator
values:
nodeSelector: {} # Set to empty map. Because key value is flexible.
replicas: TO_BE_FIXED # Specify the value could be overrided
base/site-values.yaml:
apiVersion: openinfradev.github.com/v1
kind: HelmValuesTransformer
metadata:
name: site
charts:
- name: prometheus-operator
override:
replicas: 1 # Override replicas
nodeSelector:
site_name: 1