Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom CNAMEs (defined via GUI, not Chart's values) aren't saved after pod restarts. #269

Open
perfectra1n opened this issue Oct 29, 2023 · 11 comments

Comments

@perfectra1n
Copy link

perfectra1n commented Oct 29, 2023

If you define CNAMEs via the GUI instead of the chart's values, as the file located at /etc/dnsmasq.d/05-pihole-custom-cname.conf isn't backed by any PVC, the file disappears.

  1. Import some CNAMEs
    image
  2. Delete pod
  3. CNAMEs gone
    image

I'm happy to make a PR, but I was curious what you thought the best way to tackle the issue was - I've just mounted an additional NFS PVC at /etc/dnsmasq.d/ for now lol.

        extraVolumes:
          dnsmasq-conf:
            persistentVolumeClaim:
              claimName: pihole-backup-dnsmasq-pvc
        
        extraVolumeMounts:
          dnsmasq-conf:
            mountPath: /etc/dnsmasq.d
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pihole-backup-dnsmasq-pvc
  namespace: pihole-backup
spec:
  storageClassName: "truenas-csi-nfs"
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      # NFS Subdir Provisioner doesn't care at all abou this
      storage: 1Gi
@dfoulkes
Copy link
Contributor

Personally I've just been mainitaining my own custom values.yml file that has my preffered dnsmasq settings:
Doing this you can perist your custom settings between deployment plus ideal for automating the helm deployment.

  customDnsEntries: 
    - address=/s1.mydomain.cloud/10.10.10.123
    - address=/s2.mydomain.cloud/10.10.10.124
    - address=/s3.mydomain.cloud/10.10.10.125
    - address=/s4.mydomain.cloud/10.10.10.126

Although you are right this will not show in the GUI console fustratingly, it will at least make them persist between deployments.

Alternatively, you can use the environment variable PIHOLE_DNS_ if you which to externalise the local DNS mechcanisim for Pihole or conitnue to use a NFS lol.

@dfoulkes
Copy link
Contributor

Just seen you wanted CNAME not A record lol.

Ok, good point personally haven't hit this issue. Curiously, what's the usecase a ingress class?

@dfoulkes
Copy link
Contributor

dfoulkes commented Nov 15, 2023

Looking through the spec, there's option todo this the same way I proposed for A records.

have you tried this in the values.yml

dnsmasq: 
    customCnameEntries::
       # Here we specify custom cname entries that should point to `A` records or
       # elements in customDnsEntries array.
       # The format should be:
       - cname=cname.foo.bar,foo.bar
       - cname=cname.bar.foo,bar.foo

@perfectra1n
Copy link
Author

Gotchya, I prefer to manage CNAME / A records via the GUI so that I don't have them publicly facing (public GitOps repo) and the A records are already saved across restarts, I thought it would be useful to have CNAME's records persisted as well to match user expectations.

@dfoulkes
Copy link
Contributor

dfoulkes commented Nov 16, 2023

Fare point, if its the public facing element that concerns you and you're not overally bothered by the cosmetics, you could just supply a different value file that's not in public source control at runtime.

@perfectra1n
Copy link
Author

Understood, however as a user, if I make a change in the GUI, I would expect that change to persist across "restarts". Since A records do, I would expect CNAME records to as well.

@MoJo2600
Copy link
Owner

Maybe we should make sure to persist all the data to one pvc when persistence is enabled. I don't think it makes sense to have multiple pvc.

@perfectra1n
Copy link
Author

Fair, I could make that happen. I’ll submit a PR for it :)

@jannesaarinen
Copy link

My workaround for this was to mount both /etc/pihole and /etc/dnsmasq.d as subpaths from the config PVC. If this is done in the chart, I guess it will be a breaking change for those of us using PVC as persistence.

Should I make I PR for this solution to fix this issue? My assumption is that many users use the CNAME functionality from GUI in homelab as it's quite volatile, if you are constantly introducing new stuff.

@perfectra1n
Copy link
Author

You're more than welcome to do the PR, I manage it as such (which I think is the same as you):

        extraVolumes:
          dnsmasq-conf:
            persistentVolumeClaim:
              claimName: pihole-dnsmasq-pvc

        extraVolumeMounts:
          dnsmasq-conf:
            mountPath: /etc/dnsmasq.d

@dfoulkes
Copy link
Contributor

dfoulkes commented Sep 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants