Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add actions for deployment to EKS cluster #1

Merged
merged 5 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/eks/aws-cli/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: update aws cli
description: update AWS CLI
runs:
using: composite
steps:
- run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && sudo ./aws/install --update
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
34 changes: 34 additions & 0 deletions .github/eks/deploy-helm/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: deploy helm
description: deploy the helm chart
inputs:
release-name:
description: name of the release
required: true
namespace:
description: deployment's namespace
required: true
chart-name:
description: the helm chart's name
required: true
org-name:
description: the organisation name
required: true
repo-url:
description: the helm chart's URL
required: true
target-port:
description: port where the service runs on
required: true
values-file-path:
description: path of the helm chart values file
required: true
runs:
using: composite
steps:
- run: |
helm repo add ${{ inputs.org-name }} ${{ inputs.repo-url }}
helm repo update
helm upgrade --install ${{ inputs.release-name }} ${{ inputs.chart-name }} \
--set service.targetPort=${{ inputs.target-port }} \
--values ${{ inputs.values-file-path }} \
--atomic --namespace ${{ inputs.namespace }}
8 changes: 8 additions & 0 deletions .github/eks/eksctl/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: install eksctl
description: install eksctl
runs:
using: composite
steps:
- run: |
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
16 changes: 16 additions & 0 deletions .github/eks/extract-image-tag/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: extract image tag
description: extract and edit image tag into helm values file
inputs:
values_file_path:
description: Path of the helm values file
required: true
image_tag:
description: Tag of the built image
required: true
runs:
using: composite
steps:
- run: |
image_tag="${{ inputs.image_tag##*: }}"
echo $image_tag
sed -i "s|image-tag|${{ inputs.image_tag }}|g" "${{ inputs.values_file_path }}"
14 changes: 14 additions & 0 deletions .github/eks/setup-helm/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: setup helm
description: install and setup Helm
runs:
using: composite
steps:
- name: Install helm-s3 plugin
run: |
helm plugin install https://github.com/hypnoglow/helm-s3.git

- name: Set up Helm
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
27 changes: 27 additions & 0 deletions .github/eks/setup-iam/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Setup IAM
description: set up IAM identity mapping for EKS
inputs:
cluster:
description: EKS cluster name
required: true
region:
description: AWS region
required: true
arn:
description: IAM ARN
required: true
username:
description: Username for the IAM identity
required: true
runs:
using: composite
steps:
- run: |
aws sts get-caller-identity
eksctl create iamidentitymapping \
--cluster ${{ inputs.cluster }} \
--region ${{ inputs.region }} \
--arn ${{ inputs.arn }} \
--group system:masters \
--no-duplicate-arns \
--username ${{ inputs.username }}
14 changes: 14 additions & 0 deletions .github/eks/update-kubeconfig/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: update kubeconfig
description: update kubeconfig file to include new user ARN
inputs:
cluster:
description: EKS cluster name
required: true
region:
description: AWS region
required: true
runs:
using: composite
steps:
- run: |
aws eks update-kubeconfig --name ${{ inputs.cluster }} --region ${{ inputs.region }}