Replaced rabbitMQ with Kafka, fixed regcred

This commit is contained in:
PB
2025-11-08 18:20:44 +01:00
parent 4e812b3b22
commit 3907be917d
8 changed files with 131 additions and 74 deletions

View File

@@ -23,7 +23,7 @@ spec:
resources:
requests:
storage: 5Gi
# storageClassName: api-cache-pv
storageClassName: api-cache-pv
---
apiVersion: v1
kind: Service
@@ -100,6 +100,8 @@ spec:
- --redis.addr=redis://api-cache:6379
ports:
- containerPort: 9121
imagePullSecrets:
- name: regcred
volumes:
- name: api-cache-data
persistentVolumeClaim:

View File

@@ -1,4 +1,31 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: api-eventbus-pv
namespace: egommerce
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
storageClassName: api-eventbus-pv
hostPath:
path: "/home/keedosn/.egommerce/kafka" # Ensure this path exists on the node
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: api-eventbus-pvc
namespace: egommerce
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: api-eventbus-pv
---
apiVersion: v1
kind: Service
metadata:
name: api-eventbus
@@ -10,25 +37,22 @@ spec:
selector:
app: api-eventbus
ports:
- name: api-eventbus
- name: api-eventbus-main
protocol: TCP
port: 5672
port: 9092
nodePort: 31200
- name: api-eventbus-mngmnt
- name: api-eventbus-controller
protocol: TCP
port: 15672
port: 9093
nodePort: 31299
# - name: api-eventbus-metrics
# protocol: TCP
# port: 15692
# nodePort: 31201
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: api-eventbus
namespace: egommerce
spec:
serviceName: "api-eventbus"
replicas: 1
selector:
matchLabels:
@@ -39,32 +63,35 @@ spec:
app: api-eventbus
spec:
containers:
- name: api-eventbus
image: git.ego.freeddns.org/egommerce/api-eventbus:dev
imagePullPolicy: Always
command: [
"rabbitmq-server"
]
env:
- name: APP_NAME
value: api-eventbus
- name: RABBITMQ_ERLANG_COOKIE
value: rabbitmq
volumeMounts:
- name: eventbus-data
mountPath: /var/lib/rabbitmq
- name: eventbus-logs
mountPath: /var/log/rabbitmq
resources:
limits:
cpu: "1"
memory: 1G
ports:
- containerPort: 5672
- containerPort: 15672
- containerPort: 15692
- name: api-eventbus
image: apache/kafka:latest
imagePullPolicy: Always # For future image
ports:
- containerPort: 9092
name: eventbus
- containerPort: 9093
name: eventbus-ctrl
volumeMounts:
- name: api-eventbus-storage
mountPath: /var/lib/kafka/data
env:
- name: KAFKA_PROCESS_ROLES
value: "broker,controller"
- name: KAFKA_CONTROLLER_LISTENER_NAMES
value: "CONTROLLER"
- name: KAFKA_LISTENERS
value: "PLAINTEXT://:9092,CONTROLLER://:9093"
- name: KAFKA_CONTROLLER_QUORUM_VOTERS
value: "1@localhost:9093"
- name: KAFKA_NODE_ID
value: "1"
- name: KAFKA_ADVERTISED_LISTENERS
value: "PLAINTEXT://localhost:9092"
- name: KAFKA_LOG_DIRS
value: "/var/lib/kafka/data"
imagePullSecrets:
- name: regcred
volumes:
- name: eventbus-data
emptyDir:
- name: eventbus-logs
emptyDir:
- name: api-eventbus-storage
persistentVolumeClaim:
claimName: api-eventbus-pvc

View File

@@ -22,6 +22,7 @@ metadata:
namespace: egommerce
spec:
controller: haproxy.org/ingress-controller/haproxy
# PROBABLY NOT NEEDED :D
---
apiVersion: networking.k8s.io/v1
kind: Ingress
@@ -34,6 +35,7 @@ metadata:
haproxy.org/path-rewrite: |
/api/identity/(.*) /\1
/api/catalog/(.*) /\1
/api/basket/(.*) /\1
spec:
ingressClassName: haproxy
tls:
@@ -58,6 +60,13 @@ spec:
name: catalog-svc
port:
number: 443
- path: /api/basket
pathType: Prefix
backend:
service:
name: basket-svc
port:
number: 443
---
apiVersion: apps/v1
kind: Deployment
@@ -82,10 +91,10 @@ spec:
resources:
limits:
cpu: 100m
memory: 512Mi
memory: 512M
requests:
cpu: 50m
memory: 256Mi
memory: 256M
ports:
- containerPort: 8443
args:
@@ -119,4 +128,6 @@ spec:
# runAsNonRoot: true
# allowPrivilegeEscalation: false
# seccompProfile:
# type: RuntimeDefault
# type: RuntimeDefault
imagePullSecrets:
- name: regcred

