mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Address review comments
This commit is contained in:
		
							parent
							
								
									82e0bf534b
								
							
						
					
					
						commit
						ddaa65f4f3
					
				| @ -34,7 +34,7 @@ import org.apache.logging.log4j.Logger; | ||||
|         authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) | ||||
| public class DeleteCniConfigurationCmd extends DeleteUserDataCmd { | ||||
| 
 | ||||
|     public static final Logger logger = LogManager.getLogger(DeleteUserDataCmd.class.getName()); | ||||
|     public static final Logger logger = LogManager.getLogger(DeleteCniConfigurationCmd.class.getName()); | ||||
| 
 | ||||
| 
 | ||||
|     ///////////////////////////////////////////////////// | ||||
| @ -49,7 +49,7 @@ public class DeleteCniConfigurationCmd extends DeleteUserDataCmd { | ||||
|             response.setSuccess(result); | ||||
|             setResponseObject(response); | ||||
|         } else { | ||||
|             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete userdata"); | ||||
|             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete CNI configuration"); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -210,7 +210,7 @@ public class TemplateResponse extends BaseResponseWithTagInformation implements | ||||
| 
 | ||||
|     @SerializedName(ApiConstants.FOR_CKS) | ||||
|     @Param(description = "If true it indicates that the template can be used for CKS cluster deployments", | ||||
|             since = "4.20") | ||||
|             since = "4.21.0") | ||||
|     private Boolean forCks; | ||||
| 
 | ||||
|     @SerializedName(ApiConstants.DEPLOY_AS_IS_DETAILS) | ||||
|  | ||||
| @ -805,8 +805,6 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne | ||||
|         response.setClusterType(kubernetesCluster.getClusterType()); | ||||
|         response.setCreated(kubernetesCluster.getCreated()); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         return response; | ||||
|     } | ||||
| 
 | ||||
