From 432c54b58e55335b48feabab80a5e5782c3ef549 Mon Sep 17 00:00:00 2001 From: dykim Date: Mon, 1 Jun 2026 14:58:33 +0900 Subject: [PATCH] Enable Redis sessions for prod validation --- Jenkinsfile | 7 ++ k8s/prod/session-redis.yaml | 67 +++++++++++++++++++ .../egovProps/globals-prod.properties | 2 +- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 k8s/prod/session-redis.yaml diff --git a/Jenkinsfile b/Jenkinsfile index f8b193e..9637c02 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -162,8 +162,15 @@ spec: done fi + if [ -f "k8s/${TARGET_ENV}/session-redis.yaml" ]; then + kubectl apply -f "k8s/${TARGET_ENV}/session-redis.yaml" + kubectl -n ${APP_NS} rollout status deploy/sayit-helpdesk-session-redis --timeout=120s + fi + if [ "${TARGET_ENV}" = "dev" ]; then kubectl -n ${APP_NS} patch deploy ${DEPLOY} --type=strategic -p '{"spec":{"template":{"spec":{"containers":[{"name":"'${DEPLOY}'","env":[{"name":"SPRING_PROFILES_ACTIVE","value":"redis-session"}],"volumeMounts":[{"name":"heapdumps","mountPath":"/heapdumps"}]}],"volumes":[{"name":"heapdumps","nfs":{"server":"192.168.0.120","path":"/volume2/NFS/helpdesk-dev/heapdumps"}}]}}}}' + elif [ "${TARGET_ENV}" = "prod" ]; then + kubectl -n ${APP_NS} patch deploy ${DEPLOY} --type=strategic -p '{"spec":{"template":{"spec":{"containers":[{"name":"'${DEPLOY}'","env":[{"name":"SPRING_PROFILES_ACTIVE","value":"redis-session"}]}]}}}}' fi kubectl -n ${APP_NS} set image deploy/${DEPLOY} ${DEPLOY}=${REG}/${IMAGE}:${IMAGE_TAG} diff --git a/k8s/prod/session-redis.yaml b/k8s/prod/session-redis.yaml new file mode 100644 index 0000000..5028923 --- /dev/null +++ b/k8s/prod/session-redis.yaml @@ -0,0 +1,67 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: sayit-helpdesk-session-redis + namespace: sayit-helpdesk + labels: + app: sayit-helpdesk-session-redis +spec: + replicas: 1 + selector: + matchLabels: + app: sayit-helpdesk-session-redis + template: + metadata: + labels: + app: sayit-helpdesk-session-redis + spec: + containers: + - name: redis + image: redis:7.2-alpine + imagePullPolicy: IfNotPresent + args: + - redis-server + - --save + - "" + - --appendonly + - "no" + ports: + - name: redis + containerPort: 6379 + readinessProbe: + tcpSocket: + port: redis + initialDelaySeconds: 3 + periodSeconds: 5 + timeoutSeconds: 2 + failureThreshold: 3 + livenessProbe: + tcpSocket: + port: redis + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 2 + failureThreshold: 3 + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + cpu: 500m + memory: 256Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: sayit-helpdesk-session-redis + namespace: sayit-helpdesk + labels: + app: sayit-helpdesk-session-redis +spec: + type: ClusterIP + selector: + app: sayit-helpdesk-session-redis + ports: + - name: redis + port: 6379 + targetPort: redis diff --git a/src/main/resources/egovframework/egovProps/globals-prod.properties b/src/main/resources/egovframework/egovProps/globals-prod.properties index e3ddc43..430bdf1 100644 --- a/src/main/resources/egovframework/egovProps/globals-prod.properties +++ b/src/main/resources/egovframework/egovProps/globals-prod.properties @@ -152,7 +152,7 @@ ldap.username =uid=admin,ou=system ldap.password =secret # Spring Session Redis -Session.Redis.Enabled=false +Session.Redis.Enabled=true Session.Redis.Host=sayit-helpdesk-session-redis Session.Redis.Port=6379 Session.Redis.Database=0