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

Add ENV variable for ConfigMap for adlists #1581

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gattjoe
Copy link

@gattjoe gattjoe commented May 14, 2024

Description

This change adds support for managing adlists with a ConfigMap in kubernetes. I modified _startup.sh to look for a CONFIGMAP_ADLISTS ENV variable. If found, it will call a new configmap_adlists shell script. In that script, I delete the entries for the adlists from gravity; then, I borrowed the database_table_from_file function from gravity.sh to import the adlists. Currently, it is a separate instance of that code; however, I think there can be a way to import it from gravity.sh so the code stays in sync.

Motivation and Context

I want to be able to manage adlists in kubernetes declaratively. Currently, if you mount a ConfigMap with an adlists file, it is only read into gravity on first boot and subsequent adds/deletes are not processed by pi-hole (by design).

This is definitely wet clay and the code can be hardened, but I didn't want to spend too many cycles if this is something the maintainers are not interested in accepting (or have a different / better approach in mind).

How Has This Been Tested?

I added / deleted adlists from a ConfigMap and restarted pi-hole to confirm that it deleted the old adlists from gravity and imported the new lists.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@gattjoe
Copy link
Author

gattjoe commented Jun 8, 2024

@PromoFaux bueller?

@PromoFaux
Copy link
Member

Hi, thanks for the contribution. At this stage it is unlikely that we will release another v5-based image, excepting for minor bug fixes - new features should be based upon the development-v6 branch.

Defining adlists in a container is something I've often thought about, but then forgotten about thinking about further

@gattjoe
Copy link
Author

gattjoe commented Jun 10, 2024

fair enough, makes sense. What's the ETA for v6? I can refactor my code once its published.

Copy link

github-actions bot commented Sep 2, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@PromoFaux
Copy link
Member

What's the ETA for v6? I can refactor my code once its published.

Soon™ - but no actual date. Maybe by the end of September, maybe not!

However, the relevant code has now been merged into the development branch

Copy link

github-actions bot commented Sep 5, 2024

Conflicts have been resolved.

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

Successfully merging this pull request may close these issues.

2 participants