proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/AbstractKubernetesHealthIndicator.java | AbstractKubernetesHealthIndicator | doHealthCheck | class AbstractKubernetesHealthIndicator extends AbstractHealthIndicator {
/**
* Inside key.
*/
public static final String INSIDE = "inside";
/**
* Namespace key.
*/
public static final String NAMESPACE = "namespace";
/**
* Pod name key.
*/
public static final String POD_NAME = "podName";
/**
* ... |
try {
builder.up().withDetails(getDetails());
}
catch (Exception e) {
builder.down(e);
}
| 281 | 45 | 326 | <methods>public final org.springframework.boot.actuate.health.Health health() <variables>private static final java.lang.String DEFAULT_MESSAGE,private static final java.lang.String NO_MESSAGE,private final Function<java.lang.Exception,java.lang.String> healthCheckFailedMessage,private final org.apache.commons.logging.L... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/AbstractKubernetesInfoContributor.java | AbstractKubernetesInfoContributor | contribute | class AbstractKubernetesInfoContributor implements InfoContributor {
/**
* Kubernetes key.
*/
public static final String KUBERNETES = "kubernetes";
/**
* Inside key.
*/
public static final String INSIDE = "inside";
/**
* Namespace key.
*/
public static final String NAMESPACE = "namespace";
/**
... |
try {
builder.withDetail(KUBERNETES, getDetails());
}
catch (Exception e) {
LOG.warn("Failed to get pod details", e);
}
| 328 | 55 | 383 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/KubernetesCommonsSanitizeAutoConfiguration.java | KubernetesCommonsSanitizeAutoConfiguration | secretsPropertySourceSanitizingFunction | class KubernetesCommonsSanitizeAutoConfiguration {
@Bean
@ConditionalOnMissingBean
SanitizingFunction secretsPropertySourceSanitizingFunction() {<FILL_FUNCTION_BODY>}
} |
return data -> {
PropertySource<?> propertySource = data.getPropertySource();
if (propertySource instanceof BootstrapPropertySource<?> bootstrapPropertySource) {
PropertySource<?> source = bootstrapPropertySource.getDelegate();
if (source instanceof SecretsPropertySource) {
return new SanitizableD... | 54 | 376 | 430 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/KubernetesNamespaceProvider.java | KubernetesNamespaceProvider | getNamespace | class KubernetesNamespaceProvider {
/**
* Property name for namespace.
*/
public static final String NAMESPACE_PROPERTY = "spring.cloud.kubernetes.client.namespace";
/**
* Property for namespace file path.
*/
public static final String NAMESPACE_PATH_PROPERTY = "spring.cloud.kubernetes.client.serviceAccou... |
// If they provided the namespace in the constructor just return that
if (!ObjectUtils.isEmpty(namespacePropertyValue)) {
return namespacePropertyValue;
}
// No namespace provided so try to get it from another source
String namespace = null;
if (environment != null) {
namespace = environment.getPrope... | 734 | 160 | 894 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/LazilyInstantiate.java | LazilyInstantiate | get | class LazilyInstantiate<T> implements Supplier<T> {
private volatile T t;
private final Supplier<T> supplier;
private LazilyInstantiate(Supplier<T> supplier) {
this.supplier = supplier;
}
public static <T> LazilyInstantiate<T> using(Supplier<T> supplier) {
return new LazilyInstantiate<>(supplier);
}
pub... |
T localT = t;
if (localT == null) {
synchronized (this) {
localT = t;
if (localT == null) {
localT = supplier.get();
t = localT;
}
}
}
return localT;
| 130 | 81 | 211 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigMapPropertySourceLocator.java | ConfigMapPropertySourceLocator | addPropertySourcesFromPaths | class ConfigMapPropertySourceLocator implements PropertySourceLocator {
private static final Log LOG = LogFactory.getLog(ConfigMapPropertySourceLocator.class);
private final ConfigMapCache cache;
protected final ConfigMapConfigProperties properties;
/**
* This constructor is deprecated, and we do not use it a... |
Set<String> uniquePaths = new LinkedHashSet<>(properties.paths());
if (!uniquePaths.isEmpty()) {
LOG.warn(
"path support is deprecated and will be removed in a future release. Please use spring.config.import");
}
LOG.debug("paths property sources : " + uniquePaths);
uniquePaths.stream().map(Paths::ge... | 620 | 456 | 1,076 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesConfigDataLoader.java | KubernetesConfigDataLoader | load | class KubernetesConfigDataLoader implements ConfigDataLoader<KubernetesConfigDataResource>, Ordered {
@Override
public ConfigData load(ConfigDataLoaderContext context, KubernetesConfigDataResource resource)
throws IOException, ConfigDataResourceNotFoundException {<FILL_FUNCTION_BODY>}
@Override
public int getO... |
List<PropertySource<?>> propertySources = new ArrayList<>(2);
ConfigurableBootstrapContext bootstrapContext = context.getBootstrapContext();
Environment env = resource.getEnvironment();
if (bootstrapContext.isRegistered(SecretsPropertySourceLocator.class)) {
propertySources.add(bootstrapContext.get(Secret... | 94 | 448 | 542 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesConfigDataLocationResolver.java | KubernetesConfigDataLocationResolver | of | class KubernetesConfigDataLocationResolver
implements ConfigDataLocationResolver<KubernetesConfigDataResource>, Ordered {
private static final boolean RETRY_IS_PRESENT = isPresent("org.springframework.retry.annotation.Retryable", null);
private final Log log;
public KubernetesConfigDataLocationResolver(Deferred... |
Binder binder = context.getBinder();
String applicationName = binder.bind("spring.application.name", String.class).orElse(null);
String namespace = binder.bind("spring.cloud.kubernetes.client.namespace", String.class)
.orElse(binder.bind("kubernetes.namespace", String.class).orElse(""));
KubernetesC... | 1,698 | 175 | 1,873 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesConfigDataResource.java | KubernetesConfigDataResource | equals | class KubernetesConfigDataResource extends ConfigDataResource {
private final KubernetesClientProperties properties;
private final ConfigMapConfigProperties configMapProperties;
private final SecretsConfigProperties secretsConfigProperties;
private final boolean optional;
private final Profiles profiles;
pr... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
KubernetesConfigDataResource that = (KubernetesConfigDataResource) o;
return Objects.equals(this.properties, that.properties) && Objects.equals(this.optional, that.optional)
&& Objects.equals(this.profi... | 559 | 160 | 719 | <methods>public void <init>() <variables>private final boolean optional |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/KubernetesConfigServerBootstrapper.java | KubernetesConfigServerBootstrapper | createKubernetesDiscoveryProperties | class KubernetesConfigServerBootstrapper implements BootstrapRegistryInitializer {
public static boolean hasConfigServerInstanceProvider() {
return !ClassUtils.isPresent("org.springframework.cloud.config.client.ConfigServerInstanceProvider", null);
}
public static KubernetesDiscoveryProperties createKubernetesDi... |
PropertyResolver propertyResolver = getPropertyResolver(bootstrapContext);
return propertyResolver.resolveConfigurationProperties(KubernetesDiscoveryProperties.PREFIX,
KubernetesDiscoveryProperties.class, () -> KubernetesDiscoveryProperties.DEFAULT);
| 597 | 62 | 659 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/LabeledConfigMapNormalizedSource.java | LabeledConfigMapNormalizedSource | equals | class LabeledConfigMapNormalizedSource extends NormalizedSource {
private final Map<String, String> labels;
private final ConfigUtils.Prefix prefix;
private final boolean includeProfileSpecificSources;
public LabeledConfigMapNormalizedSource(String namespace, Map<String, String> labels, boolean failFast,
Con... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LabeledConfigMapNormalizedSource other = (LabeledConfigMapNormalizedSource) o;
return Objects.equals(labels(), other.labels()) && Objects.equals(namespace(), other.namespace());
| 484 | 96 | 580 | <methods>public abstract boolean equals(java.lang.Object) ,public final boolean failFast() ,public abstract int hashCode() ,public final Optional<java.lang.String> name() ,public final Optional<java.lang.String> namespace() ,public abstract java.lang.String target() ,public abstract java.lang.String toString() ,public ... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/LabeledSecretNormalizedSource.java | LabeledSecretNormalizedSource | equals | class LabeledSecretNormalizedSource extends NormalizedSource {
private final Map<String, String> labels;
private final ConfigUtils.Prefix prefix;
private final boolean includeProfileSpecificSources;
public LabeledSecretNormalizedSource(String namespace, Map<String, String> labels, boolean failFast,
ConfigUti... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LabeledSecretNormalizedSource other = (LabeledSecretNormalizedSource) o;
return Objects.equals(labels(), other.labels()) && Objects.equals(namespace(), other.namespace());
| 479 | 94 | 573 | <methods>public abstract boolean equals(java.lang.Object) ,public final boolean failFast() ,public abstract int hashCode() ,public final Optional<java.lang.String> name() ,public final Optional<java.lang.String> namespace() ,public abstract java.lang.String target() ,public abstract java.lang.String toString() ,public ... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/LabeledSourceData.java | LabeledSourceData | compute | class LabeledSourceData {
public final SourceData compute(Map<String, String> labels, ConfigUtils.Prefix prefix, String target,
boolean profileSources, boolean failFast, String namespace, String[] activeProfiles) {<FILL_FUNCTION_BODY>}
/**
* Implementation specific (fabric8 or k8s-native) way to get the data f... |
MultipleSourcesContainer data = MultipleSourcesContainer.empty();
try {
Set<String> profiles = Set.of();
if (profileSources) {
profiles = Arrays.stream(activeProfiles).collect(Collectors.toSet());
}
data = dataSupplier(labels, profiles);
// need this check because when there is no data, the n... | 190 | 444 | 634 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/NamedConfigMapNormalizedSource.java | NamedConfigMapNormalizedSource | toString | class NamedConfigMapNormalizedSource extends NormalizedSource {
private final ConfigUtils.Prefix prefix;
private final boolean includeProfileSpecificSources;
private final boolean appendProfileToName;
public NamedConfigMapNormalizedSource(String name, String namespace, boolean failFast, ConfigUtils.Prefix prefi... |
return "{ config-map name : '" + name() + "', namespace : '" + namespace() + "', prefix : '" + prefix() + "' }";
| 585 | 39 | 624 | <methods>public abstract boolean equals(java.lang.Object) ,public final boolean failFast() ,public abstract int hashCode() ,public final Optional<java.lang.String> name() ,public final Optional<java.lang.String> namespace() ,public abstract java.lang.String target() ,public abstract java.lang.String toString() ,public ... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/NamedSecretNormalizedSource.java | NamedSecretNormalizedSource | toString | class NamedSecretNormalizedSource extends NormalizedSource {
private final ConfigUtils.Prefix prefix;
private final boolean includeProfileSpecificSources;
private final boolean appendProfileToName;
public NamedSecretNormalizedSource(String name, String namespace, boolean failFast, ConfigUtils.Prefix prefix,
... |
return "{ secret name : '" + name() + "', namespace : '" + namespace() + "'";
| 575 | 27 | 602 | <methods>public abstract boolean equals(java.lang.Object) ,public final boolean failFast() ,public abstract int hashCode() ,public final Optional<java.lang.String> name() ,public final Optional<java.lang.String> namespace() ,public abstract java.lang.String target() ,public abstract java.lang.String toString() ,public ... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/NamedSourceData.java | NamedSourceData | compute | class NamedSourceData {
public final SourceData compute(String sourceName, ConfigUtils.Prefix prefix, String target, boolean profileSources,
boolean failFast, String namespace, String[] activeProfiles) {<FILL_FUNCTION_BODY>}
protected String generateSourceName(String target, String sourceName, String namespace, ... |
LinkedHashSet<String> sourceNames = new LinkedHashSet<>();
// first comes non-profile based source
sourceNames.add(sourceName);
MultipleSourcesContainer data = MultipleSourcesContainer.empty();
try {
if (profileSources) {
for (String activeProfile : activeProfiles) {
// add all profile based s... | 224 | 362 | 586 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/PropertySourceUtils.java | PropertySourceUtils | yamlParserGenerator | class PropertySourceUtils {
private PropertySourceUtils() {
throw new IllegalStateException("Can't instantiate a utility class");
}
/**
* Function to convert a String to Properties.
*/
public static final Function<String, Properties> KEY_VALUE_TO_PROPERTIES = s -> {
Properties properties = new Properties(... |
return s -> {
YamlPropertiesFactoryBean yamlFactory = new YamlPropertiesFactoryBean();
yamlFactory.setDocumentMatchers(properties -> {
if (environment != null) {
String profiles = null;
String activeOnProfile = properties.getProperty(SPRING_CONFIG_ACTIVATE_ON_PROFILE);
String springProfiles ... | 390 | 261 | 651 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/SecretsPropertySource.java | SecretsPropertySource | toString | class SecretsPropertySource extends MapPropertySource {
public SecretsPropertySource(SourceData sourceData) {
super(sourceData.sourceName(), sourceData.sourceData());
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
} |
return getClass().getSimpleName() + " {name='" + this.name + "'}";
| 70 | 27 | 97 | <methods>public void <init>(java.lang.String, Map<java.lang.String,java.lang.Object>) ,public boolean containsProperty(java.lang.String) ,public java.lang.Object getProperty(java.lang.String) ,public java.lang.String[] getPropertyNames() <variables> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/SecretsPropertySourceLocator.java | SecretsPropertySourceLocator | putPathConfig | class SecretsPropertySourceLocator implements PropertySourceLocator {
private static final Log LOG = LogFactory.getLog(SecretsPropertySourceLocator.class);
private final SecretsCache cache;
protected final SecretsConfigProperties properties;
/**
* This constructor is deprecated, and we do not use it anymore i... |
if (!properties.paths().isEmpty()) {
LOG.warn(
"path support is deprecated and will be removed in a future release. Please use spring.config.import");
}
this.properties.paths().stream().map(Paths::get).filter(Files::exists).flatMap(x -> {
try {
return Files.walk(x);
}
catch (IOException e)... | 977 | 171 | 1,148 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/SourceDataEntriesProcessor.java | SourceDataEntriesProcessor | extractProperties | class SourceDataEntriesProcessor extends MapPropertySource {
private static final Log LOG = LogFactory.getLog(SourceDataEntriesProcessor.class);
private static Predicate<String> ENDS_IN_EXTENSION = x -> x.endsWith(".yml") || x.endsWith(".yaml")
|| x.endsWith(".properties");
public SourceDataEntriesProcessor(So... |
if (resourceName.endsWith(".yml") || resourceName.endsWith(".yaml") || resourceName.endsWith(".properties")) {
if (resourceName.endsWith(".properties")) {
LOG.debug("entry : " + resourceName + " will be treated as a single properties file");
return KEY_VALUE_TO_PROPERTIES.andThen(PROPERTIES_TO_MAP).appl... | 1,516 | 186 | 1,702 | <methods>public void <init>(java.lang.String, Map<java.lang.String,java.lang.Object>) ,public boolean containsProperty(java.lang.String) ,public java.lang.Object getProperty(java.lang.String) ,public java.lang.String[] getPropertyNames() <variables> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/reload/ConfigReloadAutoConfiguration.java | ConfigReloadAutoConfiguration | configurationUpdateStrategy | class ConfigReloadAutoConfiguration {
@Bean("springCloudKubernetesTaskScheduler")
@ConditionalOnMissingBean
public TaskSchedulerWrapper<TaskScheduler> taskScheduler() {
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
threadPoolTaskScheduler.setThreadNamePrefix("spring-cloud-kub... |
String strategyName = properties.strategy().name();
return switch (properties.strategy()) {
case RESTART_CONTEXT -> {
restarter.orElseThrow(() -> new AssertionError("Restart endpoint is not enabled"));
yield new ConfigurationUpdateStrategy(strategyName, () -> {
wait(properties);
restarter.get(... | 286 | 171 | 457 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/reload/ConfigReloadUtil.java | ConfigReloadUtil | changed | class ConfigReloadUtil {
private ConfigReloadUtil() {
}
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(ConfigReloadUtil.class));
public static boolean reload(String target, String eventSourceType, PropertySourceLocator locator,
ConfigurableEnvironment environment, Class<? extends Ma... |
if (left.size() != right.size()) {
if (LOG.isDebugEnabled()) {
LOG.debug("left size: " + left.size());
left.forEach(item -> LOG.debug(item.toString()));
LOG.debug("right size: " + right.size());
right.forEach(item -> LOG.debug(item.toString()));
}
LOG.warn(() -> "The current number of Confi... | 1,310 | 274 | 1,584 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/reload/ConfigurationChangeDetector.java | ConfigurationChangeDetector | reloadProperties | class ConfigurationChangeDetector {
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(ConfigurationChangeDetector.class));
protected ConfigurableEnvironment environment;
protected ConfigReloadProperties properties;
protected ConfigurationUpdateStrategy strategy;
public ConfigurationChan... |
LOG.info(() -> "Reloading using strategy: " + this.strategy.name());
strategy.reloadProcedure().run();
| 164 | 41 | 205 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/reload/PollingConfigMapChangeDetector.java | PollingConfigMapChangeDetector | executeCycle | class PollingConfigMapChangeDetector extends ConfigurationChangeDetector {
protected Log log = LogFactory.getLog(getClass());
private final PropertySourceLocator propertySourceLocator;
private final Class<? extends MapPropertySource> propertySourceClass;
private final TaskScheduler taskExecutor;
private final... |
boolean changedConfigMap = false;
if (monitorConfigMaps) {
log.debug("Polling for changes in config maps");
List<? extends MapPropertySource> currentConfigMapSources = findPropertySources(propertySourceClass,
environment);
if (!currentConfigMapSources.isEmpty()) {
changedConfigMap = changed(loc... | 339 | 160 | 499 | <methods>public void <init>(org.springframework.core.env.ConfigurableEnvironment, ConfigReloadProperties, ConfigurationUpdateStrategy) ,public void reloadProperties() <variables>private static final org.springframework.core.log.LogAccessor LOG,protected org.springframework.core.env.ConfigurableEnvironment environment,p... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/reload/PollingSecretsChangeDetector.java | PollingSecretsChangeDetector | executeCycle | class PollingSecretsChangeDetector extends ConfigurationChangeDetector {
protected Log log = LogFactory.getLog(getClass());
private final PropertySourceLocator propertySourceLocator;
private final Class<? extends MapPropertySource> propertySourceClass;
private final TaskScheduler taskExecutor;
private final l... |
boolean changedSecrets = false;
if (monitorSecrets) {
log.debug("Polling for changes in secrets");
List<MapPropertySource> currentSecretSources = locateMapPropertySources(this.propertySourceLocator,
this.environment);
if (!currentSecretSources.isEmpty()) {
List<? extends MapPropertySource> prope... | 335 | 168 | 503 | <methods>public void <init>(org.springframework.core.env.ConfigurableEnvironment, ConfigReloadProperties, ConfigurationUpdateStrategy) ,public void reloadProperties() <variables>private static final org.springframework.core.log.LogAccessor LOG,protected org.springframework.core.env.ConfigurableEnvironment environment,p... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/reload/condition/EventReloadDetectionMode.java | EventReloadDetectionMode | matches | class EventReloadDetectionMode implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {<FILL_FUNCTION_BODY>}
} |
Environment environment = context.getEnvironment();
if (!environment.containsProperty(Constants.RELOAD_MODE)) {
return true;
}
return ConfigReloadProperties.ReloadDetectionMode.EVENT.name()
.equalsIgnoreCase(environment.getProperty(Constants.RELOAD_MODE));
| 47 | 76 | 123 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/reload/condition/PollingReloadDetectionMode.java | PollingReloadDetectionMode | matches | class PollingReloadDetectionMode implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {<FILL_FUNCTION_BODY>}
} |
Environment environment = context.getEnvironment();
if (!environment.containsProperty(Constants.RELOAD_MODE)) {
return false;
}
return ConfigReloadProperties.ReloadDetectionMode.POLLING.name()
.equalsIgnoreCase(environment.getProperty(Constants.RELOAD_MODE));
| 48 | 78 | 126 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/discovery/KubernetesDiscoveryClientHealthIndicatorInitializer.java | KubernetesDiscoveryClientHealthIndicatorInitializer | postConstruct | class KubernetesDiscoveryClientHealthIndicatorInitializer {
private static final LogAccessor LOG = new LogAccessor(
LogFactory.getLog(KubernetesDiscoveryClientHealthIndicatorInitializer.class));
private final PodUtils<?> podUtils;
private final ApplicationEventPublisher applicationEventPublisher;
public Kube... |
LOG.debug(() -> "publishing InstanceRegisteredEvent");
InstanceRegisteredEvent<RegisteredEventSource> instanceRegisteredEvent = new InstanceRegisteredEvent<>(
new RegisteredEventSource("kubernetes", podUtils.isInsideKubernetes(), podUtils.currentPod().get()),
null);
applicationEventPublisher.publishEvent... | 241 | 100 | 341 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/discovery/ServicePortSecureResolver.java | ServicePortSecureResolver | resolve | class ServicePortSecureResolver {
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(ServicePortSecureResolver.class));
private static final Set<String> TRUTHY_STRINGS = Set.of("true", "on", "yes", "1");
private final KubernetesDiscoveryProperties properties;
public ServicePortSecureResolv... |
String serviceName = input.serviceName();
ServicePortNameAndNumber portData = input.portData();
Integer portNumber = portData.portNumber();
Optional<String> securedLabelValue = Optional.ofNullable(input.serviceLabels().get(SECURED));
if (securedLabelValue.isPresent() && TRUTHY_STRINGS.contains(securedLabe... | 476 | 362 | 838 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/Leader.java | Leader | isCandidate | class Leader {
private final String role;
private final String id;
public Leader(String role, String id) {
this.role = role;
this.id = id;
}
public String getRole() {
return this.role;
}
public String getId() {
return this.id;
}
public boolean isCandidate(Candidate candidate) {<FILL_FUNCTION_BODY... |
if (candidate == null) {
return false;
}
return Objects.equals(role, candidate.getRole()) && Objects.equals(id, candidate.getId());
| 290 | 49 | 339 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderInfoContributor.java | LeaderInfoContributor | contribute | class LeaderInfoContributor implements InfoContributor {
private final LeadershipController leadershipController;
private final Candidate candidate;
public LeaderInfoContributor(LeadershipController leadershipController, Candidate candidate) {
this.leadershipController = leadershipController;
this.candidate =... |
Map<String, Object> details = new HashMap<>();
leadershipController.getLocalLeader().ifPresentOrElse(leader -> {
details.put("leaderId", leader.getId());
details.put("role", leader.getRole());
details.put("isLeader", leader.isCandidate(candidate));
}, () -> details.put("leaderId", "Unknown"));
builde... | 103 | 124 | 227 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderInitiator.java | LeaderInitiator | stop | class LeaderInitiator implements SmartLifecycle {
private static final Logger LOGGER = LoggerFactory.getLogger(LeaderInitiator.class);
private final LeaderProperties leaderProperties;
private final LeadershipController leadershipController;
private final LeaderRecordWatcher leaderRecordWatcher;
private final ... |
if (isRunning()) {
LOGGER.debug("Leader initiator stopping");
this.scheduledExecutorService.shutdown();
this.scheduledExecutorService = null;
this.hostPodWatcher.stop();
this.leaderRecordWatcher.stop();
this.leadershipController.revoke();
this.isRunning = false;
}
| 494 | 96 | 590 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderProperties.java | LeaderProperties | getNamespace | class LeaderProperties {
/**
* Should leader election be enabled. Default: true
*/
private boolean enabled = true;
/**
* Should leader election be started automatically on startup. Default: true
*/
private boolean autoStartup = true;
/**
* Role for which leadership this candidate will compete.
*/
p... |
if (namespace == null || namespace.isEmpty()) {
return defaultValue;
}
return namespace;
| 720 | 31 | 751 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderUtils.java | LeaderUtils | hostName | class LeaderUtils {
// k8s environment variable responsible for host name
private static final String HOSTNAME = "HOSTNAME";
private LeaderUtils() {
}
public static String hostName() throws UnknownHostException {<FILL_FUNCTION_BODY>}
} |
String hostName = EnvReader.getEnv(HOSTNAME);
if (StringUtils.hasText(hostName)) {
return hostName;
}
else {
return InetAddress.getLocalHost().getHostName();
}
| 71 | 65 | 136 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeadershipController.java | LeadershipController | handleLeaderChange | class LeadershipController {
private static final Logger LOGGER = LoggerFactory.getLogger(LeadershipController.class);
protected static final String PROVIDER_KEY = "provider";
protected static final String PROVIDER = "spring-cloud-kubernetes";
protected static final String KIND_KEY = "kind";
protected static ... |
if (Objects.equals(this.localLeader, newLeader)) {
LOGGER.debug("Leader is still '{}'", this.localLeader);
return;
}
Leader oldLeader = this.localLeader;
this.localLeader = newLeader;
if (oldLeader != null && oldLeader.isCandidate(this.candidate)) {
notifyOnRevoked();
}
else if (newLeader != n... | 980 | 189 | 1,169 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/profile/AbstractKubernetesProfileEnvironmentPostProcessor.java | AbstractKubernetesProfileEnvironmentPostProcessor | addNamespaceFromServiceAccountFile | class AbstractKubernetesProfileEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered {
private static final DeferredLog LOG = new DeferredLog();
private static final String NAMESPACE_PATH_PROPERTY = "spring.cloud.kubernetes.client.serviceAccountNamespacePath";
protected static final String NAMESPA... |
String serviceAccountNamespacePathString = environment.getProperty(NAMESPACE_PATH_PROPERTY,
SERVICE_ACCOUNT_NAMESPACE_PATH);
String namespace = KubernetesNamespaceProvider
.getNamespaceFromServiceAccountFile(serviceAccountNamespacePathString);
if (StringUtils.hasText(namespace)) {
environment.getPrope... | 556 | 134 | 690 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/main/java/org/springframework/cloud/kubernetes/configserver/KubernetesConfigServerAutoConfiguration.java | KubernetesConfigServerAutoConfiguration | configMapPropertySourceSupplier | class KubernetesConfigServerAutoConfiguration {
@Bean
@Profile("kubernetes")
public EnvironmentRepository kubernetesEnvironmentRepository(CoreV1Api coreV1Api,
List<KubernetesPropertySourceSupplier> kubernetesPropertySourceSuppliers,
KubernetesNamespaceProvider kubernetesNamespaceProvider) {
return new Kuber... |
return (coreApi, applicationName, namespace, springEnv) -> {
List<String> namespaces = namespaceSplitter(properties.getConfigMapNamespaces(), namespace);
List<MapPropertySource> propertySources = new ArrayList<>();
namespaces.forEach(space -> {
NamedConfigMapNormalizedSource source = new NamedConfigMa... | 443 | 186 | 629 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/main/java/org/springframework/cloud/kubernetes/configserver/KubernetesEnvironmentRepository.java | KubernetesEnvironmentRepository | addApplicationConfiguration | class KubernetesEnvironmentRepository implements EnvironmentRepository {
private static final Log LOG = LogFactory.getLog(KubernetesEnvironmentRepository.class);
private final CoreV1Api coreApi;
private final List<KubernetesPropertySourceSupplier> kubernetesPropertySourceSuppliers;
private final String namespac... |
kubernetesPropertySourceSuppliers.forEach(supplier -> {
List<MapPropertySource> propertySources = supplier.get(coreApi, applicationName, namespace, springEnv);
propertySources.forEach(propertySource -> {
if (propertySource.getPropertyNames().length > 0) {
LOG.debug("Adding PropertySource " + propertyS... | 730 | 163 | 893 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/src/main/java/org/springframework/cloud/kubernetes/configuration/watcher/ConfigMapWatcherChangeDetector.java | ConfigMapWatcherChangeDetector | onEvent | class ConfigMapWatcherChangeDetector extends KubernetesClientEventBasedConfigMapChangeDetector
implements
RefreshTrigger permits BusEventBasedConfigMapWatcherChangeDetector, HttpBasedConfigMapWatchChangeDetector {
private final ScheduledExecutorService executorService;
private final long refreshDelay;
ConfigM... |
// this::refreshTrigger is coming from BusEventBasedConfigMapWatcherChangeDetector
WatcherUtil.onEvent(configMap, CONFIG_MAP_LABEL, CONFIG_MAP_APPS_ANNOTATION, refreshDelay, executorService,
"config-map", this::triggerRefresh);
| 300 | 81 | 381 | <methods>public void <init>(io.kubernetes.client.openapi.apis.CoreV1Api, org.springframework.core.env.ConfigurableEnvironment, ConfigReloadProperties, ConfigurationUpdateStrategy, org.springframework.cloud.kubernetes.client.config.KubernetesClientConfigMapPropertySourceLocator, org.springframework.cloud.kubernetes.comm... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/src/main/java/org/springframework/cloud/kubernetes/configuration/watcher/ConfigUpdateStrategyAutoConfiguration.java | ConfigUpdateStrategyAutoConfiguration | noopConfigurationUpdateStrategy | class ConfigUpdateStrategyAutoConfiguration {
private static final LogAccessor LOG = new LogAccessor(
LogFactory.getLog(ConfigUpdateStrategyAutoConfiguration.class));
@Bean
@ConditionalOnMissingBean
ConfigurationUpdateStrategy noopConfigurationUpdateStrategy() {<FILL_FUNCTION_BODY>}
} |
LOG.debug(() -> "creating NOOP strategy because reload is disabled");
return ConfigurationUpdateStrategy.NOOP;
| 78 | 34 | 112 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/src/main/java/org/springframework/cloud/kubernetes/configuration/watcher/ConfigurationWatcherAutoConfiguration.java | ConfigurationWatcherAutoConfiguration | httpBasedConfigMapWatchChangeDetector | class ConfigurationWatcherAutoConfiguration {
private static final String AMQP = "bus-amqp";
private static final String KAFKA = "bus-kafka";
@Bean
@ConditionalOnMissingBean
public WebClient webClient(WebClient.Builder webClientBuilder) {
return webClientBuilder.build();
}
@Bean
@ConditionalOnMissingBean(... |
return new HttpBasedConfigMapWatchChangeDetector(coreV1Api, environment, properties, strategy,
configMapPropertySourceLocator, namespaceProvider, k8SConfigurationProperties, threadFactory,
httpRefreshTrigger);
| 1,635 | 58 | 1,693 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/src/main/java/org/springframework/cloud/kubernetes/configuration/watcher/ConfigurationWatcherConfigurationProperties.java | ConfigurationWatcherConfigurationProperties | setActuatorPath | class ConfigurationWatcherConfigurationProperties {
/**
* label to enable refresh/restart when using configmaps.
*/
public static final String CONFIG_MAP_LABEL = "spring.cloud.kubernetes.config";
/**
* label to enable refresh/restart when using secrets.
*/
public static final String SECRET_LABEL = "spring... |
String normalizedPath = actuatorPath;
if (!normalizedPath.startsWith("/")) {
normalizedPath = "/" + normalizedPath;
}
if (normalizedPath.endsWith("/")) {
normalizedPath = normalizedPath.substring(0, normalizedPath.length() - 1);
}
this.actuatorPath = normalizedPath;
| 547 | 95 | 642 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/src/main/java/org/springframework/cloud/kubernetes/configuration/watcher/HttpRefreshTrigger.java | HttpRefreshTrigger | getActuatorUri | class HttpRefreshTrigger implements RefreshTrigger {
private static final LogAccessor LOG = new LogAccessor(
LogFactory.getLog(KubernetesClientEventBasedSecretsChangeDetector.class));
private final KubernetesInformerReactiveDiscoveryClient kubernetesReactiveDiscoveryClient;
private final ConfigurationWatcherCo... |
String metadataUri = si.getMetadata().getOrDefault(ConfigurationWatcherConfigurationProperties.ANNOTATION_KEY,
"");
LOG.debug(() -> "Metadata actuator uri is: " + metadataUri);
UriComponentsBuilder actuatorUriBuilder = UriComponentsBuilder.newInstance().scheme(si.getScheme())
.host(si.getHost());
if ... | 755 | 224 | 979 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/src/main/java/org/springframework/cloud/kubernetes/configuration/watcher/SecretsWatcherChangeDetector.java | SecretsWatcherChangeDetector | onEvent | class SecretsWatcherChangeDetector extends KubernetesClientEventBasedSecretsChangeDetector implements
RefreshTrigger permits BusEventBasedSecretsWatcherChangeDetector, HttpBasedSecretsWatchChangeDetector {
private final ScheduledExecutorService executorService;
private final long refreshDelay;
SecretsWatcherCha... |
// this::refreshTrigger is coming from BusEventBasedSecretsWatcherChangeDetector
WatcherUtil.onEvent(secret, SECRET_LABEL, SECRET_APPS_ANNOTATION, refreshDelay, executorService, "secret",
this::triggerRefresh);
| 295 | 76 | 371 | <methods>public void <init>(io.kubernetes.client.openapi.apis.CoreV1Api, org.springframework.core.env.ConfigurableEnvironment, ConfigReloadProperties, ConfigurationUpdateStrategy, org.springframework.cloud.kubernetes.client.config.KubernetesClientSecretsPropertySourceLocator, org.springframework.cloud.kubernetes.common... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/src/main/java/org/springframework/cloud/kubernetes/configuration/watcher/WatcherUtil.java | WatcherUtil | schedule | class WatcherUtil {
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(WatcherUtil.class));
private WatcherUtil() {
}
static void onEvent(KubernetesObject kubernetesObject, String label, String annotationName, long refreshDelay,
ScheduledExecutorService executorService, String type,
B... |
LOG.debug(() -> "Scheduling remote refresh event to be published for " + type + ": with appName : " + appName
+ " to be published in " + refreshDelay + " milliseconds");
executorService.schedule(() -> {
try {
triggerRefresh.apply(kubernetesObject, appName).subscribe();
}
catch (Throwable t) {
... | 826 | 142 | 968 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-discoveryserver/src/main/java/org/springframework/cloud/kubernetes/discoveryserver/DiscoveryServerController.java | DiscoveryServerController | apps | class DiscoveryServerController {
private final KubernetesInformerReactiveDiscoveryClient reactiveDiscoveryClient;
public DiscoveryServerController(KubernetesInformerReactiveDiscoveryClient reactiveDiscoveryClient) {
this.reactiveDiscoveryClient = reactiveDiscoveryClient;
}
@GetMapping("/apps")
public Flux<Se... |
return reactiveDiscoveryClient.getServices()
.flatMap(service -> reactiveDiscoveryClient.getInstances(service).collectList()
.flatMap(serviceInstances -> Mono.just(new Service(service,
serviceInstances.stream().map(x -> (DefaultKubernetesServiceInstance) x).toList()))));
| 350 | 88 | 438 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-discoveryserver/src/main/java/org/springframework/cloud/kubernetes/discoveryserver/HeartBeatListener.java | HeartBeatListener | onApplicationEvent | class HeartBeatListener implements ApplicationListener<HeartbeatEvent> {
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(HeartBeatListener.class));
private final AtomicReference<List<EndpointNameAndNamespace>> lastState = new AtomicReference<>(List.of());
HeartBeatListener(Environment env... |
LOG.debug(() -> "received heartbeat event");
List<EndpointNameAndNamespace> state = (List<EndpointNameAndNamespace>) event.getValue();
LOG.debug(() -> "state received : " + state);
lastState.set(state);
| 248 | 70 | 318 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-discovery/src/main/java/org/springframework/cloud/kubernetes/discovery/ConfigServerBootstrapper.java | KubernetesFunction | apply | class KubernetesFunction implements ConfigServerInstanceProvider.Function {
private KubernetesFunction() {
}
static KubernetesFunction create(BootstrapContext context) {
return new KubernetesFunction();
}
@Override
public List<ServiceInstance> apply(String serviceId, Binder binder, BindHandler bindHan... |
if (binder == null || bindHandler == null || !getDiscoveryEnabled(binder, bindHandler)) {
// If we don't have the Binder or BinderHandler from the
// ConfigDataLocationResolverContext
// we won't be able to create the necessary configuration
// properties to configure the
// Kubernetes Discovery... | 338 | 118 | 456 | <methods>public non-sealed void <init>() ,public static KubernetesClientProperties createKubernetesClientProperties(org.springframework.boot.context.properties.bind.Binder, org.springframework.boot.context.properties.bind.BindHandler) ,public static KubernetesClientProperties createKubernetesClientProperties(org.spring... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-discovery/src/main/java/org/springframework/cloud/kubernetes/discovery/KubernetesCatalogWatch.java | KubernetesCatalogWatch | catalogServicesWatch | class KubernetesCatalogWatch implements ApplicationEventPublisherAware {
private static final ParameterizedTypeReference<List<EndpointNameAndNamespace>> TYPE = new ParameterizedTypeReference<>() {
};
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(KubernetesCatalogWatch.class));
private... |
try {
List<EndpointNameAndNamespace> currentState = restTemplate.exchange("/state", HttpMethod.GET, null, TYPE)
.getBody();
if (!catalogState.get().equals(currentState)) {
LOG.debug(() -> "Received update from kubernetes discovery http client: " + currentState);
publisher.publishEvent(new Heartbe... | 261 | 157 | 418 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-discovery/src/main/java/org/springframework/cloud/kubernetes/discovery/KubernetesCatalogWatchAutoConfiguration.java | KubernetesCatalogWatchAutoConfiguration | kubernetesCatalogWatch | class KubernetesCatalogWatchAutoConfiguration {
private static final LogAccessor LOG = new LogAccessor(
LogFactory.getLog(KubernetesCatalogWatchAutoConfiguration.class));
// this has to be a RestTemplateBuilder and not a WebClientBuilder, otherwise
// we need the webflux dependency, and it might leak into clien... |
String watchDelay = environment.getProperty(CATALOG_WATCH_PROPERTY_NAME);
if (watchDelay != null) {
LOG.debug("using delay : " + watchDelay);
}
else {
LOG.debug("using default watch delay : " + CATALOG_WATCHER_DEFAULT_DELAY);
}
return new KubernetesCatalogWatch(builder, properties);
| 183 | 110 | 293 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-discovery/src/main/java/org/springframework/cloud/kubernetes/discovery/KubernetesDiscoveryClient.java | KubernetesDiscoveryClient | getServices | class KubernetesDiscoveryClient implements DiscoveryClient {
private final RestTemplate rest;
private final boolean emptyNamespaces;
private final Set<String> namespaces;
private final String discoveryServerUrl;
@Deprecated(forRemoval = true)
public KubernetesDiscoveryClient(RestTemplate rest, KubernetesDisc... |
Service[] services = rest.getForEntity(discoveryServerUrl + "/apps", Service[].class).getBody();
if (services != null && services.length > 0) {
return Arrays.stream(services).filter(this::matchNamespaces).map(Service::name).toList();
}
return List.of();
| 576 | 85 | 661 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-discovery/src/main/java/org/springframework/cloud/kubernetes/discovery/KubernetesDiscoveryClientAutoConfiguration.java | Reactive | kubernetesReactiveDiscoveryClientHealthIndicator | class Reactive {
@Bean
@ConditionalOnClass(name = { "org.springframework.web.reactive.function.client.WebClient" })
@ConditionalOnMissingBean(WebClient.Builder.class)
public WebClient.Builder webClientBuilder() {
return WebClient.builder();
}
@Bean
@ConditionalOnClass(name = { "org.springframework.we... |
ReactiveDiscoveryClientHealthIndicator healthIndicator = new ReactiveDiscoveryClientHealthIndicator(client,
properties);
InstanceRegisteredEvent event = new InstanceRegisteredEvent(applicationContext.getId(), null);
healthIndicator.onApplicationEvent(event);
return healthIndicator;
| 291 | 83 | 374 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-discovery/src/main/java/org/springframework/cloud/kubernetes/discovery/KubernetesDiscoveryPodUtils.java | KubernetesDiscoveryPodUtils | currentPod | class KubernetesDiscoveryPodUtils implements PodUtils<Object> {
@Override
public Supplier<Object> currentPod() {<FILL_FUNCTION_BODY>}
@Override
public boolean isInsideKubernetes() {
// this bean is used in a config that is annotated
// with @ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES),
// so safe t... |
// we don't really have a way to get the pod here
return () -> null;
| 112 | 27 | 139 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-discovery/src/main/java/org/springframework/cloud/kubernetes/discovery/KubernetesServiceInstance.java | KubernetesServiceInstance | equals | class KubernetesServiceInstance implements ServiceInstance {
private String instanceId;
private String serviceId;
private String host;
private int port;
private boolean secure;
private URI uri;
private Map<String, String> metadata;
private String scheme;
private String namespace;
public KubernetesSe... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
KubernetesServiceInstance that = (KubernetesServiceInstance) o;
return getPort() == that.getPort() && isSecure() == that.isSecure()
&& Objects.equals(getInstanceId(), that.getInstanceId())
&& Object... | 665 | 200 | 865 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-examples/kubernetes-leader-election-example/src/main/java/org/springframework/cloud/kubernetes/examples/LeaderController.java | LeaderController | revokeLeadership | class LeaderController {
private final String host;
@Value("${spring.cloud.kubernetes.leader.role}")
private String role;
private Context context;
public LeaderController() throws UnknownHostException {
this.host = InetAddress.getLocalHost().getHostName();
}
/**
* Return a message whether this instance ... |
if (this.context == null) {
String message = String.format("Cannot revoke leadership because '%s' is not a leader", this.host);
return ResponseEntity.badRequest().body(message);
}
this.context.yield();
String message = String.format("Leadership revoked for '%s'", this.host);
return ResponseEntity.ok(... | 485 | 99 | 584 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-autoconfig/src/main/java/org/springframework/cloud/kubernetes/fabric8/Fabric8AutoConfiguration.java | Fabric8AutoConfiguration | kubernetesClientConfig | class Fabric8AutoConfiguration {
private static <D> D or(D left, D right) {
return left != null ? left : right;
}
private static Integer orDurationInt(Duration left, Integer right) {
return left != null ? (int) left.toMillis() : right;
}
private static Long orDurationLong(Duration left, Long right) {
retu... |
Config base = Config.autoConfigure(null);
ConfigBuilder builder = new ConfigBuilder(base)
// Only set values that have been explicitly specified
.withMasterUrl(or(kubernetesClientProperties.masterUrl(), base.getMasterUrl()))
.withApiVersion(or(kubernetesClientProperties.apiVersion(), base.getApiVersion... | 254 | 800 | 1,054 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-autoconfig/src/main/java/org/springframework/cloud/kubernetes/fabric8/Fabric8HealthIndicator.java | Fabric8HealthIndicator | getDetails | class Fabric8HealthIndicator extends AbstractKubernetesHealthIndicator {
private final PodUtils<Pod> utils;
public Fabric8HealthIndicator(PodUtils<Pod> utils) {
this.utils = utils;
}
@Override
protected Map<String, Object> getDetails() {<FILL_FUNCTION_BODY>}
} |
Pod current = this.utils.currentPod().get();
if (current != null) {
Map<String, Object> details = CollectionUtils.newHashMap(8);
details.put(INSIDE, true);
ObjectMeta metadata = current.getMetadata();
details.put(NAMESPACE, metadata.getNamespace());
details.put(POD_NAME, metadata.getName());
det... | 94 | 248 | 342 | <methods>public non-sealed void <init>() <variables>public static final java.lang.String HOST_IP,public static final java.lang.String INSIDE,public static final java.lang.String LABELS,public static final java.lang.String NAMESPACE,public static final java.lang.String NODE_NAME,public static final java.lang.String POD_... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-autoconfig/src/main/java/org/springframework/cloud/kubernetes/fabric8/Fabric8InfoContributor.java | Fabric8InfoContributor | getDetails | class Fabric8InfoContributor extends AbstractKubernetesInfoContributor {
private final PodUtils<Pod> utils;
public Fabric8InfoContributor(PodUtils<Pod> utils) {
this.utils = utils;
}
@Override
public Map<String, Object> getDetails() {<FILL_FUNCTION_BODY>}
} |
Pod current = this.utils.currentPod().get();
if (current != null) {
Map<String, Object> details = CollectionUtils.newHashMap(7);
details.put(INSIDE, true);
ObjectMeta metadata = current.getMetadata();
details.put(NAMESPACE, metadata.getNamespace());
details.put(POD_NAME, metadata.getName());
P... | 93 | 230 | 323 | <methods>public non-sealed void <init>() ,public void contribute(org.springframework.boot.actuate.info.Info.Builder) ,public abstract Map<java.lang.String,java.lang.Object> getDetails() <variables>public static final java.lang.String HOST_IP,public static final java.lang.String INSIDE,public static final java.lang.Stri... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-autoconfig/src/main/java/org/springframework/cloud/kubernetes/fabric8/Fabric8PodUtils.java | Fabric8PodUtils | isServiceAccountFound | class Fabric8PodUtils implements PodUtils<Pod> {
/**
* HOSTNAME environment variable name.
*/
public static final String HOSTNAME = "HOSTNAME";
/**
* KUBERNETES_SERVICE_HOST environment variable name.
*/
public static final String KUBERNETES_SERVICE_HOST = "KUBERNETES_SERVICE_HOST";
private static final... |
boolean serviceAccountPathPresent = Paths.get(Config.KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH).toFile().exists();
if (!serviceAccountPathPresent) {
// https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
LOG.warn("serviceaccount path not present, did you disable it via 'automountS... | 548 | 166 | 714 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-autoconfig/src/main/java/org/springframework/cloud/kubernetes/fabric8/Fabric8Utils.java | Fabric8Utils | getApplicationNamespace | class Fabric8Utils {
private Fabric8Utils() {
}
public static ServiceMetadata serviceMetadata(Service service) {
ObjectMeta metadata = service.getMetadata();
ServiceSpec serviceSpec = service.getSpec();
return new ServiceMetadata(metadata.getName(), metadata.getNamespace(), serviceSpec.getType(),
metada... |
if (StringUtils.hasText(namespace)) {
LOG.debug(configurationTarget + " namespace : " + namespace);
return namespace;
}
if (provider != null) {
String providerNamespace = provider.getNamespace();
if (StringUtils.hasText(providerNamespace)) {
LOG.debug(() -> configurationTarget + " namespace fro... | 471 | 182 | 653 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-autoconfig/src/main/java/org/springframework/cloud/kubernetes/fabric8/profile/Fabric8ProfileEnvironmentPostProcessor.java | Fabric8ProfileEnvironmentPostProcessor | isInsideKubernetes | class Fabric8ProfileEnvironmentPostProcessor extends AbstractKubernetesProfileEnvironmentPostProcessor {
@Override
protected boolean isInsideKubernetes(Environment environment) {<FILL_FUNCTION_BODY>}
} |
try (KubernetesClient client = new KubernetesClientBuilder().build()) {
Fabric8PodUtils podUtils = new Fabric8PodUtils(client);
return environment.containsProperty(Fabric8PodUtils.KUBERNETES_SERVICE_HOST)
|| podUtils.isInsideKubernetes();
}
| 53 | 87 | 140 | <methods>public non-sealed void <init>() ,public int getOrder() ,public void postProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment, org.springframework.boot.SpringApplication) <variables>public static final java.lang.String KUBERNETES_PROFILE,private static final org.springframework.boot.logging.D... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigDataLocationResolver.java | Fabric8ConfigDataLocationResolver | registerBeans | class Fabric8ConfigDataLocationResolver extends KubernetesConfigDataLocationResolver {
public Fabric8ConfigDataLocationResolver(DeferredLogFactory factory) {
super(factory);
}
@Override
protected void registerBeans(ConfigDataLocationResolverContext resolverContext, ConfigDataLocation location,
Profiles profi... |
KubernetesClientProperties kubernetesClientProperties = propertyHolder.kubernetesClientProperties();
ConfigMapConfigProperties configMapProperties = propertyHolder.configMapConfigProperties();
SecretsConfigProperties secretsProperties = propertyHolder.secretsProperties();
ConfigurableBootstrapContext bootstra... | 301 | 446 | 747 | <methods>public void <init>(org.springframework.boot.logging.DeferredLogFactory) ,public final int getOrder() ,public final boolean isResolvable(org.springframework.boot.context.config.ConfigDataLocationResolverContext, org.springframework.boot.context.config.ConfigDataLocation) ,public final List<org.springframework.c... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySource.java | Fabric8ConfigMapPropertySource | getSourceData | class Fabric8ConfigMapPropertySource extends SourceDataEntriesProcessor {
private static final EnumMap<NormalizedSourceType, Fabric8ContextToSourceData> STRATEGIES = new EnumMap<>(
NormalizedSourceType.class);
static {
STRATEGIES.put(NormalizedSourceType.NAMED_CONFIG_MAP, namedConfigMap());
STRATEGIES.put(No... |
NormalizedSourceType type = context.normalizedSource().type();
return Optional.ofNullable(STRATEGIES.get(type)).map(x -> x.apply(context))
.orElseThrow(() -> new IllegalArgumentException("no strategy found for : " + type));
| 254 | 71 | 325 | <methods>public void <init>(SourceData) ,public static Map<java.lang.String,java.lang.Object> processAllEntries(Map<java.lang.String,java.lang.String>, org.springframework.core.env.Environment) ,public static Map<java.lang.String,java.lang.Object> processAllEntries(Map<java.lang.String,java.lang.String>, org.springfram... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceLocator.java | Fabric8ConfigMapPropertySourceLocator | getMapPropertySource | class Fabric8ConfigMapPropertySourceLocator extends ConfigMapPropertySourceLocator {
private final KubernetesClient client;
private final KubernetesNamespaceProvider provider;
Fabric8ConfigMapPropertySourceLocator(KubernetesClient client, ConfigMapConfigProperties properties,
KubernetesNamespaceProvider provid... |
// NormalizedSource has a namespace, but users can skip it.
// In such cases we try to get it elsewhere
String namespace = getApplicationNamespace(this.client, normalizedSource.namespace().orElse(null),
normalizedSource.target(), provider);
Fabric8ConfigContext context = new Fabric8ConfigContext(client, no... | 155 | 106 | 261 | <methods>public void <init>(ConfigMapConfigProperties) ,public void <init>(ConfigMapConfigProperties, org.springframework.cloud.kubernetes.commons.config.ConfigMapCache) ,public PropertySource<?> locate(org.springframework.core.env.Environment) ,public Collection<PropertySource<?>> locateCollection(org.springframework.... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapsCache.java | Fabric8ConfigMapsCache | byNamespace | class Fabric8ConfigMapsCache implements ConfigMapCache {
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(Fabric8ConfigMapsCache.class));
/**
* at the moment our loading of config maps is using a single thread, but might change
* in the future, thus a thread safe structure.
*/
private... |
boolean[] b = new boolean[1];
List<StrippedSourceContainer> result = CACHE.computeIfAbsent(namespace, x -> {
b[0] = true;
return strippedConfigMaps(client.configMaps().inNamespace(namespace).list().getItems());
});
if (b[0]) {
LOG.debug(() -> "Loaded all config maps in namespace '" + namespace + "'")... | 265 | 157 | 422 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigUtils.java | Fabric8ConfigUtils | configMapsDataByName | class Fabric8ConfigUtils {
private static final Log LOG = LogFactory.getLog(Fabric8ConfigUtils.class);
private Fabric8ConfigUtils() {
}
/**
* finds namespaces to be used for the event based reloading.
*/
public static Set<String> namespaces(KubernetesClient client, KubernetesNamespaceProvider provider,
C... |
List<StrippedSourceContainer> strippedConfigMaps = strippedConfigMaps(client, namespace);
if (strippedConfigMaps.isEmpty()) {
return MultipleSourcesContainer.empty();
}
return ConfigUtils.processNamedData(strippedConfigMaps, environment, sourceNames, namespace, false);
| 1,303 | 82 | 1,385 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsCache.java | Fabric8SecretsCache | byNamespace | class Fabric8SecretsCache implements SecretsCache {
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(Fabric8SecretsCache.class));
/**
* at the moment our loading of config maps is using a single thread, but might change
* in the future, thus a thread safe structure.
*/
private static ... |
boolean[] b = new boolean[1];
List<StrippedSourceContainer> result = CACHE.computeIfAbsent(namespace, x -> {
b[0] = true;
return strippedSecrets(client.secrets().inNamespace(namespace).list().getItems());
});
if (b[0]) {
LOG.debug(() -> "Loaded all secrets in namespace '" + namespace + "'");
}
el... | 253 | 154 | 407 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySource.java | Fabric8SecretsPropertySource | getSourceData | class Fabric8SecretsPropertySource extends SecretsPropertySource {
private static final EnumMap<NormalizedSourceType, Fabric8ContextToSourceData> STRATEGIES = new EnumMap<>(
NormalizedSourceType.class);
static {
STRATEGIES.put(NormalizedSourceType.NAMED_SECRET, namedSecret());
STRATEGIES.put(NormalizedSource... |
NormalizedSourceType type = context.normalizedSource().type();
return Optional.ofNullable(STRATEGIES.get(type)).map(x -> x.apply(context))
.orElseThrow(() -> new IllegalArgumentException("no strategy found for : " + type));
| 247 | 71 | 318 | <methods>public void <init>(SourceData) ,public java.lang.String toString() <variables> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceLocator.java | Fabric8SecretsPropertySourceLocator | getPropertySource | class Fabric8SecretsPropertySourceLocator extends SecretsPropertySourceLocator {
private final KubernetesClient client;
private final KubernetesNamespaceProvider provider;
Fabric8SecretsPropertySourceLocator(KubernetesClient client, SecretsConfigProperties properties,
KubernetesNamespaceProvider provider) {
... |
// NormalizedSource has a namespace, but users can skip it.
// In such cases we try to get it elsewhere
String namespace = getApplicationNamespace(client, normalizedSource.namespace().orElse(null),
normalizedSource.target(), provider);
Fabric8ConfigContext context = new Fabric8ConfigContext(client, normali... | 154 | 104 | 258 | <methods>public void <init>(SecretsConfigProperties) ,public void <init>(SecretsConfigProperties, org.springframework.cloud.kubernetes.commons.config.SecretsCache) ,public PropertySource<?> locate(org.springframework.core.env.Environment) ,public Collection<PropertySource<?>> locateCollection(org.springframework.core.e... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/LabeledConfigMapContextToSourceDataProvider.java | LabeledConfigMapContextToSourceDataProvider | get | class LabeledConfigMapContextToSourceDataProvider implements Supplier<Fabric8ContextToSourceData> {
LabeledConfigMapContextToSourceDataProvider() {
}
/*
* Computes a ContextSourceData (think content) for configmap(s) based on some labels.
* There could be many sources that are read based on incoming labels, fo... |
return context -> {
LabeledConfigMapNormalizedSource source = (LabeledConfigMapNormalizedSource) context.normalizedSource();
return new LabeledSourceData() {
@Override
public MultipleSourcesContainer dataSupplier(Map<String, String> labels, Set<String> profiles) {
return Fabric8ConfigUtils.conf... | 226 | 172 | 398 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/LabeledSecretContextToSourceDataProvider.java | LabeledSecretContextToSourceDataProvider | get | class LabeledSecretContextToSourceDataProvider implements Supplier<Fabric8ContextToSourceData> {
LabeledSecretContextToSourceDataProvider() {
}
/*
* Computes a ContextSourceData (think content) for secret(s) based on some labels.
* There could be many secrets that are read based on incoming labels, for which w... |
return context -> {
LabeledSecretNormalizedSource source = (LabeledSecretNormalizedSource) context.normalizedSource();
return new LabeledSourceData() {
@Override
public MultipleSourcesContainer dataSupplier(Map<String, String> labels, Set<String> profiles) {
return Fabric8ConfigUtils.secretsDat... | 222 | 170 | 392 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/NamedConfigMapContextToSourceDataProvider.java | NamedConfigMapContextToSourceDataProvider | generateSourceName | class NamedConfigMapContextToSourceDataProvider implements Supplier<Fabric8ContextToSourceData> {
NamedConfigMapContextToSourceDataProvider() {
}
/*
* Computes a ContextToSourceData (think content) for config map(s) based on name.
* There could be potentially many config maps read (we also read profile based
... |
if (source.appendProfileToName()) {
return ConfigUtils.sourceName(target, sourceName, namespace, activeProfiles);
}
return super.generateSourceName(target, sourceName, namespace, activeProfiles);
| 362 | 58 | 420 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/NamedSecretContextToSourceDataProvider.java | NamedSecretContextToSourceDataProvider | generateSourceName | class NamedSecretContextToSourceDataProvider implements Supplier<Fabric8ContextToSourceData> {
NamedSecretContextToSourceDataProvider() {
}
@Override
public Fabric8ContextToSourceData get() {
return context -> {
NamedSecretNormalizedSource source = (NamedSecretNormalizedSource) context.normalizedSource();
... |
if (source.appendProfileToName()) {
return ConfigUtils.sourceName(target, sourceName, namespace, activeProfiles);
}
return super.generateSourceName(target, sourceName, namespace, activeProfiles);
| 264 | 58 | 322 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/reload/Fabric8ConfigReloadAutoConfiguration.java | Fabric8ConfigReloadAutoConfiguration | secretsPropertyChangeEventWatcher | class Fabric8ConfigReloadAutoConfiguration {
/**
* Polling configMap ConfigurationChangeDetector.
* @param properties config reload properties
* @param strategy configuration update strategy
* @param fabric8ConfigMapPropertySourceLocator configMap property source locator
* @return a bean that listen to conf... |
return new Fabric8EventBasedSecretsChangeDetector(environment, properties, kubernetesClient, strategy,
fabric8SecretsPropertySourceLocator, new KubernetesNamespaceProvider(environment));
| 944 | 51 | 995 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/reload/Fabric8EventBasedConfigMapChangeDetector.java | Fabric8EventBasedConfigMapChangeDetector | inform | class Fabric8EventBasedConfigMapChangeDetector extends ConfigurationChangeDetector {
private static final LogAccessor LOG = new LogAccessor(
LogFactory.getLog(Fabric8EventBasedConfigMapChangeDetector.class));
private final Fabric8ConfigMapPropertySourceLocator fabric8ConfigMapPropertySourceLocator;
private fin... |
LOG.info("Kubernetes event-based configMap change detector activated");
namespaces.forEach(namespace -> {
SharedIndexInformer<ConfigMap> informer;
if (enableReloadFiltering) {
informer = kubernetesClient.configMaps().inNamespace(namespace)
.withLabels(Map.of(ConfigReloadProperties.RELOAD_LABEL_FIL... | 899 | 226 | 1,125 | <methods>public void <init>(org.springframework.core.env.ConfigurableEnvironment, ConfigReloadProperties, ConfigurationUpdateStrategy) ,public void reloadProperties() <variables>private static final org.springframework.core.log.LogAccessor LOG,protected org.springframework.core.env.ConfigurableEnvironment environment,p... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-config/src/main/java/org/springframework/cloud/kubernetes/fabric8/config/reload/Fabric8EventBasedSecretsChangeDetector.java | SecretInformerAwareEventHandler | onDelete | class SecretInformerAwareEventHandler implements ResourceEventHandler<Secret> {
private final SharedIndexInformer<Secret> informer;
private SecretInformerAwareEventHandler(SharedIndexInformer<Secret> informer) {
this.informer = informer;
}
@Override
public void onAdd(Secret secret) {
LOG.debug("Secre... |
LOG.debug("Secret " + secret.getMetadata().getName() + " was deleted in namespace "
+ secret.getMetadata().getNamespace());
onEvent(secret);
| 366 | 46 | 412 | <methods>public void <init>(org.springframework.core.env.ConfigurableEnvironment, ConfigReloadProperties, ConfigurationUpdateStrategy) ,public void reloadProperties() <variables>private static final org.springframework.core.log.LogAccessor LOG,protected org.springframework.core.env.ConfigurableEnvironment environment,p... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/Fabric8ConfigServerBootstrapper.java | Fabric8ConfigServerBootstrapper | initialize | class Fabric8ConfigServerBootstrapper extends KubernetesConfigServerBootstrapper {
@Override
public void initialize(BootstrapRegistry registry) {<FILL_FUNCTION_BODY>}
} |
if (hasConfigServerInstanceProvider()) {
return;
}
registry.registerIfAbsent(KubernetesDiscoveryProperties.class, context -> {
if (!getDiscoveryEnabled(context)) {
return null;
}
return createKubernetesDiscoveryProperties(context);
});
registry.registerIfAbsent(KubernetesClientProperties.cl... | 50 | 497 | 547 | <methods>public non-sealed void <init>() ,public static KubernetesClientProperties createKubernetesClientProperties(org.springframework.boot.context.properties.bind.Binder, org.springframework.boot.context.properties.bind.BindHandler) ,public static KubernetesClientProperties createKubernetesClientProperties(org.spring... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/Fabric8DiscoveryServicesAdapter.java | Fabric8DiscoveryServicesAdapter | filter | class Fabric8DiscoveryServicesAdapter implements Function<KubernetesClient, List<Service>> {
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(Fabric8DiscoveryServicesAdapter.class));
private static final SpelExpressionParser PARSER = new SpelExpressionParser();
private static final SimpleE... |
String spelExpression = properties.filter();
Predicate<Service> predicate;
if (spelExpression == null || spelExpression.isEmpty()) {
predicate = service -> true;
}
else {
Expression filterExpr = PARSER.parseExpression(spelExpression);
predicate = service -> {
Boolean include = filterExpr.getValu... | 427 | 138 | 565 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/Fabric8EndpointSliceV1CatalogWatch.java | Fabric8EndpointSliceV1CatalogWatch | apply | class Fabric8EndpointSliceV1CatalogWatch
implements Function<Fabric8CatalogWatchContext, List<EndpointNameAndNamespace>> {
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(Fabric8EndpointSliceV1CatalogWatch.class));
@Override
public List<EndpointNameAndNamespace> apply(Fabric8CatalogWatch... |
// take only pods that have endpoints
List<EndpointSlice> endpointSlices;
KubernetesClient client = context.kubernetesClient();
if (context.properties().allNamespaces()) {
LOG.debug(() -> "discovering endpoint slices in all namespaces");
endpointSlices = client.discovery().v1().endpointSlices().inAnyNam... | 191 | 392 | 583 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/Fabric8EndpointsCatalogWatch.java | Fabric8EndpointsCatalogWatch | apply | class Fabric8EndpointsCatalogWatch
implements Function<Fabric8CatalogWatchContext, List<EndpointNameAndNamespace>> {
@Override
public List<EndpointNameAndNamespace> apply(Fabric8CatalogWatchContext context) {<FILL_FUNCTION_BODY>}
} |
List<Endpoints> endpoints = endpoints(context.properties(), context.kubernetesClient(),
context.namespaceProvider(), "catalog-watcher", null, ALWAYS_TRUE);
/**
* <pre>
* - An "Endpoints" holds a List of EndpointSubset.
* - A single EndpointSubset holds a List of EndpointAddress
*
* - (The... | 73 | 271 | 344 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/Fabric8KubernetesDiscoveryClientUtils.java | Fabric8KubernetesDiscoveryClientUtils | withFilter | class Fabric8KubernetesDiscoveryClientUtils {
private static final LogAccessor LOG = new LogAccessor(
LogFactory.getLog(Fabric8KubernetesDiscoveryClientUtils.class));
static final Predicate<Service> ALWAYS_TRUE = x -> true;
private Fabric8KubernetesDiscoveryClientUtils() {
}
static List<Endpoints> endpoint... |
if (properties.filter() == null || properties.filter().isBlank() || filter == ALWAYS_TRUE) {
LOG.debug(() -> "filter not present");
return endpoints;
}
List<Endpoints> result = new ArrayList<>();
// group by namespace in order to make a single API call per namespace when
// retrieving services
Map<... | 1,545 | 363 | 1,908 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/Fabric8PodLabelsAndAnnotationsSupplier.java | Fabric8PodLabelsAndAnnotationsSupplier | apply | class Fabric8PodLabelsAndAnnotationsSupplier implements Function<String, PodLabelsAndAnnotations> {
private final KubernetesClient client;
private final String namespace;
private Fabric8PodLabelsAndAnnotationsSupplier(KubernetesClient client, String namespace) {
this.client = client;
this.namespace = namespac... |
ObjectMeta metadata = Optional.ofNullable(client.pods().inNamespace(namespace).withName(podName).get())
.map(Pod::getMetadata).orElse(new ObjectMeta());
return new PodLabelsAndAnnotations(metadata.getLabels(), metadata.getAnnotations());
| 263 | 74 | 337 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/KubernetesCatalogWatch.java | KubernetesCatalogWatch | catalogServicesWatch | class KubernetesCatalogWatch implements ApplicationEventPublisherAware {
private static final String DISCOVERY_GROUP_VERSION = DISCOVERY_GROUP + "/" + DISCOVERY_VERSION;
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(KubernetesCatalogWatch.class));
private final Fabric8CatalogWatchContex... |
try {
List<EndpointNameAndNamespace> currentState = stateGenerator.apply(context);
if (!currentState.equals(catalogEndpointsState)) {
LOG.debug(() -> "Received endpoints update from kubernetesClient: " + currentState);
publisher.publishEvent(new HeartbeatEvent(this, currentState));
}
catalogEn... | 699 | 142 | 841 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/KubernetesClientServicesFunctionProvider.java | KubernetesClientServicesFunctionProvider | servicesFunction | class KubernetesClientServicesFunctionProvider {
private KubernetesClientServicesFunctionProvider() {
}
public static KubernetesClientServicesFunction servicesFunction(KubernetesDiscoveryProperties properties,
Environment environment) {<FILL_FUNCTION_BODY>}
@Deprecated(forRemoval = true)
public static Kubern... |
if (properties.allNamespaces()) {
return (client) -> client.services().inAnyNamespace().withLabels(properties.serviceLabels());
}
return client -> {
String namespace = Fabric8Utils.getApplicationNamespace(client, null, "discovery-service",
new KubernetesNamespaceProvider(environment));
return cli... | 277 | 114 | 391 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/KubernetesDiscoveryClient.java | KubernetesDiscoveryClient | getInstances | class KubernetesDiscoveryClient implements DiscoveryClient, EnvironmentAware {
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(KubernetesDiscoveryClient.class));
private final KubernetesDiscoveryProperties properties;
private final KubernetesClientServicesFunction kubernetesClientServices... |
Objects.requireNonNull(serviceId);
List<Endpoints> allEndpoints = getEndPointsList(serviceId).stream().toList();
List<ServiceInstance> instances = new ArrayList<>();
for (Endpoints endpoints : allEndpoints) {
// endpoints are only those that matched the serviceId
instances.addAll(serviceInstances(endpo... | 1,164 | 372 | 1,536 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/KubernetesDiscoveryClientAutoConfiguration.java | KubernetesDiscoveryClientAutoConfiguration | indicatorInitializer | class KubernetesDiscoveryClientAutoConfiguration {
private static final LogAccessor LOG = new LogAccessor(
LogFactory.getLog(KubernetesDiscoveryClientAutoConfiguration.class));
@Bean
@ConditionalOnMissingBean
public KubernetesClientServicesFunction servicesFunction(KubernetesDiscoveryProperties properties,
... |
LOG.debug(() -> "Will publish InstanceRegisteredEvent from blocking implementation");
return new KubernetesDiscoveryClientHealthIndicatorInitializer(podUtils, applicationEventPublisher);
| 277 | 49 | 326 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/reactive/KubernetesReactiveDiscoveryClient.java | KubernetesReactiveDiscoveryClient | getInstances | class KubernetesReactiveDiscoveryClient implements ReactiveDiscoveryClient {
private final KubernetesDiscoveryClient kubernetesDiscoveryClient;
public KubernetesReactiveDiscoveryClient(KubernetesClient client, KubernetesDiscoveryProperties properties,
KubernetesClientServicesFunction kubernetesClientServicesFunc... |
Assert.notNull(serviceId, "[Assertion failed] - the object argument must not be null");
return Flux.defer(() -> Flux.fromIterable(kubernetesDiscoveryClient.getInstances(serviceId)))
.subscribeOn(Schedulers.boundedElastic());
| 235 | 74 | 309 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-discovery/src/main/java/org/springframework/cloud/kubernetes/fabric8/discovery/reactive/KubernetesReactiveDiscoveryClientAutoConfiguration.java | KubernetesReactiveDiscoveryClientAutoConfiguration | reactiveIndicatorInitializer | class KubernetesReactiveDiscoveryClientAutoConfiguration {
private static final LogAccessor LOG = new LogAccessor(
LogFactory.getLog(KubernetesReactiveDiscoveryClientAutoConfiguration.class));
@Bean
@ConditionalOnMissingBean
public KubernetesClientServicesFunction servicesFunction(KubernetesDiscoveryProperties... |
LOG.debug(() -> "Will publish InstanceRegisteredEvent from reactive implementation");
return new KubernetesDiscoveryClientHealthIndicatorInitializer(podUtils, applicationEventPublisher);
| 407 | 50 | 457 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-istio/src/main/java/org/springframework/cloud/kubernetes/fabric8/client/istio/IstioBootstrapConfiguration.java | IstioDetectionConfiguration | addIstioProfile | class IstioDetectionConfiguration {
private final MeshUtils utils;
private final ConfigurableEnvironment environment;
public IstioDetectionConfiguration(MeshUtils utils, ConfigurableEnvironment environment) {
this.utils = utils;
this.environment = environment;
}
@PostConstruct
public void detectIs... |
if (utils.isIstioEnabled()) {
if (hasIstioProfile(environment)) {
if (LOG.isDebugEnabled()) {
LOG.debug("'istio' already in list of active profiles");
}
}
else {
if (LOG.isDebugEnabled()) {
LOG.debug("Adding 'istio' to list of active profiles");
}
environment.addActi... | 182 | 171 | 353 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-istio/src/main/java/org/springframework/cloud/kubernetes/fabric8/client/istio/utils/MeshUtils.java | MeshUtils | checkIstioServices | class MeshUtils {
private static final Log LOG = LogFactory.getLog(MeshUtils.class);
private final IstioClientProperties istioClientProperties;
private final RestTemplate restTemplate = new RestTemplateBuilder().build();
public MeshUtils(IstioClientProperties istioClientProperties) {
this.istioClientPropertie... |
try {
// Check if Istio Envoy proxy is installed. Notice that the check is done to
// localhost.
// TODO: We can improve this initial detection if better methods are found.
String resource = "http://localhost:" + this.istioClientProperties.getEnvoyPort();
ResponseEntity<String> response = this.restTem... | 143 | 329 | 472 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-leader/src/main/java/org/springframework/cloud/kubernetes/fabric8/leader/Fabric8LeaderAutoConfiguration.java | Fabric8LeaderAutoConfiguration | candidate | class Fabric8LeaderAutoConfiguration {
/*
* Used for publishing application events that happen: granted, revoked or failed to
* acquire mutex.
*/
@Bean
@ConditionalOnMissingBean(LeaderEventPublisher.class)
public LeaderEventPublisher defaultLeaderEventPublisher(ApplicationEventPublisher applicationEventPubli... |
String id = LeaderUtils.hostName();
String role = leaderProperties.getRole();
return new DefaultCandidate(id, role);
| 639 | 38 | 677 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-leader/src/main/java/org/springframework/cloud/kubernetes/fabric8/leader/Fabric8LeaderRecordWatcher.java | Fabric8LeaderRecordWatcher | onClose | class Fabric8LeaderRecordWatcher
implements org.springframework.cloud.kubernetes.commons.leader.LeaderRecordWatcher, Watcher<ConfigMap> {
private static final Logger LOGGER = LoggerFactory.getLogger(Fabric8LeaderRecordWatcher.class);
private final Object lock = new Object();
private final Fabric8LeadershipContr... |
if (cause != null) {
synchronized (this.lock) {
LOGGER.warn("Watcher stopped unexpectedly, will restart", cause);
this.watch = null;
start();
}
}
| 535 | 63 | 598 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-leader/src/main/java/org/springframework/cloud/kubernetes/fabric8/leader/Fabric8LeadershipController.java | Fabric8LeadershipController | createConfigMap | class Fabric8LeadershipController extends LeadershipController {
private static final Logger LOGGER = LoggerFactory.getLogger(Fabric8LeadershipController.class);
private final KubernetesClient kubernetesClient;
public Fabric8LeadershipController(Candidate candidate, LeaderProperties leaderProperties,
LeaderEve... |
LOGGER.debug("Creating new config map with data: {}", data);
ConfigMap newConfigMap = new ConfigMapBuilder().withNewMetadata()
.withName(this.leaderProperties.getConfigMapName()).addToLabels(PROVIDER_KEY, PROVIDER)
.addToLabels(KIND_KEY, KIND).endMetadata().addToData(data).build();
this.kubernetesClien... | 1,310 | 151 | 1,461 | <methods>public void <init>(org.springframework.integration.leader.Candidate, org.springframework.cloud.kubernetes.commons.leader.LeaderProperties, org.springframework.integration.leader.event.LeaderEventPublisher) ,public Optional<org.springframework.cloud.kubernetes.commons.leader.Leader> getLocalLeader() ,public abs... |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-leader/src/main/java/org/springframework/cloud/kubernetes/fabric8/leader/Fabric8PodReadinessWatcher.java | Fabric8PodReadinessWatcher | stop | class Fabric8PodReadinessWatcher implements PodReadinessWatcher, Watcher<Pod> {
private static final Logger LOGGER = LoggerFactory.getLogger(Fabric8PodReadinessWatcher.class);
private final Object lock = new Object();
private final String podName;
private final KubernetesClient kubernetesClient;
private final... |
if (this.watch != null) {
synchronized (this.lock) {
if (this.watch != null) {
LOGGER.debug("Stopping pod readiness watcher for '{}'", this.podName);
this.watch.close();
this.watch = null;
}
}
}
| 576 | 88 | 664 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-loadbalancer/src/main/java/org/springframework/cloud/kubernetes/fabric8/loadbalancer/Fabric8ServiceInstanceMapper.java | Fabric8ServiceInstanceMapper | secure | class Fabric8ServiceInstanceMapper implements KubernetesServiceInstanceMapper<Service> {
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(Fabric8ServiceInstanceMapper.class));
/**
* empty on purpose, load balancer implementation does not need them.
*/
private static final Map<String, In... |
ObjectMeta metadata = service.getMetadata();
ServicePortNameAndNumber portNameAndNumber = new ServicePortNameAndNumber(port.getPort(), port.getName());
Input input = new Input(portNameAndNumber, metadata.getName(), metadata.getLabels(), metadata.getAnnotations());
return resolver.resolve(input);
| 859 | 84 | 943 | <no_super_class> |
spring-cloud_spring-cloud-kubernetes | spring-cloud-kubernetes/spring-cloud-kubernetes-fabric8-loadbalancer/src/main/java/org/springframework/cloud/kubernetes/fabric8/loadbalancer/Fabric8ServicesListSupplier.java | Fabric8ServicesListSupplier | get | class Fabric8ServicesListSupplier extends KubernetesServicesListSupplier<Service> {
private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(Fabric8ServicesListSupplier.class));
private final KubernetesClient kubernetesClient;
private final KubernetesNamespaceProvider namespaceProvider;
Fabric8S... |
List<ServiceInstance> result = new ArrayList<>();
String serviceName = getServiceId();
LOG.debug(() -> "serviceID : " + serviceName);
if (discoveryProperties.allNamespaces()) {
LOG.debug(() -> "discovering services in all namespaces");
List<Service> services = kubernetesClient.services().inAnyNamespace(... | 249 | 520 | 769 | <methods>public void <init>(org.springframework.core.env.Environment, KubernetesServiceInstanceMapper<io.fabric8.kubernetes.api.model.Service>, KubernetesDiscoveryProperties) ,public abstract Flux<List<org.springframework.cloud.client.ServiceInstance>> get() ,public java.lang.String getServiceId() <variables>protected ... |
spring-cloud_spring-cloud-netflix | spring-cloud-netflix/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaClient.java | CloudEurekaClient | getEurekaHttpClient | class CloudEurekaClient extends DiscoveryClient {
private static final Log log = LogFactory.getLog(CloudEurekaClient.class);
private final AtomicLong cacheRefreshedCount = new AtomicLong(0);
private final ApplicationEventPublisher publisher;
private final Field eurekaTransportField;
private final ApplicationI... |
if (this.eurekaHttpClient.get() == null) {
try {
Object eurekaTransport = this.eurekaTransportField.get(this);
Field registrationClientField = ReflectionUtils.findField(eurekaTransport.getClass(),
"registrationClient");
ReflectionUtils.makeAccessible(registrationClientField);
this.eurekaHttp... | 694 | 180 | 874 | <methods>public void <init>(com.netflix.appinfo.ApplicationInfoManager, com.netflix.discovery.EurekaClientConfig, TransportClientFactories#RAW) ,public void <init>(com.netflix.appinfo.ApplicationInfoManager, com.netflix.discovery.EurekaClientConfig, TransportClientFactories#RAW, AbstractDiscoveryClientOptionalArgs#RAW)... |
spring-cloud_spring-cloud-netflix | spring-cloud-netflix/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaTransportConfig.java | CloudEurekaTransportConfig | hashCode | class CloudEurekaTransportConfig implements EurekaTransportConfig {
private int sessionedClientReconnectIntervalSeconds = 20 * 60;
private double retryableClientQuarantineRefreshPercentage = 0.66;
private int bootstrapResolverRefreshIntervalSeconds = 5 * 60;
private int applicationsResolverDataStalenessThreshol... |
return Objects.hash(sessionedClientReconnectIntervalSeconds, retryableClientQuarantineRefreshPercentage,
bootstrapResolverRefreshIntervalSeconds, applicationsResolverDataStalenessThresholdSeconds,
asyncResolverRefreshIntervalMs, asyncResolverWarmUpTimeoutMs, asyncExecutorThreadPoolSize,
readClusterVip, w... | 1,811 | 112 | 1,923 | <no_super_class> |
spring-cloud_spring-cloud-netflix | spring-cloud-netflix/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClient.java | EurekaDiscoveryClient | getServices | class EurekaDiscoveryClient implements DiscoveryClient {
/**
* Client description {@link String}.
*/
public static final String DESCRIPTION = "Spring Cloud Eureka Discovery Client";
private final EurekaClient eurekaClient;
private final EurekaClientConfig clientConfig;
public EurekaDiscoveryClient(EurekaCl... |
Applications applications = this.eurekaClient.getApplications();
if (applications == null) {
return Collections.emptyList();
}
List<Application> registered = applications.getRegisteredApplications();
List<String> names = new ArrayList<>();
for (Application app : registered) {
if (app.getInstances().i... | 322 | 127 | 449 | <no_super_class> |
spring-cloud_spring-cloud-netflix | spring-cloud-netflix/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClientConfiguration.java | EurekaClientConfigurationRefresher | onApplicationEvent | class EurekaClientConfigurationRefresher
implements ApplicationListener<RefreshScopeRefreshedEvent> {
@Autowired(required = false)
private EurekaClient eurekaClient;
@Autowired(required = false)
private EurekaAutoServiceRegistration autoRegistration;
public void onApplicationEvent(RefreshScopeRefreshedE... |
// This will force the creation of the EurekaClient bean if not already
// created
// to make sure the client will be re-registered after a refresh event
if (eurekaClient != null) {
eurekaClient.getApplications();
}
if (autoRegistration != null) {
// register in case meta data changed
thi... | 111 | 115 | 226 | <no_super_class> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.