Explore the option of mount of an OS secret with runner configuration into the VM (explored and deployed)) #436

Closed
opened 2026-03-04 14:40:32 +00:00 by lenkaseg · 10 comments
Member

Documentation: https://kubevirt.io/user-guide/storage/disks_and_volumes/#secret

  • create a VM (use a template from the current runnerhost VM) with mounted service account that would allow to watch the secret with the runners configuration
  • create service account
  • create role
  • create role binding
  • create secret with the runners
  • make a POC that proves the VM can get the secrets
Documentation: https://kubevirt.io/user-guide/storage/disks_and_volumes/#secret - create a VM (use a template from the current runnerhost VM) with mounted service account that would allow to watch the secret with the runners configuration - create service account - create role - create role binding - create secret with the runners - make a POC that proves the VM can get the secrets
lenkaseg added this to the Backlog project 2026-03-04 14:40:33 +00:00
Author
Member

First POC:

  • create a secret in forgejo OC namespace

  • create a pod that can fetch the secret and read it

First POC: - [x] create a secret in forgejo OC namespace - [x] create a pod that can fetch the secret and read it
Author
Member
  • exploring virtiofs mount, seems that we would need to enable virtiofs on a cluster, it is not enabled now
  • exploring mount as a disc, but that would require reboot every time we want to fetch a fresh secret, so not an option
  • exploring VM with a service account, role, rolebinding - this option would enable us to watch the secret, so it could run the playbook every time the secret changes, probably no need for cron then
- exploring virtiofs mount, seems that we would need to enable virtiofs on a cluster, it is not enabled now - exploring mount as a disc, but that would require reboot every time we want to fetch a fresh secret, so not an option - exploring VM with a service account, role, rolebinding - this option would enable us to watch the secret, so it could run the playbook every time the secret changes, probably no need for cron then
Author
Member
  • created a service account
  • created role to be able to get a secret called forgejo-runner-config (the test secret I created earlier)
  • created rolebinding to enable the service account to act as the defined role
  • created a test runner vm on openshift staging with the service account mounted as a disc
  • logged inside the VM and fetched the secret successfully
- [x] created a service account - [x] created role to be able to get a secret called forgejo-runner-config (the test secret I created earlier) - [x] created rolebinding to enable the service account to act as the defined role - [x] created a test runner vm on openshift staging with the service account mounted as a disc - [x] logged inside the VM and fetched the secret successfully
Author
Member
  • Let claude create a watcher - piece of code that keep watching the secret and at an event of change, it fetches the secret and stores it on the VM

Code of the watcher: https://gist.github.com/LenkaSeg/fd5fc87370e98b063ef33fdecd0f43b0

  • Started the watcher on a testing VM
  • Changed the secret
  • Troubleshot(/shooted?) the watcher until it started working, fetched the token well
  • Watched the watcher watch and fetch the changed secret and store it in the VM.
  • Copy the entire playbook ansible-role-forgejo-runner inside the VM and try to make it fetch the secret with runner definitions and run them as a runner services.
  • Add/remove some more runners in the secret and watch if they get synced and the runner services get added/removed.
- [x] Let claude create a watcher - piece of code that keep watching the secret and at an event of change, it fetches the secret and stores it on the VM Code of the watcher: https://gist.github.com/LenkaSeg/fd5fc87370e98b063ef33fdecd0f43b0 - [x] Started the watcher on a testing VM - [x] Changed the secret - [x] Troubleshot(/shooted?) the watcher until it started working, fetched the token well - [x] Watched the watcher watch and fetch the changed secret and store it in the VM. - [x] Copy the entire playbook ansible-role-forgejo-runner inside the VM and try to make it fetch the secret with runner definitions and run them as a runner services. - [x] Add/remove some more runners in the secret and watch if they get synced and the runner services get added/removed.
lenkaseg modified the project from Backlog to Sprint 17 2026-03-23 10:27:09 +00:00
Member
  • Create the systemd unit to install and run this watcher
  • watcher needs to deploy the config to /home/fedora/forgejo-runners-vars.yaml
- Create the systemd unit to install and run this watcher - watcher needs to deploy the config to /home/fedora/forgejo-runners-vars.yaml
Author
Member
  • Create the systemd unit to install and run this watcher

  • watcher needs to deploy the config to /home/fedora/forgejo-runners-vars.yaml

- [x] Create the systemd unit to install and run this watcher - [x] watcher needs to deploy the config to /home/fedora/forgejo-runners-vars.yaml
Author
Member

The watcher now watches the secret and synchronizes the runner configs in a file inside the runner vm.
Running the playbook from the VM, the runner service start and runners get deployed to staging.

Required to solve a problem with networking, all good and working now.

The watcher now watches the secret and synchronizes the runner configs in a file inside the runner vm. Running the playbook from the VM, the runner service start and runners get deployed to staging. Required to solve a problem with networking, all good and working now.
Author
Member

Next steps:

  • automate the playbook run at the event of secret sync
  • open a PR on ansible-role-forgejo-runner repo with the VM side changes
  • open a PR on infra/ansible with the infra side changes (service account, role, rolebinding, updated vm definition)
Next steps: - [x] automate the playbook run at the event of secret sync - [x] open a PR on ansible-role-forgejo-runner repo with the VM side changes - [x] open a PR on infra/ansible with the infra side changes (service account, role, rolebinding, updated vm definition)
Author
Member
VM side changes: https://codeberg.org/fedora/ansible-role-forgejo-runner/pulls/6
Author
Member

Ansible infra side changes: infra/ansible#3253

Ansible infra side changes: https://forge.fedoraproject.org/infra/ansible/pulls/3253
lenkaseg 2026-03-31 14:02:52 +00:00
lenkaseg changed title from Explore the option of mount of an OS secret with runner configuration into the VM to Explore the option of mount of an OS secret with runner configuration into the VM (explored and deployed)) 2026-03-31 15:33:23 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forge/forge#436
No description provided.