fix readme

This commit is contained in:
kkb0318
2024-05-31 21:41:02 +09:00
parent a4d600253e
commit 618f70d22a
6 changed files with 148 additions and 23 deletions
+21
View File
@@ -0,0 +1,21 @@
apiVersion: batch/v1
kind: Job
metadata:
name: s3-echoer
spec:
template:
spec:
serviceAccountName: s3-echoer
containers:
- name: main
image: amazonlinux:2018.03
command:
- "sh"
- "-c"
- "curl -sL -o /s3-echoer https://github.com/mhausenblas/s3-echoer/releases/latest/download/s3-echoer-linux && chmod +x /s3-echoer && echo This is an in-cluster test | /s3-echoer TARGET_BUCKET"
env:
- name: AWS_DEFAULT_REGION
value: "ap-northeast-1"
- name: ENABLE_IRP
value: "true"
restartPolicy: Never
+21
View File
@@ -0,0 +1,21 @@
apiVersion: batch/v1
kind: Job
metadata:
name: s3-echoer
spec:
template:
spec:
serviceAccountName: s3-echoer
containers:
- name: main
image: amazonlinux:2023
command:
- "sh"
- "-c"
- "curl -sL -o /s3-echoer https://github.com/kkb0318/s3-echoer-arm/releases/latest/download/s3-echoer-linux-arm64 && chmod +x /s3-echoer && echo This is an in-cluster test | /s3-echoer TARGET_BUCKET"
env:
- name: AWS_DEFAULT_REGION
value: "ap-northeast-1"
- name: ENABLE_IRP
value: "true"
restartPolicy: Never
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
TARGET_BUCKET_PREFIX=s3-echoer
AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-ap-northeast-1}
JOB_TEMPLATE=job-arm.yaml.template
# deploy s3 echoer job into k8s cluster
timestamp=$(date +%s)
TARGET_BUCKET=$ROLE_NAME-$timestamp
aws s3api create-bucket \
--bucket $TARGET_BUCKET_PREFIX \
--create-bucket-configuration LocationConstraint=$AWS_DEFAULT_REGION \
--region $AWS_DEFAULT_REGION
sed -e "s/TARGET_BUCKET/${TARGET_BUCKET_PREFIX}/g" ${JOB_TEMPLATE} > s3-echoer-job.yaml
kubectl create -f s3-echoer-job.yaml
echo "The S3 bucket is $TARGET_BUCKET_PREFIX"