cluster-config

by startxfr

Helm chartv21.3.418App 4.21.19GPL-3.0-or-laterVerified publisher

Helm chart used to configure cluster generic behaviours like image prunning and cluster auto-scaling capacity

About this chart

Cluster Chart : Config

This helm chart is used to create a personnalized cluster configuration with various cluster level components configured as required.

This chart is part of the cluster-xxx startx helm chart series that doesn't necessarily deploy pods but rather represent a cluster configuration state orchestrated by gitops tools like ArgoCD.

Requirements and guidelines

Read the startx helm-repository homepage for more information on how to use these resources.

Deploy this helm chart on openshift

1. Connect to your Openshift cluster

oc login -t <token> <cluster-url>

2. Install the repository

helm repo add startx https://helm-repository.readthedocs.io/en/latest/repos/stable/

3. Get information about this chart

helm show chart startx/cluster-config

4. Install this chart

helm install cluster-config startx/cluster-config

Default values

Complete deployment of a project with the following characteristics :

  • 1 ClusterAutoscaler: named default that is disabled by default but could enable autoscaling with the following limits
    • No lest than 4 cores
    • No lest than 16Gi RAM
    • No lest than 2 nodes
    • No more than 40 cores
    • No more than 160Gi RAM
    • No more than 20 nodes
    • Cluster could scale down
  • 1 ClusterVersion: named version that is disabled by default but could enable and is related to
    • The candidate channel
    • The 4.5 version
  • 1 Secret: named alertmanager-main that configure
    • The PagerDutyStartx receiver as default alert receiver using the startx pagerDutty key (fake ;)
    • An api endpoint pointing to the api_endpoint endpoint
  • 1 ImagePruner: named cluster that define an image prunner that will
    • Run every 15min but is suspended
    • Preserve 5 failed history
    • Preserve 5 successful history
  • 1 namespace: named openshift-operators-redhat to host redhat operators
# base configuration running default configuration
helm install cluster-config startx/cluster-config

Values files

  • startx : Startx cluster default configuration with 30min enabled image prunnning scheduling, pagerdutty alert enabled and cluster auto-scaling topped to 64 core and 400Gi RAM consumed (see values.yaml)
helm install cluster-config startx/cluster-config -f https://raw.githubusercontent.com/startxfr/helm-repository/master/charts/cluster-config/values-startx.yaml

Other values files

Values files without a detailed section above (each one is a complete set of values for helm install cluster-config startx/cluster-config -f <file>) :

  • values-cdf-poc.yaml : against values-startx.yaml: differ on 27 keys, by top-level key: monitoring (11), project (8), context (3), projectSosReport (3), ...
  • values-mg.yaml : against values-startx.yaml: differ on 14 keys, by top-level key: monitoring (11), ingresscontroller (1), project (1), projectSosReport (1)
  • values-ppmc.yaml : against values-startx.yaml: differ on 23 keys, by top-level key: monitoring (10), project (6), projectSosReport (3), context (2), ...
  • values-prgmk.yaml : against values-startx.yaml: differ on 19 keys, by top-level key: monitoring (10), project (5), projectSosReport (2), clusterversion (1), ...
  • values-startx-elastic.yaml : context startx/default/infra; against values-startx.yaml: differ on 110 keys, by top-level key: project (26), operatorElastic (24), monitoring (14), projectSosReport (14), ...
  • values-startx-loki.yaml : context startx/default/infra; against values-startx.yaml: differ on 110 keys, by top-level key: project (26), operatorLoki (24), monitoring (14), projectSosReport (14), ...
  • values-startx-operator.yaml : context startx/default/infra; against values-startx.yaml: differ on 115 keys, by top-level key: project (26), operatorSosReport (22), operatorGlobal (15), monitoring (14), ...
  • values-startx_noinfra-elastic.yaml : context startx/default/infra; against values-startx-elastic.yaml: differ on operatorElastic.subscription.operator.config.infra (true → false)
  • values-startx_noinfra-loki.yaml : context startx/default/infra; against values-startx-loki.yaml: differ on operatorLoki.subscription.operator.config.infra (true → false)
  • values-startx_noinfra-operator.yaml : context startx/default/infra; against values-startx-operator.yaml: differ on operatorGlobal.operatorGroup.enabled (false → true)
  • values-startx_noinfra.yaml : context startx/default/infra; same values as values-startx.yaml

Cluster monitoring

The monitoring block manages the cluster-monitoring-config ConfigMap of the openshift-monitoring namespace (platform Prometheus and Alertmanager) and, with monitoring.userWorkload.enabled, the user-workload-monitoring-config ConfigMap of the openshift-user-workload-monitoring namespace. Both ConfigMaps replace any existing configuration, which is validated by the monitoring admission webhook of OpenShift 4.19+: unknown keys and the reserved external labels prometheus, prometheus_replica and cluster are rejected, this is why the cluster name is exposed as cluster_name. Dashboards, alert routes or remote write relabelings keyed on the former cluster external label must be updated to cluster_name when upgrading an existing deployment.

