stakater / Reloader

A Kubernetes controller to watch changes in ConfigMap and Secrets and do rolling upgrades on Pods with their associated Deployment, StatefulSet, DaemonSet and DeploymentConfig – [✩Star] if you're using it!

Home Page:https://docs.stakater.com/reloader/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User Supplied "podAntiAffinity" is overwritten by "reloader-podAntiAffinity" set in deployment in 1.0.54

Sanghamitra-PERSONAL opened this issue · comments

Hello Team,

Describe the bug
In the Values file there is reloader.deployment.affinity option .

When I set the affinity block with enable HA = true : ->
deployment:
replicas: 3
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- reloader-reloader
- key: release
operator: In
values:
- reloader
topologyKey: topology.kubernetes.io/zone

During the installation it always gets overwritten by below block, :
_helpers.tpl :
{{- define "reloader-podAntiAffinity" -}}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:

  • weight: 100
    podAffinityTerm:
    labelSelector:
    matchExpressions:
    - key: app
    operator: In
    values:
    - {{ template "reloader-fullname" . }}
    topologyKey: "kubernetes.io/hostname"
    {{- end -}}

Due to the reason below :
Deployment.yaml :->
{{ toYaml .Values.reloader.deployment.affinity | indent 8 }}
{{- end}}
{{ include "reloader-podAntiAffinity" . | indent 8 }}
{{- end }}

So at the end the deployment from the cluster is :
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- reloader-reloader
topologyKey: kubernetes.io/hostname
weight: 100
containers:

Expected behavior
From the above output , because of "include "reloader-podAntiAffinity"" this is happening.
I expect that this "include "reloader-podAntiAffinity" shouldnot be set after the line " toYaml .Values.reloader.deployment.affinity" in order helm chart takes into consideration user assigned podAntiAffinity as part of User Assigned Values file.

Deployment.yaml :->
{{ toYaml .Values.reloader.deployment.affinity | indent 8 }}
{{- end}}
{{ include "reloader-podAntiAffinity" . | indent 8 }}
{{- end }}

Environment

  • Operator Version: 1.0.54
  • Kubernetes Version: AKS 1.27.3

Thanks,
Sanghamitra

hi @Sanghamitra-PERSONAL , can you open a PR for the said issue?

Thanks for the reply @MuneebAijaz . Should I raise PR to 1.0.54 version or to the latest version?

Please let me know.

Thanks,
Sanghamitra

hi @Sanghamitra-PERSONAL , you can raise the PR again latest version, master branch

Hi @MuneebAijaz , I have raised a PR #596 for the same. Please review.

Thanks,
Sanghamitra