Skip to content

Commit

Permalink
chore(provider/kubernetes): Bump client to 1.0.0-beta1 (#1961)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwander authored Oct 4, 2017
1 parent af93e66 commit c05a9e5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion clouddriver-kubernetes/clouddriver-kubernetes.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {
compile spinnaker.dependency('lombok')

// TODO(lwander) move to spinnaker-dependencies when library stabilizes
compile 'io.kubernetes:client-java:0.2'
compile 'io.kubernetes:client-java:1.0.0-beta1'
compile 'com.github.fge:json-patch:1.9'
compile 'com.netflix.spinnaker.moniker:moniker:0.2.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class KubernetesClientApiAdapter {
/*
"fixme" and note this is k8s-client api issue and we are working this as workaround.
*/
V1beta1StatefulSetList list = apiInstance.listNamespacedStatefulSet(namespace, null, null, null, null, API_CALL_TIMEOUT_SECONDS, false)
V1beta1StatefulSetList list = apiInstance.listNamespacedStatefulSet(namespace, null, null, null, null, null, null, null, API_CALL_TIMEOUT_SECONDS, false)
String apiVersion = list.getApiVersion();
for (V1beta1StatefulSet item : list.getItems()) {
item.setApiVersion(apiVersion);
Expand All @@ -160,7 +160,7 @@ class KubernetesClientApiAdapter {
/*
"fixme" and note this is k8s-client api issue and we are working this as workaround.
*/
V1beta1DaemonSetList list = extApi.listNamespacedDaemonSet(namespace, null, null, null, null, API_CALL_TIMEOUT_SECONDS, null)
V1beta1DaemonSetList list = extApi.listNamespacedDaemonSet(namespace, null, null, null, null, null, null, null, API_CALL_TIMEOUT_SECONDS, null)
String apiVersion = list.getApiVersion();
for (V1beta1DaemonSet item : list.getItems()) {
item.setApiVersion(apiVersion);
Expand Down Expand Up @@ -228,8 +228,8 @@ class KubernetesClientApiAdapter {

List<String> getNamespacesByName() {
exceptionWrapper("namespaces.list", "Get Namespaces", null) {
V1NamespaceList result = coreApi.listNamespace(API_CALL_RESULT_FORMAT, null, null, null, 30, null);
return result.items
V1NamespaceList result = coreApi.listNamespace(API_CALL_RESULT_FORMAT, null, null, null, null, null, null, 30, null)
return result.items.collect { n -> n.getMetadata().getName() }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.fge.jsonpatch.diff.JsonDiff;
import com.google.gson.Gson;
import com.netflix.spectator.api.Clock;
import com.netflix.spectator.api.Registry;
import com.netflix.spinnaker.clouddriver.kubernetes.security.KubernetesCredentials;
Expand Down Expand Up @@ -66,12 +65,14 @@ public class KubernetesV2Credentials implements KubernetesCredentials {
private final Clock clock;
private final String accountName;
private final ObjectMapper mapper = new ObjectMapper();
private final Gson gson = new Gson();
private final List<String> namespaces;
private final List<String> omitNamespaces;
private final String PRETTY = "";
private final String CONTINUE = null;
private final boolean EXACT = true;
private final boolean EXPORT = false;
private final boolean INCLUDE_UNINITIALIZED = false;
private final Integer LIMIT = null; // TODO(lwander): include paginination
private final boolean WATCH = false;
private final String DEFAULT_VERSION = "0";
private final int TIMEOUT_SECONDS = 10; // TODO(lwander) make configurable
Expand Down Expand Up @@ -174,11 +175,13 @@ private KubernetesV2Credentials(@NotNull String accountName,
@Override
public List<String> getDeclaredNamespaces() {
List<String> result;
String labelSelector = null;
String fieldSelector = null;
if (!namespaces.isEmpty()) {
result = namespaces;
} else {
try {
result = coreV1Api.listNamespace(null, null, null, null, TIMEOUT_SECONDS, null)
result = coreV1Api.listNamespace(PRETTY, CONTINUE, fieldSelector, INCLUDE_UNINITIALIZED, labelSelector, LIMIT, DEFAULT_VERSION, TIMEOUT_SECONDS, WATCH)
.getItems()
.stream()
.map(n -> n.getMetadata().getName())
Expand Down Expand Up @@ -276,7 +279,7 @@ public List<V1beta1NetworkPolicy> listNetworkPolicies(String namespace, Kubernet
final KubernetesKind kind = KubernetesKind.NETWORK_POLICY;
return runAndRecordMetrics(methodName, namespace, () -> {
try {
V1beta1NetworkPolicyList list = extensionsV1beta1Api.listNamespacedNetworkPolicy(namespace, PRETTY, fieldSelectorString, labelSelectorString, DEFAULT_VERSION, TIMEOUT_SECONDS, WATCH);
V1beta1NetworkPolicyList list = extensionsV1beta1Api.listNamespacedNetworkPolicy(namespace, PRETTY, CONTINUE, fieldSelectorString, INCLUDE_UNINITIALIZED, labelSelectorString, LIMIT, DEFAULT_VERSION, TIMEOUT_SECONDS, WATCH);
return annotateMissingFields(list == null ? new ArrayList<>() : list.getItems(),
V1beta1NetworkPolicy.class,
apiVersion,
Expand Down Expand Up @@ -317,7 +320,7 @@ public List<V1Pod> listPods(String namespace, KubernetesSelectorList fieldSelect
final KubernetesKind kind = KubernetesKind.POD;
return runAndRecordMetrics(methodName, namespace, () -> {
try {
V1PodList list = coreV1Api.listNamespacedPod(namespace, PRETTY, fieldSelectorString, labelSelectorString, DEFAULT_VERSION, TIMEOUT_SECONDS, WATCH);
V1PodList list = coreV1Api.listNamespacedPod(namespace, PRETTY, CONTINUE, fieldSelectorString, INCLUDE_UNINITIALIZED, labelSelectorString, LIMIT, DEFAULT_VERSION, TIMEOUT_SECONDS, WATCH);
return annotateMissingFields(list == null ? new ArrayList<>() : list.getItems(),
V1Pod.class,
apiVersion,
Expand Down Expand Up @@ -352,7 +355,7 @@ public List<V1beta1ReplicaSet> listReplicaSets(String namespace, KubernetesSelec
final KubernetesKind kind = KubernetesKind.REPLICA_SET;
return runAndRecordMetrics(methodName, namespace, () -> {
try {
V1beta1ReplicaSetList list = extensionsV1beta1Api.listNamespacedReplicaSet(namespace, PRETTY, fieldSelectorString, labelSelectorString, DEFAULT_VERSION, TIMEOUT_SECONDS, WATCH);
V1beta1ReplicaSetList list = extensionsV1beta1Api.listNamespacedReplicaSet(namespace, PRETTY, CONTINUE, fieldSelectorString, INCLUDE_UNINITIALIZED, labelSelectorString, LIMIT, DEFAULT_VERSION, TIMEOUT_SECONDS, WATCH);
return annotateMissingFields(list == null ? new ArrayList<>() : list.getItems(),
V1beta1ReplicaSet.class,
apiVersion,
Expand Down

0 comments on commit c05a9e5

Please sign in to comment.