92
92
#
93
93
function initAndValidateOutputDir {
94
94
domainOutputDir=" ${outputDir} /weblogic-domains/${domainUID} "
95
+
95
96
validateOutputDir \
96
97
${domainOutputDir} \
97
98
${valuesInputFile} \
@@ -100,6 +101,8 @@ function initAndValidateOutputDir {
100
101
weblogic-domain-pvc.yaml \
101
102
weblogic-domain-traefik-${clusterNameLC} .yaml \
102
103
weblogic-domain-traefik-security-${clusterNameLC} .yaml \
104
+ weblogic-domain-apache.yaml \
105
+ weblogic-domain-apache-security.yaml \
103
106
create-weblogic-domain-job.yaml \
104
107
domain-custom-resource.yaml
105
108
}
@@ -183,12 +186,14 @@ function validateLoadBalancer {
183
186
case ${loadBalancer} in
184
187
" TRAEFIK" )
185
188
;;
189
+ " APACHE" )
190
+ ;;
186
191
" VOYAGER" )
187
192
;;
188
193
" NONE" )
189
194
;;
190
195
* )
191
- validationError " Invalid value for loadBalancer: ${loadBalancer} . Valid values are TRAEFIK, VOYAGER and NONE."
196
+ validationError " Invalid value for loadBalancer: ${loadBalancer} . Valid values are APACHE, TRAEFIK, VOYAGER and NONE."
192
197
;;
193
198
esac
194
199
fi
@@ -341,6 +346,15 @@ function initialize {
341
346
validationError " The template file ${traefikInput} for generating the traefik deployment was not found"
342
347
fi
343
348
349
+ apacheSecurityInput=" ${scriptDir} /weblogic-domain-apache-security-template.yaml"
350
+ if [ ! -f ${apacheSecurityInput} ]; then
351
+ validationError " The file ${apacheSecurityInput} for generating the apache-webtier RBAC was not found"
352
+ fi
353
+
354
+ apacheInput=" ${scriptDir} /weblogic-domain-apache-template.yaml"
355
+ if [ ! -f ${apacheInput} ]; then
356
+ validationError " The template file ${apacheInput} for generating the apache-webtier deployment was not found"
357
+
344
358
voyagerInput=" ${scriptDir} /voyager-ingress-template.yaml"
345
359
if [ ! -f ${voyagerInput} ]; then
346
360
validationError " The template file ${voyagerInput} for generating the Voyager Ingress was not found"
@@ -414,6 +428,8 @@ function createYamlFiles {
414
428
dcrOutput=" ${domainOutputDir} /domain-custom-resource.yaml"
415
429
traefikSecurityOutput=" ${domainOutputDir} /weblogic-domain-traefik-security-${clusterNameLC} .yaml"
416
430
traefikOutput=" ${domainOutputDir} /weblogic-domain-traefik-${clusterNameLC} .yaml"
431
+ apacheOutput=" ${domainOutputDir} /weblogic-domain-apache.yaml"
432
+ apacheSecurityOutput=" ${domainOutputDir} /weblogic-domain-apache-security.yaml"
417
433
voyagerOutput=" ${domainOutputDir} /voyager-ingress.yaml"
418
434
419
435
enabledPrefix=" " # uncomment the feature
@@ -523,6 +539,39 @@ function createYamlFiles {
523
539
sed -i -e " s:%CLUSTER_NAME_LC%:${clusterNameLC} :g" ${traefikSecurityOutput}
524
540
fi
525
541
542
+ if [ " ${loadBalancer} " = " APACHE" ]; then
543
+ # Apache file
544
+ cp ${apacheInput} ${apacheOutput}
545
+ echo Generating ${apacheOutput}
546
+ sed -i -e " s:%NAMESPACE%:$namespace :g" ${apacheOutput}
547
+ sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${apacheOutput}
548
+ sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${apacheOutput}
549
+ sed -i -e " s:%CLUSTER_NAME_LC%:${clusterNameLC} :g" ${apacheOutput}
550
+ sed -i -e " s:%ADMIN_SERVER_NAME%:${adminServerName} :g" ${apacheOutput}
551
+ sed -i -e " s:%ADMIN_PORT%:${adminPort} :g" ${apacheOutput}
552
+ sed -i -e " s:%MANAGED_SERVER_PORT%:${managedServerPort} :g" ${apacheOutput}
553
+ sed -i -e " s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort :g" ${apacheOutput}
554
+ sed -i -e " s:%WEB_APP_PREPATH%:$loadBalancerAppPrepath :g" ${apacheOutput}
555
+
556
+ if [ ! -z " ${loadBalancerVolumePath} " ]; then
557
+ sed -i -e " s:%LOAD_BALANCER_VOLUME_PATH%:${loadBalancerVolumePath} :g" ${apacheOutput}
558
+ sed -i -e " s:# volumes:volumes:g" ${apacheOutput}
559
+ sed -i -e " s:# - name:- name:g" ${apacheOutput}
560
+ sed -i -e " s:# hostPath: hostPath:g" ${apacheOutput}
561
+ sed -i -e " s:# path: path:g" ${apacheOutput}
562
+ sed -i -e " s:# volumeMounts:volumeMounts:g" ${apacheOutput}
563
+ sed -i -e " s:# - name:- name:g" ${apacheOutput}
564
+ sed -i -e " s:# mountPath: mountPath:g" ${apacheOutput}
565
+ fi
566
+
567
+ # Apache security file
568
+ cp ${apacheSecurityInput} ${apacheSecurityOutput}
569
+ echo Generating ${apacheSecurityOutput}
570
+ sed -i -e " s:%NAMESPACE%:$namespace :g" ${apacheSecurityOutput}
571
+ sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${apacheSecurityOutput}
572
+ sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${apacheSecurityOutput}
573
+ fi
574
+
526
575
if [ " ${loadBalancer} " = " VOYAGER" ]; then
527
576
# Voyager Ingress file
528
577
cp ${voyagerInput} ${voyagerOutput}
@@ -724,6 +773,50 @@ function setupTraefikLoadBalancer {
724
773
fi
725
774
}
726
775
776
+ #
777
+ # Deploy Apache load balancer
778
+ #
779
+ function setupApacheLoadBalancer {
780
+
781
+ apacheName=" ${domainUID} -apache-webtier"
782
+
783
+ echo Setting up apache security
784
+ kubectl apply -f ${apacheSecurityOutput}
785
+
786
+ echo Checking the cluster role ${apacheName} was created
787
+ CLUSTERROLE=` kubectl get clusterroles | grep ${apacheName} | wc | awk ' { print $1; } ' `
788
+ if [ " $CLUSTERROLE " != " 1" ]; then
789
+ fail " The cluster role ${apacheName} was not created"
790
+ fi
791
+
792
+ echo Checking the cluster role binding ${apacheName} was created
793
+ CLUSTERROLEBINDING=` kubectl get clusterrolebindings | grep ${apacheName} | wc | awk ' { print $1; } ' `
794
+ if [ " $CLUSTERROLEBINDING " != " 1" ]; then
795
+ fail " The cluster role binding ${apacheName} was not created"
796
+ fi
797
+
798
+ echo Deploying apache
799
+ kubectl apply -f ${apacheOutput}
800
+
801
+ echo Checking apache deployment
802
+ SS=` kubectl get deployment -n ${namespace} | grep ${apacheName} | wc | awk ' { print $1; } ' `
803
+ if [ " $SS " != " 1" ]; then
804
+ fail " The deployment ${apacheName} was not created"
805
+ fi
806
+
807
+ echo Checking the apache service account
808
+ SA=` kubectl get serviceaccount ${apacheName} -n ${namespace} | grep ${apacheName} | wc | awk ' { print $1; } ' `
809
+ if [ " $SA " != " 1" ]; then
810
+ fail " The service account ${apacheName} was not created"
811
+ fi
812
+
813
+ echo Checking apache service
814
+ TSVC=` kubectl get services -n ${namespace} | grep ${apacheName} | wc | awk ' { print $1; } ' `
815
+ if [ " $TSVC " != " 1" ]; then
816
+ fail " The service ${apacheServiceName} was not created"
817
+ fi
818
+ }
819
+
727
820
#
728
821
# Function to create the domain custom resource
729
822
#
@@ -782,6 +875,9 @@ function outputJobSummary {
782
875
echo " The load balancer for cluster '${clusterName} ' is available at http:${K8S_IP} :${loadBalancerWebPort} / (add the application path to the URL)"
783
876
echo " The load balancer dashboard for cluster '${clusterName} ' is available at http:${K8S_IP} :${loadBalancerDashboardPort} "
784
877
echo " "
878
+ elif [ " ${loadBalancer} " = " APACHE" ]; then
879
+ echo " The apache load balancer for '${domainUID} ' is available at http:${K8S_IP} :${loadBalancerWebPort} / (add the application path to the URL)"
880
+
785
881
fi
786
882
echo " The following files were generated:"
787
883
echo " ${domainOutputDir} /create-weblogic-domain-inputs.yaml"
@@ -792,6 +888,9 @@ function outputJobSummary {
792
888
if [ " ${loadBalancer} " = " TRAEFIK" ]; then
793
889
echo " ${traefikSecurityOutput} "
794
890
echo " ${traefikOutput} "
891
+ elif [ " ${loadBalancer} " = " APACHE" ]; then
892
+ echo " ${apacheSecurityOutput} "
893
+ echo " ${apacheOutput} "
795
894
elif [ " ${loadBalancer} " = " VOYAGER" ]; then
796
895
echo " ${voyagerOutput} "
797
896
fi
@@ -824,6 +923,8 @@ if [ "${generateOnly}" = false ]; then
824
923
# Setup load balancer
825
924
if [ " ${loadBalancer} " = " TRAEFIK" ]; then
826
925
setupTraefikLoadBalancer
926
+ elif [ " ${loadBalancer} " = " APACHE" ]; then
927
+ setupApacheLoadBalancer
827
928
elif [ " ${loadBalancer} " = " VOYAGER" ]; then
828
929
setupVoyagerLoadBalancer
829
930
fi
0 commit comments