OT-CONTAINER-KIT / helm-charts

A repository which that will contain helm charts with best and security practices.
https://ot-container-kit.github.io/helm-charts
49 stars 84 forks source link

Fix affinity indentation of redis-cluster helm chart #35

Closed raphaelzoellner closed 2 years ago

raphaelzoellner commented 2 years ago

This change aims to fix the indentation of the RedisCluster template under spec.redisLeader.affinity and spec.redisFollower.affinity.

The issue for the affinity indentation becomes visible by running the command helm template ./redis-cluster -f ./values.yaml

values.yaml:

redisCluster:
  leader:
    affinity:
      podAntiAffinity:
        preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchLabels:
                  app: redis-cluster-leader
                  role: leader
              topologyKey: kubernetes.io/hostname
            weight: 100
  follower:
    replicas: 3
    affinity:
      podAntiAffinity:
        preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchLabels:
                  app: redis-cluster-follower
                  role: follower
              topologyKey: kubernetes.io/hostname
            weight: 100

Command output before:

---
# Source: redis-cluster/templates/redis-cluster.yaml
apiVersion: redis.redis.opstreelabs.in/v1beta1
kind: RedisCluster
metadata:
  name: RELEASE-NAME
  labels:
    app.kubernetes.io/name: RELEASE-NAME
    helm.sh/chart: redis-cluster-0.10.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/instance: RELEASE-NAME
    app.kubernetes.io/version: 0.10.0
    app.kubernetes.io/component: middleware
spec:
  clusterSize: 3
  redisLeader:
    affinity:
        podAntiAffinity:
        preferredDuringSchedulingIgnoredDuringExecution:
        - podAffinityTerm:
            labelSelector:
              matchLabels:
                app: redis-cluster-leader
                role: leader
            topologyKey: kubernetes.io/hostname
          weight: 100
    replicas: 3
  redisFollower:
    affinity:
        podAntiAffinity:
        preferredDuringSchedulingIgnoredDuringExecution:
        - podAffinityTerm:
            labelSelector:
              matchLabels:
                app: redis-cluster-follower
                role: follower
            topologyKey: kubernetes.io/hostname
          weight: 100
    replicas: 3
  redisExporter:
    enabled: true
    image: "quay.io/opstree/redis-exporter:1.0"
    imagePullPolicy: "IfNotPresent"
    resources:
      {}
  kubernetesConfig:
    image: "quay.io/opstree/redis:v6.2.5"
    imagePullPolicy: "IfNotPresent"
    resources:
      {}
  storage:
    volumeClaimTemplate:
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi

Command output afterwards:

---
# Source: redis-cluster/templates/redis-cluster.yaml
apiVersion: redis.redis.opstreelabs.in/v1beta1
kind: RedisCluster
metadata:
  name: RELEASE-NAME
  labels:
    app.kubernetes.io/name: RELEASE-NAME
    helm.sh/chart: redis-cluster-0.10.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/instance: RELEASE-NAME
    app.kubernetes.io/version: 0.10.0
    app.kubernetes.io/component: middleware
spec:
  clusterSize: 3
  redisLeader:
    affinity:
      podAntiAffinity:
        preferredDuringSchedulingIgnoredDuringExecution:
        - podAffinityTerm:
            labelSelector:
              matchLabels:
                app: redis-cluster-leader
                role: leader
            topologyKey: kubernetes.io/hostname
          weight: 100
    replicas: 3
  redisFollower:
    affinity:
      podAntiAffinity:
        preferredDuringSchedulingIgnoredDuringExecution:
        - podAffinityTerm:
            labelSelector:
              matchLabels:
                app: redis-cluster-follower
                role: follower
            topologyKey: kubernetes.io/hostname
          weight: 100
    replicas: 3
  redisExporter:
    enabled: true
    image: "quay.io/opstree/redis-exporter:1.0"
    imagePullPolicy: "IfNotPresent"
    resources:
      {}
  kubernetesConfig:
    image: "quay.io/opstree/redis:v6.2.5"
    imagePullPolicy: "IfNotPresent"
    resources:
      {}
  storage:
    volumeClaimTemplate:
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi
iamabhishek-dubey commented 2 years ago

Please update the minor version of chart

pszelestey commented 2 years ago

Hi @raphaelzoellner,

Could you please update minor version of redis-cluster chart? Thank you in advance!

BR, Peter