monitoring:
  enabled: true
  infra_enabled: false
  storageClass: ocs-storagecluster-ceph-rbd   # block RWO storage class of the cluster
  storageSize: "50Gi"                          # per Prometheus replica (2 PVC)
  storageSizeAlert: "5Gi"                      # per Alertmanager replica (2 PVC)
  retentionPeriod: 15d
  retentionSize: 40GB                          # about 80% of storageSize
  enableUserWorkload: true
  externalLabels:
    custom:
      site: paris
  userWorkload:
    enabled: true
    retentionPeriod: 7d
    storageSize: "10Gi"
KeyDefaultDescription
monitoring.enabledfalseManage the cluster-monitoring-config ConfigMap
monitoring.infra_enabledfalseDeploy the monitoring components (except node-exporter) on the infra nodes
monitoring.storageClassgp3-csiStorage class of the Prometheus and Alertmanager persistent volumes
monitoring.storageSize20GiSize of the Prometheus persistent volume (one per replica)
monitoring.storageSizeAlert5GiSize of the Alertmanager persistent volume (one per replica)
monitoring.enableUserWorkloadfalseEnable the monitoring of user-defined projects
monitoring.retentionPeriod7dPrometheus data retention duration
monitoring.retentionSize""Prometheus maximum data size on disk (ex: 40GB), empty keeps only the time-based retention
monitoring.resources200m / 2GiResource requests and limits of the Prometheus pods
monitoring.externalLabels.contextLabelstrueAdd the scope, environment and cluster_name labels from the deployment context
monitoring.externalLabels.custom{}Additional external labels (reserved keys are rejected)
monitoring.remoteWrite[]Remote write endpoints of the platform Prometheus
monitoring.alertmanager.enabledtrueDeploy the platform Alertmanager
monitoring.extraConfig{}Additional cluster-monitoring-config settings added as-is (managed keys must not be repeated)
monitoring.userWorkload.enabledfalseManage the user-workload-monitoring-config ConfigMap (requires enableUserWorkload)
monitoring.userWorkload.retentionPeriod24hData retention duration of the user workload Prometheus
monitoring.userWorkload.retentionSize""Maximum data size on disk of the user workload Prometheus
monitoring.userWorkload.storageClass""Storage class of the user workload Prometheus volume (empty uses monitoring.storageClass)
monitoring.userWorkload.storageSize10GiSize of the user workload Prometheus persistent volume (one per replica)
monitoring.userWorkload.resources{}Resource requests and limits of the user workload Prometheus pods
monitoring.userWorkload.extraConfig{}Additional user-workload-monitoring-config settings added as-is

Switching from the default ephemeral storage to persistent volumes restarts the Prometheus and Alertmanager pods: the metrics history and the active silences are lost. Growing storageSize later does not resize existing PersistentVolumeClaims.

Ownership of the cluster singletons

The resources of this chart are cluster singletons: openshift-monitoring/cluster-monitoring-config, the HelmChartRepository list, the image pruner, the registry and ingress settings, the cluster autoscaler or the cluster proxy. A cluster has one of each, so exactly one owner must render them. Two owners (two Applications, or this chart and another one) overwrite each other and make the Application permanently OutOfSync.

A consumer that already manages one of these resources itself must leave the matching flag false: for example monitoring.enabled for cluster-monitoring-config, which is false by default. Enable a feature only in the one Application that owns it.

Deploy with ArgoCD

This chart configures multiple cluster domains. Deploy one ArgoCD Application per domain.

AppProject

git clone https://gitlab.com/startx1/helm.git
cd helm-repository/charts/cluster-config/examples/argocd/
oc apply -k .

Applications

External secrets

Secrets rendered from values can come from an external store (Vault, AWS Secrets Manager...) through the External Secrets Operator instead. With externalSecret.enabled: true in one of the sections below, the chart renders an ExternalSecret producing the very same Secret, so the objects that reference it (APIServer, IngressController, image registry, monitoring) are unchanged. Without externalSecret, the chart keeps rendering the Secret from the values.

SectionSecret produced (namespace)Required keys
api.externalSecretapi.name (openshift-config, kubernetes.io/tls)tls.crt, tls.key
ingresscontroller.list[].certificate.externalSecret<name>-ingress-cert (openshift-ingress, kubernetes.io/tls)tls.crt, tls.key
alertmanager.externalSecretalertmanager-main (openshift-monitoring)alertmanager.yaml
registryconfig.externalSecretimage-registry-private-configuration-user (openshift-image-registry)REGISTRY_STORAGE_S3_ACCESSKEY, REGISTRY_STORAGE_S3_SECRETKEY
externalSecretDefaults:
  secretStoreRef:
    name: vault-backend
    kind: ClusterSecretStore
api:
  enabled: true
  url: api.mycluster.example.com
  externalSecret:
    enabled: true
    remoteRefs:
      

Deploy cluster-config with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cluster-config 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 chartcluster-config is pinned at v21.3.418 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