CKS: Add CNI configuration details to the response and UI

This commit is contained in:
Pearl Dsilva 2024-07-08 07:58:53 -04:00 committed by nvazquez
parent 1dadd257a5
commit e5d377a1ad
No known key found for this signature in database
GPG Key ID: 656E1BCC8CB54F84
6 changed files with 32 additions and 1 deletions

View File

@ -115,6 +115,7 @@ public class ApiConstants {
public static final String CNI_CONFIG = "cniconfig";
public static final String CNI_CONFIG_ID = "cniconfigurationid";
public static final String CNI_CONFIG_DETAILS = "cniconfigdetails";
public static final String CNI_CONFIG_NAME = "cniconfigname";
public static final String COMPONENT = "component";
public static final String CPU_CORE_PER_SOCKET = "cpucorepersocket";
public static final String CPU_NUMBER = "cpunumber";

View File

@ -63,7 +63,9 @@ import com.cloud.kubernetes.cluster.actionworkers.KubernetesClusterAddWorker;
import com.cloud.network.rules.PortForwardingRuleVO;
import com.cloud.network.rules.dao.PortForwardingRulesDao;
import com.cloud.template.TemplateApiService;
import com.cloud.user.UserDataVO;
import com.cloud.user.dao.AccountDao;
import com.cloud.user.dao.UserDataDao;
import com.cloud.uservm.UserVm;
import com.cloud.vm.NicVO;
import com.cloud.vm.UserVmService;
@ -256,6 +258,8 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne
@Inject
protected ServiceOfferingDao serviceOfferingDao;
@Inject
protected UserDataDao userDataDao;
@Inject
protected VMTemplateDao templateDao;
@Inject
protected TemplateJoinDao templateJoinDao;
@ -705,6 +709,12 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne
response.setServiceOfferingName(offering.getName());
}
Long cniConfigId = kubernetesCluster.getCniConfigId();
if (Objects.nonNull(cniConfigId)) {
UserDataVO cniConfig = userDataDao.findById(cniConfigId);
response.setCniConfigId(cniConfig.getUuid());
response.setCniConfigName(cniConfig.getName());
}
setNodeTypeServiceOfferingResponse(response, WORKER, kubernetesCluster.getWorkerServiceOfferingId());
setNodeTypeServiceOfferingResponse(response, CONTROL, kubernetesCluster.getControlServiceOfferingId());
setNodeTypeServiceOfferingResponse(response, ETCD, kubernetesCluster.getEtcdServiceOfferingId());

View File

@ -135,6 +135,14 @@ public class KubernetesClusterResponse extends BaseResponseWithAnnotations imple
@Param(description = "keypair details")
private String keypair;
@SerializedName(ApiConstants.CNI_CONFIG_ID)
@Param(description = "ID of CNI Configuration associated with the cluster")
private String cniConfigId;
@SerializedName(ApiConstants.CNI_CONFIG_NAME)
@Param(description = "Name of CNI Configuration associated with the cluster")
private String cniConfigName;
@Deprecated(since = "4.16")
@SerializedName(ApiConstants.MASTER_NODES)
@Param(description = "the master nodes count for the Kubernetes cluster. This parameter is deprecated, please use 'controlnodes' parameter.")
@ -499,4 +507,12 @@ public class KubernetesClusterResponse extends BaseResponseWithAnnotations imple
public void setClusterType(KubernetesCluster.ClusterType clusterType) {
this.clusterType = clusterType;
}
public void setCniConfigId(String cniConfigId) {
this.cniConfigId = cniConfigId;
}
public void setCniConfigName(String cniConfigName) {
this.cniConfigName = cniConfigName;
}
}

View File

@ -2650,6 +2650,7 @@
"label.usersecretkey": "Secret Key",
"label.create.bucket": "Create Bucket",
"label.cniconfiguration": "CNI Configuration",
"label.cniconfigname": "Associated CNI Configuration",
"label.cniconfigparams": "CNI Configuration parameters",
"message.acquire.ip.failed": "Failed to acquire IP.",
"message.action.acquire.ip": "Please confirm that you want to acquire new IP.",

View File

@ -132,6 +132,9 @@
<div v-else-if="item === 'usersource'">
{{ $t(getUserSourceLabel(dataResource[item])) }}
</div>
<div v-else-if="$route.meta.name === 'kubernetes' && item === 'cniconfigname'">
<router-link :to="{ path: '/cniconfiguration/' + dataResource.cniconfigurationid }">{{ dataResource.cniconfigname }}</router-link>
</div>
<div v-else>{{ dataResource[item] }}</div>
</div>
</a-list-item>

View File

@ -552,7 +552,7 @@ export default {
const filters = ['cloud.managed', 'external.managed']
return filters
},
details: ['name', 'description', 'zonename', 'kubernetesversionname', 'autoscalingenabled', 'minsize', 'maxsize', 'size', 'controlnodes', 'etcdnodes', 'cpunumber', 'memory', 'keypair', 'associatednetworkname', 'account', 'domain', 'zonename', 'clustertype', 'created'],
details: ['name', 'description', 'zonename', 'kubernetesversionname', 'autoscalingenabled', 'minsize', 'maxsize', 'size', 'controlnodes', 'etcdnodes', 'cpunumber', 'memory', 'keypair', 'cniconfigname', 'associatednetworkname', 'account', 'domain', 'zonename', 'clustertype', 'created'],
tabs: [
{
name: 'k8s',