Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: server url을 infra 설정의 helm chart에 매핑된 value로 수정 #309

Merged
merged 1 commit into from
Nov 30, 2024

Conversation

minisundev
Copy link
Member

@minisundev minisundev commented Nov 30, 2024

#️⃣연관된 이슈

📝작업 내용

ServerClientConfig 에서 배포 환경일 때에 올바른 yaml파일을 읽지 않아서 UserController가 깨지는 문제 수정

ServerClientConfig.kt에서

@Value("\${url.server}")
  private lateinit var serverUrl: String

이 부분에서
원래 두번째 것을 읽어야 하는데 첫번째 것을 읽어서 생기는 문제를 해결하였습니다!
image
dev 환경이 아니기 때문에 dev.yml의 값을 읽지 않는다고 합니다

@yudonggeun 님이 infra 설정의 helm 차트에 Server의 url을 등록하고

https://github.com/kSideProject/kpring-infra/blob/main/charts/user/templates/deployment.yaml

{{- if .Values.global.enable.user }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Values.service.name }}
  namespace: {{ .Release.namespace }}
  labels:
    app: {{ .Values.service.name }}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: {{ .Values.service.name }}
  template:
    metadata:
      labels:
        app: {{ .Values.service.name }}
    spec:
      containers:
        - name: {{ .Values.service.name }}
          image: {{ .Values.service.image }}:{{ .Values.service.tag }}
          ports:
            - containerPort: {{ .Values.service.port }}
          env:
            - name: AUTH_SERVICE_URL
              value: {{ .Values.api.authServiceUrl }}
            - name: APPLICATION_PROFILE
              valueFrom:
                configMapKeyRef:
                  name: profile-config
                  key: profile
            - name: MYSQL_USERNAME
              value: {{ .Values.mysql.username }}
            - name: MYSQL_PASSWORD
              value: {{ .Values.mysql.password }}
            - name: MYSQL_URL
              value: {{ .Values.mysql.url }}
            - name: URL_SERVER
              value: {{ .Values.global.core.url.server }}
{{- end }}

그것을 받아서 배포 환경에서 쓸 수 있도록 했습니다!

ServerClientConfig.kt에서

@Value("\${url.server}")
  private lateinit var serverUrl: String

url.server에 매핑되는 값은

application.yml에서

url:
  server: "${SERVER_URL:http://localhost:8080/}"

helm차트에서 SERVER_URL이 될 수 있도록 했습니다!

@minisundev minisundev added the bug 버그 label Nov 30, 2024
@minisundev minisundev requested a review from a team November 30, 2024 13:39
@minisundev minisundev self-assigned this Nov 30, 2024
@minisundev minisundev merged commit acb5c10 into dev Nov 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 버그
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[User] 스웨거 User API 503에러 발생
1 participant