Skip to content


The util package contains ease of use functions to simplify working with kubernetes and jsonnet



fn ingressFor

ingressFor(service, host='', path='/', port='service.spec.ports[0].port')

ingressFor constructs a ingress object, compatible with the automatic translation to openshift routes. It expects a value for the hostname and defaults to '/' for the path.

fn routeFor

routeFor(service, host='', path='/', port='service.spec.ports[0].port')

routeFor constructs a openshift route to the specified service. It expects a value for the hostname and defaults to '/' for the path.

fn serviceFor

serviceFor(deployment, ignored_labels, nameFormat='%(port)s')

serviceFor constructs a service for the specified deployment.

Selector labels are taken from the pod spec but can be ignored using the ignored_labels parameter.

The ports of the service will have the same name as in the container spec to avoid confusion. This can be changed with the nameFormat parameter.

fn weightedRouteFor

weightedRouteFor(name, host='', port='', services, path='/')

weightedRouteFor constructs a openshift route to the specified services. It expects a value for the name, hostname, port, services and defaults to '/' for the path. services expects an array consisting of objects with the keys name (name of the service) and weight.

obj certmanager

certman holds functions related to cert-manager (

obj certmanager.issuer


new(emain, ingressClassName='nginx', production=true, clusterwide=true, name='letsencrypt-production || letsencrypt-staging')

constructs a cert-manager issuer resource for letsencrypt with sensible default.

obj java

java holds my functions related to java based applications

obj java.container


new(name, image, port=8080, actuatorPort='port+8080', env={})

constructs a container with reccomended settings for Java/Spring Boot applications. Includes liveness- and readiness probes, activates the kubernetes spring profile and sets sensible resource defaults.

obj java.deployment


new(name, image, replicas=1, env={}, containerMixin={}, runtime='spring-boot', component='backend')

constructs a deployment using the java container. If you need more control, construct this deployment yourself.

containerMixin can be used to modify the application container. For example:*...*/,
increases the initial delay seconds of the default liveness probe.

The runtime and component parameters are used to prefill recommended labels

obj java.livenessProbe


new(port=8080, initialDelaySeconds=30)

new constructs a fresh liveness probe, checking if the tcp port 8080 is open

obj java.readinessProbe


new(port=18080, path='/actuator/health')

new constructs a fresh readiness probe, checking if the application is up. The port and path of the actuator endpoint can be changed using the parameters.

obj openshiftOAuth

openshiftOAuth contains utilities to proxy an application using the OpenShift OAuth Proxy

obj openshiftOAuth.container


new(upstream, serviceAccount)

constructs a container proxying connections to the upstream parameter.

obj openshiftOAuth.deployment

fn openshiftOAuth.deployment.withProxy

withProxy(upstream, serviceAccount)

add a proxy sidecar to the container. This also sets the service account used by the pod. The ServiceAccount needs to have the correct redirect reference for the route. See for an easy way to create a compliant service account

obj openshiftOAuth.serviceAccount


new(name, route)

constructs a serviceaccount annotated with a oauth-redirectreference pointing to the route parameter

Last update: 2023-11-28