Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ lint-prometheus: $(PROMTOOL) ## Run promtool check against recording rules and a
@$(PROMTOOL) check rules ./internal/manifests/internal/alerts/prometheus-*.yaml

.PHONY: fmt
fmt: $(GOFUMPT) ## Run gofumpt on source code.
find . -type f -name '*.go' -not -path '**/fake_*.go' -exec $(GOFUMPT) -w {} \;
fmt: lint-fix ## Format the source code (alias for lint-fix).

.PHONY: oci-build
oci-build: ## Build the image
Expand Down Expand Up @@ -257,31 +256,37 @@ deploy: manifests $(KUSTOMIZE) ## Deploy controller in the configured Kubernetes
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/overlays/development | kubectl delete --ignore-not-found=$(ignore-not-found) -f -

OLM_IMG = $(REGISTRY_BASE)/loki-operator:$(OLM_VERSION)
OLM_BUNDLE_IMG = $(REGISTRY_BASE)/loki-operator-bundle:$(OLM_VERSION)
DEV_VERSION := 0.0.1-$(shell date +"%Y%m%d%H%M%S")-$(shell git rev-parse --short HEAD)
OLM_VERSION ?= $(DEV_VERSION)

# Build and push the bundle image to a container registry.
.PHONY: olm-deploy-bundle
olm-deploy-bundle: bundle bundle-build
$(MAKE) oci-push IMG=$(BUNDLE_IMG)
olm-deploy-bundle:
$(MAKE) bundle bundle-build oci-push VERSION=$(OLM_VERSION) IMG=$(OLM_BUNDLE_IMG)

# Build and push the operator image to a container registry.
.PHONY: olm-deploy-operator
olm-deploy-operator: oci-build oci-push
olm-deploy-operator:
$(MAKE) oci-build oci-push IMG=$(OLM_IMG)

.PHONY: olm-deploy
ifeq ($(or $(findstring openshift-logging,$(IMG)),$(findstring openshift-logging,$(BUNDLE_IMG))),openshift-logging)
ifeq ($(or $(findstring openshift-logging,$(OLM_IMG)),$(findstring openshift-logging,$(OLM_BUNDLE_IMG))),openshift-logging)
olm-deploy: ## Deploy the operator bundle and the operator via OLM into an Kubernetes cluster selected via KUBECONFIG.
$(error Set variable REGISTRY_BASE to use a custom container registry org account for local development)
else
olm-deploy: olm-deploy-bundle olm-deploy-operator $(OPERATOR_SDK)
$(OPERATOR_SDK) run bundle -n $(LOKI_OPERATOR_NS) --install-mode AllNamespaces $(BUNDLE_IMG) --security-context-config restricted
$(OPERATOR_SDK) run bundle -n $(LOKI_OPERATOR_NS) --install-mode AllNamespaces $(OLM_BUNDLE_IMG) --security-context-config restricted
endif

.PHONY: olm-upgrade
ifeq ($(or $(findstring openshift-logging,$(IMG)),$(findstring openshift-logging,$(BUNDLE_IMG))),openshift-logging)
ifeq ($(or $(findstring openshift-logging,$(OLM_IMG)),$(findstring openshift-logging,$(OLM_BUNDLE_IMG))),openshift-logging)
olm-upgrade: ## Upgrade the operator bundle and the operator via OLM into an Kubernetes cluster selected via KUBECONFIG.
$(error Set variable REGISTRY_BASE to use a custom container registry org account for local development)
else
olm-upgrade: olm-deploy-bundle olm-deploy-operator $(OPERATOR_SDK)
$(OPERATOR_SDK) run bundle-upgrade -n $(LOKI_OPERATOR_NS) $(BUNDLE_IMG)
$(OPERATOR_SDK) run bundle-upgrade -n $(LOKI_OPERATOR_NS) $(OLM_BUNDLE_IMG)
endif

.PHONY: olm-undeploy
Expand Down