100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
EKS creation scripts now allows multiple clusters in same AWS account (#2070)
Eric Bariauxe57de4a83ddc
diff --git a/kubernetes/eks-setup-haproxy.sh b/kubernetes/eks-setup-haproxy.shindex 621b4dc4c..e2ad7b65d 100755--- a/kubernetes/eks-setup-haproxy.sh+++ b/kubernetes/eks-setup-haproxy.sh@@ -31,14 +31,20 @@ helm install postgresql postgresql -f postgresql/values-eks.yaml# Waiting for the LB to be created# AWS LB Controller only creates an Network LB if there's a service-# Following logic is assuming there is the only (network) LB in the account-while ! aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?Type=='network']" 2>/dev/null | grep '"Code": "active"'; do++CLUSTER_VPC_ID=$(aws eks describe-cluster --profile or --name $CLUSTER_NAME --query 'cluster.resourcesVpcConfig.vpcId' --output text)+if [ -z "$CLUSTER_VPC_ID" ] || [ "$CLUSTER_VPC_ID" = "None" ]; then+ echo "Error: Failed to retrieve VPC ID for cluster '$CLUSTER_NAME'. Aborting."+ exit 1+fi++while ! aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='network']" 2>/dev/null | grep '"Code": "active"'; doecho "Waiting for load balancer to be created..."sleep 10done-DNS_NAME=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?Type=='network'].DNSName | [0]")-HOSTED_ZONE_ID=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?Type=='network'].CanonicalHostedZoneId | [0]")+DNS_NAME=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='network'].DNSName | [0]")+HOSTED_ZONE_ID=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='network'].CanonicalHostedZoneId | [0]")aws route53 change-resource-record-sets \--hosted-zone-id /hostedzone/Z08751721JH0NB6LLCB4V \diff --git a/kubernetes/eks-setup.sh b/kubernetes/eks-setup.shindex 487f30c1d..a781fbe8b 100755--- a/kubernetes/eks-setup.sh+++ b/kubernetes/eks-setup.sh@@ -24,7 +24,6 @@ kubectl rollout status deployment aws-load-balancer-controller -n kube-system --helm install or-setup or-setup --set aws.enabled=true --set aws.managerVolumeId=$MANAGER_VOLUMEID --set aws.psqlVolumeId=$PSQL_VOLUMEIDCERTIFICATE_ARN=$(aws acm request-certificate --domain-name $FQDN --subject-alternative-names $MQTTS_FQDN --validation-method DNS --profile or --query "CertificateArn" --output text)-aws acm describe-certificate --certificate-arn $CERTIFICATE_ARN --profile orhelm install postgresql postgresql -f postgresql/values-eks.yamlhelm install keycloak keycloak -f keycloak/values-eks.yaml \@@ -58,17 +57,23 @@ aws route53 change-resource-record-sets \--profile dnschg# AWS LB Controller only creates an Application LB if there's an ingress-# Following logic is assuming there is the only (application) LB in the account-while ! aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?Type=='application']" 2>/dev/null | grep '"Code": "active"'; do++CLUSTER_VPC_ID=$(aws eks describe-cluster --profile or --name $CLUSTER_NAME --query 'cluster.resourcesVpcConfig.vpcId' --output text)+if [ -z "$CLUSTER_VPC_ID" ] || [ "$CLUSTER_VPC_ID" = "None" ]; then+ echo "Error: Failed to retrieve VPC ID for cluster '$CLUSTER_NAME'. Aborting."+ exit 1+fi++while ! aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='application']" 2>/dev/null | grep '"Code": "active"'; doecho "Waiting for application load balancer to be created..."sleep 10done# We're re-directing the FQDN to the application LB (web interface)-until DNS_NAME=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?Type=='application'].DNSName | [0]") && [ -n "$DNS_NAME" ]; do+until DNS_NAME=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='application'].DNSName | [0]") && [ -n "$DNS_NAME" ]; doecho "Waiting for LoadBalancer DNS..."; sleep 5done-HOSTED_ZONE_ID=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?Type=='application'].CanonicalHostedZoneId | [0]")+HOSTED_ZONE_ID=$(aws elbv2 describe-load-balancers --profile or --query "LoadBalancers[?VpcId=='$CLUSTER_VPC_ID' && Type=='application'].CanonicalHostedZoneId | [0]")aws route53 change-resource-record-sets \--hosted-zone-id /hostedzone/Z08751721JH0NB6LLCB4V \