Go to file
Tobias Trabelsi 3280b21f9b
All checks were successful
Pipeline was successful
fix image query
2023-11-04 21:32:38 +01:00
.woodpecker decom agents as well 2023-11-01 20:48:45 +01:00
chart/metallb-ip-floater decom agents as well 2023-11-01 20:48:45 +01:00
cmd decom agents as well 2023-11-01 20:48:45 +01:00
internal fix image query 2023-11-04 21:32:38 +01:00
.gitignore Initial commit 2023-10-29 19:28:09 +00:00
Dockerfile akeleton config and launch template 2023-10-29 22:44:39 +01:00
go.mod implemented spawning of new agents 2023-10-31 23:18:08 +01:00
go.sum implemented spawning of new agents 2023-10-31 23:18:08 +01:00
LICENSE Initial commit 2023-10-29 19:28:09 +00:00
README.md decom agents as well 2023-11-01 20:48:45 +01:00

woodpecker-autoscaler

status-badge

Dynamically spawns woodpecker ci build agents in hetzner cloud.

Installing with Helm

The deployment will use helm and the chart in chart/woodpecker-autoscaler.
You will need a hcloud api token, a woodpecker agent secret, a woodpecker api token and a definition of the build agents to be created. Expose these information to the floater as described in this example:

env:
  - name: WOODPECKER_AUTOSCALER_LOGLEVEL
    value: "Info"
  - name: WOODPECKER_AUTOSCALER_CHECK_INTERVAL
    value: "15"
  - name: WOODPECKER_AUTOSCALER_WOODPECKER_LABEL_SELECTOR
    value: "uploadfilter24.eu/instance-role=Woodpecker"
  - name: WOODPECKER_AUTOSCALER_WOODPECKER_INSTANCE
    value: "define_it"
  - name: WOODPECKER_AUTOSCALER_WOODPECKER_AGENT_SECRET
    value: "define_it"
  - name: WOODPECKER_AUTOSCALER_WOODPECKER_API_TOKEN
    value: "define_it"
  - name: WOODPECKER_AUTOSCALER_HCLOUD_TOKEN
    value: "define_it"
  - name: WOODPECKER_AUTOSCALER_HCLOUD_INSTANCE_TYPE
    value: "cpx21"
  - name: WOODPECKER_AUTOSCALER_HCLOUD_REGION
    value: "define_it"
  - name: WOODPECKER_AUTOSCALER_HCLOUD_DATACENTER
    value: "define_it"
  - name: WOODPECKER_AUTOSCALER_HCLOUD_SSH_KEY
    value: "define_it"

you can also create a secret manually with these information and reference the existing secret like this in the values.yaml:

externalConfigSecret:
  enabled: true
  name: "my-existing-secret"

Now you are able to deploy:

kubectl create namespace woodpecker-autoscaler
cd chart/woodpecker-autoscaler
helm upgrade --install -f values.yaml -n woodpecker-autoscaler woodpecker-autoscaler ./

Installing Manually

Download the binary from the release section and place it somewhere on your system; /usr/bin/woodpecker-autoscaler for example. Create a systemd service like the one in this template:

[Unit]
Description=Dynamically spawn woodpecker ci build agents in hetzner cloud

[Service]
Type=simple
Nice=10
ExecStart=/usr/bin/woodpecker-autoscaler
EnvironmentFile="/etc/default/woodpecker-autoscaler.env"

Now place the environment variable configuration in the specified file:

WOODPECKER_AUTOSCALER_LOGLEVEL=Info
WOODPECKER_AUTOSCALER_CHECK_INTERVAL=15
WOODPECKER_AUTOSCALER_WOODPECKER_LABEL_SELECTOR="uploadfilter24.eu/instance-role=Woodpecker"
WOODPECKER_AUTOSCALER_WOODPECKER_INSTANCE="define_it"
WOODPECKER_AUTOSCALER_WOODPECKER_AGENT_SECRET="define_it"
WOODPECKER_AUTOSCALER_WOODPECKER_API_TOKEN="define_it"
WOODPECKER_AUTOSCALER_HCLOUD_TOKEN="define_it"
WOODPECKER_AUTOSCALER_HCLOUD_INSTANCE_TYPE=cpx21
WOODPECKER_AUTOSCALER_HCLOUD_REGION="define_it"
WOODPECKER_AUTOSCALER_HCLOUD_DATACENTER="define_it"
WOODPECKER_AUTOSCALER_HCLOUD_SSH_KEY="define_it"

Now reload the systemd daemons and start the service:

sudo systemctl daemon-reload
sudo systemctl enable woodpecker-autoscaler
sudo systemctl start woodpecker-autoscaler

Made with ♡ by the folkes at uploadfilter24.eu :)