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.

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.

None yet

1 participant