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

Question: Internal workings of Varnish Helm chart purging with multiple replicas #20

Open
Manikkumar1988 opened this issue Aug 5, 2024 · 1 comment
Labels
question Further information is requested

Comments

@Manikkumar1988
Copy link

I wanted to use the official Varnish Helm chart to deploy a Varnish cluster with HPA enabled.

When I send a PURGE request, Can you explain how purging works in this setup and provide recommendations for ensuring consistent purging across all replicas?

Wanted to ensure cache invalidated across all replicas & get the acknowledgment for the same.

@sirn sirn added the question Further information is requested label Aug 5, 2024
@sirn
Copy link
Collaborator

sirn commented Aug 5, 2024

Hi there! Varnish Helm Chart currently doesn't do anything special with regarding networking and purging. In the Enterprise version, we have varnish-broadcaster and varnish-discovery for this purpose, but for the open-source version you have to manually do this for every instance.

Right now, the only way to iterate the list of all available Varnish instances is to set up Varnish Helm Chart in a headless ClusterIP mode, e.g.:

server:
  service:
    type: ClusterIP
    clusterIP: "None"

This allows service-name.namespace.svc.cluster.local to resolve an A record to each individual Varnish instance. Then, on the component that's sending purges, you can make sure it sends PURGE to all A records returned by the cluster's DNS.

Alternatively, there's something like varnish-towncrier that might work (although I have not tried it myself). This could be set up through server.extraContainers. Since towncrier doesn't rely on Varnish VSM, it should be pretty straightforward to set up:

server:
  extraContainers:
    - name: towncrier
      image: ghcr.io/emgag/varnish-towncrier:latest
      args:
        - listen
      env:
        - name: VT_REDIS_URI
          value: redis://redis-service
        # Match this with `server.http.port`
        - name: VT_ENDPOINT_URI
          value: http://127.0.0.1:6081/
      # the rest of the configuration

I'm going to ping @gquintard and @ThijsFeryn if they have a better idea :-)

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

No branches or pull requests

2 participants