Skip to content

Commit 4a46e16

Browse files
feat: add Crossplane + CrossplaneProvider reconciler (#11)
* feat(api): refine `ProviderConfig` * chore(`ProviderConfig`): update samples * docs: add docs how to use service-provider-crossplane * fix: typo * update docs * register schemes for clusters * add mechanism to read CRDs from file system * feat: first draft of Crossplane reconciler * refine crossplane reconcile logic * feat(crossplane): add kubeconfig handling for flux SA on MCP cluster * feat: add juggler for reconciling Crossplane Instance * fix: typo * fix: controller setup * fix: imports * fix: liniting issues * feat(juggler): add `Crossplane` component * docs: update sample * fix: remove log * add todos * feat: implement deletion * chore: update MCP scheme * chore: refactor reconcile loop * fix: using `POD_NAMESPACE` env variable * fix: check for `Crossplane` CR is not found beginning of reconcile * fix(bug): update status * chore: implement smartrequeue package * chore: update build submodule * feat: add `CrossplaneProvider` component * feat: use component label * add todo * chore(dep): update control-plane-operator * fix: register ObjectReconciler * fix: remove unused code * feat: add CrossplaneProvider component to Juggler * fix: linting errors * fix: linting error * fix: disabled crossplane providers * fix: format package name in `Provider` CR * docs: update readme * docs: update readme * feat: release v0.0.2 * docs: fix typo * fix: header * chore: update sample * fix: remove unnecessary funcs + add tests * fix: imports * revert: changes on `health-probe-bind-address` * chore: remove own docs * chore: remove unused field * fix: remove `PolicyRulesComponent` interface from `Crossplane` component * fix: remove unused code
1 parent 27f3b89 commit 4a46e16

25 files changed

+2050
-218
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ go.work
2727
*~
2828

2929
*.html
30+
31+
/tmp

README.md

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,70 @@
44

55
## About this project
66

7-
Service provider Crossplane manages the lifecycle of Crossplane instances.
7+
Service provider Crossplane manages the lifecycle of Crossplane instances and Crossplane providers in a `ManagedControlPlane`.
88

9-
## Installation of the Service Provider Crossplane
9+
## 🏗️ Installation of the Service Provider Crossplane
1010

1111
### Local Development
12+
To run the service-provider-crossplane locally, you need to first bootstrap an openMCP environment by using [openmcp-operator](https://github.com/openmcp-project/openmcp-operator) and [cluster-provider-kind](https://github.com/openmcp-project/cluster-provider-kind). A comprehensive guide will follow soon.
1213

13-
To install the service provider Crossplane locally, you can use the following command:
14+
For current testing reasons, the service-provider-crossplane needs to run in the cluster. To run the latest version of your changes in your local environment, you need to run:
1415

1516
```bash
16-
TODO
17+
task build:img:build
18+
```
19+
20+
This will build the image of the service-provider-crossplane locally and puts it into your local Docker registry.
21+
22+
```bash
23+
docker images ghcr.io/openmcp-project/images/service-provider-crossplane
24+
```
25+
26+
You can then apply the `ServiceProvider` resource to your openMCP Platform cluster:
27+
28+
```yaml
29+
apiVersion: openmcp.cloud/v1alpha1
30+
kind: ServiceProvider
31+
metadata:
32+
name: crossplane
33+
spec:
34+
image: ghcr.io/openmcp-project/images/service-provider-crossplane:... # latest local docker image build
1735
```
1836
1937
### OpenMCP Landscape
38+
When you already have an openMCP environment set up, you can deploy the service-provider-crossplane by applying the following manifest:
2039
2140
```yaml
22-
apiVersion: services.openmcp.cloud/v1alpha1
41+
apiVersion: openmcp.cloud/v1alpha1
2342
kind: ServiceProvider
2443
metadata:
2544
name: crossplane
2645
spec:
27-
image: ghcr.io/openmcp-project/images/service-provicer-crossplane:<version>
46+
image: ghcr.io/openmcp-project/images/service-provider-crossplane:<latest-version> # latest upstream version
2847
```
2948
30-
## Configure a `ProviderConfig`
49+
## 📖 Usage
50+
51+
### Configure a `ProviderConfig`
3152
A `ProviderConfig` is an API where you can configure the installation of a Crossplane instance in your `ManagedControlPlane`.
3253

3354
```yaml
3455
apiVersion: crossplane.services.openmcp.cloud/v1alpha1
3556
kind: ProviderConfig
3657
metadata:
37-
name: providerconfig-sample
58+
name: default
3859
spec:
3960
chart:
4061
repository: "https://charts.crossplane.io/stable"
4162
name: crossplane
42-
version: v1.20.0
63+
availableVersions:
64+
- v1.20.0
65+
- v1.19.0
66+
availableProviders:
67+
- name: provider-kubernetes
68+
package: xpkg.upbound.io/upbound/provider-kubernetes
69+
versions:
70+
- v0.16.0
4371
```
4472

4573
### Install a Crossplane instance
@@ -54,38 +82,54 @@ spec:
5482
version: v1.20.0
5583
providers:
5684
- name: provider-kubernetes
57-
version: v0.18.0
85+
version: v0.16.0
5886
```
5987

60-
## Development
88+
## 🧑‍💻 Development
6189

62-
### Building the image locally
90+
### Building the binary locally
6391

64-
To build the image locally, you can use the following command:
92+
To build the binary locally, you can use the following command:
6593

6694
```bash
6795
task build
6896
```
6997

98+
### Build the image locally
99+
100+
To build the image locally, you can use the following command:
101+
102+
```bash
103+
task build:img:build
104+
```
105+
106+
### Run unit tests locally
107+
108+
To run the unit tests locally, you can use the following command:
109+
110+
```bash
111+
task test
112+
```
113+
70114
### Generating the CRDs, DeepCopy functions etc.
71115
To generate the CRDs, DeepCopy functions, and other boilerplate code, you can use the following command:
72116

73117
```bash
74118
task generate
75119
```
76120

77-
## Support, Feedback, Contributing
121+
## ❤️ Support, Feedback, Contributing
78122

79123
This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/openmcp-project/service-provider-crossplane/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md).
80124

81-
## Security / Disclosure
125+
## 🔐 Security / Disclosure
82126
If you find any bug that may be a security problem, please follow our instructions at [in our security policy](https://github.com/openmcp-project/service-provider-crossplane/security/policy) on how to report it. Please do not create GitHub issues for security-related doubts or problems.
83127

84-
## Code of Conduct
128+
## 🤝 Code of Conduct
85129

86130
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its [Code of Conduct](https://github.com/openmcp-project/.github/blob/main/CODE_OF_CONDUCT.md) at all times.
87131

88-
## Licensing
132+
## 📋 Licensing
89133

90134
Copyright 2025 SAP SE or an SAP affiliate company and service-provider-crossplane contributors. Please see our [LICENSE](LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/openmcp-project/service-provider-crossplane).
91135

Taskfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ includes:
77
vars:
88
API_DIRS: '{{.ROOT_DIR}}/api/v1alpha1/...'
99
MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests'
10-
CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/api/v1alpha1/...'
10+
CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/api/v1alpha1/... {{.ROOT_DIR}}/pkg/...'
1111
COMPONENTS: 'service-provider-crossplane'
1212
REPO_URL: 'https://github.com/openmcp-project/service-provider-crossplane'
1313
CHART_COMPONENTS: "[]"

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.0.1-dev
1+
v0.0.2

api/crds/crds.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package crds
2+
3+
import (
4+
"embed"
5+
6+
crdutil "github.com/openmcp-project/controller-utils/pkg/crds"
7+
apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
8+
)
9+
10+
//go:embed manifests
11+
var CRDFS embed.FS
12+
13+
func CRDs() ([]*apiextv1.CustomResourceDefinition, error) {
14+
return crdutil.CRDsFromFileSystem(CRDFS, "manifests")
15+
}

api/crds/manifests/crossplane.services.openmcp.cloud_providerconfigs.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,28 +70,24 @@ spec:
7070
- versions
7171
type: object
7272
type: array
73-
availableVersions:
74-
description: AvailableVersions holds the list of available versions
75-
for Crossplane.
76-
items:
77-
type: string
78-
type: array
7973
chart:
8074
description: Optional custom Helm chart configuration.
8175
properties:
76+
availableVersions:
77+
description: AvailableVersions of the Helm chart.
78+
items:
79+
type: string
80+
type: array
8281
name:
8382
description: Name of the Helm chart.
8483
type: string
8584
repository:
8685
description: Repository is the URL to a Helm repository.
8786
type: string
88-
version:
89-
description: Version of the Helm chart.
90-
type: string
9187
required:
88+
- availableVersions
9289
- name
9390
- repository
94-
- version
9591
type: object
9692
imageMapping:
9793
additionalProperties:
@@ -101,7 +97,6 @@ spec:
10197
type: object
10298
required:
10399
- availableProviders
104-
- availableVersions
105100
- chart
106101
type: object
107102
status:

api/v1alpha1/providerconfig_types.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ type ChartSpec struct {
4646
// +kubebuilder:validation:Required
4747
Name string `json:"name"`
4848

49-
// Version of the Helm chart.
49+
// AvailableVersions of the Helm chart.
5050
// +kubebuilder:validation:Required
51-
Version string `json:"version"`
51+
AvailableVersions []string `json:"availableVersions"`
5252
}
5353

5454
// ProviderConfigSpec defines the desired state of ProviderConfig.
@@ -61,10 +61,6 @@ type ProviderConfigSpec struct {
6161
// +kubebuilder:validation:Optional
6262
ImageMapping map[string]string `json:"imageMapping,omitempty"`
6363

64-
// AvailableVersions holds the list of available versions for Crossplane.
65-
// +kubebuilder:validation:Required
66-
AvailableVersions []string `json:"availableVersions"`
67-
6864
// AvailableProviders holds the list of providers that can be configured with the Service Provider Crossplane.
6965
// +kubebuilder:validation:Required
7066
AvailableProviders []AvailableCrossplaneProvider `json:"availableProviders"`

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)