Skip to content

Commit 3090a6c

Browse files
committed
Add ORC with image controller
This commits creates a new home for ORC, initially incubated in CAPO. The initial implementation of ORC has an image controller. The image controller is integrated with OpenStackServer and from there into both OpenStackMachine and the bastion. The E2E tests are updated to use the new image controller. Images are now loaded dynamically by the test suite.
1 parent 3624479 commit 3090a6c

File tree

146 files changed

+25713
-242
lines changed

Some content is hidden

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

146 files changed

+25713
-242
lines changed

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ linters-settings:
5959
sections:
6060
- standard
6161
- default
62+
- prefix(github.com/k-orc/openstack-resource-controller)
6263
- prefix(sigs.k8s.io/cluster-api-provider-openstack)
6364
gocritic:
6465
enabled-tags:
@@ -130,6 +131,9 @@ linters-settings:
130131
alias: controlplanev1alpha4
131132
- pkg: sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1
132133
alias: controlplanev1
134+
# ORC
135+
- pkg: github.com/k-orc/openstack-resource-controller/api/v1alpha1
136+
alias: orcv1alpha1
133137

134138
nolintlint:
135139
# https://github.com/golangci/golangci-lint/issues/3228

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ ARG goproxy=https://proxy.golang.org
2121
ENV GOPROXY=$goproxy
2222

2323
# Copy the Go Modules manifests
24+
RUN mkdir orc
2425
COPY go.mod go.mod
2526
COPY go.sum go.sum
27+
COPY orc/go.mod orc/go.mod
28+
COPY orc/go.sum orc/go.sum
2629

2730
# Cache deps before building and copying source so that we don't need to re-download as much
2831
# and so that source changes don't invalidate our downloaded layer

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ TEST_PATHS ?= ./...
150150
test: $(ARTIFACTS) $(GOTESTSUM) kubebuilder_assets
151151
KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" $(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.test.xml --junitfile-hide-empty-pkg --jsonfile $(ARTIFACTS)/test-output.log -- \
152152
-v $(TEST_PATHS) $(TEST_ARGS)
153+
$(MAKE) -C $(REPO_ROOT)/orc test
153154

154155
E2E_TEMPLATES_DIR=test/e2e/data/infrastructure-openstack
155156
E2E_KUSTOMIZE_DIR=test/e2e/data/kustomize
@@ -250,10 +251,12 @@ $(GO_APIDIFF): # Build go-apidiff.
250251
.PHONY: lint
251252
lint: $(GOLANGCI_LINT) ## Lint codebase
252253
$(GOLANGCI_LINT) run -v --fast=false
254+
$(MAKE) -C $(REPO_ROOT)/orc lint
253255

254256
.PHONY: lint-update
255257
lint-update: $(GOLANGCI_LINT) ## Lint codebase
256258
$(GOLANGCI_LINT) run -v --fast=false --fix
259+
$(MAKE) -C $(REPO_ROOT)/orc lint-fix
257260

258261
lint-fast: $(GOLANGCI_LINT) ## Run only faster linters to detect possible issues
259262
$(GOLANGCI_LINT) run -v --fast=true
@@ -264,11 +267,13 @@ lint-fast: $(GOLANGCI_LINT) ## Run only faster linters to detect possible issues
264267

265268
.PHONY: modules
266269
modules: ## Runs go mod to ensure proper vendoring.
270+
$(MAKE) -C $(REPO_ROOT)/orc modules
267271
go mod tidy
268272
cd $(TOOLS_DIR); go mod tidy
273+
cd $(REPO_ROOT)/hack/codegen; go mod tidy
269274

270275
.PHONY: generate
271-
generate: templates generate-controller-gen generate-codegen generate-conversion-gen generate-go generate-manifests generate-api-docs ## Generate all generated code
276+
generate: templates generate-orc generate-controller-gen generate-codegen generate-conversion-gen generate-go generate-manifests generate-api-docs ## Generate all generated code
272277

273278
.PHONY: generate-go
274279
generate-go: $(MOCKGEN)
@@ -280,9 +285,14 @@ generate-controller-gen: $(CONTROLLER_GEN)
280285
paths=./api/... \
281286
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt
282287

288+
.PHONY: generate-codegen
283289
generate-codegen: generate-controller-gen
284290
./hack/update-codegen.sh
285291

292+
.PHONY: generate-orc
293+
generate-orc:
294+
$(MAKE) -C $(REPO_ROOT)/orc generate
295+
286296
.PHONY: generate-conversion-gen
287297
capo_module := sigs.k8s.io/cluster-api-provider-openstack
288298
generate-conversion-gen: $(CONVERSION_GEN)
@@ -308,6 +318,7 @@ generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc.
308318
$(CONTROLLER_GEN) \
309319
paths=./ \
310320
paths=./controllers/... \
321+
paths=./internal/controllers/... \
311322
output:rbac:dir=$(RBAC_ROOT) \
312323
rbac:roleName=manager-role
313324

PROJECT

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ resources:
3030
kind: OpenStackClusterTemplate
3131
version: v1alpha7
3232
- group: infrastructure
33-
version: v1beta1
3433
kind: OpenStackCluster
35-
- group: infrastructure
3634
version: v1beta1
37-
kind: OpenStackMachine
3835
- group: infrastructure
36+
kind: OpenStackMachine
3937
version: v1beta1
38+
- group: infrastructure
4039
kind: OpenStackMachineTemplate
40+
version: v1beta1
4141
- group: infrastructure
4242
kind: OpenStackClusterTemplate
4343
version: v1beta1
@@ -47,4 +47,5 @@ resources:
4747
- group: infrastructure
4848
kind: OpenStackServer
4949
version: v1alpha1
50+
- group: infrastructure
5051
version: "2"

api/v1beta1/conditions_consts.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const (
4242
InstanceDeleteFailedReason = "InstanceDeleteFailed"
4343
// OpenstackErrorReason used when there is an error communicating with OpenStack.
4444
OpenStackErrorReason = "OpenStackError"
45+
// DependencyFailedReason indicates that a dependent object failed.
46+
DependencyFailedReason = "DependencyFailed"
4547
)
4648

4749
const (

api/v1beta1/types.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ type OpenStackMachineTemplateResource struct {
2828
Spec OpenStackMachineSpec `json:"spec"`
2929
}
3030

31-
// ImageParam describes a glance image. It can be specified by ID or filter.
31+
type ResourceReference struct {
32+
// Name is the name of the referenced resource
33+
Name string `json:"name"`
34+
}
35+
36+
// ImageParam describes a glance image. It can be specified by ID, filter, or a
37+
// reference to an ORC Image.
3238
// +kubebuilder:validation:MaxProperties:=1
3339
// +kubebuilder:validation:MinProperties:=1
3440
type ImageParam struct {
@@ -42,6 +48,11 @@ type ImageParam struct {
4248
// be raised.
4349
// +optional
4450
Filter *ImageFilter `json:"filter,omitempty"`
51+
52+
// ImageRef is a reference to an ORC Image in the same namespace as the
53+
// referring object.
54+
// +optional
55+
ImageRef *ResourceReference `json:"imageRef,omitempty"`
4556
}
4657

4758
// ImageFilter describes a query for an image.

api/v1beta1/zz_generated.deepcopy.go

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

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml

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

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml

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

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml

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

0 commit comments

Comments
 (0)