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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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