conjurdemos / kubernetes-conjur-demo

Demo application for Conjur Kubernetes integration
11 stars 14 forks source link

Fixes test app verify for running with KinD on a MacOS #118

Closed diverdane closed 4 years ago

diverdane commented 4 years ago

When the Kubernetes Conjur demo scripts are run on a Kubernetes-in-Docker cluster that is running on MacOS, then the demo script verification that the demo API endpoints are reachable (check-url function) currently fails:

curl: (28) Connection timed out after 3003 milliseconds
'check_urls' Retry 5/150 exited 28, retrying in 2 seconds...

The problem is that using Node-IP:NodePort does not work for KinD on MacOS because Docker on MacOS runs Docker containers inside a VM, so there is no direct way to connect from the MacOS host to Kubernetes containers.

The fix is to add the creation of a test-curl pod in the test application namespace that is capable of running curl from within the KinD cluster, and then using this to verify applications using their internal service address.

This change also replaces the test environment variable TEST_APP_NODEPORT_SVCS (defaults to false) with TEST_APP_LOADBALANCER_SVCS (defaults to true) because that more accurately reflects what needs to be distinguished (i.e. if there aren't any load balancers, the test application service type could be either NodePort or clusterIP, since the test app verification is now agnostic of NodePort vs clusterIP services.

Addresses Issue #117