Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1beta1
package v1alpha1

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only unittest that is accessing the manifest file in FS. Moved from argocd-operator/ to the top level so it verifies those manifests now.


import (
"os"
Expand Down
122 changes: 3 additions & 119 deletions argocd-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,6 @@ ifeq ($(CONTAINER_RUNTIME),)
$(warning "No container runtime (Docker or Podman) found in PATH. Please install one of them.")
endif

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif

# DEFAULT_CHANNEL defines the default channel used in the bundle.
# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
# To re-generate a bundle for any other default channel without changing the default setup, you can:
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
ifneq ($(origin DEFAULT_CHANNEL), undefined)
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

# Set the Operator SDK version to use.
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
OPERATOR_SDK_VERSION ?= v1.35.0
Expand All @@ -57,10 +38,6 @@ GOLANGCILINT_VERSION ?= v2.12.2
# /argocd-operator-bundle:$VERSION and /argocd-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= quay.io/argoprojlabs/argocd-operator

# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)

# Image URL to use all building/pushing image targets
IMG ?= $(IMAGE_TAG_BASE):v$(VERSION)

Expand Down Expand Up @@ -99,12 +76,6 @@ help: ## Display this help.

##@ Development

manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

fmt: ## Run go fmt against code.
go fmt ./...

Expand All @@ -119,15 +90,15 @@ get-image-updater-crd: ## Download Image Updater CRD.
# Exclude E2E tests from the list of unit test packages
UNIT_TEST_PACKAGES := $(shell go list ./... | grep -E -v '/tests/ginkgo')

test: manifests generate fmt vet envtest ## Run tests.
test: fmt vet envtest ## Run tests.
REDIS_CONFIG_PATH="$(shell pwd)/build/redis" go test $(UNIT_TEST_PACKAGES) -coverprofile cover.out

##@ Build

build: generate fmt vet ## Build manager binary.
build: fmt vet ## Build manager binary.
go build -ldflags=$(LD_FLAGS) -o bin/manager cmd/main.go

run: manifests generate fmt vet ## Run a controller from your host.
run: fmt vet ## Run a controller from your host.
REDIS_CONFIG_PATH="build/redis" ARGOCD_OPERATOR_NAMESPACE="argocd" go run -ldflags=$(LD_FLAGS) ./cmd/main.go

docker-build: test ## Build docker image with the manager.
Expand Down Expand Up @@ -160,16 +131,6 @@ endif

##@ Deployment

ifndef ignore-not-found
ignore-not-found = false
endif

install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
## TODO: Remove sed usage after all v1alpha1 references are updated to v1beta1 in codebase.
## For local testing, conversion webhook defined in crd makes call to webhook for each v1alpha1 reference
## causing failures as we don't set up the webhook for local testing.
$(KUSTOMIZE) build config/crd | sed '/conversion:/,/- v1beta1/d' |kubectl apply --server-side=true -f -

list-crds: ## List all CRDs in the cluster
@echo "=== Installed CRDs ==="
@kubectl get crds --sort-by=.metadata.name
Expand Down Expand Up @@ -198,16 +159,6 @@ install-prometheus-crds: ## Install Prometheus Operator CRDs if not already inst
echo "Prometheus Operator CRDs installed successfully"; \
fi

uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f -

deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | kubectl apply --server-side=true -f -

undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f -

##@ E2E


Expand Down Expand Up @@ -243,32 +194,6 @@ rm -rf $$TMP_DIR ;\
}
endef

.PHONY: bundle
# Detect platform and set SED_INPLACE accordingly
ifeq ($(shell uname), Darwin)
SED_INPLACE = sed -i ''
else
SED_INPLACE = sed -i
endif
bundle: operator-sdk manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
$(OPERATOR_SDK) generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
$(OPERATOR_SDK) bundle validate ./bundle
$(SED_INPLACE) 's/control-plane: argocd-operator/control-plane: controller-manager/g' bundle/manifests/argocd-operator-webhook-service_v1_service.yaml bundle/manifests/argocd-operator-controller-manager-metrics-service_v1_service.yaml bundle/manifests/argocd-operator.clusterserviceversion.yaml
rm -fr deploy/olm-catalog/argocd-operator/$(VERSION)
mkdir -p deploy/olm-catalog/argocd-operator/$(VERSION)
cp -r bundle/manifests/* deploy/olm-catalog/argocd-operator/$(VERSION)/
mv deploy/olm-catalog/argocd-operator/$(VERSION)/argocd-operator.clusterserviceversion.yaml deploy/olm-catalog/argocd-operator/$(VERSION)/argocd-operator.v$(VERSION).clusterserviceversion.yaml

.PHONY: bundle-build
bundle-build: ## Build the bundle image.
$(CONTAINER_RUNTIME) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
$(MAKE) docker-push IMG=$(BUNDLE_IMG)

# UTIL_IMG defines the image:tag used for the utility image (for backup).
# You can use it as an arg. (E.g make util-build UTIL_IMG=<some-registry>/<project-name-bundle>:<tag>)
UTIL_IMG ?= $(IMAGE_TAG_BASE)-util:v$(VERSION)
Expand All @@ -281,23 +206,6 @@ util-build: ## Build the util container image (for backup)
util-push: ## Push the util container image
$(MAKE) docker-push IMG=$(UTIL_IMG)

# REGISTRY_IMG defines the image:tag used for the (legacy) registry container image.
# You can use it as an arg. (E.g make registry-build REGISTRY_IMG=<some-registry>/<project-name-bundle>:<tag>)
REGISTRY_IMG ?= $(IMAGE_TAG_BASE)-registry:v$(VERSION)

.PHONY: registry-build
registry-build: ## Build the registry container image
rm -fr build/_output
mkdir -p build/_output/registry
cp -r deploy/registry/* build/_output/registry/
mkdir -p build/_output/registry/manifests
cp -r deploy/olm-catalog/argocd-operator build/_output/registry/manifests/
$(CONTAINER_RUNTIME) build -t $(REGISTRY_IMG) build/_output/registry

.PHONY: registry-push
registry-push: ## Push the util container image
$(MAKE) docker-push IMG=$(REGISTRY_IMG)

.PHONY: opm
OPM = ./bin/opm
opm: ## Download opm locally if necessary.
Expand All @@ -315,30 +223,6 @@ OPM = $(shell which opm)
endif
endif

# A comma-separated list of bundle images (e.g. make catalog-build BUNDLE_IMGS=example.com/operator-bundle:v0.1.0,example.com/operator-bundle:v0.2.0).
# These images MUST exist in a registry and be pull-able.
BUNDLE_IMGS ?= $(BUNDLE_IMG)

# The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0).
CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:v$(VERSION)

# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image.
ifneq ($(origin CATALOG_BASE_IMG), undefined)
FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG)
endif

# Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'.
# This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see:
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
.PHONY: catalog-build
catalog-build: opm ## Build a catalog image.
$(OPM) index add --container-tool $(shell basename $(CONTAINER_RUNTIME)) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)

# Push the catalog image.
.PHONY: catalog-push
catalog-push: ## Push a catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)

.PHONY: e2e-tests-sequential-ginkgo
e2e-tests-sequential-ginkgo: ginkgo
@echo "Running operator sequential Ginkgo E2E tests..."
Expand Down
Loading
Loading