@@ -183,10 +183,12 @@ function validateLoadBalancer {
183
183
case ${loadBalancer} in
184
184
" TRAEFIK" )
185
185
;;
186
+ " VOYAGER" )
187
+ ;;
186
188
" NONE" )
187
189
;;
188
190
* )
189
- validationError " Invalid value for loadBalancer: ${loadBalancer} . Valid values are TRAEFIK and NONE."
191
+ validationError " Invalid value for loadBalancer: ${loadBalancer} . Valid values are TRAEFIK, VOYAGER and NONE."
190
192
;;
191
193
esac
192
194
fi
@@ -339,6 +341,11 @@ function initialize {
339
341
validationError " The template file ${traefikInput} for generating the traefik deployment was not found"
340
342
fi
341
343
344
+ voyagerInput=" ${scriptDir} /voyager-ingress-template.yaml"
345
+ if [ ! -f ${voyagerInput} ]; then
346
+ validationError " The template file ${voyagerInput} for generating the Voyager Ingress was not found"
347
+ fi
348
+
342
349
failIfValidationErrors
343
350
344
351
# Parse the commonn inputs file
@@ -407,6 +414,7 @@ function createYamlFiles {
407
414
dcrOutput=" ${domainOutputDir} /domain-custom-resource.yaml"
408
415
traefikSecurityOutput=" ${domainOutputDir} /weblogic-domain-traefik-security-${clusterNameLC} .yaml"
409
416
traefikOutput=" ${domainOutputDir} /weblogic-domain-traefik-${clusterNameLC} .yaml"
417
+ voyagerOutput=" ${domainOutputDir} /voyager-ingress.yaml"
410
418
411
419
enabledPrefix=" " # uncomment the feature
412
420
disabledPrefix=" # " # comment out the feature
@@ -493,25 +501,40 @@ function createYamlFiles {
493
501
sed -i -e " s:%JAVA_OPTIONS%:${javaOptions} :g" ${dcrOutput}
494
502
sed -i -e " s:%STARTUP_CONTROL%:${startupControl} :g" ${dcrOutput}
495
503
496
- # Traefik file
497
- cp ${traefikInput} ${traefikOutput}
498
- echo Generating ${traefikOutput}
499
- sed -i -e " s:%NAMESPACE%:$namespace :g" ${traefikOutput}
500
- sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${traefikOutput}
501
- sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${traefikOutput}
502
- sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${traefikOutput}
503
- sed -i -e " s:%CLUSTER_NAME_LC%:${clusterNameLC} :g" ${traefikOutput}
504
- sed -i -e " s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort :g" ${traefikOutput}
505
- sed -i -e " s:%LOAD_BALANCER_DASHBOARD_PORT%:$loadBalancerDashboardPort :g" ${traefikOutput}
506
-
507
- # Traefik security file
508
- cp ${traefikSecurityInput} ${traefikSecurityOutput}
509
- echo Generating ${traefikSecurityOutput}
510
- sed -i -e " s:%NAMESPACE%:$namespace :g" ${traefikSecurityOutput}
511
- sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${traefikSecurityOutput}
512
- sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${traefikSecurityOutput}
513
- sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${traefikSecurityOutput}
514
- sed -i -e " s:%CLUSTER_NAME_LC%:${clusterNameLC} :g" ${traefikSecurityOutput}
504
+ if [ " ${loadBalancer} " = " TRAEFIK" ]; then
505
+ # Traefik file
506
+ cp ${traefikInput} ${traefikOutput}
507
+ echo Generating ${traefikOutput}
508
+ sed -i -e " s:%NAMESPACE%:$namespace :g" ${traefikOutput}
509
+ sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${traefikOutput}
510
+ sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${traefikOutput}
511
+ sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${traefikOutput}
512
+ sed -i -e " s:%CLUSTER_NAME_LC%:${clusterNameLC} :g" ${traefikOutput}
513
+ sed -i -e " s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort :g" ${traefikOutput}
514
+ sed -i -e " s:%LOAD_BALANCER_DASHBOARD_PORT%:$loadBalancerDashboardPort :g" ${traefikOutput}
515
+
516
+ # Traefik security file
517
+ cp ${traefikSecurityInput} ${traefikSecurityOutput}
518
+ echo Generating ${traefikSecurityOutput}
519
+ sed -i -e " s:%NAMESPACE%:$namespace :g" ${traefikSecurityOutput}
520
+ sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${traefikSecurityOutput}
521
+ sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${traefikSecurityOutput}
522
+ sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${traefikSecurityOutput}
523
+ sed -i -e " s:%CLUSTER_NAME_LC%:${clusterNameLC} :g" ${traefikSecurityOutput}
524
+ fi
525
+
526
+ if [ " ${loadBalancer} " = " VOYAGER" ]; then
527
+ # Voyager Ingress file
528
+ cp ${voyagerInput} ${voyagerOutput}
529
+ echo Generating ${voyagerOutput}
530
+ sed -i -e " s:%NAMESPACE%:$namespace :g" ${voyagerOutput}
531
+ sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${voyagerOutput}
532
+ sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${voyagerOutput}
533
+ sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${voyagerOutput}
534
+ sed -i -e " s:%MANAGED_SERVER_PORT%:${managedServerPort} :g" ${voyagerOutput}
535
+ sed -i -e " s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort :g" ${voyagerOutput}
536
+ sed -i -e " s:%LOAD_BALANCER_DASHBOARD_PORT%:$loadBalancerDashboardPort :g" ${voyagerOutput}
537
+ fi
515
538
516
539
# Remove any "...yaml-e" files left over from running sed
517
540
rm -f ${domainOutputDir} /* .yaml-e
@@ -604,6 +627,59 @@ function createDomain {
604
627
605
628
}
606
629
630
+ #
631
+ # Deploy Voyager/HAProxy load balancer
632
+ #
633
+ function setupVoyagerLoadBalancer {
634
+ # only deploy Voyager Ingress Controller the first time
635
+ local vpod=` kubectl get pod -n voyager | grep voyager | wc -l`
636
+ if [ " $vpod " == " 0" ]; then
637
+ kubectl create namespace voyager
638
+ curl -fsSL https://raw.githubusercontent.com/appscode/voyager/6.0.0/hack/deploy/voyager.sh \
639
+ | bash -s -- --provider=baremetal --namespace=voyager
640
+ fi
641
+
642
+ # verify Voyager controller pod is ready
643
+ local ready=` kubectl -n voyager get pod | grep voyager-operator | awk ' { print $2; } ' `
644
+ if [ " ${ready} " != " 1/1" ] ; then
645
+ fail " Voyager Ingress Controller is not ready"
646
+ fi
647
+
648
+ # deploy Voyager Ingress resource
649
+ kubectl apply -f ${voyagerOutput}
650
+
651
+ echo Checking Voyager Ingress resource
652
+ local maxwaitsecs=100
653
+ local mstart=` date +%s`
654
+ while : ; do
655
+ local mnow=` date +%s`
656
+ local vdep=` kubectl get ingresses.voyager.appscode.com -n ${namespace} | grep ${domainUID} -voyager | wc | awk ' { print $1; } ' `
657
+ if [ " $vdep " = " 1" ]; then
658
+ echo ' The Voyager Ingress resource ${domainUID}-voyager is created successfully.'
659
+ break
660
+ fi
661
+ if [ $(( mnow - mstart)) -gt $(( maxwaitsecs)) ]; then
662
+ fail " The Voyager Ingress resource ${domainUID} -voyager was not created."
663
+ fi
664
+ sleep 5
665
+ done
666
+
667
+ echo Checking Voyager service
668
+ local maxwaitsecs=100
669
+ local mstart=` date +%s`
670
+ while : ; do
671
+ local mnow=` date +%s`
672
+ local vscv=` kubectl get service ${domainUID} -voyager-stats -n ${namespace} | grep ${domainUID} -voyager-stats | wc | awk ' { print $1; } ' `
673
+ if [ " $vscv " = " 1" ]; then
674
+ echo ' The service ${domainUID}-voyager-stats is created successfully.'
675
+ break
676
+ fi
677
+ if [ $(( mnow - mstart)) -gt $(( maxwaitsecs)) ]; then
678
+ fail " The service ${domainUID} -voyager-stats was not created."
679
+ fi
680
+ sleep 5
681
+ done
682
+ }
607
683
#
608
684
# Deploy traefik load balancer
609
685
#
@@ -702,7 +778,7 @@ function outputJobSummary {
702
778
if [ " ${exposeAdminT3Channel} " = true ]; then
703
779
echo " T3 access is available at t3:${K8S_IP} :${t3ChannelPort} "
704
780
fi
705
- if [ " ${loadBalancer} " = " TRAEFIK" ]; then
781
+ if [ " ${loadBalancer} " = " TRAEFIK" ] || [ " ${loadBalancer} " = " VOYAGER " ] ; then
706
782
echo " The load balancer for cluster '${clusterName} ' is available at http:${K8S_IP} :${loadBalancerWebPort} / (add the application path to the URL)"
707
783
echo " The load balancer dashboard for cluster '${clusterName} ' is available at http:${K8S_IP} :${loadBalancerDashboardPort} "
708
784
echo " "
@@ -716,6 +792,8 @@ function outputJobSummary {
716
792
if [ " ${loadBalancer} " = " TRAEFIK" ]; then
717
793
echo " ${traefikSecurityOutput} "
718
794
echo " ${traefikOutput} "
795
+ elif [ " ${loadBalancer} " = " VOYAGER" ]; then
796
+ echo " ${voyagerOutput} "
719
797
fi
720
798
}
721
799
@@ -746,6 +824,8 @@ if [ "${generateOnly}" = false ]; then
746
824
# Setup load balancer
747
825
if [ " ${loadBalancer} " = " TRAEFIK" ]; then
748
826
setupTraefikLoadBalancer
827
+ elif [ " ${loadBalancer} " = " VOYAGER" ]; then
828
+ setupVoyagerLoadBalancer
749
829
fi
750
830
751
831
# Create the domain custom resource
0 commit comments