Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/composites/pre-test-actions/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ runs:
- name: build project
shell: bash
run: |
./mvnw clean install -Dspring-boot.build-image.skip=true -DskipITs -DskipTests -T1C -U -B -q
./mvnw clean install -P 'run-on-github-actions' -Dspring-boot.build-image.skip=true -DskipITs -DskipTests -T1C -U -B -q
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only need this for github, so add the profile


- name: build controllers project
uses: ./.github/workflows/composites/build-controllers-project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,11 @@
@AutoConfigureAfter(KubernetesCommonsAutoConfiguration.class)
public class KubernetesClientAutoConfiguration {

/**
* this bean will be based on
* {@link org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryProperties}
* in the next major release.
*/
@Deprecated(forRemoval = true)
@Bean
@ConditionalOnMissingBean
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we were getting something from the environment via :

environment.getProperty("spring.cloud.kubernetes.client.user-agent"

and now we do it from KubernetesClientProperties. It should have been like this from the beginning, but because of other factors and being public, we never did this clean-up.

public ApiClient apiClient(Environment environment) {
public ApiClient apiClient(KubernetesClientProperties clientProperties) {
ApiClient apiClient = kubernetesApiClient();
// it's too early to inject KubernetesClientProperties here, all its properties
// are missing. For the time being work-around with reading from the environment.
apiClient.setUserAgent(environment.getProperty("spring.cloud.kubernetes.client.user-agent",
KubernetesClientProperties.DEFAULT_USER_AGENT));
apiClient.setUserAgent(clientProperties.userAgent());
return apiClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,6 @@ public class KubernetesClientPodUtils implements PodUtils<V1Pod> {

private final boolean failFast;

@Deprecated(forRemoval = true)
public KubernetesClientPodUtils(CoreV1Api client, String namespace) {
if (client == null) {
throw new IllegalArgumentException("Must provide an instance of KubernetesClient");
}

this.client = client;
this.hostName = EnvReader.getEnv(HOSTNAME);
this.serviceHost = EnvReader.getEnv(KUBERNETES_SERVICE_HOST);
this.current = LazilyInstantiate.using(this::internalGetPod);
this.namespace = namespace;
this.failFast = false;
}

// mainly needed for the health and info contributors, so that they report DOWN
// correctly
public KubernetesClientPodUtils(CoreV1Api client, String namespace, boolean failFast) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
*/
public class KubernetesClientSecretsPropertySource extends SecretsPropertySource {

@Deprecated(forRemoval = true)
public KubernetesClientSecretsPropertySource(SourceData sourceData) {
super(sourceData);
}

private static final EnumMap<NormalizedSourceType, KubernetesClientContextToSourceData> STRATEGIES = new EnumMap<>(
NormalizedSourceType.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,7 @@ static class LocalTestConfig {
@Bean
KubernetesClientProperties kubernetesClientProperties() {
return new KubernetesClientProperties(null, null, null, "default", null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null);
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one less argument here, rollingTimeout was deprecated in fabric8 and not used anymore

}

@Bean
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
package org.springframework.cloud.kubernetes.client.discovery;

import java.util.Collections;
import java.util.List;

import io.kubernetes.client.informer.SharedIndexInformer;
import io.kubernetes.client.informer.SharedInformerFactory;
import io.kubernetes.client.informer.cache.Lister;
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.apis.CoreV1Api;
import io.kubernetes.client.openapi.models.V1Endpoints;
import io.kubernetes.client.openapi.models.V1EndpointsList;
import io.kubernetes.client.openapi.models.V1Service;
Expand Down Expand Up @@ -96,8 +98,9 @@ public void initialize(BootstrapRegistry registry) {
.sharedIndexInformerFor(endpointsApi, V1Endpoints.class, 0L, namespace);
Lister<V1Endpoints> endpointsLister = new Lister<>(endpointsSharedIndexInformer.getIndexer());
KubernetesInformerDiscoveryClient discoveryClient = new KubernetesInformerDiscoveryClient(
sharedInformerFactory, serviceLister, endpointsLister, serviceSharedIndexInformer,
endpointsSharedIndexInformer, discoveryProperties);
List.of(sharedInformerFactory), List.of(serviceLister), List.of(endpointsLister),
List.of(serviceSharedIndexInformer), List.of(endpointsSharedIndexInformer), discoveryProperties,
new CoreV1Api(apiClient));
try {
discoveryClient.afterPropertiesSet();
return discoveryClient::getInstances;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import jakarta.annotation.PostConstruct;
import org.apache.commons.logging.LogFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryProperties;
Expand Down Expand Up @@ -82,46 +81,17 @@ public class KubernetesInformerDiscoveryClient implements DiscoveryClient {

private final ServicePortSecureResolver servicePortSecureResolver;

// visible only for testing and
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment is first resolved, related to CoreV1Api

// must be constructor injected in a future release
@Autowired
CoreV1Api coreV1Api;

@Deprecated(forRemoval = true)
public KubernetesInformerDiscoveryClient(String namespace, SharedInformerFactory sharedInformerFactory,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this constructor is removed, and we are left with a single one.

Let me try to simplify this. We had two constructors:

public KubernetesInformerDiscoveryClient(List<SharedInformerFactory> factories) {

}

and

public KubernetesInformerDiscoveryClient(SharedInformerFactory factory) {

}

again, this simplifies it so that its easier to understand the change.

Now, we only have a single constructor, that accepts a List. As such, all the callers we had, have to change now.

Lister<V1Service> serviceLister, Lister<V1Endpoints> endpointsLister,
SharedInformer<V1Service> serviceInformer, SharedInformer<V1Endpoints> endpointsInformer,
KubernetesDiscoveryProperties properties) {
this.sharedInformerFactories = List.of(sharedInformerFactory);
this.serviceListers = List.of(serviceLister);
this.endpointsListers = List.of(endpointsLister);
this.informersReadyFunc = () -> serviceInformer.hasSynced() && endpointsInformer.hasSynced();
this.properties = properties;
filter = filter(properties);
servicePortSecureResolver = new ServicePortSecureResolver(properties);
}

public KubernetesInformerDiscoveryClient(SharedInformerFactory sharedInformerFactory,
Lister<V1Service> serviceLister, Lister<V1Endpoints> endpointsLister,
SharedInformer<V1Service> serviceInformer, SharedInformer<V1Endpoints> endpointsInformer,
KubernetesDiscoveryProperties properties) {
this.sharedInformerFactories = List.of(sharedInformerFactory);
this.serviceListers = List.of(serviceLister);
this.endpointsListers = List.of(endpointsLister);
this.informersReadyFunc = () -> serviceInformer.hasSynced() && endpointsInformer.hasSynced();
this.properties = properties;
filter = filter(properties);
servicePortSecureResolver = new ServicePortSecureResolver(properties);
}
private final CoreV1Api coreV1Api;

public KubernetesInformerDiscoveryClient(List<SharedInformerFactory> sharedInformerFactories,
List<Lister<V1Service>> serviceListers, List<Lister<V1Endpoints>> endpointsListers,
List<SharedInformer<V1Service>> serviceInformers, List<SharedInformer<V1Endpoints>> endpointsInformers,
KubernetesDiscoveryProperties properties) {
KubernetesDiscoveryProperties properties, CoreV1Api coreV1Api) {
this.sharedInformerFactories = sharedInformerFactories;

this.serviceListers = serviceListers;
this.endpointsListers = endpointsListers;
this.coreV1Api = coreV1Api;
this.informersReadyFunc = () -> {
boolean serviceInformersReady = serviceInformers.isEmpty() || serviceInformers.stream()
.map(SharedInformer::hasSynced)
Expand Down
Loading
Loading