This document will walk you through running the Rsyslog Relp extension and a fake rsyslog relp service on your local machine for development purposes. This guide uses Gardener's local development setup and builds on top of it.
If you encounter difficulties, please open an issue so that we can make this process easier.
- Make sure that you have a running local Gardener setup. The steps to complete this can be found here.
- Make sure you are running Gardener version
>= 1.74.0
or the latest version of the master branch.
Important: Make sure that your KUBECONFIG
env variable is targeting the local Gardener cluster!
make extension-up
This will build the shoot-rsyslog-relp
, shoot-rsyslog-relp-admission
, and shoot-rsyslog-relp-echo-server
images and deploy the needed resources and configurations in the garden cluster. The shoot-rsyslog-relp-echo-server
will act as development replacement of a real rsyslog relp server.
Once the above step is completed, we can deploy and configure a Shoot cluster with default rsyslog relp settings.
kubectl apply -f ./example/shoot.yaml
Once the Shoot's namespace is created, we can create a networkpolicy
that will allow egress traffic from the rsyslog
on the Shoot's nodes to the rsyslog-relp-echo-server
that serves as a fake rsyslog target server.
kubectl apply -f ./example/local/allow-machine-to-rsyslog-relp-echo-server-netpol.yaml
Currently, the Shoot's nodes run Ubuntu, which does not have the rsyslog-relp
and auditd
packages installed, so the configuration done by the extension has no effect.
Once the Shoot is created, we have to manually install the rsyslog-relp
and auditd
packages:
kubectl -n shoot--local--local exec -it $(kubectl -n shoot--local--local get po -l app=machine,machine-provider=local -o name) -- bash -c "
apt-get update && \
apt-get install -y rsyslog-relp auditd && \
systemctl enable rsyslog.service && \
systemctl start rsyslog.service"
Once that is done we can verify that log messages are forwarded to the rsyslog-relp-echo-server
by checking its logs.
kubectl -n rsyslog-relp-echo-server logs deployment/rsyslog-relp-echo-server
Changes to the rsyslog relp extension can be applied to the local environment by repeatedly running the make
recipe.
make extension-up
To tear down the development environment, delete the Shoot cluster or disable the shoot-rsyslog-relp
extension in the Shoot's spec. When the extension is not used by the Shoot anymore, you can run:
make extension-down
This will delete the ControllerRegistration
and ControllerDeployment
of the extension, the shoot-rsyslog-relp-admission
deployment, and the rsyslog-relp-echo-server
deployment.
The testmachinery tests use an rsyslog-relp-echo-server
image from a publicly available repository. The one which is currently used is eu.gcr.io/gardener-project/gardener/extensions/shoot-rsyslog-relp-echo-server:v0.1.0
.
Sometimes it might be necessary to update the image and publish it, e.g. when updating the alpine
base image version specified in the repository's Dokerfile.
To do that:
-
Bump the version with which the image is built in the Makefile.
-
Build the
shoot-rsyslog-relp-echo-server
image:make echo-server-docker-image
-
Once the image is built, push it to
gcr
with:make push-echo-server-image
-
Finally, bump the version of the image used by the
testmachinery
tests here. -
Create a PR with the changes.