To start developing, you need the following tools installed:
-
Get yourself a GitHub PAT for development purposes with access to an Organization where the runners will be registered.
-
To configure
garm
you have to generate a newconfig.toml
with your previous created PAT. You can use themake template
target in the root directory of this repository to generate a newconfigMap
which contains a validconfig.toml
forgarm
GARM_GITHUB_OAUTH_TOKEN=ghp_QVK50pUo25QsJBy5DfA95EyUCzAbG20Q1NP2 make template
-
Start the development environment by running
make tilt-up
in the root directory of this repository.This will start a local Kubernetes cluster using
kind
(kind get clusters
will show you agarm
cluster) and deploy a garm-server with an already registeredgarm-provider-k8s
. Themake tilt-up
command will give you the URL to the local tilt environment. -
As we also written the garm-operator to manage
garm
resources (likePools
,Organizations
and so on) we are using thegarm-operator
to bootstrap the local development setup.You will notice that in the
garm-operator-system
namespace thegarm-operator
is running. -
You are now able to create the
garm
resources by either creating them viagarm-cli
in thegarm-server
container (ingarm-server
namespace) or via thegarm-operator
by applying the following manifest files to your local cluster.organization:
apiVersion: garm-operator.mercedes-benz.com/v1alpha1 kind: Organization metadata: labels: app.kubernetes.io/name: organization app.kubernetes.io/instance: organization-sample app.kubernetes.io/part-of: garm-operator name: your-org # this organization must exist and the PAT must have access to it namespace: garm-operator-system spec: webhookSecretRef: key: "webhookSecret" name: "org-webhook-secret" credentialsName: "github-pat" --- apiVersion: v1 kind: Secret metadata: name: org-webhook-secret namespace: garm-operator-system data: webhookSecret: bXlzZWNyZXQ=
image:
apiVersion: garm-operator.mercedes-benz.com/v1alpha1 kind: Image metadata: labels: app.kubernetes.io/name: image app.kubernetes.io/instance: image-sample app.kubernetes.io/part-of: garm-operator name: runner-default namespace: garm-operator-system spec: tag: localhost:5000/runner:linux-ubuntu-22.04-x86_64
pool:
apiVersion: garm-operator.mercedes-benz.com/v1alpha1 kind: Pool metadata: labels: app.kubernetes.io/instance: pool-sample app.kubernetes.io/name: pool app.kubernetes.io/part-of: garm-operator name: k8s-pool namespace: garm-operator-system spec: githubScopeRef: apiGroup: garm-operator.mercedes-benz.com kind: Organization name: your-org enabled: true extraSpecs: "{}" flavor: medium githubRunnerGroup: "" imageName: runner-default maxRunners: 4 minIdleRunners: 2 osArch: amd64 osType: linux providerName: kubernetes_external # this is the name defined in your garm server runnerBootstrapTimeout: 20 runnerPrefix: "" tags: - linux - kubernetes
Now you should be able to see two pods in the
runner
namespace:$ kubectl get pods -n runner NAME READY STATUS RESTARTS AGE garm-hoyjldsegfal 1/1 Running 0 7s garm-hpohj7g2b4df 1/1 Running 0 7s
-
Time to start developing. 🎉