The instructions in this page require host-inventory and xjoin-search to be running in an Ephemeral cluster or Minikube.
Debugging local code requires stopping the same code running in Kubernetes. However, stopping such services is tricky when the services have been deployed using Kubernetes operators and requires disabling auto reconciliation
by the service operator. For this write-up, inventory-mq-service
has been used as an example.
- Turn off
auto-reconciliation
:kubectl edit clowdenvironment <env-name>
- In the editor, which is opened by the
kubectl edit ...
command, add the following underspec
.spec: disabled: true
- In
host-inventory-mq-*
pods, set thereplicas
size tozero
:In the editor, findkubectl edit deployment host-inventory-mq-p1 -n <namespace>
replicas: 1
and change it toreplicas: 0
. If there are moremq-services
stop them also. Verify thathost-inventory-mq-*
pods are NOT listed in the output ofkubectl get po -n <namespace>
- In
VS Code
, startinv_mq_service.py
in debug mode and set a break point; e.g. in./app/queue/queue.py>handle-message
. - Start a new terminal and go to the
insights-host-inventory
project director and runpipenv shell
and create a host:Debugger should stop at the breakpoint set above.pipenv shell make run_inv_mq_service_test_producer
- When done debugging, simply enable auto-reconciliation by setting
disabled: false
in the clowdenvironment.