Skip to content

Move to Kubernetes Java Client 6.0.1 #1249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 10, 2019
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import io.kubernetes.client.models.V1ServiceAccountList;
import io.kubernetes.client.models.V1ServiceList;
import io.kubernetes.client.models.V1beta1CustomResourceDefinition;
import io.kubernetes.client.models.V1beta1IngressList;
import io.kubernetes.client.models.ExtensionsV1beta1IngressList;
import io.kubernetes.client.util.ClientBuilder;

import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -97,7 +97,6 @@ public void verifyPods(String namespace, String labelSelectors, int expected) th
V1PodList v1PodList =
coreV1Api.listNamespacedPod(
namespace,
Boolean.FALSE,
Boolean.FALSE.toString(),
null,
null,
Expand All @@ -116,7 +115,6 @@ public void verifyJobs(String labelSelectors, int expected) throws Exception {
batchV1Api.listJobForAllNamespaces(
null,
null,
Boolean.TRUE,
labelSelectors,
null,
Boolean.FALSE.toString(),
Expand All @@ -132,7 +130,6 @@ public void verifyNoDeployments(String labelSelectors) throws Exception {
appsV1Api.listDeploymentForAllNamespaces(
null,
null,
Boolean.TRUE,
labelSelectors,
null,
Boolean.FALSE.toString(),
Expand All @@ -147,7 +144,6 @@ public void verifyNoReplicaSets(String labelSelectors) throws Exception {
appsV1Api.listReplicaSetForAllNamespaces(
null,
null,
Boolean.TRUE,
labelSelectors,
null,
Boolean.FALSE.toString(),
Expand All @@ -163,7 +159,6 @@ public void verifyServices(String labelSelectors, int expected) throws Exception
coreV1Api.listServiceForAllNamespaces(
null,
null,
Boolean.TRUE,
labelSelectors,
null,
Boolean.FALSE.toString(),
Expand All @@ -182,7 +177,6 @@ public void verifyPvcs(String labelSelectors, int expected) throws Exception {
coreV1Api.listPersistentVolumeClaimForAllNamespaces(
null,
null,
Boolean.TRUE,
labelSelectors,
null,
Boolean.FALSE.toString(),
Expand All @@ -196,11 +190,10 @@ public void verifyPvcs(String labelSelectors, int expected) throws Exception {
public void verifyIngresses(
String domainNs, String domainUid, String labelSelectors, int expectedLabeled)
throws Exception {
V1beta1IngressList labeledIngressList =
ExtensionsV1beta1IngressList labeledIngressList =
extensionsV1beta1Api.listIngressForAllNamespaces(
null,
null,
Boolean.TRUE,
labelSelectors,
null,
Boolean.FALSE.toString(),
Expand All @@ -212,11 +205,10 @@ public void verifyIngresses(
"Number of labeled ingress", labeledIngressList.getItems().size(), expectedLabeled);
labeledIngressList.getItems().stream()
.forEach(li -> li.getMetadata().getNamespace().equals(domainNs));
V1beta1IngressList traefikIngressList =
ExtensionsV1beta1IngressList traefikIngressList =
extensionsV1beta1Api.listIngressForAllNamespaces(
null,
String.format("metadata.name=traefik-hostrouting-%s", domainUid),
Boolean.TRUE,
null,
null,
Boolean.FALSE.toString(),
Expand All @@ -233,7 +225,6 @@ public void verifyConfigMaps(String labelSelectors, int expected) throws Excepti
coreV1Api.listConfigMapForAllNamespaces(
null,
null,
Boolean.TRUE,
labelSelectors,
null,
Boolean.FALSE.toString(),
Expand All @@ -249,7 +240,6 @@ public void verifyNoServiceAccounts(String labelSelectors) throws Exception {
coreV1Api.listServiceAccountForAllNamespaces(
null,
null,
Boolean.TRUE,
labelSelectors,
null,
Boolean.FALSE.toString(),
Expand All @@ -264,7 +254,6 @@ public void verifyNoRoles(String labelSelectors) throws Exception {
rbacAuthorizationV1Api.listRoleForAllNamespaces(
null,
null,
Boolean.TRUE,
labelSelectors,
null,
Boolean.FALSE.toString(),
Expand All @@ -279,7 +268,6 @@ public void verifyNoRoleBindings(String labelSelectors) throws Exception {
rbacAuthorizationV1Api.listRoleBindingForAllNamespaces(
null,
null,
Boolean.TRUE,
labelSelectors,
null,
Boolean.FALSE.toString(),
Expand All @@ -294,7 +282,6 @@ public void verifySecrets(String secretName, int expected) throws Exception {
coreV1Api.listSecretForAllNamespaces(
null,
"metadata.name=" + secretName,
Boolean.TRUE,
null,
null,
Boolean.FALSE.toString(),
Expand All @@ -307,7 +294,6 @@ public void verifySecrets(String secretName, int expected) throws Exception {
public void verifyPvs(String labelSelectors, int expected) throws Exception {
V1PersistentVolumeList v1PersistentVolumeList =
coreV1Api.listPersistentVolume(
Boolean.TRUE,
Boolean.FALSE.toString(),
null,
null,
Expand All @@ -322,7 +308,6 @@ public void verifyPvs(String labelSelectors, int expected) throws Exception {
public void verifyNoClusterRoles(String domain1Ls) throws Exception {
V1ClusterRoleList v1ClusterRoleList =
rbacAuthorizationV1Api.listClusterRole(
Boolean.TRUE,
Boolean.FALSE.toString(),
null,
null,
Expand All @@ -337,7 +322,6 @@ public void verifyNoClusterRoles(String domain1Ls) throws Exception {
public void verifyNoClusterRoleBindings(String labelSelectors) throws Exception {
V1ClusterRoleBindingList v1ClusterRoleBindingList =
rbacAuthorizationV1Api.listClusterRoleBinding(
Boolean.TRUE,
Boolean.FALSE.toString(),
null,
null,
Expand All @@ -362,7 +346,6 @@ public V1PodList getPods(String namespace, String labelSelectors) {
v1PodList =
coreV1Api.listNamespacedPod(
namespace,
Boolean.FALSE,
Boolean.FALSE.toString(),
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import io.kubernetes.client.models.V1EnvVar;
import io.kubernetes.client.models.V1EnvVarSource;
import io.kubernetes.client.models.V1beta1Ingress;
import io.kubernetes.client.proto.V1;
import org.junit.Test;

Expand All @@ -18,17 +17,11 @@ public class KubernetesApiNamesTest {
@Test
public void matchTopLevelClass() {
assertThat(KubernetesApiNames.matches("io.k8s.api.core.v1.EnvVar", V1EnvVar.class), is(true));
assertThat(
KubernetesApiNames.matches("io.k8s.api.extensions.v1beta1.Ingress", V1beta1Ingress.class),
is(true));
}

@Test
public void matchNestedClass() {
assertThat(KubernetesApiNames.matches("io.k8s.api.core.v1.EnvVar", V1.EnvVar.class), is(true));
assertThat(
KubernetesApiNames.matches("io.k8s.api.extensions.v1beta1.Ingress", V1beta1Ingress.class),
is(true));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ protected V1ServiceAccountList getAllServiceAccounts() throws ApiException {
coreApi.listServiceAccountForAllNamespaces(
cont, // continue option
"", // field selector
Boolean.FALSE, // includeUninitialized
"", // labelSelector
4096, // limit size for list
"false", // pretty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
import io.kubernetes.client.ProgressResponseBody;

public interface CallParams {
/**
* Returns a boolean indicating whether partially initialized results should be included in the
* response.
*
* @return the current setting of the parameter. Defaults to including everything.
*/
Boolean getIncludeUninitialized();

/**
* Returns the limit on the number of updates to send in a single reply.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class CallParamsImpl implements CallParams {
private static final int DEFAULT_LIMIT = 500;
private static final int DEFAULT_TIMEOUT = 30;

private Boolean includeUninitialized;
private Integer limit = CallParamsImpl.DEFAULT_LIMIT;
private Integer timeoutSeconds = CallParamsImpl.DEFAULT_TIMEOUT;
private String fieldSelector;
Expand All @@ -22,15 +21,6 @@ class CallParamsImpl implements CallParams {
private ProgressResponseBody.ProgressListener progressListener;
private ProgressRequestBody.ProgressRequestListener progressRequestListener;

@Override
public Boolean getIncludeUninitialized() {
return includeUninitialized;
}

void setIncludeUninitialized(Boolean includeUninitialized) {
this.includeUninitialized = includeUninitialized;
}

@Override
public Integer getLimit() {
return limit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,6 @@ public WatchBuilder withFieldSelector(String fieldSelector) {
return this;
}

@SuppressWarnings("SameParameterValue")
WatchBuilder withIncludeUninitialized(Boolean includeUninitialized) {
callParams.setIncludeUninitialized(includeUninitialized);
return this;
}

public WatchBuilder withLabelSelector(String labelSelector) {
callParams.setLabelSelector(labelSelector);
return this;
Expand Down Expand Up @@ -232,7 +226,6 @@ public Call apply(ApiClient client, CallParams callParams) {
return new CoreV1Api(client)
.listNamespacedServiceCall(
namespace,
callParams.getIncludeUninitialized(),
callParams.getPretty(),
START_LIST,
callParams.getFieldSelector(),
Expand Down Expand Up @@ -265,7 +258,6 @@ public Call apply(ApiClient client, CallParams callParams) {
return new CoreV1Api(client)
.listNamespacedPodCall(
namespace,
callParams.getIncludeUninitialized(),
callParams.getPretty(),
START_LIST,
callParams.getFieldSelector(),
Expand Down Expand Up @@ -298,7 +290,6 @@ public Call apply(ApiClient client, CallParams callParams) {
return new BatchV1Api(client)
.listNamespacedJobCall(
namespace,
callParams.getIncludeUninitialized(),
callParams.getPretty(),
START_LIST,
callParams.getFieldSelector(),
Expand Down Expand Up @@ -331,7 +322,6 @@ public Call apply(ApiClient client, CallParams callParams) {
return new CoreV1Api(client)
.listNamespacedEventCall(
namespace,
callParams.getIncludeUninitialized(),
callParams.getPretty(),
START_LIST,
callParams.getFieldSelector(),
Expand Down Expand Up @@ -364,7 +354,6 @@ public Call apply(ApiClient client, CallParams callParams) {
return new WeblogicApi(client)
.listNamespacedDomainCall(
namespace,
callParams.getIncludeUninitialized(),
callParams.getPretty(),
START_LIST,
callParams.getFieldSelector(),
Expand Down Expand Up @@ -397,7 +386,6 @@ public Call apply(ApiClient client, CallParams callParams) {
return new CoreV1Api(client)
.listNamespacedConfigMapCall(
namespace,
callParams.getIncludeUninitialized(),
callParams.getPretty(),
START_LIST,
callParams.getFieldSelector(),
Expand Down
Loading