public class KubernetesUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ENV_KUBERNETES_SERVICE_HOST |
| Constructor and Description |
|---|
KubernetesUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
computeLabelSelector(java.util.Map<java.lang.String,java.lang.String> labels)
Determines the value of a Kubernetes labelSelector filter based on the passed labels.
|
static reactor.core.publisher.Mono<java.lang.String> |
computePodLabelSelector(io.micronaut.kubernetes.client.reactor.CoreV1ApiReactorClient client,
java.util.List<java.lang.String> podLabelKeys,
java.lang.String namespace,
java.util.Map<java.lang.String,java.lang.String> labels,
boolean exceptionOnPodLabelsMissing) |
static java.util.List<io.micronaut.context.env.PropertySource> |
configMapAsPropertySource(java.lang.String mountPoint,
java.util.Map<java.lang.String,java.lang.String> data)
Converts config map mounted as volume into property sources.
|
static io.micronaut.context.env.PropertySource |
configMapAsPropertySource(io.kubernetes.client.openapi.models.V1ConfigMap configMap)
Converts a
V1ConfigMap into a PropertySource. |
static java.util.function.Predicate<io.kubernetes.client.common.KubernetesObject> |
getExcludesFilter(java.util.Collection<java.lang.String> excludes) |
static java.util.function.Predicate<io.kubernetes.client.common.KubernetesObject> |
getIncludesFilter(java.util.Collection<java.lang.String> includes) |
static java.util.function.Predicate<io.kubernetes.client.common.KubernetesObject> |
getLabelsFilter(java.util.Map<java.lang.String,java.lang.String> labels) |
static io.micronaut.context.env.PropertySource |
secretAsPropertySource(io.kubernetes.client.openapi.models.V1Secret secret) |
public static final java.lang.String ENV_KUBERNETES_SERVICE_HOST
public static io.micronaut.context.env.PropertySource configMapAsPropertySource(io.kubernetes.client.openapi.models.V1ConfigMap configMap)
V1ConfigMap into a PropertySource.configMap - the ConfigMappublic static java.util.List<io.micronaut.context.env.PropertySource> configMapAsPropertySource(java.lang.String mountPoint,
java.util.Map<java.lang.String,java.lang.String> data)
mountPoint - the mount pointdata - the configmaps data in the mounted volume where keys are file names and values is the file contentpublic static java.lang.String computeLabelSelector(java.util.Map<java.lang.String,java.lang.String> labels)
labels - the labelspublic static io.micronaut.context.env.PropertySource secretAsPropertySource(io.kubernetes.client.openapi.models.V1Secret secret)
secret - The V1Secret to transformPropertySource.public static java.util.function.Predicate<io.kubernetes.client.common.KubernetesObject> getIncludesFilter(java.util.Collection<java.lang.String> includes)
includes - the objects to includePredicate based on a collection of object names to includepublic static java.util.function.Predicate<io.kubernetes.client.common.KubernetesObject> getExcludesFilter(java.util.Collection<java.lang.String> excludes)
excludes - the objects to excludesPredicate based on a collection of object names to excludespublic static java.util.function.Predicate<io.kubernetes.client.common.KubernetesObject> getLabelsFilter(java.util.Map<java.lang.String,java.lang.String> labels)
labels - the labels to includePredicate based on labels the kubernetes objects has to match to return truepublic static reactor.core.publisher.Mono<java.lang.String> computePodLabelSelector(io.micronaut.kubernetes.client.reactor.CoreV1ApiReactorClient client,
java.util.List<java.lang.String> podLabelKeys,
java.lang.String namespace,
java.util.Map<java.lang.String,java.lang.String> labels,
boolean exceptionOnPodLabelsMissing)
client - the CoreV1ApiReactorClientpodLabelKeys - the list of labels inside a podnamespace - in the configurationlabels - the labelsexceptionOnPodLabelsMissing - should and exception be thrown if configured pod label is not found