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 293a91d commit 6f803f7
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@ SWIFTPROXY_CR ?= ${OPERATOR_BASE_DIR}/swift-operator/${SWIFTPROXY}
SWIFTSTORAGE ?= config/samples/swift_v1beta1_swiftstorage.yaml
SWIFTSTORAGE_CR ?= ${OPERATOR_BASE_DIR}/swift-operator/${SWIFTSTORAGE}

# 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 @@ -1189,6 +1200,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 @@ -1512,7 +1533,6 @@ telemetry_deploy_cleanup: ## cleans up the service instance, Does not affect the
${CLEANUP_DIR_CMD} ${OPERATOR_BASE_DIR}/telemetry-operator ${DEPLOY_DIR}
rm -Rf ${OPERATOR_BASE_DIR}/ceilometer-operator ${DEPLOY_DIR}


##@ SWIFT
.PHONY: swift_prep
swift_prep: export IMAGE=${SWIFT_IMG}
Expand Down Expand Up @@ -1553,3 +1573,42 @@ swift_deploy_cleanup: ## cleans up the service instance, Does not affect the ope
$(eval $(call vars,$@,swift))
oc kustomize ${DEPLOY_DIR} | oc delete --ignore-not-found=true -f -
rm -Rf ${OPERATOR_BASE_DIR}/swift-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 6f803f7

Please sign in to comment.