View File

@@ -39,6 +39,8 @@ spec:
- "-config.file=/etc/loki/loki.yaml"
ports:
- containerPort: 3100
imagePullSecrets:
- name: regcred
---
apiVersion: v1
kind: ServiceAccount
@@ -98,10 +100,10 @@ spec:
resources:
limits:
cpu: 100m
memory: 512Mi
memory: 512M
requests:
cpu: 50m
memory: 128Mi
memory: 256M
livenessProbe:
httpGet:
path: /ready
@@ -136,6 +138,8 @@ spec:
capabilities:
drop:
- ALL
imagePullSecrets:
- name: regcred
terminationGracePeriodSeconds: 60
volumes:
- name: api-logger-promtail-run
@@ -176,7 +180,7 @@ spec:
resources:
requests:
storage: 5Gi
#storageClassName: api-logger-prometheus-pv
storageClassName: api-logger-prometheus-pv
---
apiVersion: v1
kind: ServiceAccount
@@ -271,11 +275,11 @@ spec:
# port: prometheus-http
resources:
limits:
cpu: 150m
memory: 894Mi
requests:
cpu: 100m
memory: 512Mi
memory: 512M
requests:
cpu: 50m
memory: 256M
volumeMounts:
# - name: config-volume
# mountPath: /etc/prometheus
@@ -293,6 +297,8 @@ spec:
capabilities:
drop:
- ALL
imagePullSecrets:
- name: regcred
volumes:
- name: api-logger-prometheus-storage
persistentVolumeClaim:
@@ -340,7 +346,7 @@ spec:
resources:
requests:
storage: 5Gi
#storageClassName: api-logger-grafana-pv
storageClassName: api-logger-grafana-pv
---
apiVersion: apps/v1
kind: Deployment
@@ -372,7 +378,6 @@ spec:
initContainers:
- name: curl
image: curlimages/curl:latest
imagePullPolicy: IfNotPresent
command:
- /bin/sh
args:
@@ -403,10 +408,10 @@ spec:
resources:
limits:
cpu: 100m
memory: 768Mi
memory: 512M
requests:
cpu: 50m
memory: 512Mi
memory: 256M
volumeMounts:
- name: api-logger-grafana-storage
mountPath: /var/lib/grafana
@@ -426,6 +431,8 @@ spec:
capabilities:
drop:
- ALL
imagePullSecrets:
- name: regcred
volumes:
- name: api-logger-grafana-storage
persistentVolumeClaim:

View File

