Class KubernetesConfigUtils

java.lang.Object
io.micronaut.kubernetes.client.openapi.configuration.KubernetesConfigUtils

@Internal public final class KubernetesConfigUtils extends Object
Utility methods for Kubernetes Configuration client.
  • Field Details

    • API_PROPERTY_SOURCE_PRIORITY

      public static final int API_PROPERTY_SOURCE_PRIORITY
      See Also:
  • Method Details

    • createResVersionPropertyName

      public static String createResVersionPropertyName(KubernetesObject kubernetesObject)
      Creates a property name for property which contains resource version of given kubernetes object.
      Parameters:
      kubernetesObject - the kubernetes object
      Returns:
      property name
    • createPropertySourceName

      public static String createPropertySourceName(KubernetesObject kubernetesObject)
      Creates a property source name from given kubernetes object.
      Parameters:
      kubernetesObject - the kubernetes object
      Returns:
      property source name
    • createPropertySourceName

      public static String createPropertySourceName(String filePath, Class<? extends KubernetesObject> type)
      Creates a property source name from given file path.
      Parameters:
      filePath - the file path
      type - the kubernetes type
      Returns:
      property source name
    • configMapAsMap

      public static Map<String,Object> configMapAsMap(V1ConfigMap configMap, Collection<io.micronaut.context.env.PropertySourceLoader> propertySourceLoaders)
      Converts a V1ConfigMap into a Map.
      Parameters:
      configMap - the V1ConfigMap instance
      propertySourceLoaders - the collection of property source loaders
      Returns:
      Map instance
    • configMapAsPropertySource

      public static io.micronaut.context.env.PropertySource configMapAsPropertySource(V1ConfigMap configMap, Collection<io.micronaut.context.env.PropertySourceLoader> propertySourceLoaders)
      Converts a V1ConfigMap into a PropertySource.
      Parameters:
      configMap - the V1ConfigMap instance
      propertySourceLoaders - the collection of property source loaders
      Returns:
      PropertySource instance
    • secretAsMap

      public static Map<String,Object> secretAsMap(V1Secret secret)
      Converts a V1Secret into a Map.
      Parameters:
      secret - the V1Secret instance
      Returns:
      Map instance
    • secretAsPropertySource

      public static io.micronaut.context.env.PropertySource secretAsPropertySource(V1Secret secret)
      Converts a V1Secret into a PropertySource.
      Parameters:
      secret - the V1Secret instance
      Returns:
      PropertySource instance
    • computePodLabelSelector

      public static reactor.core.publisher.Mono<String> computePodLabelSelector(CoreV1ApiReactor client, List<String> podLabelKeys, String namespace, Map<String,String> labels, boolean exceptionOnPodLabelsMissing)
      Creates a label selector filter from pod and passed labels.
      Parameters:
      client - the client
      podLabelKeys - the list of label keys inside a pod
      namespace - the namespace
      labels - the additional labels
      exceptionOnPodLabelsMissing - should an exception be thrown if configured pod label key is not found in pod labels
      Returns:
      the label selector filter
    • computePodLabels

      public static @NonNull reactor.core.publisher.Mono<Map<String,String>> computePodLabels(CoreV1ApiReactor client, List<String> podLabelKeys, String namespace, Map<String,String> labels, boolean exceptionOnPodLabelsMissing)
      Creates a label map from pod and passed labels.
      Parameters:
      client - the client
      podLabelKeys - the list of label keys inside a pod
      namespace - the namespace
      labels - the additional labels
      exceptionOnPodLabelsMissing - should an exception be thrown if configured pod label key is not found in pod labels
      Returns:
      the computed labels
    • parseLabels

      public static @Nullable Map<String,String> parseLabels(String labelsValue, String provider)
    • computeLabelSelector

      public static String computeLabelSelector(Map<String,String> labels)
      Creates a label selector filter based on the passed labels.
      Parameters:
      labels - the map of labels
      Returns:
      the label selector filter