Address review comments

This commit is contained in:
nvazquez 2025-02-25 10:35:12 -03:00
parent 82e0bf534b
commit ddaa65f4f3
No known key found for this signature in database
GPG Key ID: 656E1BCC8CB54F84
10 changed files with 30 additions and 30 deletions

View File

@ -34,7 +34,7 @@ import org.apache.logging.log4j.Logger;
authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User}) authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User})
public class DeleteCniConfigurationCmd extends DeleteUserDataCmd { 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); response.setSuccess(result);
setResponseObject(response); setResponseObject(response);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete userdata"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete CNI configuration");
} }
} }

View File

@ -210,7 +210,7 @@ public class TemplateResponse extends BaseResponseWithTagInformation implements
@SerializedName(ApiConstants.FOR_CKS) @SerializedName(ApiConstants.FOR_CKS)
@Param(description = "If true it indicates that the template can be used for CKS cluster deployments", @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; private Boolean forCks;
@SerializedName(ApiConstants.DEPLOY_AS_IS_DETAILS) @SerializedName(ApiConstants.DEPLOY_AS_IS_DETAILS)

View File

@ -805,8 +805,6 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne
response.setClusterType(kubernetesCluster.getClusterType()); response.setClusterType(kubernetesCluster.getClusterType());
response.setCreated(kubernetesCluster.getCreated()); response.setCreated(kubernetesCluster.getCreated());
return response; return response;
} }
@ -2476,6 +2474,7 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne
KubernetesClusterUpgradeTimeout, KubernetesClusterUpgradeTimeout,
KubernetesClusterUpgradeRetries, KubernetesClusterUpgradeRetries,
KubernetesClusterAddNodeTimeout, KubernetesClusterAddNodeTimeout,
KubernetesClusterRemoveNodeTimeout,
KubernetesClusterExperimentalFeaturesEnabled, KubernetesClusterExperimentalFeaturesEnabled,
KubernetesMaxClusterSize, KubernetesMaxClusterSize,
KubernetesControlNodeInstallAttemptWait, KubernetesControlNodeInstallAttemptWait,

View File

