Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Changing UI for portmapping
Browse files Browse the repository at this point in the history
  • Loading branch information
pubudu538 committed Aug 4, 2015
1 parent 874a220 commit 53c9fac
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public boolean equals(Object obj) {

public String toString() {
return "[application-id] " + getApplicationId() + " [cluster-id] " + getClusterId() + ", " +
super.toString() + " [kubernetes-service-port] " + getKubernetesServicePort();
super.toString() + " [kubernetes-service-port] " + getKubernetesServicePort() + ", " +
"[kubernetes-service-type] " + getKubernetesServiceType();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@
"metadataKeys" : [],
"portMapping":[
{
"name":"http-80",
"protocol":"http",
"port":"80",
"proxyPort":"8280"
"proxyPort":"8280",
"kubernetesPortType":"NodePort"
},
{
"name":"http-80",
"protocol":"https",
"port":"443",
"proxyPort":"8243"
"proxyPort":"8243",
"kubernetesPortType":"NodePort"
}
],
"iaasProvider":[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@
"required": ["port", "protocol", "proxyPort"],
"title": "PortMapping",
"properties": {
"name": {
"type": "string",
"id": "root/portMapping/0/name",
"title": "Name",
"default": "http-8280"
},
"protocol": {
"type": "string",
"id": "root/portMapping/0/protocol",
Expand All @@ -147,6 +153,13 @@
"title": "Proxy Port",
"default": "8280",
"format": "number"
},
"kubernetesPortType": {
"type": "string",
"id": "root/portMapping/0/kubernetesPortType",
"title": "Kubernetes Port Type",
"default": "NodePort",
"enum": ["NodePort","ClusterIP"]
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions components/org.apache.stratos.rest.endpoint/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.stratos</groupId>
<artifactId>org.apache.stratos.kubernetes.client</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.stratos</groupId>
<artifactId>org.apache.stratos.cloud.controller.service.stub</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
import org.wso2.carbon.user.core.tenant.Tenant;
import org.wso2.carbon.user.core.tenant.TenantManager;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import org.apache.stratos.kubernetes.client.KubernetesConstants;

import java.rmi.RemoteException;
import java.util.*;
Expand All @@ -104,8 +105,6 @@ public class StratosApiV41Utils {
public static final String APPLICATION_STATUS_DEPLOYED = "Deployed";
public static final String APPLICATION_STATUS_CREATED = "Created";
public static final String APPLICATION_STATUS_UNDEPLOYING = "Undeploying";
public static final String KUBERNETES_SERVICE_TYPE_NODEPORT = "NodePort";
public static final String KUBERNETES_SERVICE_TYPE_CLUSTERIP = "ClusterIP";
public static final String KUBERNETES_IAAS_PROVIDER = "kubernetes";

private static final Log log = LogFactory.getLog(StratosApiV41Utils.class);
Expand Down Expand Up @@ -135,6 +134,7 @@ public static void addCartridge(CartridgeBean cartridgeBean) throws RestAPIExcep
for (IaasProviderBean providers : iaasProviders) {
if (providers.getType().equals(KUBERNETES_IAAS_PROVIDER)) {
isKubernetesIaasProviderAvailable = true;
break;
}
}

Expand All @@ -152,13 +152,12 @@ public static void addCartridge(CartridgeBean cartridgeBean) throws RestAPIExcep

if (isKubernetesIaasProviderAvailable) {
if (type == null) {
throw new RestAPIException((String.format("Type is not found in portmapping: %s - Possible " +
"values - %s and %s", portMapping.getName(), KUBERNETES_SERVICE_TYPE_NODEPORT,
KUBERNETES_SERVICE_TYPE_CLUSTERIP)));
} else if (!type.equals(KUBERNETES_SERVICE_TYPE_NODEPORT) && !type.equals(KUBERNETES_SERVICE_TYPE_CLUSTERIP)) {
throw new RestAPIException((String.format("Type is not found in portmapping: %s - Possible " +
"values - %s and %s", portMapping.getName(), KUBERNETES_SERVICE_TYPE_NODEPORT,
KUBERNETES_SERVICE_TYPE_CLUSTERIP)));
portMapping.setKubernetesPortType(KubernetesConstants.NODE_PORT);
} else if (!type.equals(KubernetesConstants.NODE_PORT) && !type.equals
(KubernetesConstants.CLUSTER_IP)) {
throw new RestAPIException((String.format("Kubernetes" +
"PortType is invalid : %s - Possible values - %s and %s", portMapping.getName(),
KubernetesConstants.NODE_PORT, KubernetesConstants.CLUSTER_IP)));
}
}

Expand Down
3 changes: 2 additions & 1 deletion samples/cartridges/kubernetes/c1.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"name": "http-22",
"protocol": "http",
"port": "22",
"proxyPort": "8280"
"proxyPort": "8280",
"kubernetesPortType":"NodePort"
}
],
"deployment": {
Expand Down
3 changes: 2 additions & 1 deletion samples/cartridges/kubernetes/c2.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"name": "http-22",
"protocol": "http",
"port": "22",
"proxyPort": "8280"
"proxyPort": "8280",
"kubernetesPortType":"NodePort"
}
],
"deployment": {
Expand Down
3 changes: 2 additions & 1 deletion samples/cartridges/kubernetes/c3.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"name": "http-22",
"protocol": "http",
"port": "22",
"proxyPort": "8280"
"proxyPort": "8280",
"kubernetesPortType":"NodePort"
}
],
"deployment": {
Expand Down
3 changes: 2 additions & 1 deletion samples/cartridges/kubernetes/c4.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"name": "http-22",
"protocol": "http",
"port": "22",
"proxyPort": "8280"
"proxyPort": "8280",
"kubernetesPortType":"NodePort"
}
],
"deployment": {
Expand Down
3 changes: 2 additions & 1 deletion samples/cartridges/kubernetes/esb.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"name": "http-22",
"protocol": "http",
"port": "22",
"proxyPort": "8280"
"proxyPort": "8280",
"kubernetesPortType":"NodePort"
}
],
"deployment": {
Expand Down
3 changes: 2 additions & 1 deletion samples/cartridges/kubernetes/tomcat.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"name": "http-8080",
"protocol": "http",
"port": "8080",
"proxyPort": "8281"
"proxyPort": "8281",
"kubernetesPortType":"NodePort"
}
],
"deployment": {
Expand Down
3 changes: 2 additions & 1 deletion samples/cartridges/kubernetes/tomcat1.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"name": "http-22",
"protocol": "http",
"port": "22",
"proxyPort": "8280"
"proxyPort": "8280",
"kubernetesPortType":"NodePort"
}
],
"deployment": {
Expand Down
3 changes: 2 additions & 1 deletion samples/cartridges/kubernetes/tomcat2.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"name": "http-22",
"protocol": "http",
"port": "22",
"proxyPort": "8280"
"proxyPort": "8280",
"kubernetesPortType":"NodePort"
}
],
"deployment": {
Expand Down
3 changes: 2 additions & 1 deletion samples/cartridges/kubernetes/tomcat3.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"name": "tomcat-http",
"protocol": "http",
"port": "8080",
"proxyPort": "8280"
"proxyPort": "8280",
"kubernetesPortType":"NodePort"
}
],
"deployment": {
Expand Down
3 changes: 2 additions & 1 deletion samples/cartridges/kubernetes/wso2-is.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"name": "mgt-console",
"protocol": "https",
"port": "9443",
"proxyPort": "8443"
"proxyPort": "8443",
"kubernetesPortType":"NodePort"
}
],
"iaasProvider": [
Expand Down

0 comments on commit 53c9fac

Please sign in to comment.