util
The util package contains ease of use functions to simplify working with kubernetes and jsonnet
Index
fn ingressFor(service, host='', path='/', port='service.spec.ports[0].port')
fn routeFor(service, host='', path='/', port='service.spec.ports[0].port')
fn serviceFor(deployment, ignored_labels, nameFormat='%(port)s')
fn weightedRouteFor(name, host='', port='', services, path='/')
obj certmanager
obj certmanager.issuer
obj java
obj java.container
obj java.deployment
obj java.livenessProbe
obj java.readinessProbe
obj openshiftOAuth
obj openshiftOAuth.container
obj openshiftOAuth.deployment
obj openshiftOAuth.serviceAccount
Fields
fn ingressFor
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 constructs a openshift route to the specified service. It expects a value for the hostname and defaults to '/' for the path.
fn serviceFor
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 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 (cert-manager.io)
obj certmanager.issuer
fn certmanager.issuer.new
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
fn java.container.new
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
fn java.deployment.new
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:
deployment.new(/*...*/,
containerMixin=k.core.v1.container.livenessProbe.withInitialDelaySeconds(60))
The runtime
and component
parameters are used to prefill recommended labels
obj java.livenessProbe
fn java.livenessProbe.new
new constructs a fresh liveness probe, checking if the tcp port 8080 is open
obj java.readinessProbe
fn java.readinessProbe.new
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
fn openshiftOAuth.container.new
constructs a container proxying connections to the upstream
parameter.
obj openshiftOAuth.deployment
fn openshiftOAuth.deployment.withProxy
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
openshiftOAuth.serviceAccount.new
for an easy way to create a
compliant service account
obj openshiftOAuth.serviceAccount
fn openshiftOAuth.serviceAccount.new
constructs a serviceaccount annotated with a oauth-redirectreference pointing to the route parameter