Poolboy development can be performed in the odo
OpenShift developer CLI or building with OpenShift build configs.
An OpenShift cluster with cluster-admin is required for odo
development.
CodeReady Containers is recommended for local development.
An Ansible test suite is available for functional testing.
Use of odo
is recommended for fast iterative development.
odo
simplifies the build/deploy process and avoids creating unnecessary build artifacts during the development process.
-
Install the
odo
developer CLI as described in the OpenShift documentation: Installing odo -
Create poolboy local dev resources from the provided helm chart using
poolboy.dev.local
as the operator domain:helm template helm \ --set deploy=false \ --set admin.deploy=false \ --set nameOverride=poolboy-dev \ --set operatorDomain.name=poolboy.dev.local \ | oc apply -f -
-
Create a project for development using
odo
:oc create namespace poolboy-dev
-
Change project to
poolboy-dev
namespace:oc project poolboy-dev
-
Grant privileges for cluster role
poolboy-dev
to default service account:oc adm policy add-cluster-role-to-user poolboy-dev -z default
-
Run odo:
odo dev
NoteThe poolboy operator domain is specified in the devfile. If you are developing with a different operator domain then you will need to update the devfile.yaml
. -
Run tests with Ansible:
ansible-playbook \ -e ansible_python_interpreter='{{ ansible_playbook_python }}' \ -e poolboy_domain=poolboy.dev.local \ -e poolboy_namespace=poolboy-dev \ -e poolboy_service_account=default \ -e poolboy_test_namespace=poolboy-dev-test \ -e poolboy_tests='["simple"]' \ test/playbook.yaml
-
Cleanup
Remove
odo
componentodo delete --force poolboy
Delete resources created from helm template:
helm template helm \ --set deploy=false \ --set nameOverride=poolboy-dev \ --set operatorDomain.name=poolboy.dev.local \ | oc delete -f -
The OpenShift build process is a bit slower for development but has the advantage of being a bit closer to a normal deployment of poolboy.
It is often best to iterate development using odo
and also test with an OpenShift build and deployment prior to opening a pull request.
-
Create a project for development using
oc
:oc new-project poolboy-dev
-
Process OpenShift build template to create BuildConfig and ImageStream:
oc process --local -f build-template.yaml | oc apply -f -
-
Build poolboy image from local source:
oc start-build poolboy --from-dir=. --follow
-
Deploy Poolboy from build image
helm template helm \ --set nameOverride=poolboy-dev \ --set namespace.create=false \ --set manageClaimsInterval=5 \ --set manageHandlesInterval=5 \ --set operatorDomain.name=poolboy.dev.local \ --set=image.tagOverride=- \ --set=image.repository=$(oc get imagestream poolboy -o jsonpath='{.status.tags[?(@.tag=="latest")].items[0].dockerImageReference}') \ | oc apply -f -
-
Run tests with Ansible:
ansible-playbook \ -e ansible_python_interpreter='{{ ansible_playbook_python }}' \ -e poolboy_domain=poolboy.dev.local \ -e poolboy_namespace=poolboy-dev \ -e poolboy_service_account=poolboy-dev \ -e poolboy_test_namespace=poolboy-dev-test \ test/playbook.yaml
To test development, rerun thes build/deploy/test steps.
-
Cleanup
Remove resources created from the helm template:
helm template helm \ --set nameOverride=poolboy-dev \ --set namespace.create=false \ --set operatorDomain.name=poolboy.dev.local \ --set=image.tagOverride=- \ | oc delete -f -
Remove BuildConfig and ImageStream:
oc process --local -f build-template.yaml | oc delete -f -