Skip to content

Commit 35a2bc4

Browse files
authored
Revert "."
This reverts commit 3ede49a.
1 parent 3ede49a commit 35a2bc4

File tree

14 files changed

+2
-639
lines changed

14 files changed

+2
-639
lines changed

.github/workflows/build.yml

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

.gitignore

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,3 @@
1-
build
2-
.gradle
3-
.vscode
4-
5-
*.log
6-
*.jar
7-
*.war
8-
*.nar
9-
*.ear
10-
*.zip
11-
*.tar.gz
12-
*.rar
13-
14-
# MAC
15-
**/.DS_Store
16-
17-
# internal
18-
*internal*
19-
20-
# k8s
21-
python-ping-api.yaml
22-
231
# Byte-compiled / optimized / DLL files
242
__pycache__/
253
*.py[cod]

README.md

Lines changed: 2 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,2 @@
1-
# Python sample project for EKS
2-
3-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=DevSecOpsSamples_eks-python-api&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=DevSecOpsSamples_eks-python-api) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=DevSecOpsSamples_eks-python-api&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=DevSecOpsSamples_eks-python-api)
4-
5-
The sample project to deploy Python REST API application, Service, HorizontalPodAutoscaler, Ingress on EKS.
6-
7-
- [app.py](app/app.py)
8-
- [Dockerfile](app/Dockerfile)
9-
- [python-ping-api-template.yaml](app/python-ping-api-template.yaml)
10-
11-
---
12-
13-
## Prerequisites
14-
15-
### Installation
16-
17-
- [Installing or updating the latest version of the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
18-
19-
### Set AWS configurations
20-
21-
Set AWS configurations with `aws configure` for default region and keys:
22-
23-
```bash
24-
aws configure
25-
```
26-
27-
```bash
28-
AWS Access Key ID [None]: <enter-your-access-key>
29-
AWS Secret Access Key [None]: <enter-your-secret-key>
30-
Default region name [None]: us-east-1
31-
Default output format [None]:
32-
```
33-
34-
```bash
35-
aws configure get default.region
36-
us-east-1
37-
```
38-
39-
---
40-
41-
## Create an EKS cluster and deploy AWS Load Balancer Controller
42-
43-
Refer to the https://github.com/DevSecOpsSamples/eks-eksctl page.
44-
45-
## Set environment variables
46-
47-
```bash
48-
REGION=$(aws configure get default.region)
49-
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
50-
CLUSTER_NAME=$(kubectl config current-context | cut -d '@' -f2 | cut -d '.' -f1)
51-
echo "REGION: ${REGION}, ACCOUNT_ID: ${ACCOUNT_ID}, CLUSTER_NAME: ${CLUSTER_NAME}"
52-
```
53-
54-
## Deploy python-ping-api
55-
56-
Build and push to ECR:
57-
58-
```bash
59-
cd ../app
60-
docker build -t python-ping-api . --platform linux/amd64
61-
62-
docker tag python-ping-api:latest ${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com/python-ping-api:latest
63-
64-
aws ecr get-login-password --region ${REGION} | docker login --username AWS --password-stdin ${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com
65-
66-
docker push ${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com/python-ping-api:latest
67-
```
68-
69-
Create and deploy K8s Deployment, Service, HorizontalPodAutoscaler, Ingress using the [python-ping-api-template.yaml](app/python-ping-api-template.yaml) template file.
70-
71-
```bash
72-
73-
sed -e "s|<account-id>|${ACCOUNT_ID}|g" python-ping-api-template.yaml | sed -e "s|<region>|${REGION}|g" > python-ping-api.yaml
74-
cat python-ping-api.yaml
75-
76-
kubectl apply -f python-ping-api.yaml
77-
```
78-
79-
It may take around 5 minutes to create a load balancer, including health checking.
80-
81-
Confirm that Pod and ALB logs.
82-
83-
```bash
84-
kubectl logs -l app=python-ping-api
85-
86-
kubectl describe pods
87-
88-
kubectl logs -f $(kubectl get po -n kube-system | egrep -o 'aws-load-balancer-controller-[A-Za-z0-9-]+') -n kube-system
89-
```
90-
91-
---
92-
93-
## Cleanup
94-
95-
```bash
96-
kubectl delete -f app/python-ping-api.yaml
97-
98-
```
99-
100-
## References
101-
102-
- [Application load balancing on Amazon EKS](https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html)
1+
# _eks-python-api
2+
Python REST API sample for EKS

app/Dockerfile

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

app/app.py

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

app/build.sh

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

app/gunicorn.config.py

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

app/python-ping-api-template.yaml

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

app/requirements.txt

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

build.gradle

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

0 commit comments

Comments
 (0)