Skip to content

Commit

Permalink
Changed circleci variable associated with image tag
Browse files Browse the repository at this point in the history
  • Loading branch information
giulio-giunta committed Dec 11, 2023
1 parent c09fe35 commit cbf1aec
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 224 deletions.
32 changes: 16 additions & 16 deletions aws/k8s/celery/celery-deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
stringData:
stringData:
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
kind: Secret
metadata:
Expand All @@ -26,18 +26,18 @@ spec:
app: celery
spec:
containers:
- envFrom:
- secretRef:
name: celery-broker-url
- secretRef:
name: celery-secrets
image: geekzone/backend:0.1.${CIRCLE_PREVIOUS_BUILD_NUM}
name: celery
command: ["sh", "-c", "celery -A web worker -l INFO"]
resources:
limits:
memory: "200Mi"
cpu: 50m
requests:
memory: "50Mi"
cpu: 30m
- envFrom:
- secretRef:
name: celery-broker-url
- secretRef:
name: celery-secrets
image: geekzone/backend:0.1.$TAG
name: celery
command: ["sh", "-c", "celery -A web worker -l INFO"]
resources:
limits:
memory: "200Mi"
cpu: 50m
requests:
memory: "50Mi"
cpu: 30m
102 changes: 51 additions & 51 deletions aws/k8s/prod-environment/deploy-gz-web.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
stringData:
stringData:
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
kind: Secret
metadata:
Expand All @@ -26,55 +26,55 @@ spec:
app: gz-web
spec:
initContainers:
- name: wait-for-migration
image: geekzone/backend:0.1.${CIRCLE_PREVIOUS_BUILD_NUM}
command: ['python3', 'manage.py', 'migrate']
envFrom:
- secretRef:
name: prod-secrets
- name: wait-for-database
image: geekzone/backend:0.1.${CIRCLE_PREVIOUS_BUILD_NUM}
command: ['python3', 'manage.py', 'wait_for_database']
envFrom:
- secretRef:
name: prod-secrets
- name: wait-for-migration
image: geekzone/backend:0.1.$TAG
command: ["python3", "manage.py", "migrate"]
envFrom:
- secretRef:
name: prod-secrets
- name: wait-for-database
image: geekzone/backend:0.1.$TAG
command: ["python3", "manage.py", "wait_for_database"]
envFrom:
- secretRef:
name: prod-secrets
containers:
- name: django-backend
image: geekzone/backend:0.1.${CIRCLE_PREVIOUS_BUILD_NUM}
envFrom:
- secretRef:
name: celery-broker-url
- secretRef:
name: prod-secrets
resources:
limits:
memory: "100Mi"
cpu: 50m
requests:
memory: "50Mi"
cpu: 30m
- name: frontend-proxy
image: geekzone/frontend:0.1.${CIRCLE_PREVIOUS_BUILD_NUM}
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
resources:
limits:
memory: "50Mi"
cpu: 50m
requests:
memory: "30Mi"
cpu: 30m
- name: django-backend
image: geekzone/backend:0.1.$TAG
envFrom:
- secretRef:
name: celery-broker-url
- secretRef:
name: prod-secrets
resources:
limits:
memory: "100Mi"
cpu: 50m
requests:
memory: "50Mi"
cpu: 30m
- name: frontend-proxy
image: geekzone/frontend:0.1.$TAG
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
resources:
limits:
memory: "50Mi"
cpu: 50m
requests:
memory: "30Mi"
cpu: 30m

