feat: チャートをゼロから再設計(外部DB前提のYOURLS+Nginx構成に作り直し)
Helm Chart Release / release-chart (push) Successful in 7s

旧チャートは存在しないDocker Hubイメージ(yourls/yourls)を参照し、Bitnami MySQL
サブチャートに依存するなど正しく動作しない状態だったため、YOURLS公式イメージ
(docker.io/yourls, container-entrypoint.sh/config-container.php)の実装を確認した上で
WordPressチャートと同一方針(外部DB、emptyDir+PVC分離、fsGroup非root実行、
real IP取得対応)でスクラッチから再構築した。
This commit is contained in:
2026-09-12 07:56:17 +09:00
parent a1cf9dced9
commit de1a4144b5
18 changed files with 1056 additions and 397 deletions
+160 -60
View File
@@ -1,99 +1,199 @@
# Default values for yourls-nginx chart
# This is a YAML-formatted file.
# デフォルト値設定
replicaCount: 1
# Image configurations
image:
nginx:
registry: docker.io
repository: nginx
tag: "1.29.3-alpine-perl"
tag: "1.31.5-alpine-perl"
pullPolicy: IfNotPresent
yourls:
# 公式イメージ(docker-library/YOURLS)。fpm-alpineバリアントはPHP-FPMのみで
# リバースプロキシ(nginx)が別途必要な構成。
registry: docker.io
repository: yourls
tag: "1.10.2-fpm-alpine"
tag: "1.10.6-fpm-alpine"
pullPolicy: IfNotPresent
# Replica count
replicaCount: 1
# YOURLS設定
yourls:
# YOURLSインスタンスのURL。末尾スラッシュなし、小文字。
# 必ず実際のドメインに変更してください(短縮URL生成に使用される固定値のため、
# WordPressのように実行時のHTTP Hostヘッダーから自動判定されません)。
site: "https://your-own-domain-here.com"
# Service configuration
admin:
username: "admin"
# 空の場合はSecret作成時にランダム生成されます(helm upgradeを跨いで値は保持されます)。
# 本番環境では明示的に設定するか、existingSecretの使用を推奨します。
password: ""
# 【外部Secret連携】secret-managerチャート等、既存のSecretからパスワードを取得する場合に指定。
# 指定時は上記 password は無視されます。
existingSecret: ""
existingSecretKey: "password"
# Cookie暗号化キー。空の場合はSecret作成時にランダム生成され、以後のhelm upgradeでも
# 同じ値が再利用されます(lookup関数でSecretの既存値を参照するため、ログインセッションが
# アップグレードのたびに無効化されることはありません)。
cookiekey: ""
# true(デフォルト): 管理画面へのアクセスにログインが必須(YOURLS推奨の安全な既定値)。
# false: 統計ページ等を公開する場合に変更してください。詳細: https://yourls.org/privatepublic
privateMode: true
# サーバーのタイムゾーンオフセット(時間)
hoursOffset: 0
# 管理画面の表示言語。user/languages に該当する.moファイルがある場合のみ有効。
lang: ""
# データベース設定(外部MySQL/MariaDBを利用する構成。サブチャートは同梱しません)
database:
host: "mysql.example.svc.cluster.local"
port: 3306
name: "yourls"
user: "yourls"
# 本番環境ではexistingSecretの使用を推奨します
password: "changeme"
# 【外部Secret連携】secret-managerチャート等、既存のSecretからパスワードを取得する場合に指定。
# 指定時は上記 password は無視されます。
existingSecret: ""
existingSecretKey: "password"
tablePrefix: "yourls_"
# 既存の Secret / ConfigMap をまるごと環境変数として yourls コンテナへ注入する(envFrom)。
# 別リポジトリの secret-manager チャートが各ネームスペースへ配布する
# cred-<名前> Secret(API キー等)をそのまま読み込む用途を想定。
extraEnvFrom: []
# - secretRef:
# name: cred-gemini
# 個別の環境変数を追加する(生の env エントリ配列。value / valueFrom(secretKeyRef 等) 使用可)。
# YOURLS_DEBUG, YOURLS_UNIQUE_URLS, YOURLS_URL_CONVERT, YOURLS_NOSTATS 等、
# 本チャートが直接values化していないYOURLSの環境変数はこちらで指定してください。
extraEnv: []
# - name: YOURLS_UNIQUE_URLS
# value: "true"
nginx:
# Ingress ControllerやCDN(Cloudflare等)、外部LB等、X-Forwarded-Forヘッダーを
# 付与するリバースプロキシを前段に置く場合にのみ有効にしてください。
# Service直下にPodがぶら下がるベアメタル/MetalLB構成では、代わりに下記の
# service.externalTrafficPolicy: Local を使用してください。
forwardRealIP:
enabled: false
trustedProxies:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
# CloudflareやAWS ALB等を使っている場合は以下のIPレンジも追加してください
# - 173.245.48.0/20
extraConfig: |
# Service設定
service:
# VIP/グローバルIPが希少な環境を想定し、既定はClusterIP + Ingress(共有)としています。
# 専用のLoadBalancer IPを払い出す場合のみ type: LoadBalancer に変更してください。
type: ClusterIP
port: 80
targetPort: 80
# ベアメタルクラスター(MetalLB等)でクライアントの実IPを取得するための設定。
# kube-proxyはデフォルト(Cluster)だと送信元IPをノードIPにSNATしてしまうため、
# Local にすることでSNATを回避し、Nginxの$remote_addrに実IPがそのまま渡ります。
# LoadBalancer / NodePort でのみ有効(ClusterIPでは無視されます)。
externalTrafficPolicy: Local
# Ingress configuration
# Ingress設定
ingress:
enabled: false
className: "nginx"
className: nginx
annotations: {}
# {
# acme.cert-manager.io/http01-ingress-class: "nginx",
# cert-manager.io/cluster-issuer: "letsencrypt-issuer",
# nginx.ingress.kubernetes.io/from-to-www-redirect: "true",
# nginx.ingress.kubernetes.io/proxy-body-size: "100m"
# }
hosts:
- host: example.tld
paths:
- path: /
pathType: Prefix
tls: []
# - secretName: yourls-tls
# hosts:
# - example.tld
# コメントを外すだけで有効化できる設定例
# cert-manager.io/cluster-issuer: "letsencrypt-issuer",
# nginx.ingress.kubernetes.io/ssl-redirect: "true",
# nginx.ingress.kubernetes.io/force-ssl-redirect: "true",
# nginx.ingress.kubernetes.io/proxy-body-size: "10m",
# IP取得用(Nginx Ingress Controllerの場合)
# nginx.ingress.kubernetes.io/use-forwarded-headers: "true",
# nginx.ingress.kubernetes.io/compute-full-forwarded-for: "true",
hostname: yourls.example.com
path: /
pathType: Prefix
# TLS設定(true にするだけで hostname を使用して自動設定)
tls: false
# tlsを有効にすると自動的に以下が設定されます:
# - hosts: [hostname]
# - secretName: {hostname}-tls
# MySQL/MariaDB configuration
mysql:
# 追加のホスト設定
extraHosts: []
# - name: go.example.com
# path: /
# 追加のTLS設定
extraTls: []
# - hosts:
# - go.example.com
# secretName: go-example-com-tls
# PersistentVolume設定
# YOURLS本体(コアファイル)はemptyDirに配置(使い捨て)。
# user/plugins, user/pages, user/languages(管理画面から追加したプラグイン・ページ・
# 言語ファイル)のみPVCに永続化します。user/config.phpは環境変数から都度生成されるため
# 永続化しません(値を変更した場合に確実に反映されるようにするため)。
persistence:
enabled: true
auth:
rootPassword: "changeme"
database: "yourls"
username: "yourls"
password: "yourls"
primary:
persistence:
enabled: true
size: 8Gi
storageClass: ""
accessMode: ReadWriteOnce
size: 1Gi
# YOURLS configuration
yourls:
config:
site: "https://yourls.example.com"
username: "admin"
password: "admin"
cookiekey: "modify_this_random_string"
hours_offset: 0
lang: "en"
persistence:
enabled: true
storageClass: ""
accessMode: ReadWriteOnce
size: 1Gi
# Resources
# リソース設定
resources:
nginx:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
requests:
cpu: 50m
memory: 32Mi
yourls:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 250m
memory: 256Mi
requests:
cpu: 100m
memory: 64Mi
# Node selector
# Health Check
# livenessProbeは/robots.txt(YOURLSがDB接続前に無条件で200を返す固定応答)を見ており、
# DB接続の一時的な断でコンテナが再起動ループに陥らないようにしています。
# readinessProbeは/(DB接続を要する通常ページ)を見ており、DBに接続できない間は
# Serviceの振り分け対象から外れるようにしています。
healthCheck:
enabled: true
livenessProbe:
httpGet:
path: /robots.txt
port: 80
initialDelaySeconds: 20
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
# Node Selector
nodeSelector: {}
# Tolerations
tolerations: []
# Affinity
affinity: {}
affinity: {}