Skip to content

Commit f4af234

Browse files
authored
Migrate to Upjet v2 (#152)
1 parent ad7b2c9 commit f4af234

File tree

1,513 files changed

+231913
-97563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,513 files changed

+231913
-97563
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ cover.out
99
# ignore IDE folders
1010
.vscode/
1111
.idea/
12+
13+
/temp

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ View the [upstream changelogs](https://github.com/terraform-provider-openstack/t
6868
- Made it easier to configure authentication by not requiring so many fields.
6969
- Migrated to Upjets new No-Fork/Provider v2 SDK Architecture. The provider now does not ship with Terraform CLI anymore.
7070
- Added many cross resource references (autmatically generated from Terraform provider schema)
71-
- Add native metrics for managed resources (see [Upjet 1.3.0](https://github.com/crossplane/upjet/releases/tag/v1.3.0) for more details)
71+
- Add native metrics for managed resources (see [Upjet 1.3.0](https://github.com/crossplane/upjet/v2/releases/tag/v1.3.0) for more details)
7272

7373
### Changed
7474

CONTRIBUTING.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Contributing
2+
3+
THis project uses [Makefile](Makefile) to manage common tasks. You can see all available commands by running:
4+
5+
```bash
6+
make help
7+
```
8+
9+
Ensure your environment provides the encessary tools to build and test the project.
10+
11+
- [Go](https://golang.org/dl/) in the version specified in [go.mod](go.mod)
12+
- [Docker](https://www.docker.com/get-started) or a compatible container runtime
13+
14+
```bash
15+
16+
## Developing
17+
18+
Install the required submodules to build and run:
19+
20+
```bash
21+
make submodules
22+
```
23+
24+
Apply the Current CRDs and a providerConfig:
25+
26+
```bash
27+
kubectl apply -f package/crds
28+
kubectl apply -f examples/providerconfig/providerconfig.yaml
29+
```
30+
31+
Run against a Kubernetes cluster: (make sure to apply CRDs and providerConfig)
32+
33+
```bash
34+
make run
35+
```
36+
37+
Run a testbuild with linting:
38+
39+
```bash
40+
make reviewable
41+
```
42+
43+
Build binary:
44+
45+
```bash
46+
make build
47+
```
48+
49+
## Release a new version (Maintainer)
50+
51+
- Update Changelog (Add new Version & Date)
52+
- Create or merge to existing release branch (release-v(major).(minor))
53+
- Run Release pipeline on release branch, using specific version as parameter
54+
55+
## Environment Speicific Notes
56+
57+
### Apple Silicon (ARM64)
58+
59+
- When using Rancher Desktop, use QEMU as the emulator to ensure kind works correctly (see https://github.com/rancher-sandbox/rancher-desktop/issues/9192)

Makefile

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
PROJECT_NAME := provider-openstack
55
PROJECT_REPO := github.com/crossplane-contrib/$(PROJECT_NAME)
66

7-
export TERRAFORM_VERSION := 1.5.5
7+
export TERRAFORM_VERSION := 1.5.7
88
export TERRAFORM_PROVIDER_SOURCE := terraform-provider-openstack/openstack
99
export TERRAFORM_DOCS_PATH := docs/resources
10+
11+
# Do not allow a version of terraform greater than 1.5.x, due to versions 1.6+ being
12+
# licensed under BSL, which is not permitted.
13+
TERRAFORM_VERSION_VALID := $(shell [ "$(TERRAFORM_VERSION)" = "`printf "$(TERRAFORM_VERSION)\n1.6" | sort -V | head -n1`" ] && echo 1 || echo 0)
14+
1015
export TERRAFORM_PROVIDER_REPO := https://github.com/terraform-provider-openstack/terraform-provider-openstack
1116
export TERRAFORM_PROVIDER_VERSION := 3.3.2
1217

@@ -48,15 +53,16 @@ GO_SUBDIRS += cmd internal apis
4853
# ====================================================================================
4954
# Setup Kubernetes tools
5055

51-
KIND_VERSION = v0.21.0
52-
UP_VERSION = v0.28.0
56+
KIND_VERSION = v0.30.0
57+
UP_VERSION = v0.41.0
5358
UP_CHANNEL = stable
54-
UPTEST_VERSION = v0.11.1
59+
UPTEST_VERSION = v2.2.0
5560
UPTEST_LOCAL_VERSION = v0.13.0
5661
UPTEST_LOCAL_CHANNEL = stable
5762
KUSTOMIZE_VERSION = v5.3.0
5863
YQ_VERSION = v4.40.5
59-
CROSSPLANE_VERSION = 1.14.6
64+
CROSSPLANE_VERSION = 2.1.1
65+
CROSSPLANE_CLI_VERSION = v2.1.1
6066
CRDDIFF_VERSION = v0.12.1
6167

6268
-include build/makelib/k8s_tools.mk
@@ -99,7 +105,7 @@ xpkg.build.provider-openstack: do.build.images
99105

100106
# NOTE(hasheddan): we ensure up is installed prior to running platform-specific
101107
# build steps in parallel to avoid encountering an installation race condition.
102-
build.init: $(UP)
108+
build.init: $(UP) $(CROSSPLANE_CLI)
103109

104110
# ====================================================================================
105111
# Fallthrough
@@ -121,10 +127,14 @@ TERRAFORM := $(TOOLS_HOST_DIR)/terraform-$(TERRAFORM_VERSION)
121127
TERRAFORM_WORKDIR := $(WORK_DIR)/terraform
122128
TERRAFORM_PROVIDER_SCHEMA := config/schema.json
123129

124-
$(TERRAFORM):
130+
check-terraform-version:
131+
ifneq ($(TERRAFORM_VERSION_VALID),1)
132+
$(error invalid TERRAFORM_VERSION $(TERRAFORM_VERSION), must be less than 1.6.0 since that version introduced a not permitted BSL license))
133+
endif
134+
$(TERRAFORM): check-terraform-version
125135
@$(INFO) installing terraform $(HOSTOS)-$(HOSTARCH)
126136
@mkdir -p $(TOOLS_HOST_DIR)/tmp-terraform
127-
@curl -fsSL https://github.com/upbound/terraform/releases/download/v$(TERRAFORM_VERSION)/terraform_$(TERRAFORM_VERSION)_$(SAFEHOST_PLATFORM).zip -o $(TOOLS_HOST_DIR)/tmp-terraform/terraform.zip
137+
@curl -fsSL https://releases.hashicorp.com/terraform/$(TERRAFORM_VERSION)/terraform_$(TERRAFORM_VERSION)_$(SAFEHOST_PLATFORM).zip -o $(TOOLS_HOST_DIR)/tmp-terraform/terraform.zip
128138
@unzip $(TOOLS_HOST_DIR)/tmp-terraform/terraform.zip -d $(TOOLS_HOST_DIR)/tmp-terraform
129139
@mv $(TOOLS_HOST_DIR)/tmp-terraform/terraform $(TERRAFORM)
130140
@rm -fr $(TOOLS_HOST_DIR)/tmp-terraform
@@ -133,6 +143,7 @@ $(TERRAFORM):
133143
$(TERRAFORM_PROVIDER_SCHEMA): $(TERRAFORM)
134144
@$(INFO) generating provider schema for $(TERRAFORM_PROVIDER_SOURCE) $(TERRAFORM_PROVIDER_VERSION)
135145
@mkdir -p $(TERRAFORM_WORKDIR)
146+
# Remove lock file to prevent installation issues when changing provider versions
136147
@rm -f ${TERRAFORM_WORKDIR}/.terraform.lock.hcl
137148
@echo '{"terraform":[{"required_providers":[{"provider":{"source":"'"$(TERRAFORM_PROVIDER_SOURCE)"'","version":"'"$(TERRAFORM_PROVIDER_VERSION)"'"}}],"required_version":"'"$(TERRAFORM_VERSION)"'"}]}' > $(TERRAFORM_WORKDIR)/main.tf.json
138149
@$(TERRAFORM) -chdir=$(TERRAFORM_WORKDIR) init > $(TERRAFORM_WORKDIR)/terraform-logs.txt 2>&1
@@ -186,7 +197,7 @@ run: go.build
186197

187198
# ====================================================================================
188199
# End to End Testing
189-
CROSSPLANE_NAMESPACE = upbound-system
200+
CROSSPLANE_NAMESPACE = crossplane-system
190201
-include build/makelib/local.xpkg.mk
191202
-include build/makelib/controlplane.mk
192203

@@ -202,7 +213,7 @@ uptest: $(UPTEST_LOCAL) $(KUBECTL) $(KUTTL)
202213
local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME)
203214
@$(INFO) running locally built provider
204215
@$(KUBECTL) wait provider.pkg $(PROJECT_NAME) --for condition=Healthy --timeout 5m
205-
@$(KUBECTL) -n upbound-system wait --for=condition=Available deployment --all --timeout=5m
216+
@$(KUBECTL) -n $(CROSSPLANE_NAMESPACE) wait --for=condition=Available deployment --all --timeout=5m
206217
@$(OK) running locally built provider
207218

208219
# This target requires the following environment variables to be set:

README.md

Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<div align="center">
44

55
[![GitHub release](https://img.shields.io/github/release/crossplane-contrib/provider-openstack/all.svg)](https://github.com/crossplane-contrib/provider-openstack/releases)
6+
![Go Version](https://img.shields.io/github/go-mod/go-version/crossplane-contrib/provider-openstack)
67

78
</div>
89

@@ -11,6 +12,20 @@ is built using [Upjet](https://github.com/crossplane/upjet) code
1112
generation tools and exposes XRM-conformant managed resources for the
1213
OpenStack API.
1314

15+
## Features
16+
17+
The provider is compatible with Crossplane 1.x and 2.x
18+
19+
| Feature | Status |
20+
|-----------------------------|---------------|
21+
| [Cluster Scoped Managed Resources](./examples-generated/cluster) | ✅ Supported |
22+
| [Namespace Scoped Managed Resources](./examples-generated/namespace) | ✅ Supported (Crossplane 2+) |
23+
| [Management Policies (Beta)](https://docs.crossplane.io/latest/managed-resources/managed-resources/#managementpolicies) | ✅ Supported |
24+
| [Init Providers (Beta)](https://docs.crossplane.io/latest/managed-resources/managed-resources/#initprovider) | ✅ Supported |
25+
| [Safe Start/MRDs (Alpha)](https://docs.crossplane.io/latest/guides/implementing-safe-start/) | ✅ Supported (Crossplane 2+) |
26+
| [Change Logs (Alpha)](https://docs.crossplane.io/latest/guides/change-logs/) | ❌ Planned, see [#141](https://github.com/crossplane-contrib/provider-openstack/issues/141) |
27+
| [External Secret Stores (Alpha)](https://docs.crossplane.io/latest/guides/upgrade-to-crossplane-v2/#external-secret-stores) | ❌ Not Planned |
28+
1429
## Getting Started
1530

1631
### Installation
@@ -23,10 +38,11 @@ kind: Provider
2338
metadata:
2439
name: provider-openstack
2540
spec:
41+
# Replace by the latest version
2642
package: xpkg.crossplane.io/crossplane-contrib/provider-openstack:vX.Y.Z
2743
```
2844
29-
You can see the API reference [here](https://doc.crds.dev/github.com/crossplane-contrib/provider-openstack).
45+
You can see the API reference [here](https://doc.crds.dev/github.com/crossplane-contrib/provider-openstack) as well as examples of managed resources in the [examples-generated](./examples-generated) folder.
3046
3147
### Configuration
3248
@@ -118,45 +134,6 @@ spec:
118134
name: provider-openstack
119135
```
120136
121-
## Developing
122-
123-
Install the required submodules to build and run:
124-
125-
```bash
126-
make submodules
127-
```
128-
129-
Apply the Current CRDs and a providerConfig:
130-
131-
```bash
132-
kubectl apply -f package/crds
133-
kubectl apply -f examples/providerconfig/providerconfig.yaml
134-
```
135-
136-
Run against a Kubernetes cluster: (make sure to apply CRDs and providerConfig)
137-
138-
```bash
139-
make run
140-
```
141-
142-
Run a testbuild with linting:
143-
144-
```bash
145-
make reviewable
146-
```
147-
148-
Build binary:
149-
150-
```bash
151-
make build
152-
```
153-
154-
## Release a new version (Maintainer)
155-
156-
- Update Changelog (Add new Version & Date)
157-
- Create or merge to existing release branch (release-v(major).(minor))
158-
- Run Release pipeline on release branch, using specific version as parameter
159-
160137
## Report a Bug
161138
162139
For filing bugs, suggesting improvements, or requesting new features, please

0 commit comments

Comments
 (0)