---
apiVersion: v1
Expand All @@ -90,5 +90,5 @@ spec:
selector:
app: gz-web
ports:
- port: 80
targetPort: 8080
- port: 80
targetPort: 8080
176 changes: 91 additions & 85 deletions aws/k8s/test-environment/deploy-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,55 +78,55 @@ spec:
app: gz-web
spec:
initContainers:
- name: wait-for-migration
image: geekzone/backend:0.1.${CIRCLE_PREVIOUS_BUILD_NUM}
command: ['python3', 'manage.py', 'migrate']
envFrom:
- secretRef:
name: testing-secrets
- name: wait-for-database
image: geekzone/backend:0.1.${CIRCLE_PREVIOUS_BUILD_NUM}
command: ['python3', 'manage.py', 'wait_for_database']
envFrom:
- secretRef:
name: testing-secrets
- name: wait-for-migration
image: geekzone/backend:0.1.$TAG
command: ["python3", "manage.py", "migrate"]
envFrom:
- secretRef:
name: testing-secrets
- name: wait-for-database
image: geekzone/backend:0.1.$TAG
command: ["python3", "manage.py", "wait_for_database"]
envFrom:
- secretRef:
name: testing-secrets
containers:
- name: django-backend
image: geekzone/backend:0.1.${CIRCLE_PREVIOUS_BUILD_NUM}
envFrom:
- secretRef:
name: dynamic-secrets
- secretRef:
name: testing-secrets
resources:
limits:
memory: "100Mi"
cpu: 50m
requests:
memory: "50Mi"
cpu: 30m
- name: frontend-proxy
image: geekzone/frontend:0.1.${CIRCLE_PREVIOUS_BUILD_NUM}
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
resources:
limits:
memory: "50Mi"
cpu: 50m
requests:
memory: "30Mi"
cpu: 30m
- name: django-backend
image: geekzone/backend:0.1.$TAG
envFrom:
- secretRef:
name: dynamic-secrets
- secretRef:
name: testing-secrets
resources:
limits:
memory: "100Mi"
cpu: 50m
requests:
memory: "50Mi"
cpu: 30m
- name: frontend-proxy
image: geekzone/frontend:0.1.$TAG
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
resources:
limits:
memory: "50Mi"
cpu: 50m
requests:
memory: "30Mi"
cpu: 30m

---
apiVersion: v1
Expand All @@ -142,8 +142,8 @@ spec:
selector:
app: gz-web
ports:
- port: 80
targetPort: 8080
- port: 80
targetPort: 8080

---
apiVersion: networking.k8s.io/v1
Expand All @@ -152,22 +152,22 @@ metadata:
name: ingress-gz-web
namespace: ${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}
annotations:
nginx.ingress.kubernetes.io/app-root: /memberships/register
nginx.ingress.kubernetes.io/app-root: /memberships/register
spec:
tls:
- hosts:
- "${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}-test.geek.zone"
rules:
- host: ${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}-test.geek.zone
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: test-gz-web
port:
number: 80
- hosts:
- "${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}-test.geek.zone"
rules:
- host: ${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}-test.geek.zone
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: test-gz-web
port:
number: 80
ingressClassName: nginx

---
Expand All @@ -185,16 +185,16 @@ spec:
template:
metadata:
labels:
name: postgres
name: postgres
spec:
containers:
- name: postgres
image: postgres
ports:
- containerPort: 5432
envFrom:
- secretRef:
name: testing-postgres-secrets
- secretRef:
name: testing-postgres-secrets
volumeMounts:
- name: data
mountPath: /var/lib/postgresql
Expand Down Expand Up @@ -235,14 +235,14 @@ metadata:
name: delete-ns
namespace: ${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}
rules:
- apiGroups:
- ""
resources:
- namespaces
verbs:
- create
- watch
- delete
- apiGroups:
- ""
resources:
- namespaces
verbs:
- create
- watch
- delete

---
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -255,26 +255,32 @@ roleRef:
kind: Role
name: delete-ns
subjects:
- kind: ServiceAccount
name: delete-ns
namespace: ${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}
- kind: ServiceAccount
name: delete-ns
namespace: ${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}

---
apiVersion: batch/v1
kind: CronJob
metadata:
name: delete-ns
name: delete-ns
namespace: ${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}
spec:
schedule: "0/55 * * * *"
jobTemplate:
spec:
template:
spec:
serviceAccountName: delete-ns
serviceAccountName: delete-ns
containers:
- name: delete-ns
image: geekzone/infra
imagePullPolicy: IfNotPresent
command: ["kubectl", "delete", "ns", "${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}"]
restartPolicy: OnFailure
- name: delete-ns
image: geekzone/infra
imagePullPolicy: IfNotPresent
command:
[
"kubectl",
"delete",
"ns",
"${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}",
]
restartPolicy: OnFailure
Loading

0 comments on commit cbf1aec

Please sign in to comment.