pajikos / home-assistant-helm-chart

Helm Chart for Home Assistant
MIT License
107 stars 30 forks source link

Adding ability to override ndots for alpine/musl compatability #35

Closed gregwalters closed 8 months ago

gregwalters commented 8 months ago

I have problems with Alpine / Musl's DNS resolution and need to adjust ndots for compatibility. Lots of community discussion about this out there.

pajikos commented 8 months ago

Hi Greg, Thank you for your PR. I would actually prefer a more general option using the dnsConfig section in values.yaml. Your solution overrides the default DNS configuration in a cluster (I'm aware that ndots=5 is a default value, but the administrator might have globally changed it). Therefore, by default, the helm chart should respect the cluster's default DNS configuration and not be forced to value 5. I hope you understand what I think to do.

# Pod's DNS Configuration
# https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config
# This value is useful if you need to reduce the DNS load: set "ndots" to 0 and only use FQDNs.
dnsConfig: {}
#  nameservers:
#    - 1.2.3.4
#  searches:
#    - ns1.svc.cluster-domain.example
#    - my.dns.search.suffix
#  options:
#    - name: ndots
#      value: "2"

and in your statefulset.yaml something like this:

    spec:
      {{- if .Values.dnsConfig }}
      dnsConfig: {{- toYaml .Values.dnsConfig | nindent 8 }}
      {{- end }}

Regards Pavel

gregwalters commented 8 months ago

Pavel,

Your solution is much cleaner 👏 . Implemented as suggested!

pajikos commented 8 months ago

Hi Greg, thank you for update, please check the location of your changes, I think it should be here:

apiVersion: apps/v1
kind: StatefulSet
spec:
  template:
    spec:
    {{- if .Values.dnsConfig }}
      dnsConfig: 
        {{- toYaml .Values.dnsConfig | nindent 8 }}
    {{- end }}
gregwalters commented 8 months ago

:shame:

You're right again. I had that at the wrong level. Fixed.

pajikos commented 8 months ago

thank you