Skip to content

migrate: gitea-dev#1181

Open
uni-kakurenbo wants to merge 4 commits into
mainfrom
migration/gitea-dev
Open

migrate: gitea-dev#1181
uni-kakurenbo wants to merge 4 commits into
mainfrom
migration/gitea-dev

Conversation

@uni-kakurenbo
Copy link
Copy Markdown
Contributor

@uni-kakurenbo uni-kakurenbo commented Sep 24, 2025

  • app.ini にどうやって認証情報埋め込めばいいのかわからない

Summary by CodeRabbit

  • Chores
    • Gitea開発環境のKubernetes構成ファイルを追加しました。TLS証明書の管理、アプリケーション構成、デプロイメント設定、Ingressルーティング、永続ストレージ、サービス構成、および機密情報管理を含むインスタンスの完全なセットアップが構成されています。

@uni-kakurenbo uni-kakurenbo marked this pull request as draft September 24, 2025 08:55
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Sep 24, 2025

Diff

No diff detected!

@uni-kakurenbo uni-kakurenbo force-pushed the migration/gitea-dev branch 3 times, most recently from b674132 to e5c0094 Compare September 24, 2025 11:25
Comment thread gitea-dev/deployment.yaml Outdated
containers:
- env:
- name: USER_GID
value: "996"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1002が正しいようです。該当箇所

Suggested change
value: "996"
value: "1002"

Comment thread gitea-dev/deployment.yaml Outdated
ports:
- containerPort: 3000
protocol: TCP
- containerPort: 2200
Copy link
Copy Markdown
Collaborator

@Kentaro1043 Kentaro1043 Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2222番が正しいです
また、IngressはL7ロードバランサーで、http/httpsしかルーティングできないので、こういう書き方をしてホストのポートに直接アタッチする必要があります。

Suggested change
- containerPort: 2200
- containerPort: 2222
hostPort: 2222

Comment thread gitea-dev/config/app.ini Outdated
Comment on lines +22 to +23
SSH_PORT = 2200
SSH_LISTEN_PORT = 2200
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devは2222が正しいです

Suggested change
SSH_PORT = 2200
SSH_LISTEN_PORT = 2200
SSH_PORT = 2222
SSH_LISTEN_PORT = 2222

Comment thread gitea-dev/service.yaml Outdated
Comment on lines +12 to +14
- name: "2200"
port: 2200
targetPort: 2200
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここは必要ないです

Suggested change
- name: "2200"
port: 2200
targetPort: 2200

Comment thread gitea-dev/ingress-route.yaml Outdated
Comment on lines +16 to +20
- kind: Rule
match: Host(`git-dev.trapti.tech`)
services:
- name: gitea-dev
port: 2200
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここは必要ないです

Comment thread gitea-dev/deployment.yaml Outdated
kind: Deployment
metadata:
labels:
app: gitea-dev
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この辺の名前から -dev を削除して欲しいです。(本番環境との設定との差異は内容だけにしたいため)

Suggested change
app: gitea-dev
app: gitea

Comment thread gitea-dev/config/app.ini Outdated
REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars

[attachment]
PATH = /data/gitea/attachments
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここはS3に投げてるみたいです

Suggested change
PATH = /data/gitea/attachments
STORAGE_TYPE = minio

