diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 828bbed..b2303de 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -43,13 +43,13 @@ jobs: docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest . docker push -a $ECR_REGISTRY/$ECR_REPOSITORY - # - name: Update kube config - # run: aws eks update-kubeconfig --name simple-bank --region eu-west-1 - - # - name: Deploy image to Amazon EKS - # run: | - # kubectl apply -f eks/aws-auth.yaml - # kubectl apply -f eks/deployment.yaml - # kubectl apply -f eks/service.yaml - # kubectl apply -f eks/issuer.yaml - # kubectl apply -f eks/ingress.yaml + - name: Update kube config + run: aws eks update-kubeconfig --name simple-bank --region eu-west-1 + + - name: Deploy image to Amazon EKS + run: | + kubectl apply -f eks/aws-auth.yaml + kubectl apply -f eks/deployment.yaml + kubectl apply -f eks/service.yaml + kubectl apply -f eks/issuer.yaml + kubectl apply -f eks/ingress.yaml diff --git a/Dockerfile b/Dockerfile index 70aa57f..21de61a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,6 @@ COPY start.sh . COPY wait-for.sh . COPY db/migration ./db/migration -EXPOSE 8080 +EXPOSE 8080 9090 CMD [ "/app/main" ] ENTRYPOINT [ "/app/start.sh" ] diff --git a/eks/aws-auth.yaml b/eks/aws-auth.yaml index 89aabc3..1661ce1 100644 --- a/eks/aws-auth.yaml +++ b/eks/aws-auth.yaml @@ -5,7 +5,7 @@ metadata: namespace: kube-system data: mapUsers: | - - userarn: arn:aws:iam::095420225348:user/github-ci + - userarn: arn:aws:iam::760486049168:user/github-ci username: github-ci groups: - system:masters diff --git a/eks/deployment.yaml b/eks/deployment.yaml index e80c7bc..f82d97b 100644 --- a/eks/deployment.yaml +++ b/eks/deployment.yaml @@ -16,7 +16,11 @@ spec: spec: containers: - name: simple-bank-api - image: 095420225348.dkr.ecr.eu-west-1.amazonaws.com/simplebank:latest + image: 760486049168.dkr.ecr.eu-west-1.amazonaws.com/simplebank:latest imagePullPolicy: Always ports: - containerPort: 8080 + name: http-server + - containerPort: 9090 + name: grpc-server + diff --git a/eks/ingress.yaml b/eks/ingress.yaml index 0f96377..a2ebc5b 100644 --- a/eks/ingress.yaml +++ b/eks/ingress.yaml @@ -8,13 +8,15 @@ spec: apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: simple-bank-ingress + name: simple-bank-ingress-grpc annotations: cert-manager.io/cluster-issuer: letsencrypt + nginx.ingress.kubernetes.io/ssl-redirect: "true" + nginx.ingress.kubernetes.io/backend-protocol: "GRPC" spec: ingressClassName: nginx rules: - - host: "api.simple-bank.org" + - host: "api.simplebanktest.com" http: paths: - pathType: Prefix @@ -23,8 +25,8 @@ spec: service: name: simple-bank-api-service port: - number: 80 + number: 90 tls: - hosts: - - api.simple-bank.org + - api.simplebanktest.com secretName: simple-bank-api-cert diff --git a/eks/install.sh b/eks/install.sh new file mode 100644 index 0000000..251822c --- /dev/null +++ b/eks/install.sh @@ -0,0 +1,2 @@ +kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.2/deploy/static/provider/aws/deploy.yaml +kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.1/cert-manager.yaml \ No newline at end of file diff --git a/eks/issuer.yaml b/eks/issuer.yaml index debc36b..534107b 100644 --- a/eks/issuer.yaml +++ b/eks/issuer.yaml @@ -13,4 +13,4 @@ spec: solvers: - http01: ingress: - class: nginx + ingressClassName: nginx diff --git a/eks/service.yaml b/eks/service.yaml index e8e9972..1b3504b 100644 --- a/eks/service.yaml +++ b/eks/service.yaml @@ -8,5 +8,10 @@ spec: ports: - protocol: TCP port: 80 - targetPort: 8080 + targetPort: http-server + name: http-service + - protocol: TCP + port: 90 + targetPort: grpc-server + name: grpc-service type: ClusterIP