CKS: add created to k8s cluster and k8s version (#6446)

This PR adds created info to the response of kubernetes clusters and kubernetes supported version.
This commit is contained in:
Wei Zhou 2022-06-30 08:33:12 +02:00 committed by GitHub
parent ae46c33b65
commit a9a2aa953c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 2 deletions

View File

@ -588,6 +588,7 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne
response.setAutoscalingEnabled(kubernetesCluster.getAutoscalingEnabled());
response.setMinSize(kubernetesCluster.getMinSize());
response.setMaxSize(kubernetesCluster.getMaxSize());
response.setCreated(kubernetesCluster.getCreated());
return response;
}

View File

@ -20,6 +20,8 @@ package com.cloud.kubernetes.version;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import java.util.Date;
/**
* KubernetesSupportedVersion describes the properties of supported kubernetes version
*
@ -36,6 +38,7 @@ public interface KubernetesSupportedVersion extends InternalIdentity, Identity {
long getIsoId();
Long getZoneId();
State getState();
Date getCreated();
/**
* @return minimum # of cpu.

View File

@ -158,6 +158,7 @@ public class KubernetesSupportedVersionVO implements KubernetesSupportedVersion
this.minimumRamSize = minimumRamSize;
}
@Override
public Date getCreated() {
return created;
}

View File

@ -105,6 +105,7 @@ public class KubernetesVersionManagerImpl extends ManagerBase implements Kuberne
response.setIsoName(template.getName());
response.setIsoState(template.getState().toString());
}
response.setCreated(kubernetesSupportedVersion.getCreated());
return response;
}

View File

@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.response;
import java.util.Date;
import java.util.List;
import org.apache.cloudstack.api.ApiConstants;
@ -158,6 +159,10 @@ public class KubernetesClusterResponse extends BaseResponseWithAnnotations imple
@Param(description = "Maximum size of the cluster")
private Long maxSize;
@SerializedName(ApiConstants.CREATED)
@Param(description = "the date when this Kubernetes cluster was created")
private Date created;
public KubernetesClusterResponse() {
}
@ -377,4 +382,8 @@ public class KubernetesClusterResponse extends BaseResponseWithAnnotations imple
public void setMaxSize(Long maxSize) {
this.maxSize = maxSize;
}
public void setCreated(Date created) {
this.created = created;
}
}

View File

@ -25,6 +25,8 @@ import com.cloud.kubernetes.version.KubernetesSupportedVersion;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
@SuppressWarnings("unused")
@EntityReference(value = {KubernetesSupportedVersion.class})
public class KubernetesSupportedVersionResponse extends BaseResponse {
@ -80,6 +82,10 @@ public class KubernetesSupportedVersionResponse extends BaseResponse {
@Param(description = "the minimum RAM size in MB needed for the Kubernetes supported version")
private Integer minimumRamSize;
@SerializedName(ApiConstants.CREATED)
@Param(description = "the date when this Kubernetes supported version was created")
private Date created;
public String getId() {
return id;
}
@ -183,4 +189,8 @@ public class KubernetesSupportedVersionResponse extends BaseResponse {
public void setSupportsAutoscaling(Boolean supportsAutoscaling) {
this.supportsAutoscaling = supportsAutoscaling;
}
public void setCreated(Date created) {
this.created = created;
}
}

View File

@ -435,7 +435,7 @@ export default {
fields.push('zonename')
return fields
},
details: ['name', 'description', 'zonename', 'kubernetesversionname', 'autoscalingenabled', 'minsize', 'maxsize', 'size', 'controlnodes', 'cpunumber', 'memory', 'keypair', 'associatednetworkname', 'account', 'domain', 'zonename'],
details: ['name', 'description', 'zonename', 'kubernetesversionname', 'autoscalingenabled', 'minsize', 'maxsize', 'size', 'controlnodes', 'cpunumber', 'memory', 'keypair', 'associatednetworkname', 'account', 'domain', 'zonename', 'created'],
tabs: [{
name: 'k8s',
component: shallowRef(defineAsyncComponent(() => import('@/views/compute/KubernetesServiceTab.vue')))

View File

@ -323,7 +323,7 @@ export default {
docHelp: 'plugins/cloudstack-kubernetes-service.html#kubernetes-supported-versions',
permission: ['listKubernetesSupportedVersions'],
columns: ['name', 'state', 'semanticversion', 'isostate', 'mincpunumber', 'minmemory', 'zonename'],
details: ['name', 'semanticversion', 'supportsautoscaling', 'zoneid', 'zonename', 'isoid', 'isoname', 'isostate', 'mincpunumber', 'minmemory', 'supportsha', 'state'],
details: ['name', 'semanticversion', 'supportsautoscaling', 'zoneid', 'zonename', 'isoid', 'isoname', 'isostate', 'mincpunumber', 'minmemory', 'supportsha', 'state', 'created'],
actions: [
{
api: 'addKubernetesSupportedVersion',