Skip to content

Commit

Permalink
feat: Addition of kind infrastructure and deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsukoyachi committed Sep 16, 2024
1 parent 9ee9aa0 commit 05067b1
Show file tree
Hide file tree
Showing 30 changed files with 680 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,32 @@ And join the Nx community:
- [Follow us on X](https://twitter.com/nxdevtools) or [LinkedIn](https://www.linkedin.com/company/nrwl)
- [Our Youtube channel](https://www.youtube.com/@nxdevtools)
- [Our blog](https://nx.dev/blog?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)

## Cluster part

To start the cluster you need the following tools :
- kind
- kubectl
- openlens (to see it in a gui)
- helm

Create the cluster with the given configuration file :
- kind create cluster --config kind-cluster.yml

To see if it was deployed succesfully :
- kubectl get node

Then to export the configuration and see the cluster in open lens :
- kind export kubeconfig
- cat ~/.kube/config

Copy paste the result into open lens -> catalog -> cluster -> from kubeconfig -> add cluster

Here are a few plugin that are usefull for open lens (three line upper left -> file -> extensions) :
- @alebcay/openlens-node-pod-menu
- @nevalla/kube-resource-map

Then for the kind cluster we want to deploy we go to the kind folder and do :
- kubectl apply -y .

If done correctly every node of this project should be deployed
43 changes: 43 additions & 0 deletions apps/frontend-bff/manifest/base/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: frontend-bff
name: frontend-bff
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: frontend-bff
template:
metadata:
labels:
io.kompose.service: frontend-bff
spec:
containers:
- image: ghcr.io/startupnationlabs/spos/frontend-bff:sha-69ef30b
name: frontend-bff
ports:
- containerPort: 80
protocol: TCP
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "512Mi"
env: []
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 15
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 20
restartPolicy: Always
24 changes: 24 additions & 0 deletions apps/frontend-bff/manifest/base/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-frontend-bff
annotations:
kubernetes.io/ingress.class: traefik
cert-manager.io/cluster-issuer: letsencrypt-prod
traefik.ingress.kubernetes.io/router.middlewares: default-redirect-https@kubernetescrd
spec:
rules:
- host: frontend-bff.spos.polytech.apoorva64.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: frontend-bff
port:
number: 80
tls:
- hosts:
- frontend-bff.spos.polytech.apoorva64.com
secretName: frontend-bff.spos.polytech.apoorva64-tls
7 changes: 7 additions & 0 deletions apps/frontend-bff/manifest/base/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1

kind: Kustomization
resources:
- deployment.yml
- ingress.yml
- service.yml
14 changes: 14 additions & 0 deletions apps/frontend-bff/manifest/base/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

apiVersion: v1
kind: Service
metadata:
labels:
io.kompose.service: frontend-bff
name: frontend-bff
spec:
ports:
- name: "80"
port: 80
targetPort: 80
selector:
io.kompose.service: frontend-bff
9 changes: 9 additions & 0 deletions apps/frontend-bff/manifest/overlays/develop/ingress-patch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- op: replace
path: /spec/rules/0/host
value: frontend-bff.spos.dev.polytech.apoorva64.com
- op: replace
path: /spec/tls/0/hosts/0
value: frontend-bff.spos.dev.polytech.apoorva64.com
- op: replace
path: /spec/tls/0/secretName
value: frontend-bff.spos.dev.polytech.apoorva64-tls
15 changes: 15 additions & 0 deletions apps/frontend-bff/manifest/overlays/develop/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1

resources:
- ../../base

images:
- name: ghcr.io/startupnationlabs/spos/frontend-bff
newName: ghcr.io/startupnationlabs/spos/frontend-bff
newTag: sha-69ef30b

patches:
- target:
kind: Ingress
name: ingress-frontend-bff
path: ingress-patch.yml
9 changes: 9 additions & 0 deletions apps/frontend-bff/manifest/overlays/main/ingress-patch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- op: replace
path: /spec/rules/0/host
value: frontend-bff.spos.polytech.apoorva64.com
- op: replace
path: /spec/tls/0/hosts/0
value: frontend-bff.spos.polytech.apoorva64.com
- op: replace
path: /spec/tls/0/secretName
value: frontend-bff.spos.polytech.apoorva64-tls
16 changes: 16 additions & 0 deletions apps/frontend-bff/manifest/overlays/main/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1

resources:
- ../../base

images:
- name: ghcr.io/startupnationlabs/spos/frontend-bff
newName: ghcr.io/startupnationlabs/spos/frontend-bff
newTag: sha-69ef30b


patches:
- target:
kind: Ingress
name: ingress-frontend-bff
path: ingress-patch.yml
43 changes: 43 additions & 0 deletions apps/frontend-workflow/manifest/base/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: frontend-workflow
name: frontend-workflow
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: frontend-workflow
template:
metadata:
labels:
io.kompose.service: frontend-workflow
spec:
containers:
- image: ghcr.io/startupnationlabs/spos/frontend-workflow:sha-69ef30b
name: frontend-workflow
ports:
- containerPort: 80
protocol: TCP
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "512Mi"
env: []
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 15
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 20
restartPolicy: Always
24 changes: 24 additions & 0 deletions apps/frontend-workflow/manifest/base/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-frontend-workflow
annotations:
kubernetes.io/ingress.class: traefik
cert-manager.io/cluster-issuer: letsencrypt-prod
traefik.ingress.kubernetes.io/router.middlewares: default-redirect-https@kubernetescrd
spec:
rules:
- host: frontend-workflow.spos.polytech.apoorva64.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: frontend-workflow
port:
number: 80
tls:
- hosts:
- frontend-workflow.spos.polytech.apoorva64.com
secretName: frontend-workflow.spos.polytech.apoorva64-tls
7 changes: 7 additions & 0 deletions apps/frontend-workflow/manifest/base/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1

kind: Kustomization
resources:
- deployment.yml
- ingress.yml
- service.yml
14 changes: 14 additions & 0 deletions apps/frontend-workflow/manifest/base/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

apiVersion: v1
kind: Service
metadata:
labels:
io.kompose.service: frontend-workflow
name: frontend-workflow
spec:
ports:
- name: "80"
port: 80
targetPort: 80
selector:
io.kompose.service: frontend-workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- op: replace
path: /spec/rules/0/host
value: frontend-workflow.spos.dev.polytech.apoorva64.com
- op: replace
path: /spec/tls/0/hosts/0
value: frontend-workflow.spos.dev.polytech.apoorva64.com
- op: replace
path: /spec/tls/0/secretName
value: frontend-workflow.spos.dev.polytech.apoorva64-tls
16 changes: 16 additions & 0 deletions apps/frontend-workflow/manifest/overlays/develop/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1

resources:
- ../../base

images:
- name: ghcr.io/startupnationlabs/spos/frontend-workflow
newName: ghcr.io/startupnationlabs/spos/frontend-workflow
newTag: sha-69ef30b


patches:
- target:
kind: Ingress
name: ingress-frontend-workflow
path: ingress-patch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- op: replace
path: /spec/rules/0/host
value: frontend-workflow.spos.polytech.apoorva64.com
- op: replace
path: /spec/tls/0/hosts/0
value: frontend-workflow.spos.polytech.apoorva64.com
- op: replace
path: /spec/tls/0/secretName
value: frontend-workflow.spos.polytech.apoorva64-tls
15 changes: 15 additions & 0 deletions apps/frontend-workflow/manifest/overlays/main/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1

resources:
- ../../base

images:
- name: ghcr.io/startupnationlabs/spos/frontend-workflow
newName: ghcr.io/startupnationlabs/spos/frontend-workflow
newTag: sha-69ef30b

patches:
- target:
kind: Ingress
name: ingress
path: ingress-patch.yml
17 changes: 17 additions & 0 deletions kind-cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 30000
hostPort: 80
protocol: TCP
- containerPort: 30001
hostPort: 443
protocol: TCP
7 changes: 7 additions & 0 deletions kind/apps/spos/develop/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1

kind: Kustomization
namespace: spos-dev
resources:
- namespace.yml
- ../../../../manifest/develop
4 changes: 4 additions & 0 deletions kind/apps/spos/develop/namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: spos-dev
7 changes: 7 additions & 0 deletions kind/apps/spos/main/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1

kind: Kustomization
namespace: spos-main
resources:
- namespace.yml
- ../../../../manifest/main
4 changes: 4 additions & 0 deletions kind/apps/spos/main/namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: spos-main
7 changes: 7 additions & 0 deletions kind/infrastructure/traefik/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1

kind: Kustomization
resources:
- namespace.yml
- https://github.com/traefik/traefik-helm-chart/traefik/crds/
- render-template.yml
4 changes: 4 additions & 0 deletions kind/infrastructure/traefik/namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: traefik
Loading

0 comments on commit 05067b1

Please sign in to comment.