From cbf1aec7d5dabf7893d0372739b41dcaadc3461a Mon Sep 17 00:00:00 2001 From: giulio-giunta <56529931+giulio-giunta@users.noreply.github.com> Date: Mon, 11 Dec 2023 00:19:41 +0000 Subject: [PATCH] Changed circleci variable associated with image tag --- aws/k8s/celery/celery-deploy.yaml | 32 ++-- aws/k8s/prod-environment/deploy-gz-web.yaml | 102 +++++----- aws/k8s/test-environment/deploy-test.yaml | 176 +++++++++--------- azure/k8s/celery/celery-deploy.yaml | 32 ++-- azure/k8s/prod-environment/deploy-gz-web.yaml | 105 +++++------ azure/k8s/test-environment/deploy-test.yaml | 8 +- 6 files changed, 231 insertions(+), 224 deletions(-) diff --git a/aws/k8s/celery/celery-deploy.yaml b/aws/k8s/celery/celery-deploy.yaml index 582ed91..589f188 100644 --- a/aws/k8s/celery/celery-deploy.yaml +++ b/aws/k8s/celery/celery-deploy.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -stringData: +stringData: CELERY_BROKER_URL: ${CELERY_BROKER_URL} kind: Secret metadata: @@ -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 diff --git a/aws/k8s/prod-environment/deploy-gz-web.yaml b/aws/k8s/prod-environment/deploy-gz-web.yaml index f1fdbb4..dc2a27f 100644 --- a/aws/k8s/prod-environment/deploy-gz-web.yaml +++ b/aws/k8s/prod-environment/deploy-gz-web.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -stringData: +stringData: CELERY_BROKER_URL: ${CELERY_BROKER_URL} kind: Secret metadata: @@ -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 @@ -90,5 +90,5 @@ spec: selector: app: gz-web ports: - - port: 80 - targetPort: 8080 + - port: 80 + targetPort: 8080 diff --git a/aws/k8s/test-environment/deploy-test.yaml b/aws/k8s/test-environment/deploy-test.yaml index fefaa42..62d9870 100644 --- a/aws/k8s/test-environment/deploy-test.yaml +++ b/aws/k8s/test-environment/deploy-test.yaml @@ -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 @@ -142,8 +142,8 @@ spec: selector: app: gz-web ports: - - port: 80 - targetPort: 8080 + - port: 80 + targetPort: 8080 --- apiVersion: networking.k8s.io/v1 @@ -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 --- @@ -185,7 +185,7 @@ spec: template: metadata: labels: - name: postgres + name: postgres spec: containers: - name: postgres @@ -193,8 +193,8 @@ spec: ports: - containerPort: 5432 envFrom: - - secretRef: - name: testing-postgres-secrets + - secretRef: + name: testing-postgres-secrets volumeMounts: - name: data mountPath: /var/lib/postgresql @@ -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 @@ -255,15 +255,15 @@ 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 * * * *" @@ -271,10 +271,16 @@ spec: 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 \ No newline at end of file + - name: delete-ns + image: geekzone/infra + imagePullPolicy: IfNotPresent + command: + [ + "kubectl", + "delete", + "ns", + "${PR_NUMBER}-${CIRCLE_PROJECT_REPONAME}", + ] + restartPolicy: OnFailure diff --git a/azure/k8s/celery/celery-deploy.yaml b/azure/k8s/celery/celery-deploy.yaml index 582ed91..589f188 100644 --- a/azure/k8s/celery/celery-deploy.yaml +++ b/azure/k8s/celery/celery-deploy.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -stringData: +stringData: CELERY_BROKER_URL: ${CELERY_BROKER_URL} kind: Secret metadata: @@ -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 diff --git a/azure/k8s/prod-environment/deploy-gz-web.yaml b/azure/k8s/prod-environment/deploy-gz-web.yaml index 5286893..b3a618b 100644 --- a/azure/k8s/prod-environment/deploy-gz-web.yaml +++ b/azure/k8s/prod-environment/deploy-gz-web.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -stringData: +stringData: CELERY_BROKER_URL: ${CELERY_BROKER_URL} kind: Secret metadata: @@ -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 @@ -90,7 +90,8 @@ spec: selector: app: gz-web ports: - - port: 80 - targetPort: 8080 + - port: 80 + targetPort: 8080 + +--- ---- \ No newline at end of file diff --git a/azure/k8s/test-environment/deploy-test.yaml b/azure/k8s/test-environment/deploy-test.yaml index c6015ec..3e11ceb 100644 --- a/azure/k8s/test-environment/deploy-test.yaml +++ b/azure/k8s/test-environment/deploy-test.yaml @@ -79,20 +79,20 @@ spec: spec: initContainers: - name: wait-for-migration - image: geekzone/backend:0.1.${CIRCLE_PREVIOUS_BUILD_NUM} + 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.${CIRCLE_PREVIOUS_BUILD_NUM} + 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} + image: geekzone/backend:0.1.$TAG envFrom: - secretRef: name: dynamic-secrets @@ -106,7 +106,7 @@ spec: memory: "50Mi" cpu: 30m - name: frontend-proxy - image: geekzone/frontend:0.1.${CIRCLE_PREVIOUS_BUILD_NUM} + image: geekzone/frontend:0.1.$TAG ports: - containerPort: 8080 protocol: TCP