@@ -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
@@ -353,6 +355,11 @@ function initialize {
353
355
if [ ! -f ${apacheInput} ]; then
354
356
validationError " The template file ${apacheInput} for generating the apache-webtier deployment was not found"
355
357
fi
358
+
359
+ voyagerInput=" ${scriptDir} /voyager-ingress-template.yaml"
360
+ if [ ! -f ${voyagerInput} ]; then
361
+ validationError " The template file ${voyagerInput} for generating the Voyager Ingress was not found"
362
+ fi
356
363
357
364
failIfValidationErrors
358
365
@@ -424,7 +431,7 @@ function createYamlFiles {
424
431
traefikOutput=" ${domainOutputDir} /weblogic-domain-traefik-${clusterNameLC} .yaml"
425
432
apacheOutput=" ${domainOutputDir} /weblogic-domain-apache.yaml"
426
433
apacheSecurityOutput=" ${domainOutputDir} /weblogic-domain-apache-security.yaml"
427
-
434
+ voyagerOutput= " ${domainOutputDir} /voyager-ingress.yaml "
428
435
429
436
enabledPrefix=" " # uncomment the feature
430
437
disabledPrefix=" # " # comment out the feature
@@ -531,8 +538,9 @@ function createYamlFiles {
531
538
sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${traefikSecurityOutput}
532
539
sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${traefikSecurityOutput}
533
540
sed -i -e " s:%CLUSTER_NAME_LC%:${clusterNameLC} :g" ${traefikSecurityOutput}
541
+ fi
534
542
535
- elif [ " ${loadBalancer} " = " APACHE" ]; then
543
+ if [ " ${loadBalancer} " = " APACHE" ]; then
536
544
# Apache file
537
545
cp ${apacheInput} ${apacheOutput}
538
546
echo Generating ${apacheOutput}
@@ -565,6 +573,19 @@ function createYamlFiles {
565
573
sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${apacheSecurityOutput}
566
574
fi
567
575
576
+ if [ " ${loadBalancer} " = " VOYAGER" ]; then
577
+ # Voyager Ingress file
578
+ cp ${voyagerInput} ${voyagerOutput}
579
+ echo Generating ${voyagerOutput}
580
+ sed -i -e " s:%NAMESPACE%:$namespace :g" ${voyagerOutput}
581
+ sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${voyagerOutput}
582
+ sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${voyagerOutput}
583
+ sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${voyagerOutput}
584
+ sed -i -e " s:%MANAGED_SERVER_PORT%:${managedServerPort} :g" ${voyagerOutput}
585
+ sed -i -e " s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort :g" ${voyagerOutput}
586
+ sed -i -e " s:%LOAD_BALANCER_DASHBOARD_PORT%:$loadBalancerDashboardPort :g" ${voyagerOutput}
587
+ fi
588
+
568
589
# Remove any "...yaml-e" files left over from running sed
569
590
rm -f ${domainOutputDir} /* .yaml-e
570
591
}
@@ -656,6 +677,59 @@ function createDomain {
656
677
657
678
}
658
679
680
+ #
681
+ # Deploy Voyager/HAProxy load balancer
682
+ #
683
+ function setupVoyagerLoadBalancer {
684
+ # only deploy Voyager Ingress Controller the first time
685
+ local vpod=` kubectl get pod -n voyager | grep voyager | wc -l`
686
+ if [ " $vpod " == " 0" ]; then
687
+ kubectl create namespace voyager
688
+ curl -fsSL https://raw.githubusercontent.com/appscode/voyager/6.0.0/hack/deploy/voyager.sh \
689
+ | bash -s -- --provider=baremetal --namespace=voyager
690
+ fi
691
+
692
+ # verify Voyager controller pod is ready
693
+ local ready=` kubectl -n voyager get pod | grep voyager-operator | awk ' { print $2; } ' `
694
+ if [ " ${ready} " != " 1/1" ] ; then
695
+ fail " Voyager Ingress Controller is not ready"
696
+ fi
697
+
698
+ # deploy Voyager Ingress resource
699
+ kubectl apply -f ${voyagerOutput}
700
+
701
+ echo Checking Voyager Ingress resource
702
+ local maxwaitsecs=100
703
+ local mstart=` date +%s`
704
+ while : ; do
705
+ local mnow=` date +%s`
706
+ local vdep=` kubectl get ingresses.voyager.appscode.com -n ${namespace} | grep ${domainUID} -voyager | wc | awk ' { print $1; } ' `
707
+ if [ " $vdep " = " 1" ]; then
708
+ echo ' The Voyager Ingress resource ${domainUID}-voyager is created successfully.'
709
+ break
710
+ fi
711
+ if [ $(( mnow - mstart)) -gt $(( maxwaitsecs)) ]; then
712
+ fail " The Voyager Ingress resource ${domainUID} -voyager was not created."
713
+ fi
714
+ sleep 5
715
+ done
716
+
717
+ echo Checking Voyager service
718
+ local maxwaitsecs=100
719
+ local mstart=` date +%s`
720
+ while : ; do
721
+ local mnow=` date +%s`
722
+ local vscv=` kubectl get service ${domainUID} -voyager-stats -n ${namespace} | grep ${domainUID} -voyager-stats | wc | awk ' { print $1; } ' `
723
+ if [ " $vscv " = " 1" ]; then
724
+ echo ' The service ${domainUID}-voyager-stats is created successfully.'
725
+ break
726
+ fi
727
+ if [ $(( mnow - mstart)) -gt $(( maxwaitsecs)) ]; then
728
+ fail " The service ${domainUID} -voyager-stats was not created."
729
+ fi
730
+ sleep 5
731
+ done
732
+ }
659
733
#
660
734
# Deploy traefik load balancer
661
735
#
@@ -707,6 +781,21 @@ function setupApacheLoadBalancer {
707
781
708
782
apacheName=" ${domainUID} -apache-webtier"
709
783
784
+ echo Setting up apache security
785
+ kubectl apply -f ${apacheSecurityOutput}
786
+
787
+ echo Checking the cluster role ${apacheName} was created
788
+ CLUSTERROLE=` kubectl get clusterroles | grep ${apacheName} | wc | awk ' { print $1; } ' `
789
+ if [ " $CLUSTERROLE " != " 1" ]; then
790
+ fail " The cluster role ${apacheName} was not created"
791
+ fi
792
+
793
+ echo Checking the cluster role binding ${apacheName} was created
794
+ CLUSTERROLEBINDING=` kubectl get clusterrolebindings | grep ${apacheName} | wc | awk ' { print $1; } ' `
795
+ if [ " $CLUSTERROLEBINDING " != " 1" ]; then
796
+ fail " The cluster role binding ${apacheName} was not created"
797
+ fi
798
+
710
799
echo Deploying apache
711
800
kubectl apply -f ${apacheOutput}
712
801
@@ -783,7 +872,7 @@ function outputJobSummary {
783
872
if [ " ${exposeAdminT3Channel} " = true ]; then
784
873
echo " T3 access is available at t3:${K8S_IP} :${t3ChannelPort} "
785
874
fi
786
- if [ " ${loadBalancer} " = " TRAEFIK" ]; then
875
+ if [ " ${loadBalancer} " = " TRAEFIK" ] || [ " ${loadBalancer} " = " VOYAGER " ] ; then
787
876
echo " The load balancer for cluster '${clusterName} ' is available at http:${K8S_IP} :${loadBalancerWebPort} / (add the application path to the URL)"
788
877
echo " The load balancer dashboard for cluster '${clusterName} ' is available at http:${K8S_IP} :${loadBalancerDashboardPort} "
789
878
echo " "
@@ -803,7 +892,8 @@ function outputJobSummary {
803
892
elif [ " ${loadBalancer} " = " APACHE" ]; then
804
893
echo " ${apacheSecurityOutput} "
805
894
echo " ${apacheOutput} "
806
-
895
+ elif [ " ${loadBalancer} " = " VOYAGER" ]; then
896
+ echo " ${voyagerOutput} "
807
897
fi
808
898
}
809
899
@@ -836,7 +926,8 @@ if [ "${generateOnly}" = false ]; then
836
926
setupTraefikLoadBalancer
837
927
elif [ " ${loadBalancer} " = " APACHE" ]; then
838
928
setupApacheLoadBalancer
839
-
929
+ elif [ " ${loadBalancer} " = " VOYAGER" ]; then
930
+ setupVoyagerLoadBalancer
840
931
fi
841
932
842
933
# Create the domain custom resource
0 commit comments