@@ -5,7 +5,6 @@ metadata:
namespace: egommerce
annotations:
haproxy.org/check: "true"
# haproxy.org/server-ca: "egommerce/ca-root"
labels:
app: catalog-svc
spec:
@@ -56,13 +55,11 @@ spec:
- name: APP_NAME
value: catalog-svc
- name: APP_DOMAIN
value: catalog-svc.egommerce.local
value: catalog-svc.egommerce.io
- name: APP_PATH_PREFIX
value: /catalog
- name: API_EVENTBUS_URL
value: amqp://guest:guest@api-eventbus:5672
- name: API_MONGODB_URL
value: mongodb://mongodb:12345678@mongo-db:27017
- name: API_DATABASE_URL
value: postgres://egommerce:12345678@db-postgres:5432/egommerce?sslmode=disable
readinessProbe:
httpGet:
scheme: HTTPS
@@ -92,10 +89,10 @@ spec:
resources:
limits:
cpu: 100m
memory: 512Mi
memory: 512M
requests:
cpu: 50m
memory: 256Mi
memory: 256M
ports:
- name: catalog-svc
containerPort: 443
@@ -106,8 +103,8 @@ spec:
# args:
# - --web.listen-address=:9090
# - --web.telemetry-path=/metrics
- name: identity-scheduler # Scheduler Container
image: git.ego.freeddns.org/egommerce/identity-svc:dev
- name: catalog-scheduler # Scheduler Container
image: git.ego.freeddns.org/egommerce/catalog-svc:dev
imagePullPolicy: Always
command: [
"/usr/local/bin/scheduler"
@@ -119,6 +116,8 @@ spec:
requests:
cpu: 50m
memory: 256Mi
imagePullSecrets:
- name: regcred
volumes:
- name: catalog-cert
hostPath:

View File

@@ -23,7 +23,7 @@ spec:
resources:
requests:
storage: 5Gi
#storageClassName: db-postgres-pv
storageClassName: db-postgres-pv
---
apiVersion: v1
kind: Service
@@ -86,7 +86,7 @@ spec:
- name: APP_NAME
value: db-postgres
- name: APP_DOMAIN
value: db-postgres.egommerce.local
value: db-postgres.egommerce.io
- name: POSTGRES_USER
value: egommerce
- name: POSTGRES_DB
@@ -98,8 +98,11 @@ spec:
value: /var/lib/postgresql/data
resources:
limits:
cpu: "1"
cpu: 100m
memory: 512M
requests:
cpu: 50m
memory: 256M
ports:
- containerPort: 5432
volumeMounts:
@@ -113,6 +116,15 @@ spec:
env:
- name: DATA_SOURCE_NAME
value: "postgresql://postgres:12345678@db-postgres:5432/egommerce" #?sslmode=disable
resources:
limits:
cpu: 50m
memory: 256M
requests:
cpu: 25m
memory: 128M
imagePullSecrets:
- name: regcred
volumes:
- name: db-postgres-data
persistentVolumeClaim:

View File

@@ -5,7 +5,6 @@ metadata:
namespace: egommerce
annotations:
haproxy.org/check: "true"
# haproxy.org/server-ca: "egommerce/ca-root"
labels:
app: identity-svc
spec:
@@ -56,13 +55,11 @@ spec:
- name: APP_NAME
value: identity-svc
- name: APP_DOMAIN
value: identity-svc.egommerce.local
value: identity-svc.egommerce.io
- name: APP_PATH_PREFIX
value: /identity
- name: API_EVENTBUS_URL
value: amqp://guest:guest@api-eventbus:5672
- name: API_MONGODB_URL
value: mongodb://mongodb:12345678@mongo-db:27017
- name: API_DATABASE_URL
value: postgres://egommerce:12345678@db-postgres:5432/egommerce?sslmode=disable
readinessProbe:
httpGet:
scheme: HTTPS
@@ -92,10 +89,10 @@ spec:
resources:
limits:
cpu: 100m
memory: 512Mi
memory: 512M
requests:
cpu: 50m
memory: 256Mi
memory: 256M
ports:
- name: identity-svc
containerPort: 443
@@ -119,6 +116,8 @@ spec:
requests:
cpu: 50m
memory: 256Mi
imagePullSecrets:
- name: regcred
volumes:
- name: identity-cert
hostPath:

View File

@@ -4,5 +4,5 @@ metadata:
name: regcred
namespace: egommerce
data:
.dockerconfigjson: ewoJImF1dGhzIjogewoJCSJnaXQuZWdvLmNsb3VkbnMuYmUiOiB7CgkJCSJhdXRoIjogImEyVmxaRzl6YmpwWGIyeHVaVFZQY0hKdlozSmhiVzkzWVc1cFpVQT0iCgkJfSwKCQkiaHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdjEvIjogewoJCQkiYXV0aCI6ICJhMlZsWkc5emJqcGtiMk5yWlhKdmQyVTFiMkp5WVhwNSIKCQl9Cgl9Cn0=
.dockerconfigjson: ewogICAgICAgICJhdXRocyI6IHsKICAgICAgICAgICAgICAgICJnaXQuZWdvLmZyZWVkZG5zLm9yZyI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgImF1dGgiOiAiYTJWbFpHOXpianBNYjJ0aGJHNWxOVTl3Y205bmNtRnRiM2RoYm1sbFFBPT0iCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgImh0dHBzOi8vaW5kZXguZG9ja2VyLmlvL3YxLyI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgImF1dGgiOiAiYTJWbFpHOXpianBrYjJOclpYSnZkMlUxYjJKeVlYcDUiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgfQp9
type: kubernetes.io/dockerconfigjson