Skip to content

Commit 2b17df8

Browse files
Merge pull request #1 from devops4solutions/test
Test
2 parents 6f00541 + 25dcd04 commit 2b17df8

File tree

18 files changed

+227
-411
lines changed

18 files changed

+227
-411
lines changed

.github/workflows/cd.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Terraform Deployment
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'terraform/eks_nodegroup/**'
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- 'terraform/eks_nodegroup/**'
14+
15+
env:
16+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
17+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
18+
AWS_DEFAULT_REGION: us-east-1
19+
20+
jobs:
21+
terraform:
22+
runs-on: ubuntu-latest
23+
defaults:
24+
run:
25+
working-directory: terraform/eks_nodegroup
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v2
29+
30+
- name: Configure AWS credentials
31+
uses: aws-actions/configure-aws-credentials@v1
32+
with:
33+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
34+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
35+
aws-region: us-east-1
36+
37+
- name: Set up Terraform
38+
uses: hashicorp/setup-terraform@v1
39+
with:
40+
terraform_wrapper: true
41+
42+
- name: Initialize Terraform
43+
run: terraform init
44+
45+
- name: Validate Terraform
46+
run: terraform validate
47+
48+
- name: Plan Terraform
49+
run: terraform plan
50+
51+
- name: Apply Terraform
52+
if: github.ref == 'refs/heads/main'
53+
run: terraform apply -auto-approve

nginx/eks_auto/hpa.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: autoscaling/v1
2+
kind: HorizontalPodAutoscaler
3+
metadata:
4+
name: hpa-2048
5+
namespace: game-2048
6+
spec:
7+
scaleTargetRef:
8+
apiVersion: apps/v1
9+
kind: Deployment
10+
name: deployment-2048
11+
minReplicas: 2
12+
maxReplicas: 10
13+
targetCPUUtilizationPercentage: 50

nginx/eks_auto/load_generator.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: load-generator
5+
namespace: game-2048
6+
spec:
7+
containers:
8+
- name: stress
9+
image: progrium/stress
10+
resources:
11+
requests:
12+
cpu: 500m # Request 0.5 CPU core
13+
limits:
14+
cpu: 1000m # Limit to 1 CPU core
15+
command:
16+
- stress
17+
- --cpu
18+
- "1" # Generate CPU load on 1 core
19+
- --timeout
20+
- "600s" # Run the stress test for 10 minutes (600 seconds)

nginx/fargate/deploy_fargate.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
apiVersion: v1
33
kind: Namespace
44
metadata:
5-
name: fargate
5+
name: default
66
---
77
apiVersion: apps/v1
88
kind: Deployment
99
metadata:
1010
name: eks-sample-linux-deployment
11-
namespace: fargate
11+
namespace: default
1212
labels:
1313
app: eks-sample-linux-app
1414
spec:
@@ -45,7 +45,7 @@ apiVersion: v1
4545
kind: Service
4646
metadata:
4747
name: eks-sample-linux-service
48-
namespace: fargate
48+
namespace: default
4949
labels:
5050
app: eks-sample-linux-app
5151
spec:

nginx/kubectl.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ kubectl get deployment -n kube-system aws-load-balancer-controller
1212

1313
helm uninstall aws-load-balancer-controller -n kube-system
1414

15-
kubectl get events -n eks-sample-app --sort-by='.metadata.creationTimestamp' | tail -n 10
15+
kubectl get events --sort-by='.metadata.creationTimestamp' | tail -n 10
16+
-n eks-sample-app
1617

1718
kubectl annotate serviceaccount aws-load-balancer-controller -n kube-system eks.amazonaws.com/role-arn=arn:aws:iam::936379345511:role/acct-managed/AmazonEKSLoadBalancerControllerRole
1819

@@ -29,3 +30,10 @@ kubectl get pods -n kube-system -l app.kubernetes.io/name=aws-load-balancer-cont
2930
kubectl exec -it aws-load-balancer-controller-577d7f46d5-49w87 -n kube-system -- cat /var/run/secrets/eks.amazonaws.com/serviceaccount/token
3031

3132
aws eks --region us-east-1 update-kubeconfig --name test
33+
34+
kubectl run -i \
35+
--tty load-generator \
36+
--rm --image=busybox \
37+
--restart=Never \
38+
-- /bin/sh -c "while sleep 0.01; do wget -q -O- http://k8s-game2048-ingress2-2d00d5bb4b-1483018925.us-east-1.elb.amazonaws.com/; done"
39+

retail/nodeclass.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: eks.amazonaws.com/v1
2+
kind: NodeClass
3+
metadata:
4+
name: custom
5+
spec:
6+
7+
# Required: Name of IAM Role for Nodes
8+
role: "AmazonEKSAutoNodeRole"
9+
10+
# Required: Subnet selection for node placement
11+
subnetSelectorTerms:
12+
- tags:
13+
kubernetes.io/role/internal-elb: "1"
14+
# Alternative using direct subnet ID
15+
# - id: "subnet-0123456789abcdef0"
16+
17+
# Required: Security group selection for nodes
18+
securityGroupSelectorTerms:
19+
- name: "eks-cluster-sg-eks-100493"
20+
21+
# Alternative approaches:
22+
# - id: "sg-0123456789abcdef0"
23+
# - name: "eks-cluster-node-security-group"

retail/nodepool.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: karpenter.sh/v1
2+
kind: NodePool
3+
metadata:
4+
name: custom
5+
spec:
6+
template:
7+
metadata:
8+
labels:
9+
billing-team: custom-class
10+
spec:
11+
nodeClassRef:
12+
group: eks.amazonaws.com
13+
kind: NodeClass
14+
name: private-compute
15+
requirements:
16+
- key: "eks.amazonaws.com/instance-category"
17+
operator: In
18+
values: ["t"]
19+
- key: "eks.amazonaws.com/instance-cpu"
20+
operator: In
21+
values: ["4", "8", "16", "32"]
22+
limits:
23+
cpu: "1000"
24+
memory: 1000Gi

retail/readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ helm install -f values.yaml retail-store-app oci://public.ecr.aws/aws-containers
99

1010
kubectl get statefulset retail-store-app-catalog-mysql \
1111
-o jsonpath='{.spec.volumeClaimTemplates}' | jq .
12+
13+
ndition transitioned, Type: NodeClassReady, Status: Unknown -> False, Reason: NodeClassNotFound, Message: NodeClass not found on cluster
14+
46s Normal Ready nodepool/default

retail/test.yaml

Whitespace-only changes.

terraform/eks.tf

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)