## What this PR does
On release-1.6 the kubernetes chart still renders its own
talos-reconcile Job for every node group of a Kubernetes application,
and that Job applies the worker TalosConfigTemplate with a client-side
`kubectl apply` under a 256Mi memory limit. This PR makes it `kubectl
apply --server-side --force-conflicts`, the command the kubernetes-nodes
chart has used on this branch since #4575.
#4163 fixed the OOMKill on main, where the Job lives only in
kubernetes-nodes since 92b9785da took the worker pools out of the
kubernetes chart. So its backport #4575 changed only kubernetes-nodes
here, and the kubernetes chart kept the client-side apply that #3519 was
reported against. v1.6.5 still has it at line 324 of
`packages/apps/kubernetes/templates/talos/talos-reconcile-job.yaml`.
Neither main nor release-1.7 has this Job in the kubernetes chart, so
there is nothing to backport and the fix goes to release-1.6 directly.
Seen on a v1.6.5 cluster upgraded from v1.6.4. The upgrade ran the
`talos-reconcile-md0` Job of a tenant Kubernetes cluster again, and
within about eight minutes its container had restarted 6 times
(`restartCount`), the last time with `lastState.terminated.reason`
`OOMKilled`, and the pod sat in CrashLoopBackOff. The log ends after the
KamajiControlPlane patch (`patched (no change)`), before the template
apply reports anything, the same picture as in #3519. #4163 has the
mechanism and the measurements. With the template already in place, the
client-side apply builds its merge patch from the full OpenAPI document
of the management cluster, while server-side apply leaves the merge to
the apiserver.
Only this apply changes. The Role already grants `create` and `patch` on
`talosconfigtemplates`, which server-side apply needs. The other
`kubectl` calls in the Job are `get` with a jsonpath and a merge `patch`
of the KamajiControlPlane, which do not load the schema, and the log
above shows the patch finishing. The bootstrap-token and OIDC Jobs of
this chart apply into the tenant apiserver and both completed on the
same upgrade, so they are left alone.
The immutability webhook from #3515 is not touched. CABPT v0.6.12, which
this branch ships, rejects a TalosConfigTemplate update only when the
spec differs, so a re-run with an unchanged render should pass it as a
no-op, and a render that changes the template is still refused as
before. On main that was solved with content-hash names in #3523, a
larger change that rolls the workers, and it is not part of this fix.
`tests/talos_reconcile_server_side_apply_test.yaml` is the suite #4163
added to kubernetes-nodes, adapted to this chart, plus a case with two
node groups that checks the Job of each group, since this chart renders
one Job per group. Against the release-1.6 template all 3 cases fail, 6
assertions in total, and the other 190 tests pass. On this branch `helm
unittest` passes 193 of 193 tests in 20 suites, against 190 in 19 on
release-1.6, with helm-unittest 1.1.2. The new Job spec rotates its
content-hash name, so the two fixtures in
`tests/talos_templates_test.yaml` that pin it move from `16c1c9` and
`a9dc0c` to `4916b0` and `63c431`, and an existing cluster gets a new
Job on its next upgrade. `helm template` of the whole chart renders, the
Job script passes `sh -n` under busybox, and
`hack/admin-kubeconfig-invariant.bats`, the Bats file that renders this
chart, passes 3 of 3. I have not run it on a live cluster.
### Screenshots
Not a UI change.
### Downstream repositories
One template line and tests in `packages/apps/kubernetes`. No values,
schema, README, defaults, image or `ApplicationDefinition` change, and
the website mentions this Job only in the generated values table, so no
trigger map entry applies.
- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:
### Release note
```release-note
fix(kubernetes): the talos-reconcile Job of the kubernetes chart now applies the worker TalosConfigTemplate server-side, like the kubernetes-nodes chart. Before, on management clusters with many CRDs its client-side apply was OOMKilled at the 256Mi limit after every upgrade, and the Job crash-looped.
```
Cozystack
Cozystack is a free platform and framework for building clouds.
Cozystack is a CNCF Sandbox Level 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 as a Kubernetes distribution
You can use Cozystack as a Kubernetes distribution for Bare Metal
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 can express your intention to on the fix on your own. 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 our Telegram group and come to our weekly community meetings. Add them to your Google Calendar or iCal for convenience.
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.
