Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 22 days ago
JSON representation
Java naming context (JNDI) for WildFly using Kubernetes as backend.
- Host: GitHub
- URL: https://github.com/topicusonderwijs/naming-kubernetes
- Owner: topicusonderwijs
- License: apache-2.0
- Created: 2018-03-20T08:47:56.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-11-19T07:55:46.000Z (24 days ago)
- Last Synced: 2024-11-19T08:43:39.466Z (24 days ago)
- Topics: jndi, k8s, kubernetes, wildfly
- Language: Java
- Homepage:
- Size: 254 KB
- Stars: 2
- Watchers: 26
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hacking-lists - topicusonderwijs/naming-kubernetes - Java naming context (JNDI) for WildFly using Kubernetes as backend. (Java)
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"
```