feat: add templates

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-02-03 19:13:55 +01:00
parent 94244cf937
commit a4092639d1
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
4 changed files with 81 additions and 0 deletions

20
templates/deployment.yaml Normal file
View File

@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ service }}"
spec:
selector:
matchLabels:
app: "{{ service }}"
template:
spec:
containers:
- name: "{{ service }}"
image: "deployment:latest"
ports:
- containerPort: 3000
name: external_http
- containerPort: 3001
name: internal_http
- containerPort: 3002
name: internal_grpc

View File

@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ service }}"
spec:
selector:
matchLabels:
app: "{{ service }}"
template:
spec:
containers:
- name: "{{ service }}"
image: "deployment:latest"
ports:
- containerPort: 3000
name: external_http
- containerPort: 3001
name: internal_http
- containerPort: 3002
name: internal_grpc

View File

@ -0,0 +1,24 @@
{% set_global cluster_vars = filter_by_prefix(prefix=["clusters", cluster]) %}
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
commonLabels:
app: "{{ service }}"
cluster: "{{ cluster }}"
namespace: "{{ cluster_vars.namespace }}"
replicas:
- name: "{{ service }}"
count: {{ cluster_vars.replicas }}
images:
- name: "deployment"
newName: "{{ service }}"
newTag: "{{ image_tag }}"

View File

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: "{{ service }}"
spec:
type: LoadBalancer
ports:
- name: external_http
port: 3000
targetPort: 3000
- name: internal_http
port: 3001
targetPort: 3001
- name: internal_grpc
port: 3002
targetPort: 3002