Class KubernetesPropertySourceImporter

java.lang.Object
io.micronaut.kubernetes.configuration.imports.KubernetesPropertySourceImporter
All Implemented Interfaces:
io.micronaut.context.env.PropertySourceImporter<ImportDeclaration>, io.micronaut.core.util.Toggleable, AutoCloseable

public final class KubernetesPropertySourceImporter extends Object implements io.micronaut.context.env.PropertySourceImporter<ImportDeclaration>
A PropertySourceImporter that resolves Micronaut configuration from Kubernetes ConfigMaps and Secrets.
  • Field Details

    • KUBERNETES_CONFIG_IMPORT_CONTEXT_PROPERTY

      public static final String KUBERNETES_CONFIG_IMPORT_CONTEXT_PROPERTY
      See Also:
  • Constructor Details

    • KubernetesPropertySourceImporter

      public KubernetesPropertySourceImporter()
  • Method Details

    • getProvider

      public String getProvider()
      Specified by:
      getProvider in interface io.micronaut.context.env.PropertySourceImporter<ImportDeclaration>
    • newImportDeclaration

      public ImportDeclaration newImportDeclaration(io.micronaut.core.util.ConnectionString connectionString)
      Creates an import declaration from a Kubernetes config import connection string.
      Specified by:
      newImportDeclaration in interface io.micronaut.context.env.PropertySourceImporter<ImportDeclaration>
      Parameters:
      connectionString - The parsed import connection string
      Returns:
      The normalized import declaration
    • newImportDeclaration

      public ImportDeclaration newImportDeclaration(io.micronaut.core.convert.value.ConvertibleValues<Object> values)
      Creates an import declaration from map-like configuration values.
      Specified by:
      newImportDeclaration in interface io.micronaut.context.env.PropertySourceImporter<ImportDeclaration>
      Parameters:
      values - The raw declaration values
      Returns:
      The normalized import declaration
    • importPropertySource

      public Optional<io.micronaut.context.env.PropertySource> importPropertySource(io.micronaut.context.env.PropertySourceImporter.ImportContext<ImportDeclaration> context)
      Imports a property source by delegating to ConfigMap or Secret import support based on the declaration type.
      Specified by:
      importPropertySource in interface io.micronaut.context.env.PropertySourceImporter<ImportDeclaration>
      Parameters:
      context - The import context containing the declaration to process
      Returns:
      The imported property source when one can be resolved
    • close

      public void close()
      Closes the lazily created application context used to resolve importer support beans.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface io.micronaut.context.env.PropertySourceImporter<ImportDeclaration>