The collation repair ran at the end of the post-upgrade init-job and, when the image moved, waited for the primary to run it. Helm starts that hook as soon as the Cluster is patched; CNPG then rolls the replicas first and the primary last, and every instance whose clients hold sessions sits in smart shutdown for smartShutdownTimeout (180s on existing clusters). With three instances the wait took about eight of the Job's nine minutes, the Job printed "the init-job is out of time, the next run of it carries on" and the HelmRelease went UpgradeFailed until Flux retried. When the Job's psql met the primary restart instead, it failed with "FATAL: the database system is shutting down" and failed the upgrade the same way. A rebuild of a large index does not fit the hook budget either. Moving the repair into an ordinary manifest does not help: helm-controller waits for every Job of a release to complete within the same upgrade timeout. So a short post-upgrade hook, run after the init-job, creates the repair Job through the API, outside the release, and returns. The repair Job has an hour, keeps the wait for the new image and the resume marks it had, and is owned by the Cluster. It has a fixed name, so two repairs never run against one Cluster: the hook leaves one still running on the same image alone and deletes any other, waiting for its pod to go, before creating the new one, which also retries a repair that failed. The hook's Role reaches only that Job and the release's Cluster by name, apart from create, which RBAC cannot narrow, and is deleted once the hooks succeed. psql exits with status 2 both when an instance refuses connections while shutting down and when it drops a session, so both Jobs now rerun their script after a growing pause on that status instead of failing; the scripts are idempotent and their elapsed-time bounds keep counting across attempts. A connection lost during an index rebuild is reported the same way. smartShutdownTimeout stays as it is: the repair no longer waits inside the hook, so the rollout's length does not matter. The PostGIS extension update waits for the same rollout, so it moves into the repair Job with the collation pass, and the messages of both name the next upgrade of the release as what starts them again. A lost connection in the PostGIS pass is reported with the same status as in the collation pass, so the Job reconnects instead of giving up. The repair runs after install as well. The init-job used to record there which Debian release each database started on, and without that record the first image move is detected only if the repair reaches the primary before it restarts. The Job sets PGCONNECT_TIMEOUT, so a primary that does not answer is retried instead of using up the Job's deadline. A failed index rebuild no longer stops the PostGIS update that follows it: a unique index that duplicates keep from being rebuilt would otherwise hold the extensions back until an operator removes them. The Job still fails at its end. With an hour to spend, the repair now waits for the new image whenever the image changes, not only when an index already depends on a versioned collation. Otherwise it planned on the previous primary, missed an index created meanwhile, and the release it recorded at the end claimed that index repaired. The repair Job carries the WorkloadMonitor's selector labels, opts in to having its failure reported with workloads.cozystack.io/report-failure, and has no ttlSecondsAfterFinished, so a failed repair stays visible until the next upgrade replaces it instead of vanishing while the indexes stay wrong. Refs: #5459 Assisted-By: LLM Signed-off-by: Andrey Kolkov <androndo@gmail.com>
Cozystack
Cozystack is a free and open-source platform and framework for building clouds.
Cozystack is a CNCF Sandbox project that was originally built and sponsored by Ænix.
With Cozystack, you can transform a bunch of servers into an intelligent system with a simple REST API for spawning Kubernetes clusters, Database-as-a-Service, virtual machines, load balancers, HTTP caching services, and other services with ease.
Use Cozystack to build your own cloud or provide a cost-effective development environment.
Use-Cases
-
Using Cozystack to build a public cloud
You can use Cozystack as a backend for a public cloud -
Using Cozystack to build a private cloud
You can use Cozystack as a platform to build a private cloud powered by Infrastructure-as-Code approach -
Using Cozystack to build your own platform
You can install only the Cozystack components you need on an existing Kubernetes cluster
Documentation
The documentation is located on the cozystack.io website.
Read the Getting Started section for a quick start.
If you encounter any difficulties, start with the troubleshooting guide and work your way through the process that we've outlined.
Versioning
Versioning adheres to the Semantic Versioning principles.
A full list of the available releases is available in the GitHub repository's Release section.
Contributions
Contributions are highly appreciated and very welcomed!
In case of bugs, please check if the issue has already been opened by checking the GitHub Issues section. If it isn't, you can open a new one. A detailed report will help us replicate it, assess it, and work on a fix.
You are welcome to take on the fix yourself. Commits are used to generate the changelog, and their author will be referenced in it.
If you have a concrete feature request, open an issue. For a cross-cutting or architectural change, open a design proposal in the community repo. For questions or early ideas, use GitHub Discussions. See CONTRIBUTING.md for the full routing.
Community
You are welcome to join us in #cozystack, on either CNCF Slack (get an invite) or Kubernetes Slack (get an invite), in our Telegram group, and at our community meetings. Add them to your Google Calendar or iCal for convenience.
Project documents
| Document | What it covers |
|---|---|
| Governance | How decisions are made and who makes them |
| Contributor Ladder | How to grow from contributor to maintainer |
| Maintainers | Who maintains the project |
| Code of Conduct | What we expect of each other |
| Security Policy | Reporting a vulnerability, and which releases get fixes |
| Adopters | Who runs Cozystack in production |
| Roadmap | Where the project is going |
License
Cozystack is licensed under Apache 2.0.
The code is provided as-is with no warranties.
Commercial Support
A list of companies providing commercial support for this project can be found on official site.