Comment thread gitea-dev/config/app.ini
Comment thread gitea-dev/secrets/gitea-dev.yaml Outdated
Comment on lines +12 to +13
GITEA__lfs__MINIO_ACCESS_KEY_ID: ENC[AES256_GCM,data:JhkdKHZsI3BPhVVNZo2WPL0Hqqg=,iv:izcJl5Y465qys/ujRTzHr7Xzoi+XzL3MNVscQ2y3AMY=,tag:hLdo4ZpeEwg9ECJj3cXPcw==,type:str]
GITEA__lfs__MINIO_SECRET_ACCESS_KEY: ENC[AES256_GCM,data:AAyFxipxE3fk3QJ8hbLLw9RBHg4Yy0Z0vZsKF9jJaiUQOVTu//pREg==,iv:gU1/eUj8ugWjvPZvncNCtoPfsC+USwSfFOVvZrkPUdQ=,tag:6dXKZ5+EQ+mCXxnI/VwfGw==,type:str]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは[storage.minio]セクションにあるべきです。環境変数だとどうなるのか調べたところ、GITEA__storage_0X2E_minio__MINIO_ACCESS_KEY_IDと書くらしいです。わかりにくい...😢
Secretのファイルを編集したあとは再暗号化をお願いします🙏

参考

@uni-kakurenbo uni-kakurenbo force-pushed the migration/gitea-dev branch 10 times, most recently from 3b1abd9 to 9c6fcca Compare January 6, 2026 15:12
@uni-kakurenbo uni-kakurenbo changed the title [in-progress] migrate: gitea-dev migrate: gitea-dev Jan 6, 2026
@uni-kakurenbo uni-kakurenbo marked this pull request as ready for review January 6, 2026 15:16
Comment thread gitea-dev/ingress-route.yaml Outdated
Comment on lines +16 to +20
- kind: Rule
match: Host(`git-dev.trapti.tech`)
services:
- name: gitea
port: 2222
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここはIngressを通らないので必要なさそうです

Suggested change
- kind: Rule
match: Host(`git-dev.trapti.tech`)
services:
- name: gitea
port: 2222

Comment thread gitea-dev/config/app.ini

[repository.upload]
TEMP_PATH = /data/gitea/uploads

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[repository.signing]が抜けてる気がします

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

今の [repository.signing] の設定ってどこで確認できますか?
m011 の /srv/gitea/app.ini.bak を見ても特に何も見つからず.....

Comment thread gitea-dev/config/app.ini
[database]
PATH = /data/gitea/gitea.db
DB_TYPE = mysql
HOST = private.kmbk.tokyotech.org:33060
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tailscaleになってなさそうです

Suggested change
HOST = private.kmbk.tokyotech.org:33060
HOST = tailscale.kmbk.tokyotech.org:33060

Comment thread gitea-dev/deployment.yaml
Comment on lines +33 to +37
volumeMounts:
- name: storage
mountPath: /data
- name: config
mountPath: /app.ini
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

何故か開発環境にはなかったけど、timezoneをホストと合わせるのが良い気がします 該当箇所

@@ -0,0 +1,29 @@
apiVersion: v1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

現在Secretに関する新ルールのPRが作成中なので、それに合わせてファイル名をsecrets.enc.yamlに変更していただけると助かります🙏

ファイル名の変更時は最暗号化は必要ないです

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2026

Warning

Rate limit exceeded

@uni-kakurenbo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3c94df93-93d1-484e-b55a-8ae04ab3340f

📥 Commits

Reviewing files that changed from the base of the PR and between 434b71c and 4f98349.

📒 Files selected for processing (3)
  • gitea-dev/deployment.yaml
  • gitea-dev/ingress-route.yaml
  • gitea-dev/secrets/secrets.enc.yaml
📝 Walkthrough

ウォークスルー

Gitea開発環境向けの完全なKubernetesマニフェストセットを追加しました。証明書、デプロイメント、サービス、永続ストレージ、Traefik IngressRoute、設定ファイル、暗号化されたシークレット、およびKustomization定義を含みます。

変更内容

コホート / ファイル 概要
Kubernetesリソース定義(基本インフラストラクチャ)
gitea-dev/certificate.yaml, gitea-dev/deployment.yaml, gitea-dev/service.yaml, gitea-dev/volume-storage.yaml
TLS証明書、Gitea Deploymentコンテナ(ポート3000/2222)、Service(ポート3000公開)、100Mi PersistentVolumeClaimを定義します。
ネットワーク・ルーティング
gitea-dev/ingress-route.yaml
Traefik IngressRouteを設定し、ホストgit-dev.trapti.techへのwebsecureエントリーポイントトラフィックをGitea Serviceのポート3000および2222に転送します。TLS証明書gitea-tlsを使用します。
設定管理
gitea-dev/config/app.ini
Gitea runtimeの完全な設定(リポジトリパス、MySQLデータベース接続、MinIO/Wasabi ストレージバックエンド、ログ設定、セキュリティ設定)を定義します。
シークレット・暗号化
gitea-dev/secrets/secrets.yaml
SOPSで暗号化されたgitea-secretsリソース(LFS JWT、DB パスワード、セキュリティキー、MinIO認証情報、OAuth2シークレット等)を含みます。
オーケストレーション構成
gitea-dev/kustomization.yaml, gitea-dev/ksops.yaml
Kustomize構成でリソースマニフェストを統合し、gitea-latestイメージをghcr.io/traptitech/gitea:latestにオーバーライド、KSOPS生成器を有効化、app.ini設定をConfigMapとして生成します。

推定コードレビュー工数

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトル「migrate: gitea-dev」は、gitea-dev環境に関するKubernetesマニフェスト群の追加という変更内容の主要な部分を正確に反映している。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch migration/gitea-dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

♻️ Duplicate comments (1)
gitea-dev/ingress-route.yaml (1)

16-20: ⚠️ Potential issue | 🟠 Major

SSHポート2222のルートは削除してください。

websecureエントリポイントはHTTP/HTTPSトラフィック用であり、SSHプロトコルをルーティングできません。SSHトラフィックはDeploymentのhostPort: 2222を通じて直接ホストにルーティングされるため、このIngressRouteエントリは不要であり、動作しません。

🐛 削除案
   routes:
     - kind: Rule
       match: Host(`git-dev.trapti.tech`)
       services:
         - name: gitea
           port: 3000
-    - kind: Rule
-      match: Host(`git-dev.trapti.tech`)
-      services:
-        - name: gitea
-          port: 2222
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gitea-dev/ingress-route.yaml` around lines 16 - 20, Remove the SSH service
entry from the IngressRoute: delete the Rule block that routes to service name
"gitea" port 2222 (the match Host(`git-dev.trapti.tech`) / services -> name:
gitea / port: 2222). The "websecure" entrypoint only handles HTTP/HTTPS so do
not attempt to route SSH there; rely on the Deployment's hostPort: 2222 instead
and keep only HTTP/HTTPS service entries in this IngressRoute.
🧹 Nitpick comments (5)
gitea-dev/config/app.ini (2)

27-33: データベース設定の不要なPATH指定があります。

DB_TYPE = mysqlが設定されているため、Line 28のPATH = /data/gitea/gitea.db(SQLite用)は無視されます。混乱を避けるため削除を検討してください。

♻️ 不要な設定の削除
 [database]
-PATH = /data/gitea/gitea.db
 DB_TYPE = mysql
 HOST = private.kmbk.tokyotech.org:33060
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gitea-dev/config/app.ini` around lines 27 - 33, 設定ファイル内のデータベースセクションで DB_TYPE
= mysql が指定されているため、SQLite 用の PATH = /data/gitea/gitea.db
エントリは不要で混乱を招きます。データベース設定から PATH キーを削除し、代わりに MySQL 接続情報(DB_TYPE, HOST, NAME, USER
等)だけが残るように修正してください。

48-51: 本番モードでDebugレベルのログは冗長です。

RUN_MODE = prod(Line 2)に設定されていますが、ログレベルがDebugになっています。本番環境ではInfoまたはWarnを推奨します。

♻️ ログレベルの調整
 [log]
 MODE = console
-LEVEL = Debug
+LEVEL = Info
 ROOT_PATH = /data/gitea/log
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gitea-dev/config/app.ini` around lines 48 - 51, The logging LEVEL is set to
Debug while RUN_MODE is prod; update the [log] section to use a less verbose
level (e.g., set LEVEL = Info or LEVEL = Warn) when RUN_MODE is prod so
production logs are not overly verbose; locate the [log] block containing MODE,
LEVEL, and ROOT_PATH and change the LEVEL value accordingly (preferably LEVEL =
Info).
gitea-dev/deployment.yaml (1)

18-38: セキュリティコンテキストの設定を検討してください。

Checkovの静的解析がallowPrivilegeEscalationroot containersについて警告しています。本番環境へ移行する前に、セキュリティコンテキストを設定することを推奨します。

🛡️ securityContextの追加案
       containers:
         - env:
             - name: USER_GID
               value: "1002"
             - name: USER_UID
               value: "996"
+          securityContext:
+            allowPrivilegeEscalation: false
+            runAsNonRoot: true
+            runAsUser: 996
+            runAsGroup: 1002
           image: gitea-latest
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gitea-dev/deployment.yaml` around lines 18 - 38, Deployment is missing
securityContext settings which triggered Checkov warnings about
allowPrivilegeEscalation and root containers; update the Pod/Container spec for
the container named "gitea" to add a securityContext that enforces non-root
execution and disables privilege escalation: set runAsNonRoot: true and
runAsUser/runAsGroup to the UID/GID from USER_UID/USER_GID (or a non-zero
non-root UID), set allowPrivilegeEscalation: false, drop all capabilities
(capabilities: drop: ["ALL"]), enable readOnlyRootFilesystem: true and
seccompProfile: { type: "RuntimeDefault" } (or equivalent) on the gitea
container (or podSecurityContext) so the container no longer runs as root and
privilege escalation is prevented.
gitea-dev/kustomization.yaml (1)

8-11: latestタグの使用は本番環境では非推奨です。

開発環境では許容されますが、latestタグは再現性とロールバックの観点で問題があります。本番環境に移行する際は、特定のバージョンタグを使用することを検討してください。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gitea-dev/kustomization.yaml` around lines 8 - 11, kustomization の images
セクションで `newTag: latest` を使っているため本番での再現性/ロールバック性が損なわれます。`gitea-latest` エントリ(image
name: gitea-latest / newName: ghcr.io/traptitech/gitea)を修正して、`newTag`
に固定のバージョン(例:リリースタグや semver)を指定するか、環境ごとの変数(kustomize imageTransformers や
ConfigMap/Helm
値)で外部から注入するように変更してください。ロールアウト運用を想定するならイメージタグを変更した際に追跡できる記述(リリースノートや CI
が出力するタグ)を併せて反映してください。
gitea-dev/volume-storage.yaml (1)

6-8: ストレージサイズ100Miは開発環境でも小さい可能性があります。

Giteaはリポジトリデータ、アバター、セッションなどを/dataに保存します。100Miは開発環境であってもすぐに不足する可能性があります。また、storageClassNameが指定されていないため、クラスタのデフォルトStorageClassが使用されます。

♻️ ストレージサイズの調整案
 spec:
   resources:
     requests:
-      storage: 100Mi
+      storage: 1Gi
   volumeMode: Filesystem
   accessModes:
     - ReadWriteOnce
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gitea-dev/volume-storage.yaml` around lines 6 - 8, resources.requests.storage
が 100Mi に設定されており開発でも不足する恐れがあるので、PVC の storage: をより現実的な値(例: 1Gi または
5Gi)に引き上げし、明示的に storageClassName を追加して利用する StorageClass
を指定してください(該当フィールド:resources.requests.storage と storageClassName
を更新)。必要に応じてアクセスモード(例: accessModes)やリソースの上限(resources.limits)も検討してください。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@gitea-dev/config/app.ini`:
- Around line 60-70: 設定の矛盾があります:ENABLE_REVERSE_PROXY_AUTHENTICATION が false のまま
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION と ENABLE_REVERSE_PROXY_EMAIL を true
にしています。期待する動作に合わせて整合させてください — リバースプロキシ認証を使うなら
ENABLE_REVERSE_PROXY_AUTHENTICATION を true に切り替え、また必要に応じて
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION / ENABLE_REVERSE_PROXY_EMAIL を true
にし、認証を使わないならこれらを false にしてください(参照する設定キー:ENABLE_REVERSE_PROXY_AUTHENTICATION,
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION, ENABLE_REVERSE_PROXY_EMAIL)。

In `@gitea-dev/deployment.yaml`:
- Around line 36-37: The config volume mount currently sets mountPath: /app.ini
which Gitea will not read; update the volumeMount (the entry with name: config
and mountPath) to mount the file at Gitea's expected path
/data/gitea/conf/app.ini and add subPath: app.ini so the single file from the
volume is mounted (i.e., change mountPath to /data/gitea/conf/app.ini and add
subPath: app.ini in the same volumeMount stanza).
- Around line 19-24: The Deployment does not inject the gitea-secrets into the
container, so add an envFrom secret reference to the container spec to load all
Gitea config keys (use secret name "gitea-secrets"); specifically, within the
containers: - envFrom: - secretRef: name: gitea-secrets (placed alongside the
existing env entries) so GITEA__section__KEY style secrets (DB password,
SECRET_KEY, MinIO creds) are available as environment variables to Gitea; ensure
the secret exists and avoid duplicating keys already set via individual env
entries.

In `@gitea-dev/service.yaml`:
- Around line 8-11: The Service is missing the port for SSH (2222) referenced by
the IngressRoute rule; update the Service resource to include an additional port
entry for port 2222 (name "2222", port 2222, targetPort 2222) so it matches the
IngressRoute rule and the Deployment's containerPort/hostPort 2222, ensuring the
IngressRoute routing can reach the pods.

---

Duplicate comments:
In `@gitea-dev/ingress-route.yaml`:
- Around line 16-20: Remove the SSH service entry from the IngressRoute: delete
the Rule block that routes to service name "gitea" port 2222 (the match
Host(`git-dev.trapti.tech`) / services -> name: gitea / port: 2222). The
"websecure" entrypoint only handles HTTP/HTTPS so do not attempt to route SSH
there; rely on the Deployment's hostPort: 2222 instead and keep only HTTP/HTTPS
service entries in this IngressRoute.

---

Nitpick comments:
In `@gitea-dev/config/app.ini`:
- Around line 27-33: 設定ファイル内のデータベースセクションで DB_TYPE = mysql が指定されているため、SQLite 用の
PATH = /data/gitea/gitea.db エントリは不要で混乱を招きます。データベース設定から PATH キーを削除し、代わりに MySQL
接続情報(DB_TYPE, HOST, NAME, USER 等)だけが残るように修正してください。
- Around line 48-51: The logging LEVEL is set to Debug while RUN_MODE is prod;
update the [log] section to use a less verbose level (e.g., set LEVEL = Info or
LEVEL = Warn) when RUN_MODE is prod so production logs are not overly verbose;
locate the [log] block containing MODE, LEVEL, and ROOT_PATH and change the
LEVEL value accordingly (preferably LEVEL = Info).

In `@gitea-dev/deployment.yaml`:
- Around line 18-38: Deployment is missing securityContext settings which
triggered Checkov warnings about allowPrivilegeEscalation and root containers;
update the Pod/Container spec for the container named "gitea" to add a
securityContext that enforces non-root execution and disables privilege
escalation: set runAsNonRoot: true and runAsUser/runAsGroup to the UID/GID from
USER_UID/USER_GID (or a non-zero non-root UID), set allowPrivilegeEscalation:
false, drop all capabilities (capabilities: drop: ["ALL"]), enable
readOnlyRootFilesystem: true and seccompProfile: { type: "RuntimeDefault" } (or
equivalent) on the gitea container (or podSecurityContext) so the container no
longer runs as root and privilege escalation is prevented.

In `@gitea-dev/kustomization.yaml`:
- Around line 8-11: kustomization の images セクションで `newTag: latest`
を使っているため本番での再現性/ロールバック性が損なわれます。`gitea-latest` エントリ(image name: gitea-latest /
newName: ghcr.io/traptitech/gitea)を修正して、`newTag` に固定のバージョン(例:リリースタグや
semver)を指定するか、環境ごとの変数(kustomize imageTransformers や ConfigMap/Helm
値)で外部から注入するように変更してください。ロールアウト運用を想定するならイメージタグを変更した際に追跡できる記述(リリースノートや CI
が出力するタグ)を併せて反映してください。

In `@gitea-dev/volume-storage.yaml`:
- Around line 6-8: resources.requests.storage が 100Mi
に設定されており開発でも不足する恐れがあるので、PVC の storage: をより現実的な値(例: 1Gi または 5Gi)に引き上げし、明示的に
storageClassName を追加して利用する StorageClass
を指定してください(該当フィールド:resources.requests.storage と storageClassName
を更新)。必要に応じてアクセスモード(例: accessModes)やリソースの上限(resources.limits)も検討してください。

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fd3bdf82-6d3d-4353-b129-e3b1d4070163

📥 Commits

Reviewing files that changed from the base of the PR and between 319da40 and 434b71c.

📒 Files selected for processing (9)
  • gitea-dev/certificate.yaml
  • gitea-dev/config/app.ini
  • gitea-dev/deployment.yaml
  • gitea-dev/ingress-route.yaml
  • gitea-dev/ksops.yaml
  • gitea-dev/kustomization.yaml
  • gitea-dev/secrets/secrets.yaml
  • gitea-dev/service.yaml
  • gitea-dev/volume-storage.yaml

Comment thread gitea-dev/config/app.ini
Comment on lines +60 to +70
[service]
DISABLE_REGISTRATION = true
REQUIRE_SIGNIN_VIEW = true
ENABLE_REVERSE_PROXY_AUTHENTICATION = false
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = true
NO_REPLY_ADDRESS = trap.jp
ENABLE_REVERSE_PROXY_EMAIL = true
DEFAULT_KEEP_EMAIL_PRIVATE = true
DEFAULT_ORG_MEMBER_VISIBLE = true
ENABLE_NOTIFY_MAIL = true
ENABLE_BASIC_AUTHENTICATION = false
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

リバースプロキシ認証の設定に矛盾があります。

ENABLE_REVERSE_PROXY_AUTHENTICATION = falseに設定されていますが、ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = trueENABLE_REVERSE_PROXY_EMAIL = trueが有効になっています。認証が無効な状態でこれらの設定は機能しません。意図した動作を確認してください。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gitea-dev/config/app.ini` around lines 60 - 70,
設定の矛盾があります:ENABLE_REVERSE_PROXY_AUTHENTICATION が false のまま
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION と ENABLE_REVERSE_PROXY_EMAIL を true
にしています。期待する動作に合わせて整合させてください — リバースプロキシ認証を使うなら
ENABLE_REVERSE_PROXY_AUTHENTICATION を true に切り替え、また必要に応じて
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION / ENABLE_REVERSE_PROXY_EMAIL を true
にし、認証を使わないならこれらを false にしてください(参照する設定キー:ENABLE_REVERSE_PROXY_AUTHENTICATION,
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION, ENABLE_REVERSE_PROXY_EMAIL)。

Comment thread gitea-dev/deployment.yaml
Comment on lines +19 to +24
containers:
- env:
- name: USER_GID
value: "1002"
- name: USER_UID
value: "996"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

gitea-secretsがコンテナに注入されていません。

gitea-dev/secrets/secrets.yamlで定義されているgitea-secrets(データベースパスワード、SECRET_KEY、MinIO認証情報など)がDeploymentに注入されていません。これがPR説明で言及されている「app.iniに認証情報を埋め込む方法がわからない」問題の解決策です。GiteaはGITEA__section__KEY形式の環境変数で設定を上書きできます。

🐛 envFromを追加してシークレットを注入
       containers:
         - env:
             - name: USER_GID
               value: "1002"
             - name: USER_UID
               value: "996"
+          envFrom:
+            - secretRef:
+                name: gitea-secrets
           image: gitea-latest
           name: gitea
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
containers:
- env:
- name: USER_GID
value: "1002"
- name: USER_UID
value: "996"
containers:
- env:
- name: USER_GID
value: "1002"
- name: USER_UID
value: "996"
envFrom:
- secretRef:
name: gitea-secrets
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gitea-dev/deployment.yaml` around lines 19 - 24, The Deployment does not
inject the gitea-secrets into the container, so add an envFrom secret reference
to the container spec to load all Gitea config keys (use secret name
"gitea-secrets"); specifically, within the containers: - envFrom: - secretRef:
name: gitea-secrets (placed alongside the existing env entries) so
GITEA__section__KEY style secrets (DB password, SECRET_KEY, MinIO creds) are
available as environment variables to Gitea; ensure the secret exists and avoid
duplicating keys already set via individual env entries.

Comment thread gitea-dev/deployment.yaml
Comment on lines +36 to +37
- name: config
mountPath: /app.ini
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

app.iniのマウントパスが正しくありません。

Giteaはデフォルトで/data/gitea/conf/app.iniから設定を読み込みます。現在のマウントパス/app.iniではGiteaが設定を検出できません。また、subPathを使用してファイルを直接マウントする必要があります。

🐛 正しいマウントパスに修正
           volumeMounts:
             - name: storage
               mountPath: /data
             - name: config
-              mountPath: /app.ini
+              mountPath: /data/gitea/conf/app.ini
+              subPath: app.ini
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gitea-dev/deployment.yaml` around lines 36 - 37, The config volume mount
currently sets mountPath: /app.ini which Gitea will not read; update the
volumeMount (the entry with name: config and mountPath) to mount the file at
Gitea's expected path /data/gitea/conf/app.ini and add subPath: app.ini so the
single file from the volume is mounted (i.e., change mountPath to
/data/gitea/conf/app.ini and add subPath: app.ini in the same volumeMount
stanza).

Comment thread gitea-dev/service.yaml
Comment on lines +8 to +11
ports:
- name: "3000"
port: 3000
targetPort: 3000
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# 他のgitea環境でServiceがSSHポートを公開しているか確認
fd -e yaml . -x grep -l "kind: Service" {} \; | xargs -I{} sh -c 'echo "=== {} ===" && cat {}'

Repository: traPtitech/manifest

Length of output: 50375


🏁 Script executed:

#!/bin/bash
# Find and examine gitea-dev service configuration
find . -path "*/gitea-dev/*" -name "service.yaml" -o -path "*/gitea-dev/*" -name "*.yaml" | head -20

Repository: traPtitech/manifest

Length of output: 294


🏁 Script executed:

#!/bin/bash
# Look for gitea-dev service.yaml specifically
fd "service.yaml" . | grep gitea

Repository: traPtitech/manifest

Length of output: 141


🏁 Script executed:

#!/bin/bash
# Check the gitea-dev directory structure
ls -la gitea-dev/ 2>/dev/null || find . -type d -name "gitea-dev" | head -5

Repository: traPtitech/manifest

Length of output: 756


🏁 Script executed:

cat -n gitea-dev/service.yaml

Repository: traPtitech/manifest

Length of output: 332


🏁 Script executed:

cat -n gitea-dev/deployment.yaml

Repository: traPtitech/manifest

Length of output: 1480


🏁 Script executed:

cat -n gitea-dev/ingress-route.yaml

Repository: traPtitech/manifest

Length of output: 591


ServiceがIngressRouteで参照されているポート2222を公開していません。

IngressRouteの2つ目のルール(17-20行目)がポート2222をサービスに指定していますが、Serviceの定義にはポート2000のみが含まれています。Deploymentではコンテナポート2222にhostPort: 2222が設定されているため、現在の構成ではIngressRouteのルーティングが機能しません。Serviceに以下のポート定義を追加してください:

  ports:
    - name: "3000"
      port: 3000
      targetPort: 3000
    - name: "2222"
      port: 2222
      targetPort: 2222
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gitea-dev/service.yaml` around lines 8 - 11, The Service is missing the port
for SSH (2222) referenced by the IngressRoute rule; update the Service resource
to include an additional port entry for port 2222 (name "2222", port 2222,
targetPort 2222) so it matches the IngressRoute rule and the Deployment's
containerPort/hostPort 2222, ensuring the IngressRoute routing can reach the
pods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants