Skip to content

Commit a3136bd

Browse files
authored
add documentation about local image build (#129)
Signed-off-by: Felix Breuer <f.breuer94@gmail.com>
1 parent 7e4ecad commit a3136bd

1 file changed

Lines changed: 29 additions & 8 deletions

File tree

docs/development.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Local Development Guide
1+
# Development
2+
3+
## Run MCM locally
24

35
This guide describes how to run the STACKIT MCM provider against a real Gardener shoot on STACKIT. A local kind cluster is not suitable because the provider creates real STACKIT VMs that must join a real Kubernetes cluster.
46

5-
## Prerequisites
7+
### Prerequisites
68

79
Before you begin, ensure you have the following:
810

@@ -11,7 +13,7 @@ Before you begin, ensure you have the following:
1113
- Access to the seed and shoot via `gardenctl`
1214
- A local Go toolchain
1315

14-
## Overview
16+
### Overview
1517

1618
You will run the provider and MCM locally while pointing them at real clusters:
1719

@@ -21,7 +23,7 @@ You will run the provider and MCM locally while pointing them at real clusters:
2123

2224
MachineClass objects and Secrets are assumed to already exist. Running the provider locally results in faster feedback loops when developing new features and enables using the go debugger.
2325

24-
## 1. Get kubeconfigs with gardenctl
26+
### 1. Get kubeconfigs with gardenctl
2527

2628
Set these shell variables (replace with your values):
2729

@@ -48,7 +50,7 @@ export CONTROL_KUBECONFIG=/tmp/control.kubeconfig
4850
export CONTROL_NAMESPACE=shoot--testing--$SHOOT_NAME
4951
```
5052

51-
## 2. Scale down the in-cluster MCM
53+
### 2. Scale down the in-cluster MCM
5254

5355
Scale the existing MCM in the seed to `0`, so your local controller can take over:
5456

@@ -65,15 +67,15 @@ watch -n 5 "kubectl --kubeconfig '$CONTROL_KUBECONFIG' -n '$CONTROL_NAMESPACE' s
6567
This will check and scale down the deployment every 5 seconds.
6668
Make sure to set the environment variables.
6769

68-
## 3. Run the provider (driver)
70+
### 3. Run the provider (driver)
6971

7072
Set the environment varialbes from above and run another terminal in your provider repo:
7173

7274
```bash
7375
make start
7476
```
7577

76-
## 4. Run MCM locally
78+
### 4. Run MCM locally
7779

7880
On another terminal in the Gardener MCM repository:
7981

@@ -88,8 +90,27 @@ Set the environment varialbes from above and run the MCM:
8890
make start
8991
```
9092

91-
## Notes
93+
### Notes
9294

9395
- This workflow assumes MachineClass and Secret objects already exist and are valid.
9496
- The local controllers should reconcile existing resources and provision STACKIT VMs that join the shoot.
9597
- Re-enable the in-cluster MCM after testing by scaling it back up.
98+
99+
## Build Container Image locally
100+
101+
Create a classic personal access token in GitHub. Set an expiration date and enable the `write:packages` scope.
102+
**Note:** Using a token generated by the `gh` cli is not sufficient.
103+
104+
Login to the `ghcr.io` registry. When asked for a password, paste the access token:
105+
106+
```bash
107+
ko login -u <your_username> --password-stdin ghcr.io
108+
```
109+
110+
Build image and push to the regsitry:
111+
112+
```bash
113+
make image
114+
```
115+
116+
The pushed image name and tag are logged to the console.

0 commit comments

Comments
 (0)