Skip to content

Commit bdcd83a

Browse files
committed
[GITOPS-7475]: Default argocd instance does not get recreated after deletion
Signed-off-by: akhil nittala <[email protected]> Signed-off-by: akhil nittala <[email protected]>
1 parent e339d22 commit bdcd83a

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

Makefile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
66
VERSION ?= ""
77

8+
9+
# Try to detect Docker or Podman
10+
CONTAINER_RUNTIME := $(shell command -v docker 2> /dev/null || command -v podman 2> /dev/null)
11+
12+
# If neither Docker nor Podman is found, print an error message and exit
13+
ifeq ($(CONTAINER_RUNTIME),)
14+
$(warning "No container runtime (Docker or Podman) found in PATH. Please install one of them.")
15+
endif
816
# CHANNELS define the bundle channels used in the bundle.
917
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
1018
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
@@ -206,12 +214,12 @@ run: manifests generate fmt vet ## Run a controller from your host.
206214
CLUSTER_SCOPED_ARGO_ROLLOUTS_NAMESPACES=argo-rollouts,test-rom-ns-1,rom-ns-1,openshift-gitops ARGOCD_CLUSTER_CONFIG_NAMESPACES=openshift-gitops REDIS_CONFIG_PATH="build/redis" go run ./cmd/main.go
207215

208216
.PHONY: docker-build
209-
docker-build: test ## Build docker image with the manager.
210-
docker build -t ${IMG} .
217+
docker-build: test ## Build $(CONTAINER_RUNTIME) image with the manager.
218+
$(CONTAINER_RUNTIME) build -t ${IMG} .
211219

212220
.PHONY: docker-push
213-
docker-push: ## Push docker image with the manager.
214-
docker push ${IMG}
221+
docker-push: ## Push $(CONTAINER_RUNTIME) image with the manager.
222+
$(CONTAINER_RUNTIME) push ${IMG}
215223

216224
##@ Build Dependencies
217225

@@ -305,11 +313,11 @@ bundle: operator-sdk manifests kustomize ## Generate bundle manifests and metada
305313

306314
.PHONY: bundle-build
307315
bundle-build: ## Build the bundle image.
308-
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
316+
$(CONTAINER_RUNTIME) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
309317

310318
.PHONY: bundle-push
311319
bundle-push: ## Push the bundle image.
312-
$(MAKE) docker-push IMG=$(BUNDLE_IMG)
320+
$(MAKE) $(CONTAINER_RUNTIME)-push IMG=$(BUNDLE_IMG)
313321

314322
.PHONY: opm
315323
OPM = ./bin/opm
@@ -346,12 +354,12 @@ endif
346354
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
347355
.PHONY: catalog-build
348356
catalog-build: opm ## Build a catalog image.
349-
$(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
357+
$(OPM) index add --container-tool $(CONTAINER_RUNTIME) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
350358

351359
# Push the catalog image.
352360
.PHONY: catalog-push
353361
catalog-push: ## Push a catalog image.
354-
$(MAKE) docker-push IMG=$(CATALOG_IMG)
362+
$(MAKE) $(CONTAINER_RUNTIME)-push IMG=$(CATALOG_IMG)
355363

356364

357365
.PHONY: gosec

controllers/gitopsservice_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ func (r *ReconcileGitopsService) SetupWithManager(mgr ctrl.Manager) error {
112112
builder.WithPredicates(predicate.NewPredicateFuncs(func(obj client.Object) bool {
113113
return obj.GetName() == "openshift-gitops"
114114
})),
115-
).
115+
).Watches(&argoapp.ArgoCD{},
116+
&handler.EnqueueRequestForObject{},
117+
builder.WithPredicates(predicate.NewPredicateFuncs(func(obj client.Object) bool {
118+
return obj.GetName() == "openshift-gitops" && obj.GetNamespace() == "openshift-gitops"
119+
}))).
116120
Complete(r)
117121
}
118122

0 commit comments

Comments
 (0)