fix: v8.5.10-bのDeployment.spec.selector変更が既存リリースのアップグレードを壊す不具合を修正
Helm Chart Release / release-chart (push) Successful in 9s

既存のnginx/php-fpm Deploymentのspec.selector.matchLabelsにapp.kubernetes.io/component:webを追加していたが、Deployment.spec.selectorは作成後immutableのためhelm upgradeが'field is immutable'で失敗していた。既存Deploymentのselectorは元の内容(name+instanceのみ)に戻し、Selenium側はcomponentラベルではなくapp.kubernetes.io/name自体を<chart名>-seleniumという別名にする方式(新ヘルパーphpfpm.selenium.name/phpfpm.selenium.selectorLabels)に変更した。componentラベルだけを足す設計だとSeleniumのPodもnginx/php-fpm側Deploymentのselectorに一致してしまいReplicaSetの選択重複を起こすため、name自体をvariantにして構造的に防止する。v8.5.10-bは既存リリースへの適用不可のためスキップし、v8.5.10-c以降を使うこと。
This commit is contained in:
2026-09-26 09:46:56 +09:00
parent 86cd705d06
commit abb5dba4a1
9 changed files with 107 additions and 10 deletions
+60
View File
@@ -0,0 +1,60 @@
# Changelog - Version 8.5.10-c
## 不具合修正
### v8.5.10-b の Selenium分離が既存リリースのアップグレードを壊す問題を修正
v8.5.10-b で Selenium を独立 Deployment/Service に分離した際、既存の nginx/php-fpm
Deployment の `spec.selector.matchLabels` に `app.kubernetes.io/component: web` を
追加した。しかし **`Deployment.spec.selector` は作成後 immutable** であり、
既存リリースを `helm upgrade` すると次のエラーで失敗する。
```
cannot patch "<release>-phpfpm" with kind Deployment: Deployment.apps "<release>-phpfpm"
is invalid: spec.selector: Invalid value: ...: field is immutable.
```
**対応**
- 既存の nginx/php-fpm Deployment の `spec.selector.matchLabels` は
元の内容(`app.kubernetes.io/name` + `app.kubernetes.io/instance` のみ)に戻し、
以後も変更しない。
- Selenium 側は `app.kubernetes.io/component` ラベルではなく、
**`app.kubernetes.io/name` 自体を `<chart名>-selenium` という別名にする**方式に変更した
(新ヘルパー `phpfpm.selenium.name` / `phpfpm.selenium.selectorLabels`。
`templates/_helpers.tpl`)。component ラベルを足すだけの設計だと、Selenium の Pod も
nginx/php-fpm 側 Deployment の selector(name+instance)に一致してしまい、
2つの Deployment(ReプリカSet)が同じ Pod 集合を取り合う selector 重複を起こすため、
name 自体を variant にして構造的に重複を防止する。
- `templates/deployment-selenium.yaml` / `templates/service-selenium.yaml` の
selector・pod template labels をこの新ヘルパーに合わせて修正。
`app.kubernetes.io/component: selenium` は情報用のラベルとして pod template には
引き続き付与する(selector には使わない。README の `kubectl logs -l
app.kubernetes.io/component=selenium` 等の運用コマンドはそのまま使える)。
- メインの Service(`<release>-phpfpm`)の selector に残した
`app.kubernetes.io/component: web` は Service の selector なので immutable 制約は
受けず、そのまま維持している(Selenium 側が別名になったことで実質不要になったが、
害はないため多層防御として残す)。
**v8.5.10-b をまだ適用していない場合**: 8.5.10-b は上記のバグを含むため、
直接 **8.5.10-c 以降**を適用すること。
**v8.5.10-b の適用に失敗した場合**(今回のエラーが出た場合): リリースは
アップグレードに失敗した時点のリビジョンのままのはずなので、Chart version を
`8.5.10-c` に変更して再度アップグレードすればよい(追加の手動復旧は不要)。
**対象ファイル**: `templates/_helpers.tpl`, `templates/deployment.yaml`,
`templates/deployment-selenium.yaml`, `templates/service-selenium.yaml`, `Chart.yaml`,
`CHANGELOG-8.5.10-c.md`
## アップグレード手順
```bash
helm repo update
helm upgrade <リリース名> cafepieters/phpfpm --version 8.5.10-c -f values.yaml
```
---
**リリース日**: 2026-09-26
**担当**: プロサーバーエンジニア(Claude)