Skip to content

Commit 4955f30

Browse files
author
Kenichiro Hiraiwa
committed
feat: support EKS Auto Mode
1 parent fb1dc64 commit 4955f30

14 files changed

+92
-169
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use an official Python runtime as a parent image
2-
FROM python:3.9-slim-buster as builder
2+
FROM python:3.11-slim-buster as builder
33

44
# Set environment variables
55
ENV PYTHONDONTWRITEBYTECODE=1 \
@@ -12,7 +12,7 @@ WORKDIR /server
1212
COPY ./server/requirements.txt /server/
1313
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /server/wheels -r requirements.txt
1414

15-
FROM python:3.9-slim-buster as runner
15+
FROM python:3.11-slim-buster as runner
1616

1717
WORKDIR /server
1818

docker-compose.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
version: '3.8'
2-
31
services:
42
db:
5-
image: postgres:13
3+
image: postgres:15
64
env_file:
75
- .env
86
volumes:
97
- ./server/db/init.sh:/docker-entrypoint-initdb.d/init.sh
10-
- postgres_data:/var/lib/postgresql/data # Persist PostgreSQL data
8+
- postgres_data:/var/lib/postgresql@15/data # Persist PostgreSQL data
119
networks:
1210
- webnet
1311

@@ -30,4 +28,4 @@ networks:
3028
webnet:
3129

3230
volumes:
33-
postgres_data: # Define the volume for PostgreSQL data
31+
postgres_data: # Define the volume for PostgreSQL data

eks/create-automode-python.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: eksctl.io/v1alpha5
2+
kind: ClusterConfig
3+
4+
# The metadata section is for specifying essential details about your EKS cluster.
5+
metadata:
6+
# name: The name of your EKS cluster.
7+
name: automode-quickstart
8+
# region: The AWS region where your EKS cluster will be created.
9+
region: us-west-2
10+
# version: The Kubernetes version to use for your EKS cluster.
11+
version: "1.32"
12+
13+
autoModeConfig:
14+
# enabled: The cluster enables Auto Mode.
15+
enabled: true
16+
17+
# The IAM section is for managing IAM roles and service accounts for your cluster.
18+
iam:
19+
# withOIDC: Enable the creation of the OIDC provider associated with the cluster to allow for IAM Roles for Service Accounts (IRSA).
20+
withOIDC: true
21+
serviceAccounts:
22+
- metadata:
23+
name: adot-collector
24+
# this is to create the namespace my-cool-app
25+
namespace: my-cool-app
26+
labels: {aws-usage: "application"}
27+
attachPolicyARNs:
28+
- "arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess"
29+
30+
# The cloudWatch section is for configuring logging for your cluster.
31+
cloudWatch:
32+
clusterLogging:
33+
# enableTypes: Which types of logs to enable. '*' represents all types.
34+
enableTypes: ["*"]
35+
# logRetentionInDays: The number of days to retain log events.
36+
logRetentionInDays: 30

eks/create-fargate-python.yaml

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

eks/create-mng-python.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ metadata:
77
# name: The name of your EKS cluster.
88
name: managednode-quickstart
99
# region: The AWS region where your EKS cluster will be created.
10-
region: us-east-1
10+
region: us-west-2
1111
# version: The Kubernetes version to use for your EKS cluster.
12-
version: "1.29"
12+
version: "1.32"
1313

1414
# The IAM section is for managing IAM roles and service accounts for your cluster.
1515
iam:
@@ -28,7 +28,7 @@ iam:
2828
namespace: my-cool-app
2929
labels: {aws-usage: "application"}
3030
attachPolicyARNs:
31-
- "arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess"
31+
- "arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess"
3232

3333
# The managedNodeGroups section is for configuring your EKS managed node groups.
3434
managedNodeGroups:

eks/deploy-app-python.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ spec:
2929
spec:
3030
containers:
3131
- name: web
32-
image: 012345678901.dkr.ecr.us-east-1.amazonaws.com/fastapi-microservices:1.0
32+
image: 012345678901.dkr.ecr.us-west-2.amazonaws.com/fastapi-microservices:1.0
3333
ports:
3434
- containerPort: 8000
3535
envFrom:

eks/deploy-db-python-fargate.yaml

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

eks/deploy-db-python.yaml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
apiVersion: storage.k8s.io/v1
2-
kind: StorageClass
3-
metadata:
4-
name: ebs-sc
5-
provisioner: ebs.csi.aws.com
6-
volumeBindingMode: WaitForFirstConsumer
7-
---
81
apiVersion: v1
92
kind: Service
103
metadata:
@@ -34,10 +27,10 @@ spec:
3427
spec:
3528
containers:
3629
- name: db
37-
image: postgres:13
30+
image: postgres:15
3831
env:
3932
- name: PGDATA # This is required due to
40-
value: /var/lib/postgresql/data/pgdata
33+
value: /var/lib/postgresql@15/data/pgdata
4134
envFrom:
4235
- secretRef:
4336
name: fastapi-secret
@@ -70,4 +63,4 @@ spec:
7063
storageClassName: ebs-sc
7164
resources:
7265
requests:
73-
storage: 1Gi
66+
storage: 1Gi

eks/efs-pv.yaml

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

eks/efs-sc.yaml

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

0 commit comments

Comments
 (0)