feat(operator): expose Install/Upgrade timeouts and MaxHistory as flags

The HelmRelease generation in package_reconciler hardcoded three values
that have caused recurring pain:

- Install.Timeout = 10m (line 214)
- Upgrade.Timeout = 10m (line 220)
- MaxHistory = unset (Helm default 5)

The 10m timeout in particular contradicts the per-Application timeout
work done in `pkg/config/config.go` and
`pkg/registry/apps/application/rest.go` (commit 7b146cbe), which lets
individual Applications override the install/upgrade timeout via
annotation. The PackageSource side had no equivalent — etcd works around
it by hand-rolling its HR YAML in `packages/apps/tenant/templates/etcd.yaml`
to set a 30m timeout, harbor has had multiple commits chasing the same
problem from the other side. This closes that gap.

New operator flags (each maps to a chart value with empty default;
operator uses its own default when value is empty):

- `--helmrelease-install-timeout` (default 10m) → Spec.Install.Timeout
- `--helmrelease-upgrade-timeout` (default 10m) → Spec.Upgrade.Timeout
- `--helmrelease-max-history` (default 5)        → Spec.MaxHistory

Production behaviour unchanged. E2E and edge cases (cert rotation,
slow-installing charts) can override per-cluster without modifying
chart manifests.

Per-component overrides on `ComponentInstall` (mirroring the existing
`UpgradeCRDs` pattern) would be a strictly better fix for charts like
etcd that need an outlier timeout — left as a deliberate followup since
it touches the Package CR API.

Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
This commit is contained in:
Myasnikov Daniil committed 2026-04-28 12:44:06 +05:00
1 parent c4c70e0e18
commit e410b02e1d
4 files changed
+67 -10

No files matched your search

@@ -74,6 +74,15 @@ spec:
{{- if .Values.cozystackOperator.helmReleaseRetryInterval }}
- --helmrelease-retry-interval={{ .Values.cozystackOperator.helmReleaseRetryInterval }}
{{- end }}
{{- if .Values.cozystackOperator.helmReleaseInstallTimeout }}
- --helmrelease-install-timeout={{ .Values.cozystackOperator.helmReleaseInstallTimeout }}
{{- end }}
{{- if .Values.cozystackOperator.helmReleaseUpgradeTimeout }}
- --helmrelease-upgrade-timeout={{ .Values.cozystackOperator.helmReleaseUpgradeTimeout }}
{{- end }}
{{- if .Values.cozystackOperator.helmReleaseMaxHistory }}
- --helmrelease-max-history={{ .Values.cozystackOperator.helmReleaseMaxHistory }}
{{- end }}
- --platform-source-name=cozystack-platform
- --platform-source-url={{ .Values.cozystackOperator.platformSourceUrl }}
{{- if .Values.cozystackOperator.platformSourceRef }}
+12
View File
@@ -11,6 +11,18 @@ cozystackOperator:
# (operator default: 30s). Controls how fast failed install/upgrade attempts
# are retried. Decoupled from helmReleaseInterval (healthy reconcile cadence).
helmReleaseRetryInterval: ""
# When non-empty, overrides the operator's --helmrelease-install-timeout flag
# (operator default: 10m). Bounds individual k8s operations (job/hook/wait)
# during Helm install. Charts with long-running install hooks may need longer.
helmReleaseInstallTimeout: ""
# When non-empty, overrides the operator's --helmrelease-upgrade-timeout flag
# (operator default: 10m). Same semantics as helmReleaseInstallTimeout, for
# the Helm upgrade action.
helmReleaseUpgradeTimeout: ""
# When non-empty, overrides the operator's --helmrelease-max-history flag
# (operator default: 5). Number of release revisions Helm keeps per HR.
# Use 0 for unlimited; lower values reduce Secret accumulation in test clusters.
helmReleaseMaxHistory: ""
# Generic variant configuration (only used when cozystackOperator.variant=generic)
cozystack:
# Kubernetes API server host (IP only, no protocol/port)