From fa268392ab21464ad3938db5a6eb22e4a6d7f10d Mon Sep 17 00:00:00 2001 From: celebrateyang Date: Mon, 14 Oct 2024 11:09:51 +0800 Subject: [PATCH] add pvc --- Dockerfile | 2 +- api/src/processing/services/youtube.js | 14 ++++++++++++-- cobalt-chart/templates/pvc.yaml | 13 +++++++++++++ cobalt-chart/values.yaml | 5 +++++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 cobalt-chart/templates/pvc.yaml diff --git a/Dockerfile b/Dockerfile index e4fb8db3..9fc20fce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ FROM base AS api WORKDIR /app # 安装 curl -RUN apt-get update && apt-get install -y curl unzip +RUN apt-get update && apt-get install -y curl unzip vim COPY --from=build /prod/api /app COPY --from=build /app/.git /app/.git diff --git a/api/src/processing/services/youtube.js b/api/src/processing/services/youtube.js index 46f72a5b..f08489ed 100644 --- a/api/src/processing/services/youtube.js +++ b/api/src/processing/services/youtube.js @@ -71,9 +71,19 @@ const cloneInnertube = async (customFetch) => { const cookie = getCookie('youtube_oauth'); const oauthData = transformSessionData(cookie); - + if (!session.logged_in && oauthData) { - await session.oauth.init(oauthData); + const tokensMod = { + ...oauthData, // 复制 oauthData 中的所有属性 + client: { + client_id: oauthData.client_id, + client_secret: oauthData.client_secret + } + }; + delete tokensMod.client_id; + delete tokensMod.client_secret; + + await session.oauth.init(tokensMod); session.logged_in = true; } diff --git a/cobalt-chart/templates/pvc.yaml b/cobalt-chart/templates/pvc.yaml new file mode 100644 index 00000000..95e5af2c --- /dev/null +++ b/cobalt-chart/templates/pvc.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-pvc # 使用 Helm 释放的名称,确保唯一性 + labels: + app: {{ .Release.Name }} # 为 PVC 打上标签,便于管理 +spec: + accessModes: + - {{ .Values.pvc.accessModes }} # 动态指定访问模式,例如 ReadWriteOnce 或 ReadWriteMany + resources: + requests: + storage: {{ .Values.pvc.storage }} # 动态指定存储大小,例如 2Gi + storageClassName: {{ .Values.pvc.storageClassName }} # 动态指定存储类,例如 ssd 或 nfs diff --git a/cobalt-chart/values.yaml b/cobalt-chart/values.yaml index 07753186..e31c0f0e 100644 --- a/cobalt-chart/values.yaml +++ b/cobalt-chart/values.yaml @@ -14,6 +14,11 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +pvc: + accessModes: ReadWriteOnce # 或者 ReadWriteMany,依据需求修改 + storage: 128Mi # 存储容量,依据需求修改 + storageClassName: ssd # 存储类名称,可以根据需求调整 + podAnnotations: {}