Skip to content

Commit

Permalink
feat: install operator-sdk and document new resource scaffolding (#864)
Browse files Browse the repository at this point in the history
  • Loading branch information
rriski authored Jan 15, 2025
1 parent d77b2a9 commit ff85356
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,15 @@ $(LOCALBIN):
KUBECTL ?= kubectl
KUSTOMIZE ?= $(LOCALBIN)/kustomize-$(KUSTOMIZE_VERSION)
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk-$(OPERATOR_SDK_VERSION)
ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
SELPROJ = $(LOCALBIN)/selproj-$(SELPROJ_VERSION)

## Tool Versions
KUSTOMIZE_VERSION ?= v4.5.7
CONTROLLER_TOOLS_VERSION ?= v0.15.0
OPERATOR_SDK_VERSION ?= v1.36.0
ENVTEST_VERSION ?= release-0.16
GOLANGCI_LINT_VERSION ?= v1.54.2
SELPROJ_VERSION ?= v0.1.0
Expand All @@ -197,6 +199,11 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
$(CONTROLLER_GEN): $(LOCALBIN)
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))

.PHONY: operator-sdk
operator-sdk: $(OPERATOR_SDK) ## Download operator-sdk locally if necessary.
$(OPERATOR_SDK): $(LOCALBIN)
$(call go-install-tool,$(OPERATOR_SDK),github.com/operator-framework/operator-sdk/cmd/operator-sdk,$(OPERATOR_SDK_VERSION))

# KUBEBUILDER_ASSETS is installed in this target so that it can be used by e.g. IDE test integrations.
.PHONY: envtest
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
Expand Down Expand Up @@ -308,4 +315,4 @@ endef

PHONY: sweep
sweep: ## Run sweep to remove all resources created by e2e tests.
go run ./sweeper/...
go run ./sweeper/...
11 changes: 11 additions & 0 deletions docs/docs/contributing/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,14 @@ the source code during the documentation deployment. To generate it locally, run
```shell
make docs
```

## Generating new resources

To create new resources, install `operator-sdk` with `make operator-sdk` and run:

```shell
# Replace `<VERSION>` with your operator-sdk version.
# Replace `<KIND>` with the new resource type. E.g. "Flink" or "Valkey".
./bin/operator-sdk-<VERSION> create api --version v1alpha1 --kind <KIND> --force
./bin/operator-sdk-<VERSION> create webhook --version v1alpha1 --kind <KIND> --defaulting --programmatic-validation --conversion
```

0 comments on commit ff85356

Please sign in to comment.