Skip to content

Commit

Permalink
Merge pull request #832 from yazug/makefile_improvements
Browse files Browse the repository at this point in the history
Makefile improvements
  • Loading branch information
openshift-merge-robot authored May 24, 2023
2 parents a8eef89 + be6eb59 commit 5a81803
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ ifeq ($(USE_IMAGE_DIGESTS), true)
endif

# Image URL to use all building/pushing image targets
IMG ?= controller:latest
DEFAULT_IMG ?= quay.io/openstack-k8s-operators/osp-director-operator:latest
IMG ?= $(DEFAULT_IMG)
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.25.0
# Metrics bind address
Expand Down Expand Up @@ -225,10 +226,12 @@ $(LOCALBIN):
KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
CONTROLLER_TOOLS_VERSION ?= v0.10.0
OPERATOR_SDK_VERSION ?= v1.19.0

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand All @@ -246,13 +249,18 @@ envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest

.PHONY: operator-sdk
operator-sdk: $(OPERATOR_SDK)
$(OPERATOR_SDK): $(LOCALBIN)
test -s $(OPERATOR_SDK) || curl -o $(LOCALBIN)/operator-sdk -L https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_linux_amd64 && chmod +x $(LOCALBIN)/operator-sdk

.PHONY: bundle
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
bundle: operator-sdk manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
cp -f config/default/manager_default_images_${OSP_RELEASE}.yaml config/default/manager_default_images.yaml
operator-sdk generate kustomize manifests -q
$(OPERATOR_SDK) generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle $(BUNDLE_GEN_FLAGS)
operator-sdk bundle validate ./bundle
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
$(OPERATOR_SDK) bundle validate ./bundle
rm -f config/default/manager_default_images.yaml

.PHONY: bundle-build
Expand Down

0 comments on commit 5a81803

Please sign in to comment.