woodpecker-ci / helm

This repo contains the helm charts of the Woodpecker project.
Apache License 2.0
20 stars 16 forks source link

Add PVC for agent #163

Closed pat-s closed 4 months ago

pat-s commented 5 months ago

To persist /etc/woodpecker/agent.conf and solve https://github.com/woodpecker-ci/woodpecker/issues/3023

To clean old agents, the following commands can be executed on the database (Postgres example)

delete from agents where capacity=-1;
delete from agents where coalesce(name, '') = '';

This will clean a lot stale agents but not all.

Another way is to clean all agents for which the last contact is older than 1 day (thanks @zc-devs), one can do

delete from agents where last_contact < now() - interval '1 day';

Alternatively, one can remove all agents, then recreate the pod and the attached PV. This will reinitialize a fresh agent with a new ID.

I've tested this PR and recreated the agents (two replicas) many times. No new agents were created and /etc/woodpecker/agent.conf always showed the persistet agent ID.

pat-s commented 5 months ago

@zc-devs @ymettier This will fix the agent registration issue. Any comments/suggestions?

pat-s commented 5 months ago

ping @anbraten

pat-s commented 4 months ago

@xoxys Added yamllint, prettierc, addressed all warnings and your comments.