Selaa lähdekoodia

fix: Fix Spring Cloud compatibility and Eureka client issues

- Add compatibility-verifier disabled flag to prevent Spring Boot 2.7.0 version check failure
- Disable Eureka client registration as we use Kubernetes service discovery
- Fix configmap names in deployments (order-service, payment-service)
- Add SPRING_CONFIG_LOCATION environment variable for external config file loading
- Add SPRING_MAIN_WEB_APPLICATION_TYPE=reactive for gateway
- Create separate configmap templates for each service
- Update deployment templates with correct configmap references
Builder 2 kuukautta sitten
vanhempi
commit
0f23321a8a

+ 12 - 6
k8s/helm/shop-recycle/templates/configmap-gateway.yaml

@@ -15,6 +15,8 @@ data:
       application:
         name: shop-recycle-gateway
       cloud:
+        compatibility-verifier:
+          enabled: false
         gateway:
           routes:
             - id: order-service
@@ -23,28 +25,32 @@ data:
                 - Path=/api/order/**
               filters:
                 - RewritePath=/api/order(?<segment>.*), /api$\{segment}
-            
+
             - id: payment-service
               uri: http://{{ include "shop-recycle.fullname" . }}-payment-service:{{ .Values.paymentService.service.port }}
               predicates:
                 - Path=/api/payment/**
               filters:
                 - RewritePath=/api/payment(?<segment>.*), /api$\{segment}
-            
+
             - id: test-order
               uri: http://{{ include "shop-recycle.fullname" . }}-order-service:{{ .Values.orderService.service.port }}
               predicates:
                 - Path=/api/test/order/**
               filters:
                 - RewritePath=/api/test/order(?<segment>.*), /test$\{segment}
-            
+
             - id: test-payment
               uri: http://{{ include "shop-recycle.fullname" . }}-payment-service:{{ .Values.paymentService.service.port }}
               predicates:
                 - Path=/api/test/payment/**
               filters:
                 - RewritePath=/api/test/payment(?<segment>.*), /test$\{segment}
-    
+      
+      eureka:
+        client:
+          enabled: false
+
     management:
       endpoints:
         web:
@@ -57,10 +63,10 @@ data:
       endpoint:
         health:
           show-details: when-authorized
-    
+
     logging:
       level:
-        root: {{ .Values.logging.level }}
+        root: INFO
         com.shop.recycle: DEBUG
       pattern:
         console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"

+ 46 - 0
k8s/helm/shop-recycle/templates/configmap-order-service.yaml

@@ -0,0 +1,46 @@
+{{- if .Values.orderService.enabled }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "shop-recycle.fullname" . }}-order-service-config
+  labels:
+    app: {{ include "shop-recycle.fullname" . }}-order-service
+    {{- include "shop-recycle.labels" . | nindent 4 }}
+  namespace: {{ .Release.Namespace }}
+data:
+  application.yml: |
+    spring:
+      main:
+        web-application-type: servlet
+      application:
+        name: shop-recycle-order-service
+      cloud:
+        compatibility-verifier:
+          enabled: false
+      eureka:
+        client:
+          enabled: false
+
+    server:
+      port: {{ .Values.orderService.service.port }}
+
+    management:
+      endpoints:
+        web:
+          exposure:
+            include: health,info,metrics
+      metrics:
+        export:
+          prometheus:
+            enabled: true
+      endpoint:
+        health:
+          show-details: when-authorized
+
+    logging:
+      level:
+        root: INFO
+        com.shop.recycle: DEBUG
+      pattern:
+        console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
+{{- end }}

+ 46 - 0
k8s/helm/shop-recycle/templates/configmap-payment-service.yaml

@@ -0,0 +1,46 @@
+{{- if .Values.paymentService.enabled }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "shop-recycle.fullname" . }}-payment-service-config
+  labels:
+    app: {{ include "shop-recycle.fullname" . }}-payment-service
+    {{- include "shop-recycle.labels" . | nindent 4 }}
+  namespace: {{ .Release.Namespace }}
+data:
+  application.yml: |
+    spring:
+      main:
+        web-application-type: servlet
+      application:
+        name: shop-recycle-payment-service
+      cloud:
+        compatibility-verifier:
+          enabled: false
+      eureka:
+        client:
+          enabled: false
+
+    server:
+      port: {{ .Values.paymentService.service.port }}
+
+    management:
+      endpoints:
+        web:
+          exposure:
+            include: health,info,metrics
+      metrics:
+        export:
+          prometheus:
+            enabled: true
+      endpoint:
+        health:
+          show-details: when-authorized
+
+    logging:
+      level:
+        root: INFO
+        com.shop.recycle: DEBUG
+      pattern:
+        console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
+{{- end }}

+ 99 - 94
k8s/helm/shop-recycle/templates/deployment-gateway.yaml

@@ -1,99 +1,104 @@
-{{- if .Values.gateway.enabled }}
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  name: {{ include "shop-recycle.fullname" . }}-gateway
-  labels:
-    app: {{ include "shop-recycle.fullname" . }}-gateway
-    {{- include "shop-recycle.labels" . | nindent 4 }}
-  namespace: {{ .Release.Namespace }}
-spec:
-  replicas: {{ .Values.gateway.replicaCount }}
-  selector:
-    matchLabels:
-      app: {{ include "shop-recycle.fullname" . }}-gateway
-      {{- include "shop-recycle.selectorLabels" . | nindent 6 }}
-  template:
-    metadata:
-      annotations:
-        prometheus.io/scrape: "true"
-        prometheus.io/port: "{{ .Values.gateway.containerPort }}"
-        prometheus.io/path: "/actuator/prometheus"
-      labels:
-        app: {{ include "shop-recycle.fullname" . }}-gateway
-        {{- include "shop-recycle.selectorLabels" . | nindent 8 }}
-    spec:
-      {{- if .Values.rbac.create }}
-      serviceAccountName: {{ include "shop-recycle.serviceAccountName" . }}
-      {{- end }}
-      {{- if or .Values.global.registry.createSecret .Values.global.imagePullSecrets }}
-      imagePullSecrets:
-      {{- if .Values.global.registry.createSecret }}
-        - name: {{ include "shop-recycle.fullname" . }}-registry-secret
-      {{- end }}
-      {{- with .Values.global.imagePullSecrets }}
-{{ toYaml . | indent 8 }}
-      {{- end }}
-      {{- end }}
-      
-      {{- with .Values.tolerations }}
-      tolerations:
-        {{- toYaml . | nindent 8 }}
-      {{- end }}
-      
-      containers:
-        - name: gateway
-          image: "{{ .Values.image.registry }}/{{ .Values.image.namespace }}/{{ .Values.gateway.image.name }}:{{ .Values.gateway.image.tag }}"
-          imagePullPolicy: {{ .Values.image.pullPolicy }}
-          
-          ports:
-            - name: http
-              containerPort: {{ .Values.gateway.containerPort }}
-              protocol: {{ .Values.gateway.protocol }}
-          
-          env:
-            - name: SPRING_PROFILES_ACTIVE
-              value: "{{ .Values.gateway.springProfiles }},{{ .Values.environment }}"
-            
-            - name: JAVA_OPTS
-              value: "{{ .Values.gateway.javaOpts }}"
-            
-            - name: SPRING_CLOUD_CONFIG_SERVER_NATIVE_SEARCH_LOCATIONS
-              value: "file:///etc/config"
-            
-            {{- range $key, $value := .Values.gateway.env }}
-            - name: {{ $key }}
-              value: "{{ $value }}"
-            {{- end }}
-          
+{{- if .Values.gateway.enabled }}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ include "shop-recycle.fullname" . }}-gateway
+  labels:
+    app: {{ include "shop-recycle.fullname" . }}-gateway
+    {{- include "shop-recycle.labels" . | nindent 4 }}
+  namespace: {{ .Release.Namespace }}
+spec:
+  replicas: {{ .Values.gateway.replicaCount }}
+  selector:
+    matchLabels:
+      app: {{ include "shop-recycle.fullname" . }}-gateway
+      {{- include "shop-recycle.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      annotations:
+        prometheus.io/scrape: "true"
+        prometheus.io/port: "{{ .Values.gateway.containerPort }}"
+        prometheus.io/path: "/actuator/prometheus"
+      labels:
+        app: {{ include "shop-recycle.fullname" . }}-gateway
+        {{- include "shop-recycle.selectorLabels" . | nindent 8 }}
+    spec:
+      {{- if .Values.rbac.create }}
+      serviceAccountName: {{ include "shop-recycle.serviceAccountName" . }}
+      {{- end }}
+      {{- if or .Values.global.registry.createSecret .Values.global.imagePullSecrets }}
+      imagePullSecrets:
+      {{- if .Values.global.registry.createSecret }}
+        - name: {{ include "shop-recycle.fullname" . }}-registry-secret
+      {{- end }}
+      {{- with .Values.global.imagePullSecrets }}
+{{ toYaml . | indent 8 }}
+      {{- end }}
+      {{- end }}
+      
+      {{- with .Values.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      
+      containers:
+        - name: gateway
+          image: "{{ .Values.image.registry }}/{{ .Values.image.namespace }}/{{ .Values.gateway.image.name }}:{{ .Values.gateway.image.tag }}"
+          imagePullPolicy: {{ .Values.image.pullPolicy }}
+          
+          ports:
+            - name: http
+              containerPort: {{ .Values.gateway.containerPort }}
+              protocol: {{ .Values.gateway.protocol }}
+          
+          env:
+            - name: SPRING_PROFILES_ACTIVE
+              value: "{{ .Values.gateway.springProfiles }},{{ .Values.environment }}"
+            
+            - name: JAVA_OPTS
+              value: "{{ .Values.gateway.javaOpts }}"
+            
+            - name: SPRING_CLOUD_CONFIG_SERVER_NATIVE_SEARCH_LOCATIONS
+              value: "file:///etc/config"
+            - name: SPRING_CONFIG_LOCATION
+              value: "file:///etc/config/application.yml"
+
+            - name: SPRING_MAIN_WEB_APPLICATION_TYPE
+              value: "reactive"
+            
+            {{- range $key, $value := .Values.gateway.env }}
+            - name: {{ $key }}
+              value: "{{ $value }}"
+            {{- end }}
+          
           {{- if .Values.gateway.startupProbe }}
           startupProbe:
             {{- toYaml .Values.gateway.startupProbe | nindent 12 }}
           {{- end }}
 
-          {{- if .Values.gateway.livenessProbe }}
-          livenessProbe:
-            {{- toYaml .Values.gateway.livenessProbe | nindent 12 }}
-          {{- end }}
-          
-          {{- if .Values.gateway.readinessProbe }}
-          readinessProbe:
-            {{- toYaml .Values.gateway.readinessProbe | nindent 12 }}
-          {{- end }}
-          
-          resources:
-            {{- toYaml .Values.gateway.resources | nindent 12 }}
-          
-          volumeMounts:
-            - name: config
-              mountPath: /etc/config
-            - name: logs
-              mountPath: /app/logs
-      
-      volumes:
-        - name: config
-          configMap:
-            name: {{ include "shop-recycle.fullname" . }}-gateway-config
-        - name: logs
-          emptyDir: {}
-{{- end }}
+          {{- if .Values.gateway.livenessProbe }}
+          livenessProbe:
+            {{- toYaml .Values.gateway.livenessProbe | nindent 12 }}
+          {{- end }}
+          
+          {{- if .Values.gateway.readinessProbe }}
+          readinessProbe:
+            {{- toYaml .Values.gateway.readinessProbe | nindent 12 }}
+          {{- end }}
+          
+          resources:
+            {{- toYaml .Values.gateway.resources | nindent 12 }}
+          
+          volumeMounts:
+            - name: config
+              mountPath: /etc/config
+            - name: logs
+              mountPath: /app/logs
+      
+      volumes:
+        - name: config
+          configMap:
+            name: {{ include "shop-recycle.fullname" . }}-gateway-config
+        - name: logs
+          emptyDir: {}
+{{- end }}

+ 84 - 86
k8s/helm/shop-recycle/templates/deployment-order-service.yaml

@@ -1,91 +1,89 @@
-{{- if .Values.orderService.enabled }}
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  name: {{ include "shop-recycle.fullname" . }}-order-service
-  labels:
-    app: {{ include "shop-recycle.fullname" . }}-order-service
-    {{- include "shop-recycle.labels" . | nindent 4 }}
-  namespace: {{ .Release.Namespace }}
-spec:
-  replicas: {{ .Values.orderService.replicaCount }}
-  selector:
-    matchLabels:
-      app: {{ include "shop-recycle.fullname" . }}-order-service
-      {{- include "shop-recycle.selectorLabels" . | nindent 6 }}
-  template:
-    metadata:
-      annotations:
-        prometheus.io/scrape: "true"
-        prometheus.io/port: "{{ .Values.orderService.containerPort }}"
-        prometheus.io/path: "/actuator/prometheus"
-      labels:
-        app: {{ include "shop-recycle.fullname" . }}-order-service
-        {{- include "shop-recycle.selectorLabels" . | nindent 8 }}
-    spec:
-      {{- if .Values.rbac.create }}
-      serviceAccountName: {{ include "shop-recycle.serviceAccountName" . }}
-      {{- end }}
-      {{- if or .Values.global.registry.createSecret .Values.global.imagePullSecrets }}
-      imagePullSecrets:
-      {{- if .Values.global.registry.createSecret }}
-        - name: {{ include "shop-recycle.fullname" . }}-registry-secret
-      {{- end }}
-      {{- with .Values.global.imagePullSecrets }}
-{{ toYaml . | indent 8 }}
-      {{- end }}
-      {{- end }}
-      
-      {{- with .Values.tolerations }}
-      tolerations:
-        {{- toYaml . | nindent 8 }}
-      {{- end }}
-      
-      containers:
-        - name: order-service
-          image: "{{ .Values.image.registry }}/{{ .Values.image.namespace }}/{{ .Values.orderService.image.name }}:{{ .Values.orderService.image.tag }}"
-          imagePullPolicy: {{ .Values.image.pullPolicy }}
-          
-          ports:
-            - name: http
-              containerPort: {{ .Values.orderService.containerPort }}
-              protocol: {{ .Values.orderService.protocol }}
-          
-          env:
-            - name: SPRING_PROFILES_ACTIVE
-              value: "{{ .Values.orderService.springProfiles }},{{ .Values.environment }}"
-            
-            - name: JAVA_OPTS
-              value: "{{ .Values.orderService.javaOpts }}"
-            
-            {{- range $key, $value := .Values.orderService.env }}
-            - name: {{ $key }}
-              value: "{{ $value }}"
-            {{- end }}
-          
+{{- if .Values.orderService.enabled }}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ include "shop-recycle.fullname" . }}-order-service
+  labels:
+    app: {{ include "shop-recycle.fullname" . }}-order-service
+    {{- include "shop-recycle.labels" . | nindent 4 }}
+  namespace: {{ .Release.Namespace }}
+spec:
+  replicas: {{ .Values.orderService.replicaCount }}
+  selector:
+    matchLabels:
+      app: {{ include "shop-recycle.fullname" . }}-order-service
+      {{- include "shop-recycle.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      annotations:
+        prometheus.io/scrape: "true"
+        prometheus.io/port: "{{ .Values.orderService.containerPort }}"
+        prometheus.io/path: "/actuator/prometheus"
+      labels:
+        app: {{ include "shop-recycle.fullname" . }}-order-service
+        {{- include "shop-recycle.selectorLabels" . | nindent 8 }}
+    spec:
+      {{- if .Values.rbac.create }}
+      serviceAccountName: {{ include "shop-recycle.serviceAccountName" . }}
+      {{- end }}
+
+      containers:
+        - name: order-service
+          image: "{{ .Values.image.registry }}/{{ .Values.image.namespace }}/{{ .Values.orderService.image.name }}:{{ .Values.orderService.image.tag }}"
+          imagePullPolicy: {{ .Values.image.pullPolicy }}
+
+          ports:
+            - name: http
+              containerPort: {{ .Values.orderService.containerPort }}
+              protocol: {{ .Values.orderService.protocol }}
+
+          env:
+            - name: SPRING_PROFILES_ACTIVE
+              value: "{{ .Values.orderService.springProfiles }},{{ .Values.environment }}"
+
+            - name: JAVA_OPTS
+              value: "{{ .Values.orderService.javaOpts }}"
+
+            - name: SPRING_CONFIG_LOCATION
+              value: "file:///etc/config/application.yml"
+
+            - name: SPRING_MAIN_WEB_APPLICATION_TYPE
+              value: "reactive"
+
+            - name: LOGGING_LEVEL_ROOT
+              value: "INFO"
+
+            - name: SPRING_CLOUD_CONFIG_ENABLED
+              value: "true"
+
           {{- if .Values.orderService.startupProbe }}
           startupProbe:
             {{- toYaml .Values.orderService.startupProbe | nindent 12 }}
           {{- end }}
 
-          {{- if .Values.orderService.livenessProbe }}
-          livenessProbe:
-            {{- toYaml .Values.orderService.livenessProbe | nindent 12 }}
-          {{- end }}
-          
-          {{- if .Values.orderService.readinessProbe }}
-          readinessProbe:
-            {{- toYaml .Values.orderService.readinessProbe | nindent 12 }}
-          {{- end }}
-          
-          resources:
-            {{- toYaml .Values.orderService.resources | nindent 12 }}
-          
-          volumeMounts:
-            - name: logs
-              mountPath: /app/logs
-      
-      volumes:
-        - name: logs
-          emptyDir: {}
-{{- end }}
+          {{- if .Values.orderService.livenessProbe }}
+          livenessProbe:
+            {{- toYaml .Values.orderService.livenessProbe | nindent 12 }}
+          {{- end }}
+
+          {{- if .Values.orderService.readinessProbe }}
+          readinessProbe:
+            {{- toYaml .Values.orderService.readinessProbe | nindent 12 }}
+          {{- end }}
+
+          resources:
+            {{- toYaml .Values.orderService.resources | nindent 12 }}
+
+          volumeMounts:
+            - name: config
+              mountPath: /etc/config
+            - name: logs
+              mountPath: /app/logs
+
+      volumes:
+        - name: config
+          configMap:
+            name: {{ include "shop-recycle.fullname" . }}-order-service-config
+        - name: logs
+          emptyDir: {}
+{{- end }}

+ 84 - 86
k8s/helm/shop-recycle/templates/deployment-payment-service.yaml

@@ -1,91 +1,89 @@
-{{- if .Values.paymentService.enabled }}
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  name: {{ include "shop-recycle.fullname" . }}-payment-service
-  labels:
-    app: {{ include "shop-recycle.fullname" . }}-payment-service
-    {{- include "shop-recycle.labels" . | nindent 4 }}
-  namespace: {{ .Release.Namespace }}
-spec:
-  replicas: {{ .Values.paymentService.replicaCount }}
-  selector:
-    matchLabels:
-      app: {{ include "shop-recycle.fullname" . }}-payment-service
-      {{- include "shop-recycle.selectorLabels" . | nindent 6 }}
-  template:
-    metadata:
-      annotations:
-        prometheus.io/scrape: "true"
-        prometheus.io/port: "{{ .Values.paymentService.containerPort }}"
-        prometheus.io/path: "/actuator/prometheus"
-      labels:
-        app: {{ include "shop-recycle.fullname" . }}-payment-service
-        {{- include "shop-recycle.selectorLabels" . | nindent 8 }}
-    spec:
-      {{- if .Values.rbac.create }}
-      serviceAccountName: {{ include "shop-recycle.serviceAccountName" . }}
-      {{- end }}
-      {{- if or .Values.global.registry.createSecret .Values.global.imagePullSecrets }}
-      imagePullSecrets:
-      {{- if .Values.global.registry.createSecret }}
-        - name: {{ include "shop-recycle.fullname" . }}-registry-secret
-      {{- end }}
-      {{- with .Values.global.imagePullSecrets }}
-{{ toYaml . | indent 8 }}
-      {{- end }}
-      {{- end }}
-      
-      {{- with .Values.tolerations }}
-      tolerations:
-        {{- toYaml . | nindent 8 }}
-      {{- end }}
-      
-      containers:
-        - name: payment-service
-          image: "{{ .Values.image.registry }}/{{ .Values.image.namespace }}/{{ .Values.paymentService.image.name }}:{{ .Values.paymentService.image.tag }}"
-          imagePullPolicy: {{ .Values.image.pullPolicy }}
-          
-          ports:
-            - name: http
-              containerPort: {{ .Values.paymentService.containerPort }}
-              protocol: {{ .Values.paymentService.protocol }}
-          
-          env:
-            - name: SPRING_PROFILES_ACTIVE
-              value: "{{ .Values.paymentService.springProfiles }},{{ .Values.environment }}"
-            
-            - name: JAVA_OPTS
-              value: "{{ .Values.paymentService.javaOpts }}"
-            
-            {{- range $key, $value := .Values.paymentService.env }}
-            - name: {{ $key }}
-              value: "{{ $value }}"
-            {{- end }}
-          
+{{- if .Values.paymentService.enabled }}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ include "shop-recycle.fullname" . }}-payment-service
+  labels:
+    app: {{ include "shop-recycle.fullname" . }}-payment-service
+    {{- include "shop-recycle.labels" . | nindent 4 }}
+  namespace: {{ .Release.Namespace }}
+spec:
+  replicas: {{ .Values.paymentService.replicaCount }}
+  selector:
+    matchLabels:
+      app: {{ include "shop-recycle.fullname" . }}-payment-service
+      {{- include "shop-recycle.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      annotations:
+        prometheus.io/scrape: "true"
+        prometheus.io/port: "{{ .Values.paymentService.containerPort }}"
+        prometheus.io/path: "/actuator/prometheus"
+      labels:
+        app: {{ include "shop-recycle.fullname" . }}-payment-service
+        {{- include "shop-recycle.selectorLabels" . | nindent 8 }}
+    spec:
+      {{- if .Values.rbac.create }}
+      serviceAccountName: {{ include "shop-recycle.serviceAccountName" . }}
+      {{- end }}
+
+      containers:
+        - name: payment-service
+          image: "{{ .Values.image.registry }}/{{ .Values.image.namespace }}/{{ .Values.paymentService.image.name }}:{{ .Values.paymentService.image.tag }}"
+          imagePullPolicy: {{ .Values.image.pullPolicy }}
+
+          ports:
+            - name: http
+              containerPort: {{ .Values.paymentService.containerPort }}
+              protocol: {{ .Values.paymentService.protocol }}
+
+          env:
+            - name: SPRING_PROFILES_ACTIVE
+              value: "{{ .Values.paymentService.springProfiles }},{{ .Values.environment }}"
+
+            - name: JAVA_OPTS
+              value: "{{ .Values.paymentService.javaOpts }}"
+
+            - name: SPRING_CONFIG_LOCATION
+              value: "file:///etc/config/application.yml"
+
+            - name: SPRING_MAIN_WEB_APPLICATION_TYPE
+              value: "reactive"
+
+            - name: LOGGING_LEVEL_ROOT
+              value: "INFO"
+
+            - name: SPRING_CLOUD_CONFIG_ENABLED
+              value: "true"
+
           {{- if .Values.paymentService.startupProbe }}
           startupProbe:
             {{- toYaml .Values.paymentService.startupProbe | nindent 12 }}
           {{- end }}
 
-          {{- if .Values.paymentService.livenessProbe }}
-          livenessProbe:
-            {{- toYaml .Values.paymentService.livenessProbe | nindent 12 }}
-          {{- end }}
-          
-          {{- if .Values.paymentService.readinessProbe }}
-          readinessProbe:
-            {{- toYaml .Values.paymentService.readinessProbe | nindent 12 }}
-          {{- end }}
-          
-          resources:
-            {{- toYaml .Values.paymentService.resources | nindent 12 }}
-          
-          volumeMounts:
-            - name: logs
-              mountPath: /app/logs
-      
-      volumes:
-        - name: logs
-          emptyDir: {}
-{{- end }}
+          {{- if .Values.paymentService.livenessProbe }}
+          livenessProbe:
+            {{- toYaml .Values.paymentService.livenessProbe | nindent 12 }}
+          {{- end }}
+
+          {{- if .Values.paymentService.readinessProbe }}
+          readinessProbe:
+            {{- toYaml .Values.paymentService.readinessProbe | nindent 12 }}
+          {{- end }}
+
+          resources:
+            {{- toYaml .Values.paymentService.resources | nindent 12 }}
+
+          volumeMounts:
+            - name: config
+              mountPath: /etc/config
+            - name: logs
+              mountPath: /app/logs
+
+      volumes:
+        - name: config
+          configMap:
+            name: {{ include "shop-recycle.fullname" . }}-payment-service-config
+        - name: logs
+          emptyDir: {}
+{{- end }}

+ 10 - 0
k8s/helm/shop-recycle/values.yaml

@@ -170,6 +170,11 @@ orderService:
   
   javaOpts: "-Xms256m -Xmx512m -XX:+UseG1GC"
   springProfiles: "kubernetes"
+
+  # 环境变量
+  env:
+    SPRING_CONFIG_LOCATION: "file:///etc/config/application.yml"
+    SPRING_MAIN_WEB_APPLICATION_TYPE: "reactive"
   
   livenessProbe:
     httpGet:
@@ -234,6 +239,11 @@ paymentService:
   
   javaOpts: "-Xms256m -Xmx512m -XX:+UseG1GC"
   springProfiles: "kubernetes"
+
+  # 环境变量
+  env:
+    SPRING_CONFIG_LOCATION: "file:///etc/config/application.yml"
+    SPRING_MAIN_WEB_APPLICATION_TYPE: "reactive"
   
   livenessProbe:
     httpGet:

+ 386 - 0
k8s/helm/shop-recycle/values.yaml.bak

@@ -0,0 +1,386 @@
+# ==========================================
+# Helm Values - shop-recycle
+# 全局配置(所有环境共享)
+# ==========================================
+
+# 全局配置
+global:
+  # 镜像仓库认证(若启用,Helm 自动生成 imagePullSecret)
+  registry:
+    createSecret: true  # 设为 false 则不创建 secret,使用已有的
+    username: "admin"        # harbor.stardance 用户名
+    password: "Harbor12345"        # harbor.stardance 密码
+    email: "ops@example.com"
+  
+  # 若 registry.createSecret=false,则指定已有的 secret 名称
+  imagePullSecrets: []
+  # - name: reg-cred
+  
+# 副本数
+replicaCount: 1
+
+# 镜像配置
+image:
+  registry: harbor.stardance
+  namespace: shoprecycle
+  pullPolicy: IfNotPresent
+  tag: "3.0.0"
+  # tag由Jenkins Pipeline动态注入(--set image.tag=xxx)
+
+# 环境名称(由Pipeline动态注入)
+environment: dev
+
+# ==========================================
+# Gateway (API网关)
+# ==========================================
+gateway:
+  enabled: true
+  replicaCount: 1
+  
+  image:
+    name: shop-recycle-gateway
+    tag: "3.0.6"
+  
+  port: 8080
+  containerPort: 8080
+  protocol: TCP
+  
+  resources:
+    requests:
+      memory: "256Mi"
+      cpu: "250m"
+    limits:
+      memory: "512Mi"
+      cpu: "500m"
+  
+  # JVM参数
+  javaOpts: "-Xms256m -Xmx512m -XX:+UseG1GC"
+  
+  # Spring Profiles
+  springProfiles: "kubernetes"
+  
+  # 健康检查
+  livenessProbe:
+    httpGet:
+      path: /health
+      port: 8080
+    initialDelaySeconds: 30
+    periodSeconds: 10
+    timeoutSeconds: 5
+    failureThreshold: 3
+  
+  readinessProbe:
+    httpGet:
+      path: /health
+      port: 8080
+    initialDelaySeconds: 20
+    periodSeconds: 5
+    timeoutSeconds: 3
+    failureThreshold: 3
+  
+  # 服务配置
+  # 启动探针 - 给 Java 应用充分的启动时间(5分钟才开始检查)
+  startupProbe:
+    httpGet:
+      path: /health
+      port: 8080
+    initialDelaySeconds: 300
+    periodSeconds: 10
+    timeoutSeconds: 5
+    failureThreshold: 60
+
+  service:
+    type: ClusterIP
+    port: 8080
+    targetPort: 8080
+    annotations: {}
+  
+  # 入口配置
+  ingress:
+    enabled: false
+    className: "nginx"
+    annotations:
+      cert-manager.io/cluster-issuer: "letsencrypt-prod"
+    hosts:
+      - host: "dev.jxfxtd.com"
+        paths:
+          - path: /
+            pathType: Prefix
+    tls:
+      - secretName: gateway-tls
+        hosts:
+          - "dev.jxfxtd.com"
+  
+  # 环境变量
+  env:
+    SPRING_CLOUD_CONFIG_ENABLED: "true"
+    LOGGING_LEVEL_ROOT: "INFO"
+  
+  # ConfigMap数据
+  configMap:
+    application.yml: |
+      spring:
+        cloud:
+          gateway:
+            routes:
+              - id: order-service
+                uri: http://shop-recycle-order-service:8081
+                predicates:
+                  - Path=/api/order/**
+              - id: payment-service
+                uri: http://shop-recycle-payment-service:8082
+                predicates:
+                  - Path=/api/payment/**
+              - id: test-order
+                uri: http://shop-recycle-order-service:8081
+                predicates:
+                  - Path=/api/test/**
+              - id: test-payment
+                uri: http://shop-recycle-payment-service:8082
+                predicates:
+                  - Path=/api/test/**
+      management:
+        endpoints:
+          web:
+            exposure:
+              include: health,info
+
+# ==========================================
+# Order Service (订单服务)
+# ==========================================
+orderService:
+  enabled: true
+  replicaCount: 1
+  
+  image:
+    name: shop-recycle-order-service
+    tag: "3.0.6"
+  
+  port: 8081
+  containerPort: 8081
+  protocol: TCP
+  
+  resources:
+    requests:
+      memory: "256Mi"
+      cpu: "250m"
+    limits:
+      memory: "512Mi"
+      cpu: "500m"
+  
+  javaOpts: "-Xms256m -Xmx512m -XX:+UseG1GC"
+  springProfiles: "kubernetes"
+  
+  livenessProbe:
+    httpGet:
+      path: /health
+      port: 8081
+    initialDelaySeconds: 30
+    periodSeconds: 10
+    timeoutSeconds: 5
+    failureThreshold: 3
+  
+  readinessProbe:
+    httpGet:
+      path: /health
+      port: 8081
+    initialDelaySeconds: 20
+    periodSeconds: 5
+    timeoutSeconds: 3
+    failureThreshold: 3
+  
+  # 启动探针 - 给 Java 应用充分的启动时间(5分钟才开始检查)
+  startupProbe:
+    httpGet:
+      path: /health
+      port: 8081
+    initialDelaySeconds: 300
+    periodSeconds: 10
+    timeoutSeconds: 5
+    failureThreshold: 60
+
+  service:
+    type: ClusterIP
+    port: 8081
+    targetPort: 8081
+    annotations: {}
+  
+  env:
+    SPRING_CLOUD_CONFIG_ENABLED: "true"
+    LOGGING_LEVEL_ROOT: "INFO"
+
+# ==========================================
+# Payment Service (支付服务)
+# ==========================================
+paymentService:
+  enabled: true
+  replicaCount: 1
+  
+  image:
+    name: shop-recycle-payment-service
+    tag: "3.0.6"
+  
+  port: 8082
+  containerPort: 8082
+  protocol: TCP
+  
+  resources:
+    requests:
+      memory: "256Mi"
+      cpu: "250m"
+    limits:
+      memory: "512Mi"
+      cpu: "500m"
+  
+  javaOpts: "-Xms256m -Xmx512m -XX:+UseG1GC"
+  springProfiles: "kubernetes"
+  
+  livenessProbe:
+    httpGet:
+      path: /health
+      port: 8082
+    initialDelaySeconds: 30
+    periodSeconds: 10
+    timeoutSeconds: 5
+    failureThreshold: 3
+  
+  readinessProbe:
+    httpGet:
+      path: /health
+      port: 8082
+    initialDelaySeconds: 20
+    periodSeconds: 5
+    timeoutSeconds: 3
+    failureThreshold: 3
+  # 启动探针 - 给 Java 应用充分的启动时间(5分钟才开始检查)
+  startupProbe:
+    httpGet:
+      path: /health
+      port: 8082
+    initialDelaySeconds: 300
+    periodSeconds: 10
+    timeoutSeconds: 5
+    failureThreshold: 60
+
+  
+  service:
+    type: ClusterIP
+    port: 8082
+    targetPort: 8082
+    annotations: {}
+  
+  env:
+    SPRING_CLOUD_CONFIG_ENABLED: "true"
+    LOGGING_LEVEL_ROOT: "INFO"
+
+# ==========================================
+# Web Frontend (前端应用)
+# ==========================================
+webFrontend:
+  enabled: true
+  replicaCount: 1
+  
+  image:
+    name: shop-recycle-web
+    tag: "3.0.0"
+  
+  port: 80
+  containerPort: 80
+  protocol: TCP
+  
+  resources:
+    requests:
+      memory: "128Mi"
+      cpu: "100m"
+    limits:
+      memory: "256Mi"
+      cpu: "500m"
+  
+  livenessProbe:
+    httpGet:
+      path: /health
+      port: 80
+    initialDelaySeconds: 10
+    periodSeconds: 10
+    timeoutSeconds: 5
+    failureThreshold: 3
+  
+  readinessProbe:
+    httpGet:
+      path: /
+      port: 80
+    initialDelaySeconds: 5
+    periodSeconds: 5
+    timeoutSeconds: 3
+    failureThreshold: 3
+  
+  service:
+    type: ClusterIP
+    port: 80
+    targetPort: 80
+    annotations: {}
+  
+  ingress:
+    enabled: true
+    className: "nginx"
+    annotations:
+      cert-manager.io/cluster-issuer: "letsencrypt-prod"
+    hosts:
+      - host: "dev.jxfxtd.com"
+        paths:
+          - path: /
+            pathType: Prefix
+    tls:
+      - secretName: web-tls
+        hosts:
+          - "dev.jxfxtd.com"
+  
+  env:
+    VUE_APP_API_BASE: "http://shop-recycle-gateway:8080"
+    LOGGING_LEVEL: "info"
+
+# ==========================================
+# 网络策略
+# ==========================================
+networkPolicy:
+  enabled: false
+  policyTypes:
+    - Ingress
+    - Egress
+
+# ==========================================
+# Pod安全策略
+# ==========================================
+podSecurityPolicy:
+  enabled: false
+
+# ==========================================
+# RBAC配置
+# ==========================================
+rbac:
+  create: true
+  # 指定已有的ServiceAccount
+  serviceAccountName: ""
+
+# ==========================================
+# 节点亲和性与污点容限
+# ==========================================
+affinity: {}
+
+tolerations: []
+
+# ==========================================
+# 监控和日志
+# ==========================================
+monitoring:
+  enabled: false
+  # Prometheus ServiceMonitor
+  serviceMonitor:
+    enabled: false
+    interval: 30s
+
+logging:
+  # 日志级别
+  level: INFO
+  # 日志输出格式
+  format: json