Skip to content

Commit

Permalink
test install script combined
Browse files Browse the repository at this point in the history
  • Loading branch information
camilamacedo86 committed Jan 5, 2025
1 parent 0dc1516 commit c63fe16
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ coverage
# Release output
dist/**
operator-controller.yaml
olmv1.yaml
install.sh

# Kubernetes Generated files - skip generated files, except for vendored files
Expand Down
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,14 @@ kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND
$(CONTAINER_RUNTIME) save quay.io/operator-framework/catalogd:devel | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)

.PHONY: kind-deploy
kind-deploy: export MANIFEST := ./operator-controller.yaml
kind-deploy: manifests generate-catalogd $(KUSTOMIZE) #EXHELP Install controller and dependencies, including catalogd, onto the kind cluster.
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) > operator-controller.yaml
cd catalogd && $(KUSTOMIZE) build config/overlays/cert-manager > catalogd.yaml
kind-deploy: export MANIFEST := ./olmv1.yaml
kind-deploy: manifests generate-catalogd $(KUSTOMIZE)
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) > $(MANIFEST)
cd catalogd && $(KUSTOMIZE) build config/overlays/cert-manager >> $(MANIFEST)
sed -i.bak '/spec.selfSigned/d' $(MANIFEST) && rm -f $(MANIFEST).bak
envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s


.PHONY: generate-catalogd
generate-catalogd: ## Generate the catalogd manifests
$(MAKE) -C catalogd generate
Expand Down Expand Up @@ -337,13 +339,13 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
$(GORELEASER) $(GORELEASER_ARGS)

.PHONY: quickstart
quickstart: export MANIFEST := ./operator-controller.yaml
quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the installation release manifests and scripts.
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml
cd catalogd && $(KUSTOMIZE) build config/overlays/cert-manager > catalogd.yaml
quickstart: export MANIFEST := ./olmv1.yaml
quickstart: $(KUSTOMIZE) manifests build-catalogd #EXHELP Generate the unified installation release manifests and scripts.
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) > $(MANIFEST)
cd catalogd && $(KUSTOMIZE) build config/overlays/cert-manager >> $(MANIFEST)
sed -i.bak '/spec.selfSigned/d' $(MANIFEST) && rm -f $(MANIFEST).bak
envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh


##@ Docs

.PHONY: crd-ref-docs
Expand Down
16 changes: 4 additions & 12 deletions scripts/install.tpl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,17 @@
set -euo pipefail
IFS=$'\n\t'

operator_controller_manifest=$MANIFEST
olmv1_manifest=$MANIFEST

if [[ -z "$operator_controller_manifest" ]]; then
if [[ -z "$olmv1_manifest" ]]; then
echo "Error: Missing required MANIFEST variable"
exit 1
fi

catalogd_manifest="./catalogd/catalogd.yaml"
default_catalogs_manifest="./catalogd/config/base/default/clustercatalogs/default-catalogs.yaml"
cert_mgr_version=$CERT_MGR_VERSION
install_default_catalogs=$INSTALL_DEFAULT_CATALOGS

if [[ ! -f "$catalogd_manifest" ]]; then
echo "Error: Missing required catalogd manifest file at $catalogd_manifest"
exit 1
fi

if [[ -z "$cert_mgr_version" ]]; then
echo "Error: Missing CERT_MGR_VERSION variable"
exit 1
Expand Down Expand Up @@ -75,10 +69,11 @@ kubectl_wait "cert-manager" "deployment/cert-manager" "60s"
kubectl_wait_for_query "mutatingwebhookconfigurations/cert-manager-webhook" '{.webhooks[0].clientConfig.caBundle}' 60 5
kubectl_wait_for_query "validatingwebhookconfigurations/cert-manager-webhook" '{.webhooks[0].clientConfig.caBundle}' 60 5

kubectl apply -f "${catalogd_manifest}"
kubectl apply -f "${olmv1_manifest}"
# Wait for the rollout, and then wait for the deployment to be Available
kubectl_wait_rollout "olmv1-system" "deployment/catalogd-controller-manager" "60s"
kubectl_wait "olmv1-system" "deployment/catalogd-controller-manager" "60s"
kubectl_wait "olmv1-system" "deployment/operator-controller-controller-manager" "60s"

if [[ "${install_default_catalogs}" != "false" ]]; then
if [[ ! -f "$default_catalogs_manifest" ]]; then
Expand All @@ -89,6 +84,3 @@ if [[ "${install_default_catalogs}" != "false" ]]; then
kubectl apply -f "${default_catalogs_manifest}"
kubectl wait --for=condition=Serving "clustercatalog/operatorhubio" --timeout="60s"
fi

kubectl apply -f "${operator_controller_manifest}"
kubectl_wait "olmv1-system" "deployment/operator-controller-controller-manager" "60s"

0 comments on commit c63fe16

Please sign in to comment.