diff --git a/deploy/k8s/basket-svc.yml b/deploy/k8s/basket-svc.yml new file mode 100644 index 0000000..2c306cb --- /dev/null +++ b/deploy/k8s/basket-svc.yml @@ -0,0 +1,133 @@ +apiVersion: v1 +kind: Service +metadata: + name: basket-svc + namespace: egommerce + annotations: + haproxy.org/check: "true" + labels: + app: basket-svc +spec: + type: NodePort + selector: + app: basket-svc + ports: + - name: basket-svc + port: 443 + nodePort: 31830 + # - name: basket-svc-metrics + # port: 9090 + # nodePort: 31811 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: basket-svc + namespace: egommerce +spec: + replicas: 1 + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 # Number of extra pods that can be created during update + maxUnavailable: 1 # Max number of pods that can be unavailable during update + selector: + matchLabels: + app: basket-svc + template: + metadata: + labels: + app: basket-svc + spec: + # initContainers: + # - name: basket-svc-init + # image: busybox:1.28 + # command: [ + # 'sh', + # '-c', + # '/bin/migrate' + # ] + containers: + - name: basket-svc + image: git.ego.freeddns.org/egommerce/basket-svc:dev + imagePullPolicy: Always + env: + - name: APP_NAME + value: basket-svc + - name: APP_DOMAIN + value: basket-svc.egommerce.io + - name: APP_PATH_PREFIX + value: /basket + - name: API_DATABASE_URL + value: postgres://egommerce:12345678@db-postgres:5432/egommerce?sslmode=disable + readinessProbe: + httpGet: + scheme: HTTPS + port: basket-svc + path: /health + initialDelaySeconds: 5 + periodSeconds: 5 + failureThreshold: 1 + livenessProbe: + httpGet: + scheme: HTTPS + port: basket-svc + path: /health + initialDelaySeconds: 5 + periodSeconds: 5 + failureThreshold: 1 + volumeMounts: + - name: basket-cert + mountPath: /certs/basket-svc.crt + readOnly: true + - name: basket-key + mountPath: /certs/basket-svc.key + readOnly: true + - name: basket-migrations + mountPath: /migrations + readOnly: true + resources: + limits: + cpu: 100m + memory: 512M + requests: + cpu: 50m + memory: 256M + ports: + - name: basket-svc + containerPort: 443 + # - name: basket-svc-metrics + # image: prom/prometheus-exporter:latest + # ports: + # - containerPort: 9090 + # args: + # - --web.listen-address=:9090 + # - --web.telemetry-path=/metrics + - name: basket-scheduler # Scheduler Container + image: git.ego.freeddns.org/egommerce/basket-svc:dev + imagePullPolicy: Always + command: [ + "/usr/local/bin/scheduler" + ] + resources: + limits: + cpu: 100m + memory: 512Mi + requests: + cpu: 50m + memory: 256Mi + imagePullSecrets: + - name: regcred + volumes: + - name: basket-cert + hostPath: + path: /egommerce/stack/deploy/certs/basket-svc/basket-svc.crt + type: File + - name: basket-key + hostPath: + path: /egommerce/stack/deploy/certs/basket-svc/basket-svc.key + type: File + - name: basket-migrations + hostPath: + path: /egommerce/stack/deploy/db_migrations/basket-svc + type: Directory \ No newline at end of file diff --git a/deploy/scripts/start-k8s.sh b/deploy/scripts/start-k8s.sh index 1ee24cb..1a8b663 100644 --- a/deploy/scripts/start-k8s.sh +++ b/deploy/scripts/start-k8s.sh @@ -17,5 +17,6 @@ kubectl apply -f deploy/k8s/db-postgres.yml kubectl apply -f deploy/k8s/identity-svc.yml kubectl apply -f deploy/k8s/catalog-svc.yml +kubectl apply -f deploy/k8s/basket-svc.yml echo "Done." diff --git a/deploy/scripts/stop-k8s.sh b/deploy/scripts/stop-k8s.sh index f793945..f09a08d 100644 --- a/deploy/scripts/stop-k8s.sh +++ b/deploy/scripts/stop-k8s.sh @@ -7,6 +7,7 @@ echo "Stopping egommerce k8s stack..." kubectl delete -f deploy/k8s/identity-svc.yml kubectl delete -f deploy/k8s/catalog-svc.yml +kubectl delete -f deploy/k8s/basket-svc.yml # kubectl delete -f deploy/k8s/db-mongo.yml kubectl delete -f deploy/k8s/db-postgres.yml