mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
fix(platform): gate the MetalLB driver on its deps
cozystack.metallb-iad hard-depends on cozystack.metallb and on cozystack.address-controller, and a driver Package rendered without both beside it never leaves DependenciesNotReady — the wedge the velero and bucket-application comments in system.yaml already record for default packages, reachable here through an opt-in one. MetalLB is absent in three ways: on isp-hosted, which never calls the common-packages helper; on a slim variant that did not opt into it; and wherever disabledPackages names it. The core is absent unless enabled. Rather than restate those rules for the driver, the driver is gated on each dependency's own include having rendered a Package, so they cannot drift when either's rules change. The class-agnostic core stays in the variant-agnostic body: it carries no MetalLB dependency and is usable with another driver. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
This commit is contained in:
1 parent
39918b7a72
commit
9e8a747b0b
3 files changed
+153
-6
No files matched your search
@@ -224,7 +224,15 @@ cozystack-scheduler (emitted with its own variant in both branches)
|
||||
{{include "cozystack.platform.package.default" (list "cozystack.kubeovn-plunger" $root) }}
|
||||
{{- end }}
|
||||
{{include "cozystack.platform.package.full.default" (list "cozystack.cozy-proxy" $root) }}
|
||||
{{include "cozystack.platform.package.full.default" (list "cozystack.metallb" $root) }}
|
||||
{{- $metallb := include "cozystack.platform.package.full.default" (list "cozystack.metallb" $root) }}
|
||||
{{ $metallb }}
|
||||
{{- /* Gated on its dependencies' own includes rendering a Package, so it
|
||||
follows their emission rules rather than restating them. The core is
|
||||
rendered here only for that test; bundles/system.yaml emits it. */ -}}
|
||||
{{- $addressController := include "cozystack.platform.package.optional.default" (list "cozystack.address-controller" $root) }}
|
||||
{{- if and (trim $metallb) (trim $addressController) }}
|
||||
{{include "cozystack.platform.package.optional.default" (list "cozystack.metallb-iad" $root) }}
|
||||
{{- end }}
|
||||
{{include "cozystack.platform.package.default" (list "cozystack.reloader" $root) }}
|
||||
{{include "cozystack.platform.package.default" (list "cozystack.linstor-scheduler" $root) }}
|
||||
{{include "cozystack.platform.package.default" (list "cozystack.snapshot-controller" $root) }}
|
||||
|
||||
@@ -387,11 +387,8 @@ variants and opt-in on the slim ones. */}}
|
||||
{{- end }}
|
||||
{{include "cozystack.platform.package.optional.default" (list "cozystack.hetzner-robotlb" $) }}
|
||||
{{include "cozystack.platform.package.optional.default" (list "cozystack.talos-log-collector" $) }}
|
||||
{{- /* IP addresses as a first-class resource: the class-agnostic core plus the
|
||||
MetalLB driver. Enable both together — the driver's PackageSource
|
||||
dependsOn the core (and cozystack.metallb, which the isp-hosted variant
|
||||
never emits), so enabling only the driver leaves it waiting forever. */}}
|
||||
{{- /* Its MetalLB driver, cozystack.metallb-iad, is emitted from the
|
||||
common-packages helper. */}}
|
||||
{{include "cozystack.platform.package.optional.default" (list "cozystack.address-controller" $) }}
|
||||
{{include "cozystack.platform.package.optional.default" (list "cozystack.metallb-iad" $) }}
|
||||
|
||||
{{- end }}
|
||||
@@ -0,0 +1,142 @@
|
||||
suite: the MetalLB address driver is emitted only beside MetalLB and the address core
|
||||
templates:
|
||||
- templates/bundles/system.yaml
|
||||
release:
|
||||
name: cozystack
|
||||
namespace: cozy-system
|
||||
|
||||
tests:
|
||||
- it: emits the driver on isp-full when enabled
|
||||
set:
|
||||
bundles:
|
||||
system:
|
||||
enabled: true
|
||||
variant: isp-full
|
||||
enabledPackages:
|
||||
- cozystack.address-controller
|
||||
- cozystack.metallb-iad
|
||||
asserts:
|
||||
- containsDocument:
|
||||
apiVersion: cozystack.io/v1alpha1
|
||||
kind: Package
|
||||
name: cozystack.metallb-iad
|
||||
any: true
|
||||
- containsDocument:
|
||||
apiVersion: cozystack.io/v1alpha1
|
||||
kind: Package
|
||||
name: cozystack.metallb
|
||||
any: true
|
||||
|
||||
- it: withholds the driver on isp-hosted even when enabled
|
||||
set:
|
||||
bundles:
|
||||
system:
|
||||
enabled: true
|
||||
variant: isp-hosted
|
||||
enabledPackages:
|
||||
- cozystack.address-controller
|
||||
- cozystack.metallb-iad
|
||||
asserts:
|
||||
# any: true is REQUIRED inside the matcher for the negative to search the
|
||||
# whole document set; without it containsDocument matches nothing and
|
||||
# `not: true` passes vacuously.
|
||||
- containsDocument:
|
||||
apiVersion: cozystack.io/v1alpha1
|
||||
kind: Package
|
||||
name: cozystack.metallb-iad
|
||||
any: true
|
||||
not: true
|
||||
# The core carries no MetalLB dependency, so it is still available there.
|
||||
- containsDocument:
|
||||
apiVersion: cozystack.io/v1alpha1
|
||||
kind: Package
|
||||
name: cozystack.address-controller
|
||||
any: true
|
||||
|
||||
- it: withholds the driver on a slim variant that did not opt into MetalLB
|
||||
set:
|
||||
bundles:
|
||||
system:
|
||||
enabled: true
|
||||
variant: isp-slim
|
||||
enabledPackages:
|
||||
- cozystack.address-controller
|
||||
- cozystack.metallb-iad
|
||||
asserts:
|
||||
- containsDocument:
|
||||
apiVersion: cozystack.io/v1alpha1
|
||||
kind: Package
|
||||
name: cozystack.metallb-iad
|
||||
any: true
|
||||
not: true
|
||||
|
||||
- it: emits the driver on a slim variant that opted into MetalLB
|
||||
set:
|
||||
bundles:
|
||||
system:
|
||||
enabled: true
|
||||
variant: isp-slim
|
||||
enabledPackages:
|
||||
- cozystack.metallb
|
||||
- cozystack.address-controller
|
||||
- cozystack.metallb-iad
|
||||
asserts:
|
||||
- containsDocument:
|
||||
apiVersion: cozystack.io/v1alpha1
|
||||
kind: Package
|
||||
name: cozystack.metallb-iad
|
||||
any: true
|
||||
|
||||
- it: withholds the driver where disabledPackages removes MetalLB
|
||||
set:
|
||||
bundles:
|
||||
system:
|
||||
enabled: true
|
||||
variant: isp-full
|
||||
enabledPackages:
|
||||
- cozystack.address-controller
|
||||
- cozystack.metallb-iad
|
||||
disabledPackages:
|
||||
- cozystack.metallb
|
||||
asserts:
|
||||
- containsDocument:
|
||||
apiVersion: cozystack.io/v1alpha1
|
||||
kind: Package
|
||||
name: cozystack.metallb-iad
|
||||
any: true
|
||||
not: true
|
||||
|
||||
- it: withholds the driver when the address core is not enabled
|
||||
set:
|
||||
bundles:
|
||||
system:
|
||||
enabled: true
|
||||
variant: isp-full
|
||||
enabledPackages:
|
||||
- cozystack.metallb-iad
|
||||
asserts:
|
||||
- containsDocument:
|
||||
apiVersion: cozystack.io/v1alpha1
|
||||
kind: Package
|
||||
name: cozystack.metallb-iad
|
||||
any: true
|
||||
not: true
|
||||
|
||||
- it: withholds the driver where disabledPackages removes the address core
|
||||
set:
|
||||
bundles:
|
||||
system:
|
||||
enabled: true
|
||||
variant: isp-full
|
||||
enabledPackages:
|
||||
- cozystack.address-controller
|
||||
- cozystack.metallb-iad
|
||||
disabledPackages:
|
||||
- cozystack.address-controller
|
||||
asserts:
|
||||
- containsDocument:
|
||||
apiVersion: cozystack.io/v1alpha1
|
||||
kind: Package
|
||||
name: cozystack.metallb-iad
|
||||
any: true
|
||||
not: true
|
||||
Reference in new issue
Block a user