@@ -370,10 +370,20 @@ function initialize {
370370 if [ ! -f ${apacheInput} ]; then
371371 validationError " The template file ${apacheInput} for generating the apache-webtier deployment was not found"
372372 fi
373-
374- voyagerInput=" ${scriptDir} /voyager-ingress-template.yaml"
375- if [ ! -f ${voyagerInput} ]; then
376- validationError " The template file ${voyagerInput} for generating the Voyager Ingress was not found"
373+
374+ voyagerOperatorInput=" ${scriptDir} /voyager-operator.yaml"
375+ if [ ! -f ${voyagerOperatorInput} ]; then
376+ validationError " The file ${voyagerOperatorInput} for Voyager Operator was not found"
377+ fi
378+
379+ voyagerSecurityInput=" ${scriptDir} /voyager-operator-security.yaml"
380+ if [ ! -f ${voyagerSecurityInput} ]; then
381+ validationError " The file ${voyagerSecurityInput} for generating the Voyager RBAC was not found"
382+ fi
383+
384+ voyagerIngressInput=" ${scriptDir} /weblogic-domain-voyager-ingress-template.yaml"
385+ if [ ! -f ${voyagerIngressInput} ]; then
386+ validationError " The template file ${voyagerIngressInput} for generating the Voyager Ingress was not found"
377387 fi
378388
379389 failIfValidationErrors
@@ -449,19 +459,13 @@ function createYamlFiles {
449459 traefikOutput=" ${domainOutputDir} /weblogic-domain-traefik-${clusterNameLC} .yaml"
450460 apacheOutput=" ${domainOutputDir} /weblogic-domain-apache.yaml"
451461 apacheSecurityOutput=" ${domainOutputDir} /weblogic-domain-apache-security.yaml"
452- voyagerOutput=" ${domainOutputDir} /voyager-ingress.yaml"
462+ voyagerSecurityOutput=" ${domainOutputDir} /voyager-operator-security.yaml"
463+ voyagerOperatorOutput=" ${domainOutputDir} /voyager-operator.yaml"
464+ voyagerIngressOutput=" ${domainOutputDir} /weblogic-domain-voyager-ingress.yaml"
453465
454466 enabledPrefix=" " # uncomment the feature
455467 disabledPrefix=" # " # comment out the feature
456468
457- # For backward compatability, default to "store/oracle/weblogic:12.2.1.3" if not defined in
458- # create-weblogic-domain-inputs.yaml
459- if [ -z " ${weblogicImage} " ]; then
460- weblogicImage=" store/oracle/weblogic:12.2.1.3"
461- fi
462- # Must escape the ':' value in weblogicImage for sed to properly parse and replace
463- weblogicImage=$( echo ${weblogicImage} | sed -e " s/\:/\\ \:/g" )
464-
465469 # Generate the yaml to create the persistent volume
466470 echo Generating ${domainPVOutput}
467471
@@ -499,7 +503,6 @@ function createYamlFiles {
499503 cp ${createJobInput} ${createJobOutput}
500504 sed -i -e " s:%NAMESPACE%:$namespace :g" ${createJobOutput}
501505 sed -i -e " s:%WEBLOGIC_CREDENTIALS_SECRET_NAME%:${weblogicCredentialsSecretName} :g" ${createJobOutput}
502- sed -i -e " s:%WEBLOGIC_IMAGE%:${weblogicImage} :g" ${createJobOutput}
503506 sed -i -e " s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${weblogicImagePullSecretName} :g" ${createJobOutput}
504507 sed -i -e " s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${weblogicImagePullSecretPrefix} :g" ${createJobOutput}
505508 sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${createJobOutput}
@@ -520,7 +523,6 @@ function createYamlFiles {
520523
521524 cp ${deleteJobInput} ${deleteJobOutput}
522525 sed -i -e " s:%NAMESPACE%:$namespace :g" ${deleteJobOutput}
523- sed -i -e " s:%WEBLOGIC_IMAGE%:${weblogicImage} :g" ${deleteJobOutput}
524526 sed -i -e " s:%WEBLOGIC_CREDENTIALS_SECRET_NAME%:${weblogicCredentialsSecretName} :g" ${deleteJobOutput}
525527 sed -i -e " s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${weblogicImagePullSecretName} :g" ${deleteJobOutput}
526528 sed -i -e " s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${weblogicImagePullSecretPrefix} :g" ${deleteJobOutput}
@@ -548,7 +550,6 @@ function createYamlFiles {
548550 sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${dcrOutput}
549551 sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${dcrOutput}
550552 sed -i -e " s:%ADMIN_SERVER_NAME%:${adminServerName} :g" ${dcrOutput}
551- sed -i -e " s:%WEBLOGIC_IMAGE%:${weblogicImage} :g" ${dcrOutput}
552553 sed -i -e " s:%ADMIN_PORT%:${adminPort} :g" ${dcrOutput}
553554 sed -i -e " s:%INITIAL_MANAGED_SERVER_REPLICAS%:${initialManagedServerReplicas} :g" ${dcrOutput}
554555 sed -i -e " s:%EXPOSE_T3_CHANNEL_PREFIX%:${exposeAdminT3ChannelPrefix} :g" ${dcrOutput}
@@ -583,24 +584,7 @@ function createYamlFiles {
583584 if [ " ${loadBalancer} " = " APACHE" ]; then
584585 # Apache file
585586 cp ${apacheInput} ${apacheOutput}
586-
587587 echo Generating ${apacheOutput}
588-
589- if [ " ${loadBalancerExposeAdminPort} " = " true" ]; then
590- enableLoadBalancerExposeAdminPortPrefix=" ${enabledPrefix} "
591- else
592- enableLoadBalancerExposeAdminPortPrefix=" ${disabledPrefix} "
593- fi
594-
595- if [ ! -z " ${loadBalancerVolumePath} " ]; then
596- enableLoadBalancerVolumePathPrefix=" ${enabledPrefix} "
597- sed -i -e " s:%LOAD_BALANCER_VOLUME_PATH%:${loadBalancerVolumePath} :g" ${apacheOutput}
598- else
599- enableLoadBalancerVolumePathPrefix=" ${disabledPrefix} "
600- fi
601-
602- sed -i -e " s:%ENABLE_LOAD_BALANCER_EXPOSE_ADMIN_PORT%:${enableLoadBalancerExposeAdminPortPrefix} :g" ${apacheOutput}
603- sed -i -e " s:%ENABLE_LOAD_BALANCER_VOLUME_PATH%:${enableLoadBalancerVolumePathPrefix} :g" ${apacheOutput}
604588 sed -i -e " s:%NAMESPACE%:$namespace :g" ${apacheOutput}
605589 sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${apacheOutput}
606590 sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${apacheOutput}
@@ -610,6 +594,17 @@ function createYamlFiles {
610594 sed -i -e " s:%MANAGED_SERVER_PORT%:${managedServerPort} :g" ${apacheOutput}
611595 sed -i -e " s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort :g" ${apacheOutput}
612596 sed -i -e " s:%WEB_APP_PREPATH%:$loadBalancerAppPrepath :g" ${apacheOutput}
597+
598+ if [ ! -z " ${loadBalancerVolumePath} " ]; then
599+ sed -i -e " s:%LOAD_BALANCER_VOLUME_PATH%:${loadBalancerVolumePath} :g" ${apacheOutput}
600+ sed -i -e " s:# volumes:volumes:g" ${apacheOutput}
601+ sed -i -e " s:# - name:- name:g" ${apacheOutput}
602+ sed -i -e " s:# hostPath: hostPath:g" ${apacheOutput}
603+ sed -i -e " s:# path: path:g" ${apacheOutput}
604+ sed -i -e " s:# volumeMounts:volumeMounts:g" ${apacheOutput}
605+ sed -i -e " s:# - name:- name:g" ${apacheOutput}
606+ sed -i -e " s:# mountPath: mountPath:g" ${apacheOutput}
607+ fi
613608
614609 # Apache security file
615610 cp ${apacheSecurityInput} ${apacheSecurityOutput}
@@ -620,17 +615,21 @@ function createYamlFiles {
620615 fi
621616
622617 if [ " ${loadBalancer} " = " VOYAGER" ]; then
618+ # Voyager Operator Security yaml file
619+ cp ${voyagerSecurityInput} ${voyagerSecurityOutput}
620+ # Voyager Operator yaml file
621+ cp ${voyagerOperatorInput} ${voyagerOperatorOutput}
623622 # Voyager Ingress file
624- cp ${voyagerInput } ${voyagerOutput }
625- echo Generating ${voyagerOutput }
626- sed -i -e " s:%NAMESPACE%:$namespace :g" ${voyagerOutput }
627- sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${voyagerOutput }
628- sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${voyagerOutput }
629- sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${voyagerOutput }
630- sed -i -e " s:%CLUSTER_NAME_LC%:${clusterNameLC} :g" ${voyagerOutput }
631- sed -i -e " s:%MANAGED_SERVER_PORT%:${managedServerPort} :g" ${voyagerOutput }
632- sed -i -e " s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort :g" ${voyagerOutput }
633- sed -i -e " s:%LOAD_BALANCER_DASHBOARD_PORT%:$loadBalancerDashboardPort :g" ${voyagerOutput }
623+ cp ${voyagerIngressInput } ${voyagerIngressOutput }
624+ echo Generating ${voyagerIngressOutput }
625+ sed -i -e " s:%NAMESPACE%:$namespace :g" ${voyagerIngressOutput }
626+ sed -i -e " s:%DOMAIN_UID%:${domainUID} :g" ${voyagerIngressOutput }
627+ sed -i -e " s:%DOMAIN_NAME%:${domainName} :g" ${voyagerIngressOutput }
628+ sed -i -e " s:%CLUSTER_NAME%:${clusterName} :g" ${voyagerIngressOutput }
629+ sed -i -e " s:%CLUSTER_NAME_LC%:${clusterNameLC} :g" ${voyagerIngressOutput }
630+ sed -i -e " s:%MANAGED_SERVER_PORT%:${managedServerPort} :g" ${voyagerIngressOutput }
631+ sed -i -e " s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort :g" ${voyagerIngressOutput }
632+ sed -i -e " s:%LOAD_BALANCER_DASHBOARD_PORT%:$loadBalancerDashboardPort :g" ${voyagerIngressOutput }
634633 fi
635634
636635 # Remove any "...yaml-e" files left over from running sed
@@ -728,79 +727,8 @@ function createDomain {
728727# Deploy Voyager/HAProxy load balancer
729728#
730729function setupVoyagerLoadBalancer {
731- # only deploy Voyager Ingress Controller the first time
732- local vpod=` kubectl get pod -n voyager | grep voyager | wc -l`
733- if [ " $vpod " == " 0" ]; then
734- kubectl create namespace voyager
735- curl -fsSL https://raw.githubusercontent.com/appscode/voyager/6.0.0/hack/deploy/voyager.sh \
736- | bash -s -- --provider=baremetal --namespace=voyager
737- fi
738-
739- echo Checking voyager controller pod is ready
740- local maxwaitsecs=30
741- local mstart=` date +%s`
742- while : ; do
743- local mnow=` date +%s`
744- local ready=` kubectl -n voyager get pod | grep voyager-operator | awk ' { print $2; } ' `
745- if [ " ${ready} " = " 1/1" ] ; then
746- echo " Voyager Ingress Controller is ready"
747- break
748- fi
749- if [ $(( mnow - mstart)) -gt $(( maxwaitsecs)) ]; then
750- fail " The Voyager Ingress Controller is not ready."
751- fi
752- sleep 1
753- done
754-
755- kubectl apply -f ${voyagerOutput}
756-
757- echo Checking Voyager Ingress resource
758- local maxwaitsecs=100
759- local mstart=` date +%s`
760- while : ; do
761- local mnow=` date +%s`
762- local vdep=` kubectl get ingresses.voyager.appscode.com -n ${namespace} | grep ${domainUID} -voyager | wc | awk ' { print $1; } ' `
763- if [ " $vdep " = " 1" ]; then
764- echo " The Voyager Ingress resource ${domainUID} -voyager is created successfully."
765- break
766- fi
767- if [ $(( mnow - mstart)) -gt $(( maxwaitsecs)) ]; then
768- fail " The Voyager Ingress resource ${domainUID} -voyager was not created."
769- fi
770- sleep 5
771- done
772-
773- echo Checking HAProxy pod is running
774- local maxwaitsecs=100
775- local mstart=` date +%s`
776- while : ; do
777- local mnow=` date +%s`
778- local st=` kubectl get pod -n ${namespace} | grep ^voyager-${domainUID} -voyager- | awk ' { print $3; } ' `
779- if [ " $st " = " Running" ]; then
780- echo " The HAProxy pod for Voyaer Ingress ${domainUID} -voyager is created successfully."
781- break
782- fi
783- if [ $(( mnow - mstart)) -gt $(( maxwaitsecs)) ]; then
784- fail " The HAProxy pod for Voyaer Ingress ${domainUID} -voyager was not created or running."
785- fi
786- sleep 5
787- done
788-
789- echo Checking Voyager service
790- local maxwaitsecs=100
791- local mstart=` date +%s`
792- while : ; do
793- local mnow=` date +%s`
794- local vscv=` kubectl get service ${domainUID} -voyager-stats -n ${namespace} | grep ${domainUID} -voyager-stats | wc | awk ' { print $1; } ' `
795- if [ " $vscv " = " 1" ]; then
796- echo ' The service ${domainUID}-voyager-stats is created successfully.'
797- break
798- fi
799- if [ $(( mnow - mstart)) -gt $(( maxwaitsecs)) ]; then
800- fail " The service ${domainUID} -voyager-stats was not created."
801- fi
802- sleep 5
803- done
730+ createVoyagerOperator ${voyagerSecurityOutput} ${voyagerOperatorOutput}
731+ createVoyagerIngress ${voyagerIngressOutput} ${namespace} ${domainUID}
804732}
805733
806734#
@@ -966,7 +894,9 @@ function outputJobSummary {
966894 echo " ${apacheSecurityOutput} "
967895 echo " ${apacheOutput} "
968896 elif [ " ${loadBalancer} " = " VOYAGER" ]; then
969- echo " ${voyagerOutput} "
897+ echo " ${voyagerOperatorOutput} "
898+ echo " ${voyagerSecurityOutput} "
899+ echo " ${voyagerIngressOutput} "
970900 fi
971901}
972902
0 commit comments