@@ -188,10 +188,12 @@ function validateLoadBalancer {
188
188
;;
189
189
" APACHE" )
190
190
;;
191
+ " VOYAGER" )
192
+ ;;
191
193
" NONE" )
192
194
;;
193
195
* )
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."
195
197
;;
196
198
esac
197
199
fi
@@ -352,6 +354,10 @@ function initialize {
352
354
apacheInput=" ${scriptDir} /weblogic-domain-apache-template.yaml"
353
355
if [ ! -f ${apacheInput} ]; then
354
356
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"
355
361
fi
356
362
357
363
failIfValidationErrors
@@ -424,7 +430,7 @@ function createYamlFiles {
424
430
traefikOutput=" ${domainOutputDir} /weblogic-domain-traefik-${clusterNameLC} .yaml"
425
431
apacheOutput=" ${domainOutputDir} /weblogic-domain-apache.yaml"
426
432
apacheSecurityOutput=" ${domainOutputDir} /weblogic-domain-apache-security.yaml"
427
-
433
+ voyagerOutput= " ${domainOutputDir} /voyager-ingress.yaml "
428
434
429
435
enabledPrefix=" " # uncomment the feature
430
436
disabledPrefix=" # " # comment out the feature
@@ -531,8 +537,9 @@ function createYamlFiles {
531
537
sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${traefikSecurityOutput}
532
538
sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${traefikSecurityOutput}
533
539
sed -i -e " s:%CLUSTER_NAME_LC%:${clusterNameLC} :g" ${traefikSecurityOutput}
540
+ fi
534
541
535
- elif [ " ${loadBalancer} " = " APACHE" ]; then
542
+ if [ " ${loadBalancer} " = " APACHE" ]; then
536
543
# Apache file
537
544
cp ${apacheInput} ${apacheOutput}
538
545
echo Generating ${apacheOutput}
@@ -565,6 +572,19 @@ function createYamlFiles {
565
572
sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${apacheSecurityOutput}
566
573
fi
567
574
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
+
568
588
# Remove any "...yaml-e" files left over from running sed
569
589
rm -f ${domainOutputDir} /* .yaml-e
570
590
}
@@ -656,6 +676,59 @@ function createDomain {
656
676
657
677
}
658
678
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
+ }
659
732
#
660
733
# Deploy traefik load balancer
661
734
#
@@ -798,7 +871,7 @@ function outputJobSummary {
798
871
if [ " ${exposeAdminT3Channel} " = true ]; then
799
872
echo " T3 access is available at t3:${K8S_IP} :${t3ChannelPort} "
800
873
fi
801
- if [ " ${loadBalancer} " = " TRAEFIK" ]; then
874
+ if [ " ${loadBalancer} " = " TRAEFIK" ] || [ " ${loadBalancer} " = " VOYAGER " ] ; then
802
875
echo " The load balancer for cluster '${clusterName} ' is available at http:${K8S_IP} :${loadBalancerWebPort} / (add the application path to the URL)"
803
876
echo " The load balancer dashboard for cluster '${clusterName} ' is available at http:${K8S_IP} :${loadBalancerDashboardPort} "
804
877
echo " "
@@ -818,7 +891,8 @@ function outputJobSummary {
818
891
elif [ " ${loadBalancer} " = " APACHE" ]; then
819
892
echo " ${apacheSecurityOutput} "
820
893
echo " ${apacheOutput} "
821
-
894
+ elif [ " ${loadBalancer} " = " VOYAGER" ]; then
895
+ echo " ${voyagerOutput} "
822
896
fi
823
897
}
824
898
@@ -851,7 +925,8 @@ if [ "${generateOnly}" = false ]; then
851
925
setupTraefikLoadBalancer
852
926
elif [ " ${loadBalancer} " = " APACHE" ]; then
853
927
setupApacheLoadBalancer
854
-
928
+ elif [ " ${loadBalancer} " = " VOYAGER" ]; then
929
+ setupVoyagerLoadBalancer
855
930
fi
856
931
857
932
# Create the domain custom resource
0 commit comments