| @ -2476,6 +2474,7 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne | ||||
|             KubernetesClusterUpgradeTimeout, | ||||
|             KubernetesClusterUpgradeRetries, | ||||
|             KubernetesClusterAddNodeTimeout, | ||||
|             KubernetesClusterRemoveNodeTimeout, | ||||
|             KubernetesClusterExperimentalFeaturesEnabled, | ||||
|             KubernetesMaxClusterSize, | ||||
|             KubernetesControlNodeInstallAttemptWait, | ||||
|  | ||||
| @ -88,13 +88,13 @@ public interface KubernetesClusterService extends PluggableService, Configurable | ||||
|     static final ConfigKey<Long> KubernetesClusterAddNodeTimeout = new ConfigKey<Long>("Advanced", Long.class, | ||||
|             "cloud.kubernetes.cluster.add.node.timeout", | ||||
|             "3600", | ||||
|             "Timeout interval (in seconds) in which an external node(VM / baremetal host) addition to a cluster should be completed", | ||||
|             "Timeout interval (in seconds) in which an external node (VM / baremetal host) addition to a cluster should be completed", | ||||
|             true, | ||||
|             KubernetesServiceEnabled.key()); | ||||
|     static final ConfigKey<Long> KubernetesClusterRemoveNodeTimeout = new ConfigKey<Long>("Advanced", Long.class, | ||||
|             "cloud.kubernetes.cluster.add.node.timeout", | ||||
|             "cloud.kubernetes.cluster.remove.node.timeout", | ||||
|             "900", | ||||
|             "Timeout interval (in seconds) in which an external node(VM / baremetal host) removal from a cluster should be completed", | ||||
|             "Timeout interval (in seconds) in which an external node (VM / baremetal host) removal from a cluster should be completed", | ||||
|             true, | ||||
|             KubernetesServiceEnabled.key()); | ||||
|     static final ConfigKey<Boolean> KubernetesClusterExperimentalFeaturesEnabled = new ConfigKey<Boolean>("Advanced", Boolean.class, | ||||
| @ -113,25 +113,25 @@ public interface KubernetesClusterService extends PluggableService, Configurable | ||||
|     static final ConfigKey<Long> KubernetesControlNodeInstallAttemptWait = new ConfigKey<Long>("Advanced", Long.class, | ||||
|             "cloud.kubernetes.control.node.install.attempt.wait.duration", | ||||
|             "15", | ||||
|             "Time in seconds for the installation process to wait before it re-attempts", | ||||
|             "Control Nodes: Time in seconds for the installation process to wait before it re-attempts", | ||||
|             true, | ||||
|             KubernetesServiceEnabled.key()); | ||||
|     static final ConfigKey<Long> KubernetesControlNodeInstallReattempts = new ConfigKey<Long>("Advanced", Long.class, | ||||
|             "cloud.kubernetes.control.node.install.reattempt.count", | ||||
|             "100", | ||||
|             "Number of times the offline installation of K8S will be re-attempted", | ||||
|             "Control Nodes: Number of times the offline installation of K8S will be re-attempted", | ||||
|             true, | ||||
|             KubernetesServiceEnabled.key()); | ||||
|     final ConfigKey<Long> KubernetesWorkerNodeInstallAttemptWait = new ConfigKey<Long>("Advanced", Long.class, | ||||
|             "cloud.kubernetes.worker.node.install.attempt.wait.duration", | ||||
|             "30", | ||||
|             "Time in seconds for the installation process to wait before it re-attempts", | ||||
|             "Worker Nodes: Time in seconds for the installation process to wait before it re-attempts", | ||||
|             true, | ||||
|             KubernetesServiceEnabled.key()); | ||||
|     static final ConfigKey<Long> KubernetesWorkerNodeInstallReattempts = new ConfigKey<Long>("Advanced", Long.class, | ||||
|             "cloud.kubernetes.worker.node.install.reattempt.count", | ||||
|             "40", | ||||
|             "Number of times the offline installation of K8S will be re-attempted", | ||||
|             "Worker Nodes: Number of times the offline installation of K8S will be re-attempted", | ||||
|             true, | ||||
|             KubernetesServiceEnabled.key()); | ||||
|     static final ConfigKey<Integer> KubernetesEtcdNodeStartPort = new ConfigKey<Integer>("Advanced", Integer.class, | ||||
|  | ||||
| @ -334,10 +334,10 @@ public class KubernetesClusterStartWorker extends KubernetesClusterResourceModif | ||||
|     } | ||||
| 
 | ||||
|     private String getInitialEtcdClusterDetails(List<String> ipAddresses, List<String> hostnames) { | ||||
|         String initialCluster = "%s=http://%s:2380"; | ||||
|         String initialCluster = "%s=http://%s:%s"; | ||||
|         StringBuilder clusterInfo = new StringBuilder(); | ||||
|             for (int i = 0; i < ipAddresses.size(); i++) { | ||||
|                 clusterInfo.append(String.format(initialCluster, hostnames.get(i), ipAddresses.get(i))); | ||||
|                 clusterInfo.append(String.format(initialCluster, hostnames.get(i), ipAddresses.get(i), KubernetesClusterActionWorker.ETCD_NODE_PEER_COMM_PORT)); | ||||
|                 if (i < ipAddresses.size()-1) { | ||||
|                     clusterInfo.append(","); | ||||
|                 } | ||||
| @ -353,7 +353,7 @@ public class KubernetesClusterStartWorker extends KubernetesClusterResourceModif | ||||
|     private String getEtcdEndpointList(List<Network.IpAddresses> ipAddresses) { | ||||
|         StringBuilder endpoints = new StringBuilder(); | ||||
|         for (int i = 0; i < ipAddresses.size(); i++) { | ||||
|             endpoints.append(String.format("- http://%s:2379", ipAddresses.get(i).getIp4Address())); | ||||
|             endpoints.append(String.format("- http://%s:%s", ipAddresses.get(i).getIp4Address(), KubernetesClusterActionWorker.ETCD_NODE_CLIENT_REQUEST_PORT)); | ||||
|             if (i < ipAddresses.size()-1) { | ||||
|                 endpoints.append("\n          "); | ||||
|             } | ||||
|  | ||||
| @ -52,8 +52,7 @@ public class AddNodesToKubernetesClusterCmd extends BaseAsyncCmd { | ||||
|             entityType= UserVmResponse.class, | ||||
|             description = "comma separated list of (external) node (physical or virtual machines) IDs that need to be" + | ||||
|                     "added as worker nodes to an existing managed Kubernetes cluster (CKS)", | ||||
|             required = true, | ||||
|             since = "4.21.0") | ||||
|             required = true) | ||||
|     private List<Long> nodeIds; | ||||
| 
 | ||||
|     @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, | ||||
| @ -62,13 +61,11 @@ public class AddNodesToKubernetesClusterCmd extends BaseAsyncCmd { | ||||
|     private Long clusterId; | ||||
| 
 | ||||
|     @Parameter(name = ApiConstants.MOUNT_CKS_ISO_ON_VR, type = CommandType.BOOLEAN, | ||||
|             description = "(optional) Vmware only, uses the CKS cluster network VR to mount the CKS ISO", | ||||
|             since = "4.21.0") | ||||
|             description = "(optional) Vmware only, uses the CKS cluster network VR to mount the CKS ISO") | ||||
|     private Boolean mountCksIsoOnVr; | ||||
| 
 | ||||
|     @Parameter(name = ApiConstants.MANUAL_UPGRADE, type = CommandType.BOOLEAN, | ||||
|             description = "(optional) indicates if the node is marked for manual upgrade and excluded from the Kubernetes cluster upgrade operation", | ||||
|             since = "4.21.0") | ||||
|             description = "(optional) indicates if the node is marked for manual upgrade and excluded from the Kubernetes cluster upgrade operation") | ||||
|     private Boolean manualUpgrade; | ||||
| 
 | ||||
|     ///////////////////////////////////////////////////// | ||||
|  | ||||
| @ -115,18 +115,21 @@ public class CreateKubernetesClusterCmd extends BaseAsyncCreateCmd { | ||||
| 
 | ||||
|     @ACL(accessType = AccessType.UseEntry) | ||||
|     @Parameter(name = ApiConstants.NODE_TYPE_OFFERING_MAP, type = CommandType.MAP, | ||||
|             description = "(Optional) Node Type to Service Offering ID mapping. If provided, it overrides the serviceofferingid parameter") | ||||
|             description = "(Optional) Node Type to Service Offering ID mapping. If provided, it overrides the serviceofferingid parameter", | ||||
|             since = "4.21.0") | ||||
|     private Map<String, Map<String, String>> serviceOfferingNodeTypeMap; | ||||
| 
 | ||||
|     @ACL(accessType = AccessType.UseEntry) | ||||
|     @Parameter(name = ApiConstants.NODE_TYPE_TEMPLATE_MAP, type = CommandType.MAP, | ||||
|             description = "(Optional) Node Type to Template ID mapping. If provided, it overrides the default template: System VM template") | ||||
|             description = "(Optional) Node Type to Template ID mapping. If provided, it overrides the default template: System VM template", | ||||
|             since = "4.21.0") | ||||
|     private Map<String, Map<String, String>> templateNodeTypeMap; | ||||
| 
 | ||||
|     @ACL(accessType = AccessType.UseEntry) | ||||
|     @Parameter(name = ApiConstants.ETCD_NODES, type = CommandType.LONG, | ||||
|             description = "(Optional) Number of Kubernetes cluster etcd nodes, default is 0." + | ||||
|                     "In case the number is greater than 0, etcd nodes are separate from master nodes and are provisioned accordingly") | ||||
|                     "In case the number is greater than 0, etcd nodes are separate from master nodes and are provisioned accordingly", | ||||
|             since = "4.21.0") | ||||
|     private Long etcdNodes; | ||||
| 
 | ||||
|     @ACL(accessType = AccessType.UseEntry) | ||||
| @ -200,7 +203,8 @@ public class CreateKubernetesClusterCmd extends BaseAsyncCreateCmd { | ||||
|     @Parameter(name = ApiConstants.CNI_CONFIG_DETAILS, type = CommandType.MAP, | ||||
|             description = "used to specify the parameters values for the variables in userdata. " + | ||||
|                     "Example: cniconfigdetails[0].key=accesskey&cniconfigdetails[0].value=s389ddssaa&" + | ||||
|                     "cniconfigdetails[1].key=secretkey&cniconfigdetails[1].value=8dshfsss", since = "4.21.0") | ||||
|                     "cniconfigdetails[1].key=secretkey&cniconfigdetails[1].value=8dshfsss", | ||||
|             since = "4.21.0") | ||||
|     private Map cniConfigDetails; | ||||
| 
 | ||||
|     @Parameter(name=ApiConstants.AS_NUMBER, type=CommandType.LONG, description="the AS Number of the network") | ||||
|  | ||||
| @ -58,13 +58,12 @@ public class RemoveNodesFromKubernetesClusterCmd extends BaseAsyncCmd { | ||||
|             entityType= UserVmResponse.class, | ||||
|             description = "comma separated list of node (physical or virtual machines) IDs that need to be" + | ||||
|                     "removed from the Kubernetes cluster (CKS)", | ||||
|             required = true, | ||||
|             since = "4.21.0") | ||||
|             required = true) | ||||
|     private List<Long> nodeIds; | ||||
| 
 | ||||
