Go to file
Tobias Trabelsi 69d6147582
Some checks are pending
ci/woodpecker/push/main Pipeline is pending
fix nil dereference
2024-06-04 22:01:24 +02:00
.woodpecker update dependencies and ship multiarch builds 2024-03-04 23:00:51 +01:00
chart/woodpecker-autoscaler rename chart and fix docs 2023-11-10 21:49:50 +01:00
cmd hopefully fix time comparison 2024-02-04 00:08:43 +01:00
internal fix nil dereference 2024-06-04 22:01:24 +02:00
.gitignore Initial commit 2023-10-29 19:28:09 +00:00
CHANGELOG (feat) Cost optimized mode 2023-12-31 23:02:32 +01:00
Dockerfile akeleton config and launch template 2023-10-29 22:44:39 +01:00
go.mod update dependencies and ship multiarch builds 2024-03-04 23:00:51 +01:00
go.sum update dependencies and ship multiarch builds 2024-03-04 23:00:51 +01:00
LICENSE Initial commit 2023-10-29 19:28:09 +00:00
README.md (feat) Cost optimized mode 2023-12-31 23:02:32 +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_LOCATION
    value: "define_it"
  - name: WOODPECKER_AUTOSCALER_HCLOUD_SSH_KEY
    value: "define_it"
  - name: WOODPECKER_AUTOSCALER_COST_OPTIMIZED
    value: "true"

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_LOCATION="define_it"
WOODPECKER_AUTOSCALER_HCLOUD_SSH_KEY="define_it"
WOODPECKER_AUTOSCALER_COST_OPTIMIZED="true"

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 :)