Skip to content

Commit

Permalink
Add barbican commands to makefile
Browse files Browse the repository at this point in the history
Change-Id: Ie032ab5201c5fe08d86c9cb2077d97a5d13449b9
  • Loading branch information
jparoly committed May 15, 2023
1 parent ff8bd7d commit 8cb4b7e
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,17 @@ CERTMANAGER_URL ?= https://github.com/jetstack/cert-manager/rel
PROVISIONING_INTERFACE ?= enp2s0
IRONIC_HOST ?= 192.168.130.11

# Barbican
BARBICAN_IMG ?= quay.io/openstack-k8s-operators/barbican-operator-index:latest
BARBICAN_REPO ?= https://github.com/openstack-k8s-operators/barbican-operator.git
BARBICAN_BRANCH ?= main
BARBICAN ?= config/samples/barbican_v1alpha1_barbican.yaml
BARBICAN_CR ?= ${OPERATOR_BASE_DIR}/BARBICAN-operator/${BARBICAN}
BARBICANAPI_DEPL_IMG ?= unused
BARBICANENGINE_DEPL_IMG ?= unused
BARBICAN_KUTTL_CONF ?= ${OPERATOR_BASE_DIR}/barbican-operator/kuttl-test.yaml
BARBICAN_KUTTL_DIR ?= ${OPERATOR_BASE_DIR}/barbican-operator/tests/kuttl/tests

# target vars for generic operator install info 1: target name , 2: operator name
define vars
${1}: export NAMESPACE=${NAMESPACE}
Expand Down Expand Up @@ -1155,6 +1166,16 @@ glance_kuttl: namespace input openstack_crds openstack_storage_crds deploy_clean
make deploy_cleanup
make cleanup

.PHONY: barbican_kuttl_run
barbican_kuttl_run: ## runs kuttl tests for the barbican operator, assumes that everything needed for running the test was deployed beforehand.
kubectl-kuttl test --config ${BARBICAN_KUTTL_CONF} ${BARBICAN_KUTTL_DIR}

.PHONY: barbican_kuttl
barbican_kuttl: namespace input openstack_crds openstack_storage_crds deploy_cleanup mariadb mariadb_deploy keystone keystone_deploy barbican_deploy_prep barbican ## runs kuttl tests for the barbican operator. Installs openstack and openstack-storage crds, mariadb, keystone and barbican operators and cleans up previous deployments before running the tests and, add cleanup after running the tests.
make barbican_kuttl_run
make deploy_cleanup
make cleanup

##@ HORIZON
.PHONY: horizon_prep
horizon_prep: export IMAGE=${HORIZON_IMG}
Expand Down Expand Up @@ -1476,3 +1497,42 @@ telemetry_deploy_cleanup: ## cleans up the service instance, Does not affect the
$(eval $(call vars,$@,telemetry))
oc kustomize ${DEPLOY_DIR} | oc delete --ignore-not-found=true -f -
${CLEANUP_DIR_CMD} ${OPERATOR_BASE_DIR}/telemetry-operator ${DEPLOY_DIR}

##@ BARBICAN
.PHONY: BARBICAN_prep
barbican_prep: export IMAGE=${BARBICAN_IMG}
barbican_prep: ## creates the files to install the operator using olm
$(eval $(call vars,$@,barbican))
bash scripts/gen-olm.sh

.PHONY: barbican
barbican: namespace barbican_prep ## installs the operator, also runs the prep step. Set BARBICAN_IMG for custom image.
$(eval $(call vars,$@,barbican))
oc apply -f ${OPERATOR_DIR}

.PHONY: barbican_cleanup
barbican_cleanup: ## deletes the operator, but does not cleanup the service resources
$(eval $(call vars,$@,barbican))
bash scripts/operator-cleanup.sh
${CLEANUP_DIR_CMD} ${OPERATOR_DIR}

.PHONY: barbican_deploy_prep
barbican_deploy_prep: export KIND=Barbican
barbican_deploy_prep: export IMAGE=${BARBICAN_DEPL_IMG}
barbican_deploy_prep: barbican_deploy_cleanup ## prepares the CR to install the service based on the service sample file BARBICAN
$(eval $(call vars,$@,barbican))
mkdir -p ${OPERATOR_BASE_DIR} ${OPERATOR_DIR} ${DEPLOY_DIR}
pushd ${OPERATOR_BASE_DIR} && git clone ${GIT_CLONE_OPTS} $(if $(BARBICAN_BRANCH),-b ${BARBICAN_BRANCH}) ${BARBICAN_REPO} "${OPERATOR_NAME}-operator" && popd
cp ${BARBICAN_CR} ${DEPLOY_DIR}
bash scripts/gen-service-kustomize.sh

.PHONY: barbican_deploy
barbican_deploy: input barbican_deploy_prep ## installs the service instance using kustomize. Runs prep step in advance. Set BARBICAN_REPO and BARBICAN_BRANCH to deploy from a custom repo.
$(eval $(call vars,$@,barbican))
bash scripts/operator-deploy-resources.sh

.PHONY: barbican_deploy_cleanup
barbican_deploy_cleanup: ## cleans up the service instance, Does not affect the operator.
$(eval $(call vars,$@,barbican))
oc kustomize ${DEPLOY_DIR} | oc delete --ignore-not-found=true -f -
${CLEANUP_DIR_CMD} ${OPERATOR_BASE_DIR}/barbican-operator ${DEPLOY_DIR}

0 comments on commit 8cb4b7e

Please sign in to comment.