CHORE(app): add ArgoCD SSL configuration

- Enable SSL for ArgoCD API
- Configure TLS settings
This commit is contained in:
2025-11-25 12:30:00 +09:00
parent 124c7723db
commit 822afb3215
4 changed files with 39 additions and 4 deletions

View File

@@ -37,6 +37,12 @@ spec:
name: argocd-token
key: token
optional: false
- name: ARGOCD_CA_CERT
valueFrom:
secretKeyRef:
name: argocd-ca-cert
key: ca.crt
optional: true
resources:
requests:
memory: "100Mi"

View File

@@ -13,7 +13,7 @@ commonLabels:
# 이미지 태그 설정
images:
- name: ghcr.io/mayne0213/portfolio
newTag: main-sha-db21ed85671bdb8b6153d06250e41821772003dc
newTag: main-sha-4f895110ef62cc58495fc98f825d39ed42088d25
patchesStrategicMerge:
- deployment-patch.yaml

View File

@@ -4,6 +4,36 @@ import { NextRequest, NextResponse } from 'next/server';
// 외부에서 실행되는 경우 환경 변수로 설정 가능
const ARGOCD_SERVER_URL = process.env.ARGOCD_SERVER_URL || 'https://argocd-server.argocd.svc.cluster.local';
const ARGOCD_TOKEN = process.env.ARGOCD_TOKEN || '';
const ARGOCD_CA_CERT = process.env.ARGOCD_CA_CERT || '';
// Node.js 환경에서 커스텀 fetch 함수 생성 (인증서 지원)
async function fetchWithCert(url: string, options: RequestInit = {}): Promise<Response> {
// 브라우저 환경에서는 기본 fetch 사용
if (typeof window !== 'undefined') {
return fetch(url, options);
}
// Node.js 환경에서 인증서가 있으면 커스텀 agent 사용
if (ARGOCD_CA_CERT) {
const https = require('https');
const { Agent } = https;
const agent = new Agent({
ca: ARGOCD_CA_CERT,
rejectUnauthorized: true,
});
// Node.js의 fetch에 agent 전달
const nodeOptions: any = {
...options,
agent,
};
return fetch(url, nodeOptions);
}
return fetch(url, options);
}
interface ArgoCDApplication {
metadata: {
@@ -51,12 +81,11 @@ export async function GET(request: NextRequest) {
}
// ArgoCD API v1 - Get applications
const response = await fetch(`${ARGOCD_SERVER_URL}/api/v1/applications`, {
const response = await fetchWithCert(`${ARGOCD_SERVER_URL}/api/v1/applications`, {
headers: {
'Authorization': `Bearer ${ARGOCD_TOKEN}`,
'Content-Type': 'application/json',
},
// Next.js에서 외부 API 호출 시 캐시 설정
cache: 'no-store',
});

View File

@@ -127,7 +127,7 @@ const HeaderMenuItemsMobile = () => {
const Header = () => {
return (
<header
className="fixed h-[70px] top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60"
className="fixed h-[70px] top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-backdrop-filter:bg-background/60"
>
<div className="flex justify-between items-center tracking-wider tablet:tracking-widest font-brand-book px-4 pc:px-8 py-4 max-w-[1920px] mx-auto">
<HeaderProfile