Skip to content

Commit

Permalink
Using kustimize instead of kubectl
Browse files Browse the repository at this point in the history
  • Loading branch information
basil1987 committed Oct 1, 2022
1 parent 56c647d commit c7603d2
Show file tree
Hide file tree
Showing 23 changed files with 358 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/coit-frontend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
cd kustomize/environments/preview
kubectl apply -k .
34 changes: 34 additions & 0 deletions kustomize/coit-backend1/coit-backend1-deployment.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions kustomize/coit-backend1/service-coit-backend1-lb.yaml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions kustomize/coit-backend2/coit-backend2-deployment.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions kustomize/coit-backend2/service-coit-backend2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: coit-backend2
spec:
ports:
- port: 80
protocol: TCP
targetPort: 5000
selector:
app: coit-backend2
29 changes: 29 additions & 0 deletions kustomize/coit-frontend/coit-frontend-deployment.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions kustomize/coit-frontend/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions kustomize/coit-frontend/service-coit-frontend-lb.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions kustomize/environments/preview/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../coit-frontend

replicas:
- name: coit-frontend
count: 3

namespace: preview
11 changes: 11 additions & 0 deletions kustomize/environments/production/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../coit-frontend

replicas:
- name: coit-frontend
count: 10

namespace: production
11 changes: 11 additions & 0 deletions kustomize/environments/staging/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../coit-frontend

replicas:
- name: coit-frontend
count: 5

namespace: default
11 changes: 11 additions & 0 deletions kustomize/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- coit-frontend

replicas:
- name: coit-frontend
count: 3

namespace: default
Binary file removed resource-manifests/kustomize
Binary file not shown.
34 changes: 34 additions & 0 deletions resource-manifests/kustomize/coit-backend1-deployment.yaml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions resource-manifests/kustomize/coit-backend2-deployment.yaml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions resource-manifests/kustomize/coit-frontend-deployment.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions resource-manifests/kustomize/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions resource-manifests/kustomize/service-coit-backend1-lb.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions resource-manifests/kustomize/service-coit-backend2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: coit-backend2
spec:
ports:
- port: 80
protocol: TCP
targetPort: 5000
selector:
app: coit-backend2
12 changes: 12 additions & 0 deletions resource-manifests/kustomize/service-coit-frontend-lb.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c7603d2

Please sign in to comment.