All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.bootstrap.kubernetes.confcenter.KubernetesBootstrapConfiguration Maven / Gradle / Ivy

package org.zodiac.autoconfigure.bootstrap.kubernetes.confcenter;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.zodiac.autoconfigure.kubernetes.KubernetesAutoConfiguration;
import org.zodiac.autoconfigure.kubernetes.condition.ConditionalOnKubernetesEnabled;

@SpringBootConfiguration
@ConditionalOnKubernetesEnabled
@ConditionalOnClass(value = {io.fabric8.kubernetes.api.model.ConfigMap.class, io.fabric8.kubernetes.api.model.Secret.class})
public class KubernetesBootstrapConfiguration {

    @SpringBootConfiguration
    @Import(value = {KubernetesAutoConfiguration.class})
    protected static class KubernetesPropertySourceConfiguration {

        private io.fabric8.kubernetes.client.KubernetesClient client;

        public KubernetesPropertySourceConfiguration(io.fabric8.kubernetes.client.KubernetesClient client) {
            this.client = client;
        }

        @Bean
        @ConditionalOnMissingBean
        @ConfigurationProperties(prefix = org.zodic.kubernetes.base.constants.KubernetesSystemPropertiesConstants.SPRING_BOOTSTRAP_KUBERNETES_CONFIG_PREFIX, ignoreInvalidFields = true)
        protected ConfigMapConfigProperties configMapConfigProperties() {
            return new ConfigMapConfigProperties();
        }

        @Bean
        @ConditionalOnMissingBean
        @ConfigurationProperties(prefix = org.zodic.kubernetes.base.constants.KubernetesSystemPropertiesConstants.SPRING_BOOTSTRAP_KUBERNETES_SECRETS_PREFIX, ignoreInvalidFields = true)
        protected SecretsConfigProperties secretsConfigProperties() {
            return new SecretsConfigProperties();
        }

        @Bean
        @ConditionalOnProperty(name = org.zodic.kubernetes.base.constants.KubernetesSystemPropertiesConstants.SPRING_BOOTSTRAP_KUBERNETES_CONFIG_ENABLED, havingValue = "true")
        protected org.zodic.kubernetes.confcenter.ConfigMapPropertySourceLocator configMapPropertySourceLocator(ConfigMapConfigProperties properties) {
            return new org.zodic.kubernetes.confcenter.ConfigMapPropertySourceLocator(this.client, properties);
        }

        @Bean
        @ConditionalOnProperty(name = org.zodic.kubernetes.base.constants.KubernetesSystemPropertiesConstants.SPRING_BOOTSTRAP_KUBERNETES_SECRETS_ENABLED, havingValue = "true")
        protected org.zodic.kubernetes.confcenter.SecretsPropertySourceLocator secretsPropertySourceLocator(SecretsConfigProperties properties) {
            return new org.zodic.kubernetes.confcenter.SecretsPropertySourceLocator(this.client, properties);
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy