Skip to content

Commit d88c276

Browse files
breuerfelixreluscxoxysmaboehm
authored
clean repository for open source (#108)
* clean repository for open source Signed-off-by: Felix Breuer <f.breuer94@gmail.com> * write local development guide Signed-off-by: Felix Breuer <f.breuer94@gmail.com> * Apply suggestions from code review Co-authored-by: Rene Schach <rene.schach@shiftavenue.com> Co-authored-by: Robert Kaussow <mail@thegeeklab.de> Co-authored-by: Marcel Boehm <marcel.boehm@inovex.de> * fix review comments Signed-off-by: Felix Breuer <f.breuer94@gmail.com> * update release procedure Signed-off-by: Felix Breuer <f.breuer94@gmail.com> --------- Signed-off-by: Felix Breuer <f.breuer94@gmail.com> Co-authored-by: Rene Schach <rene.schach@shiftavenue.com> Co-authored-by: Robert Kaussow <mail@thegeeklab.de> Co-authored-by: Marcel Boehm <marcel.boehm@inovex.de>
1 parent 09fbb6f commit d88c276

33 files changed

+378
-2285
lines changed

.github/ISSUE_TEMPLATE/enhancement_request.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright [yyyy] [name of copyright owner]
190+
Copyright 2025 Schwarz IT KG
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SHELL = /usr/bin/env bash -o pipefail
44
.SHELLFLAGS = -ec
55
SOURCES := Makefile go.mod go.sum $(shell find $(DEST) -name '*.go' 2>/dev/null)
66
VERSION ?= $(shell git describe --dirty --tags --match='v*' 2>/dev/null || git rev-parse --short HEAD)
7-
REGISTRY ?= reg3.infra.ske.eu01.stackit.cloud
7+
REGISTRY ?= ghcr.io
88
REPO ?= stackitcloud/machine-controller-manager-provider-stackit
99
PUSH ?= true
1010
PLATFORMS ?= amd64 arm64
@@ -78,3 +78,19 @@ mocks: $(MOCKGEN)
7878
.PHONY: generate
7979
generate: mocks
8080
go generate ./...
81+
82+
.PHONY: start
83+
start:
84+
go run \
85+
cmd/machine-controller/main.go \
86+
--control-kubeconfig=$(CONTROL_KUBECONFIG) \
87+
--target-kubeconfig=$(TARGET_KUBECONFIG) \
88+
--namespace=$(CONTROL_NAMESPACE) \
89+
--machine-creation-timeout=20m \
90+
--machine-drain-timeout=5m \
91+
--machine-health-timeout=10m \
92+
--machine-pv-detach-timeout=2m \
93+
--machine-safety-apiserver-statuscheck-timeout=30s \
94+
--machine-safety-apiserver-statuscheck-period=1m \
95+
--machine-safety-orphan-vms-period=30m \
96+
--v=3

OWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# See the OWNERS docs at https://go.k8s.io/owners
2+
13
reviewers:
24
- machine-controller-manager-provider-stackit-reviewers
35
approvers:

README.md

Lines changed: 52 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,64 @@
11
# machine-controller-manager-provider-stackit
22

3-
[![GitHub License](https://img.shields.io/github/license/stackitcloud/stackit-sdk-go)](https://www.apache.org/licenses/LICENSE-2.0)
3+
[![GitHub License](https://img.shields.io/github/license/stackitcloud/machine-controller-manager-provider-stackit)](https://www.apache.org/licenses/LICENSE-2.0)
44

55
Out of tree (controller based) implementation for `STACKIT` as a provider for Gardener.
66

7-
A Machine Controller Manager (MCM) external provider implementation for STACKIT cloud infrastructure. This provider enables Gardener to manage virtual machines on STACKIT using the declarative Kubernetes API.
7+
A Machine Controller Manager (MCM) provider implementation for STACKIT cloud infrastructure. This provider enables Gardener to manage virtual machines on STACKIT using the declarative Kubernetes API.
88

99
The provider was built following the [MCM provider development guidelines](https://github.com/gardener/machine-controller-manager/blob/master/docs/development/cp_support_new.md) and bootstrapped from the [sample provider template](https://github.com/gardener/machine-controller-manager-provider-sampleprovider).
1010

11-
## Project Structure
12-
13-
```sh
14-
machine-controller-manager-provider-stackit/
15-
├── cmd/
16-
│ └── machine-controller/
17-
│ └── main.go # Provider entrypoint
18-
├── pkg/
19-
│ ├── provider/
20-
│ │ ├── core.go # Core provider implementation
21-
│ │ ├── provider.go # Driver interface implementation
22-
│ │ ├── stackit_client.go # STACKIT client interface
23-
│ │ ├── sdk_client.go # STACKIT SDK wrapper implementation
24-
│ │ ├── helpers.go # SDK type conversion utilities
25-
│ │ ├── apis/
26-
│ │ │ ├── provider_spec.go # ProviderSpec CRD definitions
27-
│ │ │ └── validation/ # Field validation logic
28-
│ │ └── *_test.go # Unit tests
29-
│ └── spi/
30-
│ └── spi.go # Service provider interface
31-
├── test/
32-
│ └── e2e/ # End-to-end integration tests
33-
├── samples/ # Example manifests
34-
├── kubernetes/ # Deployment manifests
35-
└── vendor/ # Go module dependencies
36-
```
37-
3811
## Getting Started
3912

40-
### Deployment
13+
### Examples
4114

4215
See the [samples/](./samples/) directory for example manifests including:
4316

4417
- [`secret.yaml`](./samples/secret.yaml) - STACKIT credentials configuration
4518
- [`machine-class.yaml`](./samples/machine-class.yaml) - MachineClass definition
4619
- [`machine.yaml`](./samples/machine.yaml) - Individual Machine example
4720
- [`machine-deployment.yaml`](./samples/machine-deployment.yaml) - MachineDeployment for scaled workloads
48-
- [`deployment.yaml`](./kubernetes/deployment.yaml) - Provider controller deployment
21+
- [`deployment.yaml`](./samples/deployment.yaml) - Provider controller deployment
22+
23+
### Minimal MachineClass Example
24+
25+
Here's a bare minimum MachineClass configuration:
26+
27+
```yaml
28+
apiVersion: machine.sapcloud.io/v1alpha1
29+
kind: MachineClass
30+
metadata:
31+
name: stackit-machine
32+
namespace: default
33+
providerSpec:
34+
region: eu01
35+
machineType: c2i.2
36+
imageId: "12345678-1234-1234-1234-123456789012"
37+
secretRef:
38+
name: stackit-credentials
39+
namespace: default
40+
```
4941
50-
Deploy using standard kubectl commands:
42+
For detailed information on all available configuration fields, see the [MachineClass documentation](./docs/machine-class.md).
43+
44+
## Local Testing & Development
45+
46+
Local development runs the provider and MCM against a real Gardener shoot on STACKIT (local kind cluster is not suitable). Follow the steps in the [local development guide](./docs/development.md).
47+
48+
Use the Makefile targets for testing:
5149
5250
```sh
53-
kubectl apply -f samples/secret.yaml
54-
kubectl apply -f samples/machine-class.yaml
55-
kubectl apply -f samples/machine.yaml
51+
# Run tests
52+
make test
53+
54+
# Verify code formatting and run all checks
55+
make verify
56+
57+
# Format code
58+
make fmt
59+
60+
# Build container image
61+
make image
5662
```
5763

5864
## STACKIT SDK Integration
@@ -65,13 +71,11 @@ Each provider instance is bound to a single STACKIT project via the service acco
6571

6672
The provider requires STACKIT credentials to be provided via a Kubernetes Secret. The Secret must contain the following fields:
6773

68-
| Field | Required | Description |
69-
| ------------------- | -------- | ---------------------------------------------------------------- |
70-
| `projectId` | Yes | STACKIT project UUID |
71-
| `serviceAccountKey` | Yes | STACKIT service account credentials (JSON format) |
72-
| `region` | Yes | STACKIT region (e.g., `eu01-1`, `eu01-2`) |
73-
| `userData` | No | Default cloud-init user data (can be overridden in ProviderSpec) |
74-
| `networkId` | No | Default network UUID (can be overridden in ProviderSpec) |
74+
| Field | Required | Description |
75+
| --------------------- | -------- | ---------------------------------------------------------------- |
76+
| `project-id` | Yes | STACKIT project UUID |
77+
| `serviceaccount.json` | Yes | STACKIT service account credentials (JSON format) |
78+
| `userData` | No | Default cloud-init user data (can be overridden in ProviderSpec) |
7579

7680
The service account key should be obtained from the STACKIT Portal (Project Settings → Service Accounts → Create Key) and contains JWT credentials and a private key for secure authentication.
7781

@@ -81,46 +85,14 @@ The service account key should be obtained from the STACKIT Portal (Project Sett
8185

8286
The provider supports the following environment variables for configuration:
8387

84-
| Variable | Default | Description |
85-
| ---------------------- | ------------- | ------------------------------------------------------------------ |
86-
| `STACKIT_API_ENDPOINT` | (SDK default) | Override STACKIT API endpoint URL (useful for testing) |
87-
| `STACKIT_NO_AUTH` | `false` | Skip authentication (for testing with mock servers, set to `true`) |
88+
| Variable | Default | Description |
89+
| ----------------------- | ------------- | ------------------------------------------------------------------ |
90+
| `STACKIT_IAAS_ENDPOINT` | (SDK default) | Override STACKIT API endpoint URL (useful for testing) |
91+
| `STACKIT_TOKEN_BASEURL` | (SDK default) | Override STACKIT Token endpoint URL (useful for testing) |
92+
| `STACKIT_NO_AUTH` | `false` | Skip authentication (for testing with mock servers, set to `true`) |
8893

8994
**Note:** `STACKIT_NO_AUTH=true` is only intended for testing environments with mock servers. It skips the authenticaiton step and communicates with the STACKIT API without authenticating itself. Do not use in production.
9095

91-
## Configuration Reference
92-
93-
### ProviderSpec Fields
94-
95-
| Field | Type | Required | Description |
96-
| --------------------- | ---------------------- | -------- | ------------------------------------------------ |
97-
| `machineType` | string | Yes | STACKIT server type (e.g., "c2i.2", "m2i.8") |
98-
| `imageId` | string | Yes | UUID of the OS image |
99-
| `labels` | map[string]string | No | Labels for server identification |
100-
| `networking` | NetworkingSpec | No | Network configuration (NetworkID or NICIDs) |
101-
| `securityGroups` | []string | No | Security group names |
102-
| `userData` | string | No | Cloud-init user data (overrides Secret.userData) |
103-
| `bootVolume` | BootVolumeSpec | No | Boot disk configuration |
104-
| `volumes` | []string | No | UUIDs of additional volumes to attach |
105-
| `keypairName` | string | No | SSH keypair name |
106-
| `availabilityZone` | string | No | Availability zone (e.g., "eu01-1") |
107-
| `affinityGroup` | string | No | UUID of affinity group |
108-
| `serviceAccountMails` | []string | No | Service account email addresses (max 1) |
109-
| `agent` | AgentSpec | No | STACKIT agent configuration |
110-
| `metadata` | map[string]interface{} | No | Custom metadata key-value pairs |
111-
112-
### Local Testing
113-
114-
Use the local development environment for rapid iteration:
115-
116-
```sh
117-
# Set up dev environment
118-
just dev
119-
120-
# Or run provider locally for debugging
121-
just start
122-
```
123-
12496
## References
12597

12698
### Machine Controller Manager
@@ -144,4 +116,4 @@ just start
144116
- [STACKIT Portal](https://portal.stackit.cloud/) - STACKIT management console
145117
- [Service Accounts](https://docs.stackit.cloud/stackit/en/service-accounts-134415819.html) - Creating and managing service accounts
146118
- [Service Account Keys](https://docs.stackit.cloud/stackit/en/usage-of-the-service-account-keys-in-stackit-175112464.html) - API authentication setup
147-
- [IaaS API Documentation](https://docs.stackit.cloud/) - STACKIT IaaS REST API reference
119+
- [IaaS API v2 Documentation](https://docs.api.stackit.cloud/documentation/iaas/version/v2) - STACKIT IaaS REST API reference

config/crd/kustomization.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

config/crd/machine.sapcloud.io_machineclasses.yaml

Lines changed: 0 additions & 127 deletions
This file was deleted.

0 commit comments

Comments
 (0)