|     @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, | ||||
|             entityType = KubernetesClusterResponse.class, | ||||
|             description = "the ID of the Kubernetes cluster", since = "4.21.0") | ||||
|             description = "the ID of the Kubernetes cluster") | ||||
|     private Long clusterId; | ||||
| 
 | ||||
|     ///////////////////////////////////////////////////// | ||||
|  | ||||
| @ -74,7 +74,8 @@ public class ScaleKubernetesClusterCmd extends BaseAsyncCmd { | ||||
| 
 | ||||
|     @ACL(accessType = SecurityChecker.AccessType.UseEntry) | ||||
|     @Parameter(name = ApiConstants.NODE_TYPE_OFFERING_MAP, type = CommandType.MAP, | ||||
|             description = "(Optional) Node Type to Service Offering ID mapping. If provided, it overrides the serviceofferingid parameter") | ||||
|             description = "(Optional) Node Type to Service Offering ID mapping. If provided, it overrides the serviceofferingid parameter", | ||||
|             since = "4.21.0") | ||||
|     protected Map<String, Map<String, String>> serviceOfferingNodeTypeMap; | ||||
| 
 | ||||
|     @Parameter(name=ApiConstants.SIZE, type = CommandType.LONG, | ||||
|  | ||||
| @ -5417,7 +5417,7 @@ public class ApiResponseHelper implements ResponseGenerator { | ||||
|             String rangeText = String.format("%s-%s", range.getStartASNumber(), range.getEndASNumber()); | ||||
|             response.setAsNumberRange(rangeText); | ||||
|         } else { | ||||
|             logger.info("is null for as number: "+ asn.getAsNumber()); | ||||
|             logger.info("Range is null for AS number: "+ asn.getAsNumber()); | ||||
|         } | ||||
|         response.setAllocated(asn.getAllocatedTime()); | ||||
|         response.setAllocationState(asn.isAllocated() ? "Allocated" : "Free"); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user