-
Notifications
You must be signed in to change notification settings - Fork 1k
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
K8s client staging #1831
K8s client staging #1831
Changes from 15 commits
2d3ca67
00dd525
38abb93
56b28ed
91d577b
bdbcca4
a5e4a49
7736c5f
c039100
00ec201
e07b638
a4ef89b
0ece2bd
b26485c
455bdf7
fd5c378
5401ad8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ import io.kubernetes.client.ApiException | |
import io.kubernetes.client.Configuration | ||
import io.kubernetes.client.apis.AppsV1beta1Api | ||
import io.kubernetes.client.models.* | ||
import io.kubernetes.client.apis.ExtensionsV1beta1Api | ||
|
||
import java.util.concurrent.TimeUnit | ||
|
||
|
@@ -40,6 +41,7 @@ class KubernetesClientApiAdapter { | |
final Clock spectatorClock | ||
final ApiClient client | ||
final AppsV1beta1Api apiInstance | ||
final ExtensionsV1beta1Api extApi | ||
|
||
public spectatorRegistry() { return spectatorRegistry } | ||
|
||
|
@@ -55,6 +57,7 @@ class KubernetesClientApiAdapter { | |
client = config.getApiCient() | ||
Configuration.setDefaultApiClient(client) | ||
apiInstance = new AppsV1beta1Api(); | ||
extApi = new ExtensionsV1beta1Api() | ||
} | ||
|
||
KubernetesOperationException formatException(String operation, String namespace, ApiException e) { | ||
|
@@ -134,4 +137,15 @@ class KubernetesClientApiAdapter { | |
return statefulSets | ||
} | ||
} | ||
|
||
List<V1beta1StatefulSet> getDaemonSets(String namespace) { | ||
exceptionWrapper("daemonSets.list", "Get Daemon Sets", namespace) { | ||
V1beta1DaemonSetList list = extApi.listNamespacedDaemonSet(namespace, null, null, null, null, API_CALL_TIMEOUT_SECONDS, null) | ||
List<V1beta1DaemonSet> daemonSet = new ArrayList<V1beta1DaemonSet>() | ||
list.items?.forEach({ item -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can just return |
||
daemonSet.add(item) | ||
}) | ||
return daemonSet | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ import io.fabric8.kubernetes.api.model.ReplicationController | |
import io.fabric8.kubernetes.api.model.HorizontalPodAutoscaler | ||
import io.fabric8.kubernetes.api.model.extensions.ReplicaSet | ||
import io.fabric8.kubernetes.client.internal.SerializationUtils | ||
import io.kubernetes.client.models.V1beta1DaemonSet | ||
import io.kubernetes.client.models.V1beta1StatefulSet | ||
|
||
@CompileStatic | ||
|
@@ -126,6 +127,30 @@ class KubernetesServerGroup implements ServerGroup, Serializable { | |
} | ||
} | ||
|
||
KubernetesServerGroup(V1beta1DaemonSet daemonSet, String account, List<Event> events) { | ||
this.name = daemonSet.metadata?.name | ||
this.account = account | ||
this.region = daemonSet.metadata?.namespace | ||
this.namespace = this.region | ||
this.createdTime = daemonSet.metadata?.creationTimestamp?.getMillis() | ||
this.zones = [this.region] as Set | ||
this.securityGroups = [] | ||
/** | ||
* Need to check if this is required or not | ||
*/ | ||
//this.replicas = daemonSet.spec?.replicas ?: 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it makes sense to keep for translating here, because this way you can see how many replicas are running in your cluster from the Spinnaker UI. |
||
this.launchConfig = [:] | ||
this.labels = daemonSet.spec?.template?.metadata?.labels | ||
/** | ||
* Will fetch this valu in next Pull Request | ||
*/ | ||
//this.deployDescription = KubernetesClientApiConverter.fromStatefulSet(daemonSet) | ||
this.kind = daemonSet.kind | ||
this.events = events?.collect { | ||
new KubernetesEvent(it) | ||
} | ||
} | ||
|
||
KubernetesServerGroup(ReplicaSet replicaSet, String account, List<Event> events, HorizontalPodAutoscaler autoscaler) { | ||
this.name = replicaSet.metadata?.name | ||
this.account = account | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space before "io"