You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/05/31 11:01:30 UTC

stratos git commit: Updating saml-sso sample artifacts and wso2is metadata handler plugin

Repository: stratos
Updated Branches:
  refs/heads/master f60d7dc8a -> 2c7c6aeb4


Updating saml-sso sample artifacts and wso2is metadata handler plugin


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/2c7c6aeb
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/2c7c6aeb
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/2c7c6aeb

Branch: refs/heads/master
Commit: 2c7c6aeb489b4d36f293e2a7728b0c5071f92e17
Parents: f60d7dc
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sun May 31 10:01:26 2015 +0100
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Sun May 31 10:01:26 2015 +0100

----------------------------------------------------------------------
 samples/cartridges/kubernetes/tomcat3.json      |  2 +-
 samples/cartridges/kubernetes/wso2-is.json      |  2 +-
 .../cartridge-docker-images/build.sh            | 17 ++---------
 .../service-images/tomcat-saml-sso/build.sh     | 21 +++++++++++++
 .../service-images/wso2is-saml-sso/build.sh     | 21 +++++++++++++
 .../packs/plugins/WSO2ISMetaDataHandler.py      | 32 +++++++++++++++-----
 6 files changed, 72 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/2c7c6aeb/samples/cartridges/kubernetes/tomcat3.json
