diff --git a/.github/workflows/build-hardhat-project.yaml b/.github/workflows/build-hardhat-project.yaml index 1e9d2411b3..3ec628ce75 100644 --- a/.github/workflows/build-hardhat-project.yaml +++ b/.github/workflows/build-hardhat-project.yaml @@ -57,17 +57,22 @@ jobs: ./create_image.sh docker push anglyuboslav/geth-smart-con deploy_k8s_and_app: + needs: deploy_hardhat_project if: ${{ github.event.label.name == 'CI:Deploy'}} name: Deploy K8S Cluster in AWS and deploy GETH DEVENV runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - - name: Install kubectl + - name: Install kubectl uses: azure/setup-kubectl@v2.0 with: version: 'v1.27.0' + - name: Install Terraform + uses: hashicorp/setup-terraform@v2 + with: + terraform_version: "1.6.3" - name: configure aws credentials uses: aws-actions/configure-aws-credentials@v3 @@ -75,6 +80,25 @@ jobs: role-to-assume: ${{ secrets.AWS_IAM_ROLE}} role-session-name: K8sBuildSession aws-region: us-east-1 + - name: Test AWS access run: aws sts get-caller-identity + + - name: Create K8S cluster with TF + run: | + cd terraform/eks-terraform + terraform apply -auto-approve + + - name: Apply YAML Manifest for the app and checks the app + run: | + kubectl apply -f geth-pod.yaml + sleep 60 + kubectl get ns + kubectl get pods -n hardhat-geth + + - name: Delete k8s cluster + run: | + cd terraform/eks-terraform + terraform destroy -auto-approve + diff --git a/geth-pod.yaml b/geth-pod.yaml new file mode 100644 index 0000000000..89dab38a88 --- /dev/null +++ b/geth-pod.yaml @@ -0,0 +1,34 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: hardhat-geth + +--- + +apiVersion: v1 +kind: Pod +metadata: + name: geth-pod + namespace: hardhat-geth +spec: + containers: + - name: geth-container + image: anglyuboslav/geth-smart-con + ports: + - containerPort: 3000 + +--- + +apiVersion: v1 +kind: Service +metadata: + name: geth-service + namespace: hardhat-geth +spec: + selector: + app: geth-pod + ports: + - protocol: TCP + port: 3000 + targetPort: 3000 + type: LoadBalancer \ No newline at end of file