diff --git a/.github/workflows/coit-frontend-ci.yml b/.github/workflows/coit-frontend-ci.yml index da23b3d0..498e8382 100644 --- a/.github/workflows/coit-frontend-ci.yml +++ b/.github/workflows/coit-frontend-ci.yml @@ -82,6 +82,5 @@ jobs: - name: Deploy the GKE Cluster run: | - cd resource-manifests/DeploymentAndServices-All - kubectl apply -f service-coit-frontend-lb.yaml - kubectl apply -f coit-frontend-deployment.yaml \ No newline at end of file + cd kustomize/environments/preview + kubectl apply -k . diff --git a/kustomize/coit-backend1/coit-backend1-deployment.yaml b/kustomize/coit-backend1/coit-backend1-deployment.yaml new file mode 100644 index 00000000..43b9f26d --- /dev/null +++ b/kustomize/coit-backend1/coit-backend1-deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: coit-backend1 + labels: + app: coit-backend1 +spec: + selector: + matchLabels: + app: coit-backend1 + replicas: 3 + minReadySeconds: 15 + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 1 + maxSurge: 1 + template: + metadata: + labels: + app: coit-backend1 + spec: + containers: + - image: coitlearning/coit-backend1:v1 + imagePullPolicy: IfNotPresent + name: coit-backend1 + ports: + - containerPort: 8080 + env: + - name: SA_LOGIC_API_URL + valueFrom: + configMapKeyRef: + name: coit-backend1-config + key: python-url diff --git a/kustomize/coit-backend1/service-coit-backend1-lb.yaml b/kustomize/coit-backend1/service-coit-backend1-lb.yaml new file mode 100644 index 00000000..dc50486c --- /dev/null +++ b/kustomize/coit-backend1/service-coit-backend1-lb.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: coit-backend1-lb +spec: + type: LoadBalancer + ports: + - port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: coit-backend1 diff --git a/kustomize/coit-backend2/coit-backend2-deployment.yaml b/kustomize/coit-backend2/coit-backend2-deployment.yaml new file mode 100644 index 00000000..4aa1f956 --- /dev/null +++ b/kustomize/coit-backend2/coit-backend2-deployment.yaml @@ -0,0 +1,28 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: coit-backend2 + labels: + app: coit-backend2 +spec: + selector: + matchLabels: + app: coit-backend2 + replicas: 2 + minReadySeconds: 15 + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 1 + maxSurge: 1 + template: + metadata: + labels: + app: coit-backend2 + spec: + containers: + - image: coitlearning/coit-backend2:v1 + imagePullPolicy: IfNotPresent + name: coit-backend2 + ports: + - containerPort: 5000 diff --git a/kustomize/coit-backend2/service-coit-backend2.yaml b/kustomize/coit-backend2/service-coit-backend2.yaml new file mode 100644 index 00000000..cbdf20c6 --- /dev/null +++ b/kustomize/coit-backend2/service-coit-backend2.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: coit-backend2 +spec: + ports: + - port: 80 + protocol: TCP + targetPort: 5000 + selector: + app: coit-backend2 \ No newline at end of file diff --git a/kustomize/coit-frontend/coit-frontend-deployment.yaml b/kustomize/coit-frontend/coit-frontend-deployment.yaml new file mode 100644 index 00000000..43e74739 --- /dev/null +++ b/kustomize/coit-frontend/coit-frontend-deployment.yaml @@ -0,0 +1,29 @@ +apiVersion: apps/v1 +kind: Deployment # 1 +metadata: + name: coit-frontend + labels: + app: coit-frontend +spec: + selector: + matchLabels: + app: coit-frontend + replicas: 2 # 2 + minReadySeconds: 15 + strategy: + type: RollingUpdate # 3 + rollingUpdate: + maxUnavailable: 1 # 4 + maxSurge: 1 # 5 + template: + metadata: + labels: + app: coit-frontend # 6 + app.kubernetes.io/name: coit-frontend + spec: + containers: + - image: coitlearning/coit-frontend:latest + imagePullPolicy: IfNotPresent # 7 + name: coit-frontend + ports: + - containerPort: 80 diff --git a/kustomize/coit-frontend/kustomization.yaml b/kustomize/coit-frontend/kustomization.yaml new file mode 100644 index 00000000..e39016d6 --- /dev/null +++ b/kustomize/coit-frontend/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - coit-frontend-deployment.yaml + - service-coit-frontend-lb.yaml + +replicas: +- name: coit-frontend + count: 3 + +namespace: default diff --git a/kustomize/coit-frontend/service-coit-frontend-lb.yaml b/kustomize/coit-frontend/service-coit-frontend-lb.yaml new file mode 100644 index 00000000..38364692 --- /dev/null +++ b/kustomize/coit-frontend/service-coit-frontend-lb.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service # 1 +metadata: + name: coit-frontend-lb +spec: + type: LoadBalancer + ports: + - port: 80 # 3 + protocol: TCP # 4 + targetPort: 80 # 5 + selector: # 6 + app: coit-frontend # 7 diff --git a/kustomize/environments/preview/kustomization.yaml b/kustomize/environments/preview/kustomization.yaml new file mode 100644 index 00000000..5ca1e828 --- /dev/null +++ b/kustomize/environments/preview/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../coit-frontend + +replicas: +- name: coit-frontend + count: 3 + +namespace: preview diff --git a/kustomize/environments/production/kustomization.yaml b/kustomize/environments/production/kustomization.yaml new file mode 100644 index 00000000..28ac0626 --- /dev/null +++ b/kustomize/environments/production/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../coit-frontend + +replicas: +- name: coit-frontend + count: 10 + +namespace: production diff --git a/kustomize/environments/staging/kustomization.yaml b/kustomize/environments/staging/kustomization.yaml new file mode 100644 index 00000000..f3a4a8fb --- /dev/null +++ b/kustomize/environments/staging/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../coit-frontend + +replicas: +- name: coit-frontend + count: 5 + +namespace: default diff --git a/kustomize/kustomization.yaml b/kustomize/kustomization.yaml new file mode 100644 index 00000000..44386bc0 --- /dev/null +++ b/kustomize/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - coit-frontend + +replicas: +- name: coit-frontend + count: 3 + +namespace: default diff --git a/resource-manifests/kustomize b/resource-manifests/kustomize deleted file mode 100755 index 0836fd2a..00000000 Binary files a/resource-manifests/kustomize and /dev/null differ diff --git a/resource-manifests/kustomize/coit-backend1-deployment.yaml b/resource-manifests/kustomize/coit-backend1-deployment.yaml new file mode 100644 index 00000000..43b9f26d --- /dev/null +++ b/resource-manifests/kustomize/coit-backend1-deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: coit-backend1 + labels: + app: coit-backend1 +spec: + selector: + matchLabels: + app: coit-backend1 + replicas: 3 + minReadySeconds: 15 + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 1 + maxSurge: 1 + template: + metadata: + labels: + app: coit-backend1 + spec: + containers: + - image: coitlearning/coit-backend1:v1 + imagePullPolicy: IfNotPresent + name: coit-backend1 + ports: + - containerPort: 8080 + env: + - name: SA_LOGIC_API_URL + valueFrom: + configMapKeyRef: + name: coit-backend1-config + key: python-url diff --git a/resource-manifests/kustomize/coit-backend2-deployment.yaml b/resource-manifests/kustomize/coit-backend2-deployment.yaml new file mode 100644 index 00000000..4aa1f956 --- /dev/null +++ b/resource-manifests/kustomize/coit-backend2-deployment.yaml @@ -0,0 +1,28 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: coit-backend2 + labels: + app: coit-backend2 +spec: + selector: + matchLabels: + app: coit-backend2 + replicas: 2 + minReadySeconds: 15 + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: 1 + maxSurge: 1 + template: + metadata: + labels: + app: coit-backend2 + spec: + containers: + - image: coitlearning/coit-backend2:v1 + imagePullPolicy: IfNotPresent + name: coit-backend2 + ports: + - containerPort: 5000 diff --git a/resource-manifests/kustomize/coit-frontend-deployment.yaml b/resource-manifests/kustomize/coit-frontend-deployment.yaml new file mode 100644 index 00000000..43e74739 --- /dev/null +++ b/resource-manifests/kustomize/coit-frontend-deployment.yaml @@ -0,0 +1,29 @@ +apiVersion: apps/v1 +kind: Deployment # 1 +metadata: + name: coit-frontend + labels: + app: coit-frontend +spec: + selector: + matchLabels: + app: coit-frontend + replicas: 2 # 2 + minReadySeconds: 15 + strategy: + type: RollingUpdate # 3 + rollingUpdate: + maxUnavailable: 1 # 4 + maxSurge: 1 # 5 + template: + metadata: + labels: + app: coit-frontend # 6 + app.kubernetes.io/name: coit-frontend + spec: + containers: + - image: coitlearning/coit-frontend:latest + imagePullPolicy: IfNotPresent # 7 + name: coit-frontend + ports: + - containerPort: 80 diff --git a/resource-manifests/kustomize/environments/preview/kustomization.yaml b/resource-manifests/kustomize/environments/preview/kustomization.yaml new file mode 100644 index 00000000..84c0cff4 --- /dev/null +++ b/resource-manifests/kustomize/environments/preview/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../coit-frontend-deployment.yaml + - ../../service-coit-frontend-lb.yaml + +replicas: +- name: coit-frontend + count: 3 + +namespace: default diff --git a/resource-manifests/kustomize/environments/production/kustomization.yaml b/resource-manifests/kustomize/environments/production/kustomization.yaml new file mode 100644 index 00000000..e5b47fdc --- /dev/null +++ b/resource-manifests/kustomize/environments/production/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../coit-frontend-deployment.yaml + - ../../service-coit-frontend-lb.yaml + +replicas: +- name: coit-frontend + count: 10 + +namespace: default diff --git a/resource-manifests/kustomize/environments/staging/kustomization.yaml b/resource-manifests/kustomize/environments/staging/kustomization.yaml new file mode 100644 index 00000000..5f22dfa0 --- /dev/null +++ b/resource-manifests/kustomize/environments/staging/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../coit-frontend-deployment.yaml + - ../../service-coit-frontend-lb.yaml + +replicas: +- name: coit-frontend + count: 5 + +namespace: default diff --git a/resource-manifests/kustomize/kustomization.yaml b/resource-manifests/kustomize/kustomization.yaml new file mode 100644 index 00000000..e39016d6 --- /dev/null +++ b/resource-manifests/kustomize/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - coit-frontend-deployment.yaml + - service-coit-frontend-lb.yaml + +replicas: +- name: coit-frontend + count: 3 + +namespace: default diff --git a/resource-manifests/kustomize/service-coit-backend1-lb.yaml b/resource-manifests/kustomize/service-coit-backend1-lb.yaml new file mode 100644 index 00000000..dc50486c --- /dev/null +++ b/resource-manifests/kustomize/service-coit-backend1-lb.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: coit-backend1-lb +spec: + type: LoadBalancer + ports: + - port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: coit-backend1 diff --git a/resource-manifests/kustomize/service-coit-backend2.yaml b/resource-manifests/kustomize/service-coit-backend2.yaml new file mode 100644 index 00000000..cbdf20c6 --- /dev/null +++ b/resource-manifests/kustomize/service-coit-backend2.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: coit-backend2 +spec: + ports: + - port: 80 + protocol: TCP + targetPort: 5000 + selector: + app: coit-backend2 \ No newline at end of file diff --git a/resource-manifests/kustomize/service-coit-frontend-lb.yaml b/resource-manifests/kustomize/service-coit-frontend-lb.yaml new file mode 100644 index 00000000..38364692 --- /dev/null +++ b/resource-manifests/kustomize/service-coit-frontend-lb.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service # 1 +metadata: + name: coit-frontend-lb +spec: + type: LoadBalancer + ports: + - port: 80 # 3 + protocol: TCP # 4 + targetPort: 80 # 5 + selector: # 6 + app: coit-frontend # 7