Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/topicusonderwijs/naming-kubernetes

Java naming context (JNDI) for WildFly using Kubernetes as backend.
https://github.com/topicusonderwijs/naming-kubernetes

jndi k8s kubernetes wildfly

Last synced: 3 months ago
JSON representation

Java naming context (JNDI) for WildFly using Kubernetes as backend.

Awesome Lists containing this project

README

        

# naming-kubernetes

A Java naming context for [WildFly](http://wildfly.org/) using [Kubernetes](https://kubernetes.io/) as backend for lookups.

JNDI lookups are resolved to configmap or secret keys using the Kubernetes API. Configmaps and secrets should have the following label to be eligible for naming resolution:

```
k8s.naming.topicus.nl/externalcontext:
```

JNDI subcontexts have their own configmap/secret. To distinguish different subcontexts the configmap/secret should get the following annotation with the full subcontext path as value:

```
k8s.naming.topicus.nl/context:
```

All lookups are first tried to resolve as configmap key. If no configmap key exists for the given JNDI name a secret lookup is performed.

## WildFly configuration
The naming-kubernetes module should be placed in the WildFly module directory.

WildFly subsystem configuration:

```xml










```

Enable debug logging for naming-kubernetes:

```xml

```

## Java types
The values returned from Kubernetes are of the Java type `String`. JNDI values are of the Java type `Object`. To expose values as typed Java objects the following type conversion rules are applied:
- Boolean: a `true` or `false` (case insensitive)
- Integer: a value containing only the characters 0-9 (no negative numbers, no overflow detection)
- String: A string of text

## Compatibility Matrix

| | < WildFly 27 | >= WildFly 27 |
|-----------------------|--------------|-----------------|
| naming-kubernetes 2.x | + | - |
| naming-kubernetes 3.x | - | + |

## Examples
The following configmap exposes the JNDI name `java://k8s/my.jndi.key` (`k8s` is the name of the external-context and has to be defined as a label on the configmap/secret):

```
apiVersion: v1
kind: ConfigMap
metadata:
labels:
k8s.naming.topicus.nl/externalcontext: "k8s"
name: ConfigMapExample
data:
my.jndi.key: "naming-kubernetes-sample-value"
```

The JNDI name `java://k8s/my.subcontext/my.jndi.key` is exposed by the following configmap:

```
apiVersion: v1
kind: ConfigMap
metadata:
labels:
k8s.naming.topicus.nl/externalcontext: "k8s"
annotations:
k8s.naming.topicus.nl/context: "my.subcontext"
name: ConfigMapSubContextExample
data:
my.jndi.key: "naming-kubernetes-sample-value"
```