@ -88,13 +88,13 @@ public interface KubernetesClusterService extends PluggableService, Configurable
static final ConfigKey<Long> KubernetesClusterAddNodeTimeout = new ConfigKey<Long>("Advanced", Long.class, static final ConfigKey<Long> KubernetesClusterAddNodeTimeout = new ConfigKey<Long>("Advanced", Long.class,
"cloud.kubernetes.cluster.add.node.timeout", "cloud.kubernetes.cluster.add.node.timeout",
"3600", "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, true,
KubernetesServiceEnabled.key()); KubernetesServiceEnabled.key());
static final ConfigKey<Long> KubernetesClusterRemoveNodeTimeout = new ConfigKey<Long>("Advanced", Long.class, static final ConfigKey<Long> KubernetesClusterRemoveNodeTimeout = new ConfigKey<Long>("Advanced", Long.class,
"cloud.kubernetes.cluster.add.node.timeout", "cloud.kubernetes.cluster.remove.node.timeout",
"900", "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, true,
KubernetesServiceEnabled.key()); KubernetesServiceEnabled.key());
static final ConfigKey<Boolean> KubernetesClusterExperimentalFeaturesEnabled = new ConfigKey<Boolean>("Advanced", Boolean.class, 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, static final ConfigKey<Long> KubernetesControlNodeInstallAttemptWait = new ConfigKey<Long>("Advanced", Long.class,
"cloud.kubernetes.control.node.install.attempt.wait.duration", "cloud.kubernetes.control.node.install.attempt.wait.duration",
"15", "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, true,
KubernetesServiceEnabled.key()); KubernetesServiceEnabled.key());
static final ConfigKey<Long> KubernetesControlNodeInstallReattempts = new ConfigKey<Long>("Advanced", Long.class, static final ConfigKey<Long> KubernetesControlNodeInstallReattempts = new ConfigKey<Long>("Advanced", Long.class,
"cloud.kubernetes.control.node.install.reattempt.count", "cloud.kubernetes.control.node.install.reattempt.count",
"100", "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, true,
KubernetesServiceEnabled.key()); KubernetesServiceEnabled.key());
final ConfigKey<Long> KubernetesWorkerNodeInstallAttemptWait = new ConfigKey<Long>("Advanced", Long.class, final ConfigKey<Long> KubernetesWorkerNodeInstallAttemptWait = new ConfigKey<Long>("Advanced", Long.class,
"cloud.kubernetes.worker.node.install.attempt.wait.duration", "cloud.kubernetes.worker.node.install.attempt.wait.duration",
"30", "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, true,
KubernetesServiceEnabled.key()); KubernetesServiceEnabled.key());
static final ConfigKey<Long> KubernetesWorkerNodeInstallReattempts = new ConfigKey<Long>("Advanced", Long.class, static final ConfigKey<Long> KubernetesWorkerNodeInstallReattempts = new ConfigKey<Long>("Advanced", Long.class,
"cloud.kubernetes.worker.node.install.reattempt.count", "cloud.kubernetes.worker.node.install.reattempt.count",
"40", "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, true,
KubernetesServiceEnabled.key()); KubernetesServiceEnabled.key());
static final ConfigKey<Integer> KubernetesEtcdNodeStartPort = new ConfigKey<Integer>("Advanced", Integer.class, static final ConfigKey<Integer> KubernetesEtcdNodeStartPort = new ConfigKey<Integer>("Advanced", Integer.class,

View File

@ -334,10 +334,10 @@ public class KubernetesClusterStartWorker extends KubernetesClusterResourceModif
} }
private String getInitialEtcdClusterDetails(List<String> ipAddresses, List<String> hostnames) { 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(); StringBuilder clusterInfo = new StringBuilder();
for (int i = 0; i < ipAddresses.size(); i++) { 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) { if (i < ipAddresses.size()-1) {
clusterInfo.append(","); clusterInfo.append(",");
} }
@ -353,7 +353,7 @@ public class KubernetesClusterStartWorker extends KubernetesClusterResourceModif
private String getEtcdEndpointList(List<Network.IpAddresses> ipAddresses) { private String getEtcdEndpointList(List<Network.IpAddresses> ipAddresses) {
StringBuilder endpoints = new StringBuilder(); StringBuilder endpoints = new StringBuilder();
for (int i = 0; i < ipAddresses.size(); i++) { 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) { if (i < ipAddresses.size()-1) {
endpoints.append("\n "); endpoints.append("\n ");
} }

View File

@ -52,8 +52,7 @@ public class AddNodesToKubernetesClusterCmd extends BaseAsyncCmd {
entityType= UserVmResponse.class, entityType= UserVmResponse.class,
description = "comma separated list of (external) node (physical or virtual machines) IDs that need to be" + 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)", "added as worker nodes to an existing managed Kubernetes cluster (CKS)",
required = true, required = true)
since = "4.21.0")
private List<Long> nodeIds; private List<Long> nodeIds;
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true,
@ -62,13 +61,11 @@ public class AddNodesToKubernetesClusterCmd extends BaseAsyncCmd {
private Long clusterId; private Long clusterId;
@Parameter(name = ApiConstants.MOUNT_CKS_ISO_ON_VR, type = CommandType.BOOLEAN, @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", description = "(optional) Vmware only, uses the CKS cluster network VR to mount the CKS ISO")
since = "4.21.0")
private Boolean mountCksIsoOnVr; private Boolean mountCksIsoOnVr;
@Parameter(name = ApiConstants.MANUAL_UPGRADE, type = CommandType.BOOLEAN, @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", description = "(optional) indicates if the node is marked for manual upgrade and excluded from the Kubernetes cluster upgrade operation")
since = "4.21.0")
private Boolean manualUpgrade; private Boolean manualUpgrade;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////

View File

@ -115,18 +115,21 @@ public class CreateKubernetesClusterCmd extends BaseAsyncCreateCmd {
@ACL(accessType = AccessType.UseEntry) @ACL(accessType = AccessType.UseEntry)
@Parameter(name = ApiConstants.NODE_TYPE_OFFERING_MAP, type = CommandType.MAP, @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; private Map<String, Map<String, String>> serviceOfferingNodeTypeMap;
@ACL(accessType = AccessType.UseEntry) @ACL(accessType = AccessType.UseEntry)
@Parameter(name = ApiConstants.NODE_TYPE_TEMPLATE_MAP, type = CommandType.MAP, @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; private Map<String, Map<String, String>> templateNodeTypeMap;
@ACL(accessType = AccessType.UseEntry) @ACL(accessType = AccessType.UseEntry)
@Parameter(name = ApiConstants.ETCD_NODES, type = CommandType.LONG, @Parameter(name = ApiConstants.ETCD_NODES, type = CommandType.LONG,
description = "(Optional) Number of Kubernetes cluster etcd nodes, default is 0." + 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; private Long etcdNodes;
@ACL(accessType = AccessType.UseEntry) @ACL(accessType = AccessType.UseEntry)
@ -200,7 +203,8 @@ public class CreateKubernetesClusterCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.CNI_CONFIG_DETAILS, type = CommandType.MAP, @Parameter(name = ApiConstants.CNI_CONFIG_DETAILS, type = CommandType.MAP,
description = "used to specify the parameters values for the variables in userdata. " + description = "used to specify the parameters values for the variables in userdata. " +
"Example: cniconfigdetails[0].key=accesskey&cniconfigdetails[0].value=s389ddssaa&" + "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; private Map cniConfigDetails;
@Parameter(name=ApiConstants.AS_NUMBER, type=CommandType.LONG, description="the AS Number of the network") @Parameter(name=ApiConstants.AS_NUMBER, type=CommandType.LONG, description="the AS Number of the network")

View File

@ -58,13 +58,12 @@ public class RemoveNodesFromKubernetesClusterCmd extends BaseAsyncCmd {
entityType= UserVmResponse.class, entityType= UserVmResponse.class,
description = "comma separated list of node (physical or virtual machines) IDs that need to be" + description = "comma separated list of node (physical or virtual machines) IDs that need to be" +
"removed from the Kubernetes cluster (CKS)", "removed from the Kubernetes cluster (CKS)",
required = true, required = true)
since = "4.21.0")
private List<Long> nodeIds; private List<Long> nodeIds;
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true, @Parameter(name = ApiConstants.ID, type = CommandType.UUID, required = true,
entityType = KubernetesClusterResponse.class, entityType = KubernetesClusterResponse.class,
description = "the ID of the Kubernetes cluster", since = "4.21.0") description = "the ID of the Kubernetes cluster")
private Long clusterId; private Long clusterId;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////

View File

@ -74,7 +74,8 @@ public class ScaleKubernetesClusterCmd extends BaseAsyncCmd {
@ACL(accessType = SecurityChecker.AccessType.UseEntry) @ACL(accessType = SecurityChecker.AccessType.UseEntry)
@Parameter(name = ApiConstants.NODE_TYPE_OFFERING_MAP, type = CommandType.MAP, @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; protected Map<String, Map<String, String>> serviceOfferingNodeTypeMap;
@Parameter(name=ApiConstants.SIZE, type = CommandType.LONG, @Parameter(name=ApiConstants.SIZE, type = CommandType.LONG,

View File

@ -5417,7 +5417,7 @@ public class ApiResponseHelper implements ResponseGenerator {
String rangeText = String.format("%s-%s", range.getStartASNumber(), range.getEndASNumber()); String rangeText = String.format("%s-%s", range.getStartASNumber(), range.getEndASNumber());
response.setAsNumberRange(rangeText); response.setAsNumberRange(rangeText);
} else { } 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.setAllocated(asn.getAllocatedTime());
response.setAllocationState(asn.isAllocated() ? "Allocated" : "Free"); response.setAllocationState(asn.isAllocated() ? "Allocated" : "Free");