mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
refactor(computeplane): stop copying pool defaults into the default md0 (#5425)
## What this PR does
When a ComputePlane has no `nodeGroups`, the module renders a default
`md0` pool. That pool also wrote `maxReplicas: 10`, `instanceType:
u1.medium` and `diskSize: 20Gi`, which are copies of the KubernetesNodes
schema defaults. That put the pool's size in two places, and the next
change to the KubernetesNodes defaults would leave the ComputePlane copy
behind.
The comment that justified the copy said a reservation read from the
release would otherwise need to know another chart's defaults. That is
not how the evaluator works: `pkg/reservation` defaults stored values
against the kind's own structural schema before evaluating, and
`TestEvaluateDefaultsStoredValues` already checks that a sparse `{roles,
minReplicas}` pool reserves exactly what the explicit one does.
This PR returns `md0` to what it was before the copy was added, `{roles:
[ingress-nginx], minReplicas: 0}`, and drops the comment. The unit test
now pins the whole `spec.values` of the default pool rather than each
copied key.
Upgrade: the md0 HelmRelease loses three keys from `spec.values`, so
Flux runs one Helm upgrade of the pool release. I rendered the
kubernetes-nodes chart with the old and the new md0 values (instance
type lookups mocked) and the output is byte-identical, including the
content-hashed KubevirtMachineTemplate name. The pool keeps its size and
does not roll. The copy has not shipped in any release tag.
### Screenshots
Not a UI change.
### Downstream repositories
- [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:
The diff touches one template and its unit test. No values key, schema
or package is added, renamed or removed.
### Release note
```release-note
refactor(computeplane): the default md0 pool no longer duplicates the KubernetesNodes size defaults; rendered pools are unchanged.
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Configuration**
* The automatically created `md0` pool now specifies only its ingress
role and a minimum of zero replicas. Maximum replicas, instance type,
and disk size are no longer explicitly set there and use the pool
chart’s defaults instead.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
2 files changed
+9
-30
No files matched your search
@@ -153,16 +153,10 @@ spec:
|
||||
md0 with roles: [ingress-nginx]; that default is gone with the split, so the
|
||||
module materialises the same md0 here, otherwise the pinned ingress-nginx
|
||||
addon would have no node to schedule onto and stay Pending forever.
|
||||
|
||||
The default md0 carries its whole size, not only what differs from the pool
|
||||
chart's defaults: those defaults live in the pool's schema and are never
|
||||
written into a release rendered here, so without them the release would not
|
||||
say what the pool can grow to, and a reservation read from it would have to
|
||||
know another chart's defaults.
|
||||
*/}}
|
||||
{{- $pools := .Values.nodeGroups }}
|
||||
{{- if not $pools }}
|
||||
{{- $pools = dict "md0" (dict "roles" (list "ingress-nginx") "minReplicas" 0 "maxReplicas" 10 "instanceType" "u1.medium" "diskSize" "20Gi") }}
|
||||
{{- $pools = dict "md0" (dict "roles" (list "ingress-nginx") "minReplicas" 0) }}
|
||||
{{- end }}
|
||||
{{- range $pool, $group := $pools }}
|
||||
---
|
||||
|
||||
@@ -116,30 +116,15 @@ tests:
|
||||
- equal:
|
||||
path: metadata.labels['apps.cozystack.io/application.name']
|
||||
value: computeplane-cluster-md0
|
||||
# The pool's size is left to the pool's own schema defaults, which
|
||||
# stay its single source.
|
||||
- equal:
|
||||
path: spec.values.cluster
|
||||
value: computeplane-cluster
|
||||
- equal:
|
||||
path: spec.values.clusterReleaseName
|
||||
value: computeplane-cluster
|
||||
- equal:
|
||||
path: spec.values.roles[0]
|
||||
value: ingress-nginx
|
||||
# The pool's size is written out rather than left to the pool chart's
|
||||
# schema defaults, which a platform-rendered release never carries, so
|
||||
# the release alone says what the pool can reserve.
|
||||
- equal:
|
||||
path: spec.values.minReplicas
|
||||
value: 0
|
||||
- equal:
|
||||
path: spec.values.maxReplicas
|
||||
value: 10
|
||||
- equal:
|
||||
path: spec.values.instanceType
|
||||
value: u1.medium
|
||||
- equal:
|
||||
path: spec.values.diskSize
|
||||
value: 20Gi
|
||||
path: spec.values
|
||||
value:
|
||||
cluster: computeplane-cluster
|
||||
clusterReleaseName: computeplane-cluster
|
||||
roles: [ingress-nginx]
|
||||
minReplicas: 0
|
||||
# canonical KubernetesNodes pool shape (mirrors rest.go): RetryOnFailure
|
||||
# strategy + disableWait, not the parent module's remediation style.
|
||||
- equal:
|
||||
|
||||
Reference in new issue
Block a user