diff --git a/.roost/roost.vivekloadbalancers.config b/.roost/roost.vivekloadbalancers.config new file mode 100644 index 00000000..b84bca18 --- /dev/null +++ b/.roost/roost.vivekloadbalancers.config @@ -0,0 +1,22 @@ +build: + type: None + content: '' +deploy: + type: text + content: | + #/bin/sh + kubectl apply -n $ROOST_NAMESPACE -f ballot/ballot.yaml + + kubectl apply -n $ROOST_NAMESPACE -f ecserver/ecserver.yaml +test: [] +uninstall: + type: text + content: |- + #/bin/sh + + kubectl delete -n $ROOST_NAMESPACE -f ballot/ballot.yaml + + kubectl delete -n $ROOST_NAMESPACE -f ecserver/ecserver.yaml +dockerCompose: '' +lastUpdatedBy: Vivek K B +lastUpdatedOn: 2023-04-06T09:34:57.083Z diff --git a/ballot/ballot.yaml b/ballot/ballot.yaml index 759a6345..e0188b49 100644 --- a/ballot/ballot.yaml +++ b/ballot/ballot.yaml @@ -8,9 +8,10 @@ spec: selector: app: ballot ports: - - name: ballot - port: 80 + - port: 8080 targetPort: 8080 + externalTrafficPolicy: Local + type: LoadBalancer --- apiVersion: apps/v1 @@ -29,6 +30,6 @@ spec: spec: containers: - name: ballot - image: local-registry:5002/ballot:latest + image: vivekklp/ballot:latest ports: - containerPort: 8080 diff --git a/ecserver/ecserver.yaml b/ecserver/ecserver.yaml index f443a498..89ae19c2 100644 --- a/ecserver/ecserver.yaml +++ b/ecserver/ecserver.yaml @@ -1,18 +1,16 @@ apiVersion: v1 kind: Service metadata: - labels: - apps: ecserver name: ecserver spec: - type: NodePort selector: app: ecserver ports: - - name: ecserver - port: 80 + - port: 8081 targetPort: 8081 - nodePort: 30081 + # nodePort: 30081 + externalTrafficPolicy: Local + type: LoadBalancer --- apiVersion: apps/v1 @@ -31,6 +29,6 @@ spec: spec: containers: - name: ecserver - image: local-registry:5002/ecserver:latest + image: vivekklp/ecserver:latest ports: - containerPort: 8081 diff --git a/election-commission/ec.yaml b/election-commission/ec.yaml index 3ed3cdc8..36f8fc1d 100644 --- a/election-commission/ec.yaml +++ b/election-commission/ec.yaml @@ -10,9 +10,10 @@ spec: app: election-commission type: "roost-example" ports: - - name: election-commission - port: 80 - targetPort: 80 + - port: 8082 + targetPort: 8082 + externalTrafficPolicy: Local + type: LoadBalancer --- apiVersion: apps/v1 @@ -33,11 +34,11 @@ spec: spec: containers: - name: election-commission - image: local-registry:5002/election-commission:latest + image: vivekklp/election-commission:latest stdin: true tty: true env: - name: EC_SERVER_ENDPOINT - value: ecserver.10.10.0.10.nip.io + value: EC_SERVER_ENDPOINT_VALUE ports: - - containerPort: 80 + - containerPort: 8082 diff --git a/loadbalancersexec.sh b/loadbalancersexec.sh new file mode 100644 index 00000000..b8d28ac5 --- /dev/null +++ b/loadbalancersexec.sh @@ -0,0 +1,22 @@ +#!/bin/bash +kubectl apply -f ballot/ballot.yaml -n $ROOST_NAMESPACE + +sleep 5 + +ballot_loadbalancer=$(kubectl get svc -n $ROOST_NAMESPACE | grep ballot | awk '{print $4}') + +kubectl apply -f ecserver/ecserver.yaml -n $ROOST_NAMESPACE + +sleep 5 + +ecserver_loadbalancer=$(kubectl get svc -n $ROOST_NAMESPACE | grep ecserver | awk '{print $4}') + +sed -i -e "s#REACT_APP_BALLOT_ENDPOINT_VALUE#${ballot_loadbalancer}:8080#" -e "s#REACT_APP_EC_SERVER_ENDPOINT_VALUE#${ecserver_loadbalancer}:8081#" voter/voter.yaml + +kubectl apply -f voter/voter.yaml -n $ROOST_NAMESPACE + +sleep 5 + +sed -i -e "s#EC_SERVER_ENDPOINT_VALUE#${ecserver_loadbalancer}:8081#" election-commission/ec.yaml + +kubectl apply -f election-commission/ec.yaml -n $ROOST_NAMESPACE diff --git a/voter/voter.yaml b/voter/voter.yaml index 41a81943..b55006cc 100644 --- a/voter/voter.yaml +++ b/voter/voter.yaml @@ -10,9 +10,10 @@ spec: app: voter type: "roost-example" ports: - - name: voter - port: 80 + - port: 80 targetPort: 80 + externalTrafficPolicy: Local + type: LoadBalancer --- apiVersion: apps/v1 @@ -33,13 +34,13 @@ spec: spec: containers: - name: voter - image: local-registry:5002/voter:latest + image: vivekklp/voter:latest stdin: true tty: true env: - name: REACT_APP_BALLOT_ENDPOINT - value: ballot.10.10.0.10.nip.io + value: REACT_APP_BALLOT_ENDPOINT_VALUE - name: REACT_APP_EC_SERVER_ENDPOINT - value: ecserver.10.10.0.10.nip.io + value: REACT_APP_EC_SERVER_ENDPOINT_VALUE ports: - containerPort: 80