| Crates.io | proa |
| lib.rs | proa |
| version | 0.1.3 |
| created_at | 2023-06-07 18:12:56.251107+00 |
| updated_at | 2025-04-08 18:47:11.993616+00 |
| description | Manage Kubernetes sidecar container lifecycle. |
| homepage | |
| repository | https://github.com/IronCoreLabs/proa |
| max_upload_size | |
| id | 884923 |
| size | 170,968 |
Inspired by https://github.com/redboxllc/scuttle, https://github.com/joho/godotenv, and https://github.com/kubernetes/enhancements/issues/753, among others. This program is meant to be the entrypoint for the "main" container in a Pod that also contains sidecar containers. Proa is a wrapper around the main process in the main container. It waits for the sidecars to be ready before starting the main program, and it shuts down the sidecars when the main process exits so the whole Pod can exit gracefully, as in the case of a Job.

Briefly, it does this:
pkill would.If it encounters errors during shutdown, it logs each error, but it exits with the same exit code as the wrapped process.
If you like, just copy job.yaml and modify it for your use. The Job has a sidecar, simulated by a Python
script, that must be ready before the main process starts. We simulate a sidecar that starts slowly by sleeping for 30 seconds
before starting the Python HTTP server. Proa uses Kubernetes' knowledge about the readiness of the sidecar container. That means
the sidecars must each provide a readinessProbe, and the Pod's serviceAccount needs permission to read and watch the Pod it's
running in.
Or if you prefer, follow this step-by-step guide:
proa executable. The easiest way to do this is probably
to use a multi-stage Dockerfile to compile proa and COPY it into your final image. See Dockerfile
for an example.ServiceAccount for your Job to use.Role and RoleBinding giving the service account permission to get, watch, and list the pods in its own
namespace.spec.template.spec.serviceAccountName to refer to that service account.spec.template.spec.containers entry for every sidecar has a readinessProbe. (It doesn't
matter if the main container has a readiness probe; proa will ignore it.)command and/or args) of the main container to call proa.
--shutdown-http-get=URL or
--shutdown-http-post=URL. Those flags can be repeated multiple times.--, followed by the path to the main program and all its arguments.RUST_LOG environment variable to the main container to control proa's logging verbosity.When it's time to shut down, proa can end the processes in your sidecars by sending SIGTERM, but it's probably not what you want. Most processes that receive SIGTERM will exit with status 143, or some other nonzero value. Kubernetes will interpret that as a container failure, and it will restart or recreate the Pod to try again.
If you're sure you want to use this, compile the program with feature kill, and also make sure your Pod meets these requirements:
shareProcessNamespace so proa can stop the sidecars, and either
hostPID, or chaos will result as it tries to kill every process on the node.It's a program to manage sidecars, but sidecar is a motorcycle metaphor, and Kubernetes is all about nautical memes. A proa is a sailboat with an outrigger, which is sort of like a sidecar on a motorcycle.
Requirements:
kind create cluster to start a tiny Kubernetes cluster in your local Docker.skaffold dev to start the compile-build-deploy loop.Every time you save a file, skaffold will rebuild and redeploy, then show you output from the containers in the Pod.
This project sponsored by IronCore Labs, makers of data privacy and security solutions for cloud apps including SaaS Shield for multi-tenant SaaS apps and Cloaked Search for data-in-use encryption over Elasticsearch and OpenSearch.