@@ -188,10 +188,12 @@ function validateLoadBalancer {
188188 ;;
189189 " APACHE" )
190190 ;;
191+ " VOYAGER" )
192+ ;;
191193 " NONE" )
192194 ;;
193195 * )
194- validationError " Invalid value for loadBalancer: ${loadBalancer} . Valid values are TRAEFIK, APACHE and NONE."
196+ validationError " Invalid value for loadBalancer: ${loadBalancer} . Valid values are APACHE, TRAEFIK, VOYAGER and NONE."
195197 ;;
196198 esac
197199 fi
@@ -352,6 +354,10 @@ function initialize {
352354 apacheInput=" ${scriptDir} /weblogic-domain-apache-template.yaml"
353355 if [ ! -f ${apacheInput} ]; then
354356 validationError " The template file ${apacheInput} for generating the apache-webtier deployment was not found"
357+
358+ voyagerInput=" ${scriptDir} /voyager-ingress-template.yaml"
359+ if [ ! -f ${voyagerInput} ]; then
360+ validationError " The template file ${voyagerInput} for generating the Voyager Ingress was not found"
355361 fi
356362
357363 failIfValidationErrors
@@ -424,7 +430,7 @@ function createYamlFiles {
424430 traefikOutput=" ${domainOutputDir} /weblogic-domain-traefik-${clusterNameLC} .yaml"
425431 apacheOutput=" ${domainOutputDir} /weblogic-domain-apache.yaml"
426432 apacheSecurityOutput=" ${domainOutputDir} /weblogic-domain-apache-security.yaml"
427-
433+ voyagerOutput= " ${domainOutputDir} /voyager-ingress.yaml "
428434
429435 enabledPrefix=" " # uncomment the feature
430436 disabledPrefix=" # " # comment out the feature
@@ -531,8 +537,9 @@ function createYamlFiles {
531537 sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${traefikSecurityOutput}
532538 sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${traefikSecurityOutput}
533539 sed -i -e " s:%CLUSTER_NAME_LC%:${clusterNameLC} :g" ${traefikSecurityOutput}
540+ fi
534541
535- elif [ " ${loadBalancer} " = " APACHE" ]; then
542+ if [ " ${loadBalancer} " = " APACHE" ]; then
536543 # Apache file
537544 cp ${apacheInput} ${apacheOutput}
538545 echo Generating ${apacheOutput}
@@ -565,6 +572,19 @@ function createYamlFiles {
565572 sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${apacheSecurityOutput}
566573 fi
567574
575+ if [ " ${loadBalancer} " = " VOYAGER" ]; then
576+ # Voyager Ingress file
577+ cp ${voyagerInput} ${voyagerOutput}
578+ echo Generating ${voyagerOutput}
579+ sed -i -e " s:%NAMESPACE%:$namespace :g" ${voyagerOutput}
580+ sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${voyagerOutput}
581+ sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${voyagerOutput}
582+ sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${voyagerOutput}
583+ sed -i -e " s:%MANAGED_SERVER_PORT%:${managedServerPort} :g" ${voyagerOutput}
584+ sed -i -e " s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort :g" ${voyagerOutput}
585+ sed -i -e " s:%LOAD_BALANCER_DASHBOARD_PORT%:$loadBalancerDashboardPort :g" ${voyagerOutput}
586+ fi
587+
568588 # Remove any "...yaml-e" files left over from running sed
569589 rm -f ${domainOutputDir} /* .yaml-e
570590}
@@ -656,6 +676,59 @@ function createDomain {
656676
657677}
658678
679+ #
680+ # Deploy Voyager/HAProxy load balancer
681+ #
682+ function setupVoyagerLoadBalancer {
683+ # only deploy Voyager Ingress Controller the first time
684+ local vpod=` kubectl get pod -n voyager | grep voyager | wc -l`
685+ if [ " $vpod " == " 0" ]; then
686+ kubectl create namespace voyager
687+ curl -fsSL https://raw.githubusercontent.com/appscode/voyager/6.0.0/hack/deploy/voyager.sh \
688+ | bash -s -- --provider=baremetal --namespace=voyager
689+ fi
690+
691+ # verify Voyager controller pod is ready
692+ local ready=` kubectl -n voyager get pod | grep voyager-operator | awk ' { print $2; } ' `
693+ if [ " ${ready} " != " 1/1" ] ; then
694+ fail " Voyager Ingress Controller is not ready"
695+ fi
696+
697+ # deploy Voyager Ingress resource
698+ kubectl apply -f ${voyagerOutput}
699+
700+ echo Checking Voyager Ingress resource
701+ local maxwaitsecs=100
702+ local mstart=` date +%s`
703+ while : ; do
704+ local mnow=` date +%s`
705+ local vdep=` kubectl get ingresses.voyager.appscode.com -n ${namespace} | grep ${domainUID} -voyager | wc | awk ' { print $1; } ' `
706+ if [ " $vdep " = " 1" ]; then
707+ echo ' The Voyager Ingress resource ${domainUID}-voyager is created successfully.'
708+ break
709+ fi
710+ if [ $(( mnow - mstart)) -gt $(( maxwaitsecs)) ]; then
711+ fail " The Voyager Ingress resource ${domainUID} -voyager was not created."
712+ fi
713+ sleep 5
714+ done
715+
716+ echo Checking Voyager service
717+ local maxwaitsecs=100
718+ local mstart=` date +%s`
719+ while : ; do
720+ local mnow=` date +%s`
721+ local vscv=` kubectl get service ${domainUID} -voyager-stats -n ${namespace} | grep ${domainUID} -voyager-stats | wc | awk ' { print $1; } ' `
722+ if [ " $vscv " = " 1" ]; then
723+ echo ' The service ${domainUID}-voyager-stats is created successfully.'
724+ break
725+ fi
726+ if [ $(( mnow - mstart)) -gt $(( maxwaitsecs)) ]; then
727+ fail " The service ${domainUID} -voyager-stats was not created."
728+ fi
729+ sleep 5
730+ done
731+ }
659732#
660733# Deploy traefik load balancer
661734#
@@ -798,7 +871,7 @@ function outputJobSummary {
798871 if [ " ${exposeAdminT3Channel} " = true ]; then
799872 echo " T3 access is available at t3:${K8S_IP} :${t3ChannelPort} "
800873 fi
801- if [ " ${loadBalancer} " = " TRAEFIK" ]; then
874+ if [ " ${loadBalancer} " = " TRAEFIK" ] || [ " ${loadBalancer} " = " VOYAGER " ] ; then
802875 echo " The load balancer for cluster '${clusterName} ' is available at http:${K8S_IP} :${loadBalancerWebPort} / (add the application path to the URL)"
803876 echo " The load balancer dashboard for cluster '${clusterName} ' is available at http:${K8S_IP} :${loadBalancerDashboardPort} "
804877 echo " "
@@ -818,7 +891,8 @@ function outputJobSummary {
818891 elif [ " ${loadBalancer} " = " APACHE" ]; then
819892 echo " ${apacheSecurityOutput} "
820893 echo " ${apacheOutput} "
821-
894+ elif [ " ${loadBalancer} " = " VOYAGER" ]; then
895+ echo " ${voyagerOutput} "
822896 fi
823897}
824898
@@ -851,7 +925,8 @@ if [ "${generateOnly}" = false ]; then
851925 setupTraefikLoadBalancer
852926 elif [ " ${loadBalancer} " = " APACHE" ]; then
853927 setupApacheLoadBalancer
854-
928+ elif [ " ${loadBalancer} " = " VOYAGER" ]; then
929+ setupVoyagerLoadBalancer
855930 fi
856931
857932 # Create the domain custom resource
0 commit comments