Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
import com.cloud.network.Networks;
import com.cloud.network.PhysicalNetwork;
import com.cloud.network.dao.FirewallRulesDao;
import com.cloud.network.dao.IPAddressDao;
import com.cloud.network.dao.IPAddressVO;
import com.cloud.network.dao.NetworkDao;
import com.cloud.network.dao.NetworkVO;
import com.cloud.network.dao.PhysicalNetworkDao;
Expand Down Expand Up @@ -216,6 +218,8 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne
@Inject
protected NetworkDao networkDao;
@Inject
protected IPAddressDao ipAddressDao;
@Inject
protected CapacityManager capacityManager;
@Inject
protected ResourceManager resourceManager;
Expand Down Expand Up @@ -610,6 +614,13 @@ public KubernetesClusterResponse createKubernetesClusterResponse(long kubernetes
response.setEndpoint(kubernetesCluster.getEndpoint());
response.setNetworkId(ntwk.getUuid());
response.setAssociatedNetworkName(ntwk.getName());
if (ntwk.getGuestType() == Network.GuestType.Isolated) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so when SHARED/L2/VPC this needs changing again?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn't be any need. It doesn't support L2 / Shared (since they don't have public IPs) or VPCs as of now, and if support is added, VPC networks are again isolated networks

List<IPAddressVO> ipAddresses = ipAddressDao.listByAssociatedNetwork(ntwk.getId(), true);
if (ipAddresses != null && ipAddresses.size() == 1) {
response.setIpAddress(ipAddresses.get(0).getAddress().addr());
response.setIpAddressId(ipAddresses.get(0).getUuid());
}
}
List<UserVmResponse> vmResponses = new ArrayList<UserVmResponse>();
List<KubernetesClusterVmMapVO> vmList = kubernetesClusterVmMapDao.listByClusterId(kubernetesCluster.getId());
ResponseView respView = ResponseView.Restricted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ public class KubernetesClusterResponse extends BaseResponse implements Controlle
@Param(description = "the list of virtualmachine associated with this Kubernetes cluster")
private List<UserVmResponse> virtualMachines;

@SerializedName(ApiConstants.IP_ADDRESS)
@Param(description = "Public IP Address of the cluster")
private String ipAddress;

@SerializedName(ApiConstants.IP_ADDRESS_ID)
@Param(description = "Public IP Address ID of the cluster")
private String ipAddressId;

public KubernetesClusterResponse() {
}

Expand Down Expand Up @@ -324,4 +332,12 @@ public void setVirtualMachines(List<UserVmResponse> virtualMachines) {
public List<UserVmResponse> getVirtualMachines() {
return virtualMachines;
}

public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}

public void setIpAddressId(String ipAddressId) {
this.ipAddressId = ipAddressId;
}
}