In order to debug fleet it is first necessary to recompile it with debug symbols.
- install fleet as usual (eg. as part of Rancher)
- determine the current chart version (eg.
100.0.3+up0.3.9
):
if kubectl get ns | grep cattle-fleet-system; then
export NAMESPACE=cattle-fleet-system
else
export NAMESPACE=fleet-system
fi
helm --namespace $NAMESPACE list
- determine the new version for the component debug deployment (eg.
100.0.4-dbg
) - recompile with debugging symbols, eg.
cd fleet
export VERSION=100.0.4-dbg
DEBUG=true TAG=$VERSION make build package
NOTE: currently make support for debug symbols is available on the master
branch
A 0.3.9 fork with the patch is available here: https://github.com/moio/fleet/tree/v0.3.9-dbg
- either push built images onto a registry, or import them into your cluster nodes manually. If you are using k3d:
export CLUSTER=upstream
k3d image import --mode direct --cluster $CLUSTER rancher/fleet:$VERSION rancher/fleet-agent:$VERSION
- upgrade the installation to the latest build
helm -n $NAMESPACE upgrade --version $VERSION --reuse-values --set debug=true fleet-crd ./dist/artifacts/fleet-crd-$VERSION.tgz
helm -n $NAMESPACE upgrade --version $VERSION --reuse-values --set debug=true --set image.tag=$VERSION --set agentImage.tag=$VERSION fleet ./dist/artifacts/fleet-$VERSION.tgz
Note: if fleet is installed by Rancher, its version string starts with 100. Installing a lower version will be overwritten by Rancher with a vanilla version.
- run
./util/debug-fleet-controller.sh
or
./util/debug-fleet-agent.sh
After following instructions above:
- determine the current image version (eg.
v0.1.26
):
kubectl --namespace $NAMESPACE describe deployment gitjob | grep Image
-
determine a new version for the component debug deployment (eg.
v0.1.26-dbg
) -
build gitjob:
cd ../gitjob
export GITJOB_VERSION=v0.1.26-dbg
DEBUG=true TAG=$GITJOB_VERSION make
- either push built images onto a registry, or import them into your cluster nodes manually. If you are using k3d:
export CLUSTER=upstream
k3d image import --mode direct --cluster $CLUSTER rancher/gitjob:$GITJOB_VERSION
- upgrade the fleet chart specifying the rebuilt gitjob image:
cd ../fleet
helm -n $NAMESPACE upgrade --version $VERSION --reuse-values --set gitjob.gitjob.tag=$GITJOB_VERSION --set gitjob.debug=true fleet ./dist/artifacts/fleet-$VERSION.tgz