Skip to content

Commit 8770bfd

Browse files
committed
ci to create and delete k8s
1 parent 14df8c4 commit 8770bfd

File tree

3 files changed

+53
-10
lines changed

3 files changed

+53
-10
lines changed

.github/workflows/cleanup-k8s.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
type: boolean
2727

2828
env:
29-
AWS_DEFAULT_REGION: us-west-2
29+
AWS_DEFAULT_REGION: us-east-1
3030

3131
jobs:
3232
cleanup-aws-resources:
@@ -43,13 +43,19 @@ jobs:
4343
with:
4444
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
4545
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
46-
aws-region: us-west-2
46+
aws-region: us-east-1
4747

4848
- name: Install prerequisites
4949
run: |
5050
# Install required tools
5151
sudo apt-get update
52-
sudo apt-get install -y jq awscli
52+
sudo apt-get install -y jq curl unzip
53+
54+
# Install AWS CLI v2
55+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
56+
unzip awscliv2.zip
57+
sudo ./aws/install
58+
aws --version
5359
5460
# Install eksctl
5561
curl --silent --location "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
@@ -60,6 +66,7 @@ jobs:
6066
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
6167
chmod +x kubectl
6268
sudo mv kubectl /usr/local/bin/
69+
kubectl version --client
6370
6471
- name: Set cleanup parameters
6572
id: params

.github/workflows/create-k8s.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ on:
6060
required: false
6161
default: ''
6262
type: string
63-
azure_subscription:
64-
description: 'Azure Subscription ID (Azure only)'
65-
required: false
66-
default: ''
67-
type: string
63+
# azure_subscription:
64+
# description: 'Azure Subscription ID (Azure only)'
65+
# required: false
66+
# default: ''
67+
# type: string
6868

6969
env:
7070
AWS_DEFAULT_REGION: us-east-1
@@ -233,7 +233,7 @@ jobs:
233233
234234
case "${{ inputs.cloud || 'aws' }}" in
235235
aws)
236-
REGION="${{ inputs.region || 'us-west-2' }}"
236+
REGION="${{ inputs.region || 'us-east-1' }}"
237237
echo "# Update kubeconfig for AWS EKS cluster:"
238238
if [[ -n "${{ inputs.aws_profile }}" ]]; then
239239
echo "aws eks update-kubeconfig --region $REGION --name $CLUSTER_NAME --profile ${{ inputs.aws_profile }}"
@@ -310,7 +310,7 @@ jobs:
310310
311311
case "${{ inputs.cloud || 'aws' }}" in
312312
aws)
313-
REGION="${{ inputs.region || 'us-west-2' }}"
313+
REGION="${{ inputs.region || 'us-east-1' }}"
314314
echo '```bash'
315315
if [[ -n "${{ inputs.aws_profile }}" ]]; then
316316
echo "aws eks update-kubeconfig --region $REGION --name $CLUSTER_NAME --profile ${{ inputs.aws_profile }}"

scripts/install-prerequisites.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Install prerequisites for Kubernetes cluster management
4+
# This script installs required tools for AWS, GCP, and Azure
5+
6+
set -e
7+
8+
echo "Installing prerequisites..."
9+
10+
# Update package lists
11+
sudo apt-get update
12+
13+
# Install basic tools
14+
echo "Installing basic tools..."
15+
sudo apt-get install -y jq curl unzip
16+
17+
# Install AWS CLI v2
18+
echo "Installing AWS CLI v2..."
19+
if ! command -v aws &> /dev/null; then
20+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
21+
unzip awscliv2.zip
22+
sudo ./aws/install
23+
rm -rf awscliv2.zip aws/
24+
fi
25+
aws --version
26+
27+
# Install kubectl
28+
echo "Installing kubectl..."
29+
if ! command -v kubectl &> /dev/null; then
30+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
31+
chmod +x kubectl
32+
sudo mv kubectl /usr/local/bin/
33+
fi
34+
kubectl version --client
35+
36+
echo "Prerequisites installation completed!"

0 commit comments

Comments
 (0)