FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Robin Goodall's avatar
Robin Goodall authored
chore: Configure Renovate

See merge request !5
4c9d3a18
History

GKE Load Balancer Healthcheck

Running locally

Minikube is required to run this project locally. See instructions for installation at https://minikube.sigs.k8s.io/docs/start/.

Install poetry via:

pipx install poetry && pipx inject poetry poethepoet[poetry_plugin]

Install application dependencies via:

poetry install

Start minikube locally via:

minikube start

Build the image and load into the local minikube registry via:

poetry poe minikube:build

Deploy the kubernetes pod in the local minikube instance via:

poetry poe minikube:deploy

This also prints the name of the deployed pod (useful in other commands).

This will start the pod with the image loaded into the registry by minikube:build, along with 2 busybox containers that can be used to test the readiness behaviour.

To open a port to the GKE Load Balancer Healthcheck container and make requests to it run:

minikube kubectl -- port-forward service/lb-health 8000:8000

In a new terminal you can now:

curl http://localhost:8000/pod-readiness

To "un-ready" one of the busybox containers run:

minikube kubectl -- exec -it <POD_NAME> -c liveness-1 -- rm /tmp/ready

(Replacing <POD_NAME> with the name of the pod printed after deploying.)

After a minute this will cause the liveness-1 container to be marked as not ready.

You can tear-down the minikube instance via:

minikube delete

The deploy-kube.yaml file is the kubernetes specification used to deploy locally to minikube.

Local development

Install git pre-commit hooks via:

poetry run pre-commit install

View all the available poe tasks by running:

poe

To run pre-commit checks in order to fix up code style and layout to match our common convention:

poetry poe fix

To build or rebuild all container images used by the application:

poetry poe compose:build

To pull any images used by the docker compose configuration:

poetry poe compose:pull

Dependencies

IMPORTANT: if you add a new dependency to the application as described below you will need to run docker compose build or add --build to the docker compose run and/or docker compose up command at least once for changes to take effect when running code inside containers. The poe tasks have already got --build appended to the command line.

To add a new dependency for the application itself:

poetry add {dependency}

To add a new development-time dependency used only when the application is running locally in development or in testing:

poetry add -G dev {dependency}

To remove a dependency which is no longer needed:

poetry remove {dependency}

CI configuration

The project is configured with Gitlab AutoDevOps via Gitlab CI using the .gitlab-ci.yml file.