----------------------------------------------------------------------
diff --git a/samples/cartridges/kubernetes/tomcat3.json b/samples/cartridges/kubernetes/tomcat3.json
index efdde17..09026f5 100755
--- a/samples/cartridges/kubernetes/tomcat3.json
+++ b/samples/cartridges/kubernetes/tomcat3.json
@@ -20,7 +20,7 @@
     "iaasProvider": [
         {
             "type": "kubernetes",
-            "imageId": "stratos/tomcat:7.0.5-sso-sample",
+            "imageId": "stratos/tomcat:7.0.5-saml-sso",
             "networkInterfaces": [
             ],
             "property": [

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c7c6aeb/samples/cartridges/kubernetes/wso2-is.json
----------------------------------------------------------------------
diff --git a/samples/cartridges/kubernetes/wso2-is.json b/samples/cartridges/kubernetes/wso2-is.json
index 4965f90..8ddaf6c 100644
--- a/samples/cartridges/kubernetes/wso2-is.json
+++ b/samples/cartridges/kubernetes/wso2-is.json
@@ -17,7 +17,7 @@
     "iaasProvider": [
         {
             "type": "kubernetes",
-            "imageId": "stratos/wso2is:4.1.0-sso-sample",
+            "imageId": "stratos/wso2is:5.0.0-sp1-saml-sso",
             "networkInterfaces": [
             ],
             "property": [

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c7c6aeb/tools/docker-images/cartridge-docker-images/build.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/build.sh b/tools/docker-images/cartridge-docker-images/build.sh
index 4a4d057..e0f090b 100755
--- a/tools/docker-images/cartridge-docker-images/build.sh
+++ b/tools/docker-images/cartridge-docker-images/build.sh
@@ -31,24 +31,13 @@ popd
 
 pushd ${script_path}/base-image/
 echo "Building base docker image..."
-docker build -t stratos/base-image:4.1.0-beta .
-
-echo "Pushing base docker image to docker hub..."
-docker push stratos/base-image:4.1.0-beta
-popd
+docker build -t stratos/base-image:4.1.0 .
 
 pushd ${script_path}/service-images/php
 echo "Building php docker image..."
-docker build -t stratos/php:4.1.0-beta .
-
-echo "Pushing php docker image to docker hub..."
-docker push stratos/php:4.1.0-beta
-popd
+docker build -t stratos/php:4.1.0 .
 
 pushd ${script_path}/service-images/tomcat
 echo "Building tomcat docker image..."
-docker build -t stratos/tomcat:4.1.0-beta .
+docker build -t stratos/tomcat:4.1.0 .
 
-echo "Pushing tomcat docker image to docker hub..."
-docker push stratos/tomcat:4.1.0-beta
-popd

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c7c6aeb/tools/docker-images/cartridge-docker-images/service-images/tomcat-saml-sso/build.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/tomcat-saml-sso/build.sh b/tools/docker-images/cartridge-docker-images/service-images/tomcat-saml-sso/build.sh
new file mode 100755
index 0000000..8a8e097
--- /dev/null
+++ b/tools/docker-images/cartridge-docker-images/service-images/tomcat-saml-sso/build.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# ---------------------------------------------------------------
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+# ---------------------------------------------------------------
+
+docker build -t stratos/tomcat:7.0.5-saml-sso .

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c7c6aeb/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/build.sh
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/build.sh b/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/build.sh
new file mode 100755
index 0000000..3791124
--- /dev/null
+++ b/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/build.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# ---------------------------------------------------------------
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+# ---------------------------------------------------------------
+
+docker build -t stratos/wso2is:5.0.0-sp1-saml-sso .

http://git-wip-us.apache.org/repos/asf/stratos/blob/2c7c6aeb/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/packs/plugins/WSO2ISMetaDataHandler.py
----------------------------------------------------------------------
diff --git a/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/packs/plugins/WSO2ISMetaDataHandler.py b/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/packs/plugins/WSO2ISMetaDataHandler.py
index d2e657d..1b7ea7a 100644
--- a/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/packs/plugins/WSO2ISMetaDataHandler.py
+++ b/tools/docker-images/cartridge-docker-images/service-images/wso2is-saml-sso/packs/plugins/WSO2ISMetaDataHandler.py
@@ -114,12 +114,30 @@ class WSO2ISMetaDataHandler(ICartridgeAgentPlugin):
         # publish SAML_ENDPOINT to metadata service
         # member_hostname = socket.gethostname()
         member_hostname = values["HOST_NAME"]
-        payload_ports = values["PORT_MAPPINGS"].split("|")
-        if values.get("LB_CLUSTER_ID") is not None:
-            port_no = payload_ports[2].split(":")[1]
-        else:
-            port_no = payload_ports[1].split(":")[1]
-        saml_endpoint = "https://%s:%s/samlsso" % (member_hostname, port_no)
+
+        # read kubernetes service https port
+        log.info("Reading port mappings...")
+        port_mappings_str = values["PORT_MAPPINGS"]
+        https_port = None
+
+        # port mappings format: "PROTOCOL:http|PORT:80|PROXY_PORT:8280,PROTOCOL:https|PORT:773|PROXY_PORT:9443"
+        log.info("Port mappings: %s" % port_mappings_str)
+        if port_mappings_str is not None:
+
+            port_mappings_array = port_mappings_str.split(";")
+            if port_mappings_array:
+
+                for port_mapping in port_mappings_array:
+                    log.debug("port_mapping: %s" % port_mapping)
+                    name_value_array = port_mapping.split("|")
+                    protocol = name_value_array[1].split(":")[1]
+                    port = name_value_array[2].split(":")[1]
+                    if protocol == "https":
+                        https_port = port
+
+        log.info("Kubernetes service management console https port: %s" % https_port)
+
+        saml_endpoint = "https://%s:%s/samlsso" % (member_hostname, https_port)
         publish_data = mdsclient.MDSPutRequest()
         hostname_entry = {"key": "SAML_ENDPOINT", "values": saml_endpoint}
         properties_data = [hostname_entry]
@@ -137,7 +155,7 @@ class WSO2ISMetaDataHandler(ICartridgeAgentPlugin):
         output, errors = p.communicate()
         log.debug("Set carbon.xml hostname")
 
-        catalina_replace_command = "sed -i \"s/STRATOS_IS_PROXY_PORT/%s/g\" %s" % (port_no, "${CARBON_HOME}/repository/conf/tomcat/catalina-server.xml")
+        catalina_replace_command = "sed -i \"s/STRATOS_IS_PROXY_PORT/%s/g\" %s" % (https_port, "${CARBON_HOME}/repository/conf/tomcat/catalina-server.xml")
 
         p = subprocess.Popen(catalina_replace_command, shell=True)
         output, errors = p.communicate()