-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5216dfe
commit 29446ea
Showing
8 changed files
with
167 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: frontend | ||
labels: | ||
app.kubernetes.io/name: frontend | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: frontend | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: frontend | ||
spec: | ||
imagePullSecrets: | ||
- name: ecrsecret | ||
containers: | ||
- name: frontend | ||
image: MY_ACCOUNT.dkr.ecr.eu-west-1.amazonaws.com/learning-frontend:ve296b828cb5109a608881efa9fe5bf208d682bbc | ||
imagePullPolicy: IfNotPresent | ||
ports: | ||
- containerPort: 8000 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: frontend | ||
labels: | ||
app.kubernetes.io/name: frontend | ||
spec: | ||
selector: | ||
app.kubernetes.io/name: frontend | ||
ports: | ||
- protocol: TCP | ||
port: 8000 | ||
targetPort: 8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
Django==4.2.16 | ||
tzdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Cron job to update ECR credentials | ||
|
||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: ecr-credentials-helper-sa | ||
namespace: default | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
namespace: default | ||
name: ecr-credentials-helper-role | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["secrets"] | ||
resourceNames: ["ecrsecret"] # Replace with your desired ECR token secret name | ||
verbs: ["delete"] | ||
- apiGroups: [""] | ||
resources: ["secrets"] | ||
verbs: ["create"] | ||
--- | ||
kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: ecr-credentials-helper-binding | ||
namespace: default | ||
subjects: | ||
- kind: ServiceAccount | ||
name: ecr-credentials-helper-sa | ||
namespace: default | ||
apiGroup: "" | ||
roleRef: | ||
kind: Role | ||
name: ecr-credentials-helper-role | ||
apiGroup: "" | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: ecr-credentials-helper | ||
namespace: default | ||
spec: | ||
schedule: "* * * * *" | ||
successfulJobsHistoryLimit: 2 | ||
failedJobsHistoryLimit: 2 | ||
suspend: false | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
hostNetwork: true | ||
serviceAccountName: ecr-credentials-helper-sa | ||
containers: | ||
- name: ecr-credentials-helper | ||
image: public.ecr.aws/aws-cli/aws-cli:2.17.58 | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- /bin/bash | ||
- -c | ||
- |- | ||
set -e | ||
export AWS_DEFAULT_REGION=$(curl http://169.254.169.254/latest/meta-data/placement/region) | ||
export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) | ||
ECR_TOKEN="$(aws ecr get-login-password)" | ||
curl -LO https://dl.k8s.io/release/v1.29.0/bin/linux/arm64/kubectl | ||
chmod +x kubectl | ||
mv kubectl /usr/bin/ | ||
kubectl delete secret --ignore-not-found ecrsecret -n default | ||
kubectl create secret docker-registry ecrsecret --docker-server=https://${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com --docker-username=AWS --docker-password=${ECR_TOKEN} --namespace=default | ||
restartPolicy: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters