mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
feat(harbor): expose replicas and zone spread for the request path (#4880)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - If it's a work in progress, consider creating this PR as a draft. --> ## What this PR does Closes #4824. Every `docker login`, pull and push goes through nginx → core (`/service/token`) → registry, and each of them ran as a single pod. Losing the node that hosted one stopped all registry traffic, however many PostgreSQL and Redis instances backed it. The vendored goharbor chart already scales these components and the registry keeps its blobs in S3, so only the wrapper was missing the knobs. **Request path (`packages/apps/harbor`)** - New `nginx.replicas`, `portal.replicas`, `core.replicas` and `registry.replicas`, all defaulting to `1`. - Above one replica, the wrapper forwards to the upstream chart a `podDisruptionBudget` with `maxUnavailable: 1` and `topologySpreadConstraints`. Upstream defaults `minAvailable` to 1 and renders whichever of the two fields is set, and the API server rejects a PDB carrying both, so the wrapper forwards `minAvailable: 0` to drop it. - At one replica nothing but `replicas: 1` is forwarded, which is the upstream default, so an existing install renders the same Deployments as before. - The `WorkloadMonitor`s for core, registry and portal take `replicas` from the values instead of a hard-coded `1`. `minReplicas` stays at 1, since one serving replica is enough for the component to work. - The spread follows the platform's `scheduling.globalAppTopologySpreadConstraints` (read from `_cluster.scheduling`), as postgres, etcd, keycloak, grafana and kubernetes-nodes already do, so the cluster operator sets the policy once. When the platform sets none, a soft spread stands in: zone then hostname, both `ScheduleAnyway`, so a cluster without zone labels or with fewer nodes than replicas still schedules every replica. Any `labelSelector` in the policy is dropped, because the upstream chart appends its own `release`/`app`/`component` selector to every entry. **Data tier (`packages/system/harbor`)** - The CNPG `Cluster` (when `database.replicas > 1`) gets `topologySpreadConstraints` from the same platform policy, or a `ScheduleAnyway` zone spread when the platform sets none; CNPG's default anti-affinity handles nodes. The Redis pods and sentinels already spread hard per node on main (#4990); this adds a `ScheduleAnyway` zone spread on top of that default. A constraint in the platform policy without a selector gets the component's own; a selector the policy sets is kept, as in the keycloak chart. **Deviations from the issue, on purpose** - Placement follows the platform-wide `globalAppTopologySpreadConstraints` instead of a set of rules hard-coded in Harbor, to stay consistent with the other applications. The fallback spreads across nodes with a `topologySpreadConstraints` entry rather than a preferred `podAntiAffinity` term: the upstream chart appends its own selector to spread entries, while an affinity term is passed through verbatim and would have to hard-code that label set in the wrapper. - On the data tier the zone spread goes through `topologySpreadConstraints`, not `affinity.topologyKey: topology.kubernetes.io/zone`. Moving CNPG's `topologyKey` to the zone would drop its per-node anti-affinity, so instances could share a node on a cluster without zone labels. With spread constraints the two add up, and for Redis the zone entry sits beside the per-node one. - `jobservice.replicas` (item 5 of the issue, which needs `jobLoggers: [database]`) is left for a follow-up, as the issue suggests. **Upgrade impact** - Request path: none at the default replica count. - Data tier: `database.replicas` and `redis.replicas` default to 2, so on upgrade most installs see a one-off rolling restart of the CNPG instances (with a switchover), of the Redis pods and of the sentinels, as their pod spec gains the spread constraint. Where the platform policy uses `DoNotSchedule`, it is now enforced for Harbor pods too, as it already is for the other applications. **Tests** - `packages/apps/harbor/tests/replica_placement_test.yaml`: defaults forward nothing beyond `replicas: 1`; above one replica the PDB and spread are forwarded; the platform policy replaces the fallback and loses its `labelSelector`, and is ignored at one replica; components scale independently; `registry.replicas` lands at the Deployment level, not under `registry.registry`; WorkloadMonitors follow the values. - `packages/system/harbor/tests/zone_spread_test.yaml`: CNPG, Redis and sentinel spread with the right selectors and no `affinity` override, both with the fallback and with a multi-entry platform policy, keeping a selector the policy sets; `redis_spread_test.yaml` covers the per-node default with the zone entry on top; and, rendering the vendored chart with the values the wrapper forwards, the PDB carries `maxUnavailable` alone and the spread entries are scoped to the component's pods. - Checked that the tests fail with the fix removed (helper without `minAvailable: 0`, upstream PDB without the zeroing, CNPG spread removed, platform policy ignored). `helm unittest` on both charts: 72/72 passing. Also rendered the app chart, with and without a platform policy, fed its HelmRelease values into the system chart, and checked the resulting Deployments, PDBs and CNPG `Cluster`. ### Screenshots No UI change. ### Downstream repositories - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [x] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: cozystack/terraform-provider-cozystack#70 (issue: the provider models Harbor by hand) - [ ] [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 adds fields to the `harbor` app's `values.schema.json`, which the Terraform provider models by hand, so a follow-up issue is open there. The website reference page is regenerated from the README on release, and no other trigger in the map matches the diff. ### Release note ```release-note feat(harbor): nginx, portal, core and registry now take a `replicas` value. Above one replica they get a PodDisruptionBudget and follow the platform's `globalAppTopologySpreadConstraints`, or a best-effort spread across zones and nodes when none is set, so draining or losing a node or zone keeps docker login, pull and push working. The PostgreSQL and Redis instances and the Redis sentinels now follow the same policy, or a best-effort zone spread; on upgrade this causes a one-off rolling restart of the database and Redis pods. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Harbor NGINX, portal, core, and registry replica counts are configurable and default to one. Above one replica, these components use a PodDisruptionBudget and follow platform-wide placement settings when available, or spread across zones and nodes otherwise. * Database replicas spread according to placement settings when configured above one. Redis replicas also spread above one, while all three Redis sentinels are always spread. * Core and registry resource settings now use a shared default when not specified. * **Documentation** * Harbor configuration guidance now describes replica settings, placement behavior, and PodDisruptionBudget behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
14 files changed
+857
-87
No files matched your search
Generated
+34
-2
@@ -27,6 +27,12 @@ type ConfigSpec struct {
|
||||
// +kubebuilder:default:=""
|
||||
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="storageClass is immutable"
|
||||
StorageClass string `json:"storageClass"`
|
||||
// Entry-point proxy configuration.
|
||||
// +kubebuilder:default:={}
|
||||
Nginx Nginx `json:"nginx"`
|
||||
// Web portal configuration.
|
||||
// +kubebuilder:default:={}
|
||||
Portal Portal `json:"portal"`
|
||||
// Core API server configuration.
|
||||
// +kubebuilder:default:={}
|
||||
Core Core `json:"core"`
|
||||
@@ -52,6 +58,11 @@ type ConfigSpec struct {
|
||||
}
|
||||
|
||||
type Core struct {
|
||||
// Number of core replicas, which issue the token every pull and push needs. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.
|
||||
// +kubebuilder:default:=1
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=2.147483647e+09
|
||||
Replicas int `json:"replicas,omitempty"`
|
||||
// Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.
|
||||
// +kubebuilder:default:={}
|
||||
Resources Resources `json:"resources,omitempty"`
|
||||
@@ -61,7 +72,7 @@ type Core struct {
|
||||
}
|
||||
|
||||
type Database struct {
|
||||
// Number of database instances.
|
||||
// Number of database instances. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset.
|
||||
// +kubebuilder:default:=2
|
||||
Replicas int `json:"replicas"`
|
||||
// Persistent Volume size for database storage.
|
||||
@@ -78,8 +89,24 @@ type Jobservice struct {
|
||||
ResourcesPreset ResourcesPreset `json:"resourcesPreset,omitempty"`
|
||||
}
|
||||
|
||||
type Nginx struct {
|
||||
// Number of replicas of the proxy every `docker login`, pull and push goes through. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.
|
||||
// +kubebuilder:default:=1
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=2.147483647e+09
|
||||
Replicas int `json:"replicas,omitempty"`
|
||||
}
|
||||
|
||||
type Portal struct {
|
||||
// Number of web portal replicas. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.
|
||||
// +kubebuilder:default:=1
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=2.147483647e+09
|
||||
Replicas int `json:"replicas,omitempty"`
|
||||
}
|
||||
|
||||
type Redis struct {
|
||||
// Number of Redis replicas.
|
||||
// Number of Redis replicas. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset; the three sentinels always are.
|
||||
// +kubebuilder:default:=2
|
||||
Replicas int `json:"replicas"`
|
||||
// Persistent Volume size for cache storage.
|
||||
@@ -88,6 +115,11 @@ type Redis struct {
|
||||
}
|
||||
|
||||
type Registry struct {
|
||||
// Number of registry replicas; they share the S3 bucket and no local state. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.
|
||||
// +kubebuilder:default:=1
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=2.147483647e+09
|
||||
Replicas int `json:"replicas,omitempty"`
|
||||
// Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.
|
||||
// +kubebuilder:default:={}
|
||||
Resources Resources `json:"resources,omitempty"`
|
||||
|
||||
+32
@@ -58,6 +58,8 @@ func (in *ConfigSpec) DeepCopyInto(out *ConfigSpec) {
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.Nginx = in.Nginx
|
||||
out.Portal = in.Portal
|
||||
in.Core.DeepCopyInto(&out.Core)
|
||||
in.Registry.DeepCopyInto(&out.Registry)
|
||||
in.Jobservice.DeepCopyInto(&out.Jobservice)
|
||||
@@ -124,6 +126,36 @@ func (in *Jobservice) DeepCopy() *Jobservice {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Nginx) DeepCopyInto(out *Nginx) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Nginx.
|
||||
func (in *Nginx) DeepCopy() *Nginx {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Nginx)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Portal) DeepCopyInto(out *Portal) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Portal.
|
||||
func (in *Portal) DeepCopy() *Portal {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Portal)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Redis) DeepCopyInto(out *Redis) {
|
||||
*out = *in
|
||||
|
||||
@@ -29,36 +29,42 @@ Without object storage in the tenant chain, Harbor cannot provision its registry
|
||||
|
||||
### Component configuration
|
||||
|
||||
| Name | Description | Type | Value |
|
||||
| ----------------------------- | -------------------------------------------------------------------------------------------------------- | ---------- | ---------- |
|
||||
| `core` | Core API server configuration. | `object` | `{}` |
|
||||
| `core.resources` | Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. | `object` | `{}` |
|
||||
| `core.resources.cpu` | Number of CPU cores allocated. | `quantity` | `""` |
|
||||
| `core.resources.memory` | Amount of memory allocated. | `quantity` | `""` |
|
||||
| `core.resourcesPreset` | Default sizing preset used when `resources` is omitted. | `string` | `t1.small` |
|
||||
| `registry` | Container image registry configuration. | `object` | `{}` |
|
||||
| `registry.resources` | Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. | `object` | `{}` |
|
||||
| `registry.resources.cpu` | Number of CPU cores allocated. | `quantity` | `""` |
|
||||
| `registry.resources.memory` | Amount of memory allocated. | `quantity` | `""` |
|
||||
| `registry.resourcesPreset` | Default sizing preset used when `resources` is omitted. | `string` | `t1.small` |
|
||||
| `jobservice` | Background job service configuration. | `object` | `{}` |
|
||||
| `jobservice.resources` | Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. | `object` | `{}` |
|
||||
| `jobservice.resources.cpu` | Number of CPU cores allocated. | `quantity` | `""` |
|
||||
| `jobservice.resources.memory` | Amount of memory allocated. | `quantity` | `""` |
|
||||
| `jobservice.resourcesPreset` | Default sizing preset used when `resources` is omitted. | `string` | `t1.nano` |
|
||||
| `trivy` | Trivy vulnerability scanner configuration. | `object` | `{}` |
|
||||
| `trivy.enabled` | Enable or disable the vulnerability scanner. | `bool` | `true` |
|
||||
| `trivy.size` | Persistent Volume size for vulnerability database cache. | `quantity` | `5Gi` |
|
||||
| `trivy.resources` | Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. | `object` | `{}` |
|
||||
| `trivy.resources.cpu` | Number of CPU cores allocated. | `quantity` | `""` |
|
||||
| `trivy.resources.memory` | Amount of memory allocated. | `quantity` | `""` |
|
||||
| `trivy.resourcesPreset` | Default sizing preset used when `resources` is omitted. | `string` | `t1.nano` |
|
||||
| `database` | PostgreSQL database configuration. | `object` | `{}` |
|
||||
| `database.size` | Persistent Volume size for database storage. | `quantity` | `5Gi` |
|
||||
| `database.replicas` | Number of database instances. | `int` | `2` |
|
||||
| `redis` | Redis cache configuration. | `object` | `{}` |
|
||||
| `redis.size` | Persistent Volume size for cache storage. | `quantity` | `1Gi` |
|
||||
| `redis.replicas` | Number of Redis replicas. | `int` | `2` |
|
||||
| Name | Description | Type | Value |
|
||||
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------- |
|
||||
| `nginx` | Entry-point proxy configuration. | `object` | `{}` |
|
||||
| `nginx.replicas` | Number of replicas of the proxy every `docker login`, pull and push goes through. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset. | `int` | `1` |
|
||||
| `portal` | Web portal configuration. | `object` | `{}` |
|
||||
| `portal.replicas` | Number of web portal replicas. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset. | `int` | `1` |
|
||||
| `core` | Core API server configuration. | `object` | `{}` |
|
||||
| `core.replicas` | Number of core replicas, which issue the token every pull and push needs. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset. | `int` | `1` |
|
||||
| `core.resources` | Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. | `object` | `{}` |
|
||||
| `core.resources.cpu` | Number of CPU cores allocated. | `quantity` | `""` |
|
||||
| `core.resources.memory` | Amount of memory allocated. | `quantity` | `""` |
|
||||
| `core.resourcesPreset` | Default sizing preset used when `resources` is omitted. | `string` | `t1.small` |
|
||||
| `registry` | Container image registry configuration. | `object` | `{}` |
|
||||
| `registry.replicas` | Number of registry replicas; they share the S3 bucket and no local state. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset. | `int` | `1` |
|
||||
| `registry.resources` | Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. | `object` | `{}` |
|
||||
| `registry.resources.cpu` | Number of CPU cores allocated. | `quantity` | `""` |
|
||||
| `registry.resources.memory` | Amount of memory allocated. | `quantity` | `""` |
|
||||
| `registry.resourcesPreset` | Default sizing preset used when `resources` is omitted. | `string` | `t1.small` |
|
||||
| `jobservice` | Background job service configuration. | `object` | `{}` |
|
||||
| `jobservice.resources` | Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. | `object` | `{}` |
|
||||
| `jobservice.resources.cpu` | Number of CPU cores allocated. | `quantity` | `""` |
|
||||
| `jobservice.resources.memory` | Amount of memory allocated. | `quantity` | `""` |
|
||||
| `jobservice.resourcesPreset` | Default sizing preset used when `resources` is omitted. | `string` | `t1.nano` |
|
||||
| `trivy` | Trivy vulnerability scanner configuration. | `object` | `{}` |
|
||||
| `trivy.enabled` | Enable or disable the vulnerability scanner. | `bool` | `true` |
|
||||
| `trivy.size` | Persistent Volume size for vulnerability database cache. | `quantity` | `5Gi` |
|
||||
| `trivy.resources` | Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. | `object` | `{}` |
|
||||
| `trivy.resources.cpu` | Number of CPU cores allocated. | `quantity` | `""` |
|
||||
| `trivy.resources.memory` | Amount of memory allocated. | `quantity` | `""` |
|
||||
| `trivy.resourcesPreset` | Default sizing preset used when `resources` is omitted. | `string` | `t1.nano` |
|
||||
| `database` | PostgreSQL database configuration. | `object` | `{}` |
|
||||
| `database.size` | Persistent Volume size for database storage. | `quantity` | `5Gi` |
|
||||
| `database.replicas` | Number of database instances. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset. | `int` | `2` |
|
||||
| `redis` | Redis cache configuration. | `object` | `{}` |
|
||||
| `redis.size` | Persistent Volume size for cache storage. | `quantity` | `1Gi` |
|
||||
| `redis.replicas` | Number of Redis replicas. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset; the three sentinels always are. | `int` | `2` |
|
||||
|
||||
|
||||
### Scheduling parameters
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
{{- /*
|
||||
Spread for the request-path components: the cluster-wide
|
||||
scheduling.globalAppTopologySpreadConstraints when the platform sets one, as
|
||||
the other applications do, otherwise a soft zone and node spread. Any
|
||||
labelSelector is dropped because the upstream chart appends its own
|
||||
release/app/component selector to every entry, and a second one would be a
|
||||
duplicate key in the rendered Deployment.
|
||||
*/}}
|
||||
{{- define "harbor.topologySpreadConstraints" -}}
|
||||
{{- $raw := dig "scheduling" "globalAppTopologySpreadConstraints" "" (.Values._cluster | default dict) }}
|
||||
{{- $constraints := list }}
|
||||
{{- if $raw }}
|
||||
{{- range (get ($raw | fromYaml) "topologySpreadConstraints" | default list) }}
|
||||
{{- $constraints = append $constraints (omit . "labelSelector") }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not $constraints }}
|
||||
{{- $constraints = list
|
||||
(dict "maxSkew" 1 "topologyKey" "topology.kubernetes.io/zone" "whenUnsatisfiable" "ScheduleAnyway")
|
||||
(dict "maxSkew" 1 "topologyKey" "kubernetes.io/hostname" "whenUnsatisfiable" "ScheduleAnyway") }}
|
||||
{{- end }}
|
||||
{{- toYaml $constraints }}
|
||||
{{- end }}
|
||||
|
||||
{{- /*
|
||||
Replica count and placement for one stateless component of the upstream chart.
|
||||
Nothing beyond `replicas` is rendered for a single replica, so an install that
|
||||
keeps the default renders the same pod template as before.
|
||||
|
||||
Upstream defaults podDisruptionBudget.minAvailable to 1 and renders whichever
|
||||
of minAvailable and maxUnavailable is truthy; the API server rejects a PDB
|
||||
carrying both, so minAvailable is zeroed to leave maxUnavailable alone.
|
||||
*/}}
|
||||
{{- define "harbor.replicaPlacement" -}}
|
||||
{{- $replicas := int (default 1 (index . 0)) }}
|
||||
replicas: {{ $replicas }}
|
||||
{{- if gt $replicas 1 }}
|
||||
podDisruptionBudget:
|
||||
enabled: true
|
||||
minAvailable: 0
|
||||
maxUnavailable: 1
|
||||
topologySpreadConstraints:
|
||||
{{- include "harbor.topologySpreadConstraints" (index . 1) | nindent 0 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,3 +1,6 @@
|
||||
{{- $componentDefaults := dict "resourcesPreset" "t1.small" }}
|
||||
{{- $core := .Values.core | default $componentDefaults }}
|
||||
{{- $registry := .Values.registry | default $componentDefaults }}
|
||||
{{- $host := include "cozy-lib.ns-host-required" . }}
|
||||
{{- $harborHost := .Values.host | default (printf "%s.%s" .Release.Name $host) }}
|
||||
|
||||
@@ -192,20 +195,24 @@ spec:
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
nginx:
|
||||
{{- include "harbor.replicaPlacement" (list (.Values.nginx).replicas $) | nindent 8 }}
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list "t1.small" (dict) $) | nindent 10 }}
|
||||
portal:
|
||||
{{- include "harbor.replicaPlacement" (list (.Values.portal).replicas $) | nindent 8 }}
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list "t1.micro" (dict) $) | nindent 10 }}
|
||||
core:
|
||||
{{- include "harbor.replicaPlacement" (list $core.replicas $) | nindent 8 }}
|
||||
{{- if and $tokenKey $tokenCert }}
|
||||
tokenKey: {{ $tokenKey | quote }}
|
||||
tokenCert: {{ $tokenCert | quote }}
|
||||
{{- end }}
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.core.resourcesPreset .Values.core.resources $) | nindent 10 }}
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list $core.resourcesPreset $core.resources $) | nindent 10 }}
|
||||
registry:
|
||||
{{- include "harbor.replicaPlacement" (list $registry.replicas $) | nindent 8 }}
|
||||
registry:
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.registry.resourcesPreset .Values.registry.resources $) | nindent 12 }}
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list $registry.resourcesPreset $registry.resources $) | nindent 12 }}
|
||||
controller:
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.registry.resourcesPreset .Values.registry.resources $) | nindent 12 }}
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list $registry.resourcesPreset $registry.resources $) | nindent 12 }}
|
||||
jobservice:
|
||||
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.jobservice.resourcesPreset .Values.jobservice.resources $) | nindent 10 }}
|
||||
trivy:
|
||||
@@ -243,9 +250,9 @@ kind: WorkloadMonitor
|
||||
metadata:
|
||||
name: {{ $.Release.Name }}-core
|
||||
labels:
|
||||
workloads.cozystack.io/resource-preset: {{ .Values.core.resourcesPreset | quote }}
|
||||
workloads.cozystack.io/resource-preset: {{ $core.resourcesPreset | quote }}
|
||||
spec:
|
||||
replicas: 1
|
||||
replicas: {{ default 1 $core.replicas }}
|
||||
minReplicas: 1
|
||||
kind: harbor
|
||||
type: core
|
||||
@@ -261,9 +268,9 @@ kind: WorkloadMonitor
|
||||
metadata:
|
||||
name: {{ $.Release.Name }}-registry
|
||||
labels:
|
||||
workloads.cozystack.io/resource-preset: {{ .Values.registry.resourcesPreset | quote }}
|
||||
workloads.cozystack.io/resource-preset: {{ $registry.resourcesPreset | quote }}
|
||||
spec:
|
||||
replicas: 1
|
||||
replicas: {{ default 1 $registry.replicas }}
|
||||
minReplicas: 1
|
||||
kind: harbor
|
||||
type: registry
|
||||
@@ -279,7 +286,7 @@ kind: WorkloadMonitor
|
||||
metadata:
|
||||
name: {{ $.Release.Name }}-portal
|
||||
spec:
|
||||
replicas: 1
|
||||
replicas: {{ default 1 (.Values.portal).replicas }}
|
||||
minReplicas: 1
|
||||
kind: harbor
|
||||
type: portal
|
||||
|
||||
@@ -0,0 +1,372 @@
|
||||
suite: request-path replicas and placement
|
||||
|
||||
release:
|
||||
name: harbor
|
||||
namespace: tenant-test
|
||||
|
||||
# nginx, core and registry sit on every docker login, pull and push, and portal
|
||||
# serves the UI. Their replica count is forwarded to the upstream chart, and only
|
||||
# above one replica does the wrapper add a PodDisruptionBudget and a soft zone and
|
||||
# node spread, so an install on the default keeps rendering the pod template it had.
|
||||
#
|
||||
# The release is selected by kind rather than by document index: the template also
|
||||
# renders a Secret and three WorkloadMonitors.
|
||||
set:
|
||||
_namespace:
|
||||
host: example.org
|
||||
ingress: nginx
|
||||
gateway: ""
|
||||
seaweedfs: seaweedfs
|
||||
_cluster:
|
||||
solver: http01
|
||||
|
||||
tests:
|
||||
- it: keeps a single replica and adds no placement by default
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: HelmRelease
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.values.harbor.nginx.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.values.harbor.portal.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.values.harbor.core.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.values.harbor.registry.replicas
|
||||
value: 1
|
||||
- notExists:
|
||||
path: spec.values.harbor.nginx.podDisruptionBudget
|
||||
- notExists:
|
||||
path: spec.values.harbor.nginx.topologySpreadConstraints
|
||||
- notExists:
|
||||
path: spec.values.harbor.portal.podDisruptionBudget
|
||||
- notExists:
|
||||
path: spec.values.harbor.portal.topologySpreadConstraints
|
||||
- notExists:
|
||||
path: spec.values.harbor.core.podDisruptionBudget
|
||||
- notExists:
|
||||
path: spec.values.harbor.core.topologySpreadConstraints
|
||||
- notExists:
|
||||
path: spec.values.harbor.registry.podDisruptionBudget
|
||||
- notExists:
|
||||
path: spec.values.harbor.registry.topologySpreadConstraints
|
||||
|
||||
- it: adds a PodDisruptionBudget and a soft zone and node spread above one replica
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: HelmRelease
|
||||
set:
|
||||
nginx:
|
||||
replicas: 2
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.values.harbor.nginx.replicas
|
||||
value: 2
|
||||
# Upstream defaults minAvailable to 1; left in place it would sit next to
|
||||
# maxUnavailable and the API server would reject the PDB.
|
||||
- equal:
|
||||
path: spec.values.harbor.nginx.podDisruptionBudget
|
||||
value:
|
||||
enabled: true
|
||||
minAvailable: 0
|
||||
maxUnavailable: 1
|
||||
- equal:
|
||||
path: spec.values.harbor.nginx.topologySpreadConstraints
|
||||
value:
|
||||
- maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
- maxSkew: 1
|
||||
topologyKey: kubernetes.io/hostname
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
|
||||
- it: scales each component independently
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: HelmRelease
|
||||
set:
|
||||
core:
|
||||
replicas: 3
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.values.harbor.core.replicas
|
||||
value: 3
|
||||
- exists:
|
||||
path: spec.values.harbor.core.podDisruptionBudget
|
||||
- equal:
|
||||
path: spec.values.harbor.nginx.replicas
|
||||
value: 1
|
||||
- notExists:
|
||||
path: spec.values.harbor.nginx.podDisruptionBudget
|
||||
- notExists:
|
||||
path: spec.values.harbor.registry.podDisruptionBudget
|
||||
|
||||
# The upstream chart reads registry.replicas, not registry.registry.replicas,
|
||||
# which is where the registry container's resources live.
|
||||
- it: places registry replicas at the Deployment level of the upstream values
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: HelmRelease
|
||||
set:
|
||||
registry:
|
||||
replicas: 2
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.values.harbor.registry.replicas
|
||||
value: 2
|
||||
- exists:
|
||||
path: spec.values.harbor.registry.topologySpreadConstraints
|
||||
- notExists:
|
||||
path: spec.values.harbor.registry.registry.replicas
|
||||
|
||||
- it: portal follows its own replica count
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: HelmRelease
|
||||
set:
|
||||
portal:
|
||||
replicas: 2
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.values.harbor.portal.replicas
|
||||
value: 2
|
||||
- exists:
|
||||
path: spec.values.harbor.portal.podDisruptionBudget
|
||||
|
||||
- it: core WorkloadMonitor expects the configured replica count
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: harbor-core
|
||||
set:
|
||||
core:
|
||||
replicas: 3
|
||||
asserts:
|
||||
- isKind:
|
||||
of: WorkloadMonitor
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 3
|
||||
- equal:
|
||||
path: spec.minReplicas
|
||||
value: 1
|
||||
|
||||
- it: registry WorkloadMonitor expects the configured replica count
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: harbor-registry
|
||||
set:
|
||||
registry:
|
||||
replicas: 2
|
||||
asserts:
|
||||
- isKind:
|
||||
of: WorkloadMonitor
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 2
|
||||
|
||||
- it: portal WorkloadMonitor expects the configured replica count
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: harbor-portal
|
||||
set:
|
||||
portal:
|
||||
replicas: 2
|
||||
asserts:
|
||||
- isKind:
|
||||
of: WorkloadMonitor
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 2
|
||||
|
||||
# The platform-wide policy is authored as a block under a top-level
|
||||
# `topologySpreadConstraints:` key, the shape the other applications read.
|
||||
# It replaces the built-in spread, and any labelSelector it carries is
|
||||
# dropped because the upstream chart appends its own to every entry.
|
||||
- it: follows the cluster-wide spread policy when the platform sets one
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: HelmRelease
|
||||
set:
|
||||
_cluster:
|
||||
solver: http01
|
||||
scheduling:
|
||||
globalAppTopologySpreadConstraints: |
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 2
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
foo: bar
|
||||
core:
|
||||
replicas: 2
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.values.harbor.core.topologySpreadConstraints
|
||||
value:
|
||||
- maxSkew: 2
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
- exists:
|
||||
path: spec.values.harbor.core.podDisruptionBudget
|
||||
|
||||
- it: ignores the cluster-wide spread policy at a single replica
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: HelmRelease
|
||||
set:
|
||||
_cluster:
|
||||
solver: http01
|
||||
scheduling:
|
||||
globalAppTopologySpreadConstraints: |
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
asserts:
|
||||
- notExists:
|
||||
path: spec.values.harbor.core.topologySpreadConstraints
|
||||
|
||||
# Zero would scale the request path away, and a negative count would fail the
|
||||
# nested HelmRelease at the apiserver; the schema refuses both up front.
|
||||
- it: rejects zero nginx replicas
|
||||
template: templates/harbor.yaml
|
||||
set:
|
||||
nginx:
|
||||
replicas: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: "/nginx/replicas.: minimum: got 0, want 1"
|
||||
|
||||
- it: rejects zero portal replicas
|
||||
template: templates/harbor.yaml
|
||||
set:
|
||||
portal:
|
||||
replicas: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: "/portal/replicas.: minimum: got 0, want 1"
|
||||
|
||||
- it: rejects zero core replicas
|
||||
template: templates/harbor.yaml
|
||||
set:
|
||||
core:
|
||||
replicas: 0
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: "/core/replicas.: minimum: got 0, want 1"
|
||||
|
||||
- it: rejects negative registry replicas
|
||||
template: templates/harbor.yaml
|
||||
set:
|
||||
registry:
|
||||
replicas: -1
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: "/registry/replicas.: minimum: got -1, want 1"
|
||||
|
||||
- it: keeps the request path available when replica counts are cleared
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: HelmRelease
|
||||
set:
|
||||
nginx.replicas: null
|
||||
portal.replicas: null
|
||||
core.replicas: null
|
||||
registry.replicas: null
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.values.harbor.nginx.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.values.harbor.portal.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.values.harbor.core.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.values.harbor.registry.replicas
|
||||
value: 1
|
||||
|
||||
- it: the core monitor follows the default after replicas are cleared
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: harbor-core
|
||||
set:
|
||||
core.replicas: null
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 1
|
||||
|
||||
- it: the registry monitor follows the default after replicas are cleared
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: harbor-registry
|
||||
set:
|
||||
registry.replicas: null
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 1
|
||||
|
||||
- it: the portal monitor follows the default after replicas are cleared
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: harbor-portal
|
||||
set:
|
||||
portal.replicas: null
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 1
|
||||
|
||||
- it: rejects a count above the Deployment int32 limit
|
||||
template: templates/harbor.yaml
|
||||
set:
|
||||
core.replicas: 2147483648
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: "/core/replicas.: maximum:"
|
||||
|
||||
- it: restores the request-path defaults when entire optional blocks are cleared
|
||||
template: templates/harbor.yaml
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: HelmRelease
|
||||
set:
|
||||
nginx: null
|
||||
portal: null
|
||||
core: null
|
||||
registry: null
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.values.harbor.nginx.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.values.harbor.portal.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.values.harbor.core.replicas
|
||||
value: 1
|
||||
- equal:
|
||||
path: spec.values.harbor.registry.replicas
|
||||
value: 1
|
||||
@@ -29,11 +29,46 @@
|
||||
"source": "storageclass"
|
||||
}
|
||||
},
|
||||
"nginx": {
|
||||
"description": "Entry-point proxy configuration.",
|
||||
"type": "object",
|
||||
"default": {},
|
||||
"properties": {
|
||||
"replicas": {
|
||||
"description": "Number of replicas of the proxy every `docker login`, pull and push goes through. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.",
|
||||
"type": "integer",
|
||||
"default": 1,
|
||||
"maximum": 2147483647,
|
||||
"minimum": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"portal": {
|
||||
"description": "Web portal configuration.",
|
||||
"type": "object",
|
||||
"default": {},
|
||||
"properties": {
|
||||
"replicas": {
|
||||
"description": "Number of web portal replicas. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.",
|
||||
"type": "integer",
|
||||
"default": 1,
|
||||
"maximum": 2147483647,
|
||||
"minimum": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"core": {
|
||||
"description": "Core API server configuration.",
|
||||
"type": "object",
|
||||
"default": {},
|
||||
"properties": {
|
||||
"replicas": {
|
||||
"description": "Number of core replicas, which issue the token every pull and push needs. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.",
|
||||
"type": "integer",
|
||||
"default": 1,
|
||||
"maximum": 2147483647,
|
||||
"minimum": 1
|
||||
},
|
||||
"resources": {
|
||||
"description": "Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.",
|
||||
"type": "object",
|
||||
@@ -128,6 +163,13 @@
|
||||
"type": "object",
|
||||
"default": {},
|
||||
"properties": {
|
||||
"replicas": {
|
||||
"description": "Number of registry replicas; they share the S3 bucket and no local state. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.",
|
||||
"type": "integer",
|
||||
"default": 1,
|
||||
"maximum": 2147483647,
|
||||
"minimum": 1
|
||||
},
|
||||
"resources": {
|
||||
"description": "Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.",
|
||||
"type": "object",
|
||||
@@ -438,7 +480,7 @@
|
||||
],
|
||||
"properties": {
|
||||
"replicas": {
|
||||
"description": "Number of database instances.",
|
||||
"description": "Number of database instances. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset.",
|
||||
"type": "integer",
|
||||
"default": 2
|
||||
},
|
||||
@@ -468,7 +510,7 @@
|
||||
],
|
||||
"properties": {
|
||||
"replicas": {
|
||||
"description": "Number of Redis replicas.",
|
||||
"description": "Number of Redis replicas. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset; the three sentinels always are.",
|
||||
"type": "integer",
|
||||
"default": 2
|
||||
},
|
||||
|
||||
@@ -70,21 +70,47 @@ storageClass: ""
|
||||
## @value xlarge
|
||||
## @value 2xlarge
|
||||
|
||||
## @typedef {struct} Nginx - Entry-point proxy configuration.
|
||||
## @field {int} [replicas] - Number of replicas of the proxy every `docker login`, pull and push goes through. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.
|
||||
## @minimum 1
|
||||
## @maximum 2147483647
|
||||
|
||||
## @param {Nginx} nginx - Entry-point proxy configuration.
|
||||
nginx:
|
||||
replicas: 1
|
||||
|
||||
## @typedef {struct} Portal - Web portal configuration.
|
||||
## @field {int} [replicas] - Number of web portal replicas. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.
|
||||
## @minimum 1
|
||||
## @maximum 2147483647
|
||||
|
||||
## @param {Portal} portal - Web portal configuration.
|
||||
portal:
|
||||
replicas: 1
|
||||
|
||||
## @typedef {struct} Core - Core API server configuration.
|
||||
## @field {int} [replicas] - Number of core replicas, which issue the token every pull and push needs. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.
|
||||
## @minimum 1
|
||||
## @maximum 2147483647
|
||||
## @field {Resources} [resources] - Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.
|
||||
## @field {ResourcesPreset} [resourcesPreset] - Default sizing preset used when `resources` is omitted.
|
||||
|
||||
## @param {Core} core - Core API server configuration.
|
||||
core:
|
||||
replicas: 1
|
||||
resources: {}
|
||||
resourcesPreset: "t1.small"
|
||||
|
||||
## @typedef {struct} Registry - Container image registry configuration.
|
||||
## @field {int} [replicas] - Number of registry replicas; they share the S3 bucket and no local state. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.
|
||||
## @minimum 1
|
||||
## @maximum 2147483647
|
||||
## @field {Resources} [resources] - Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.
|
||||
## @field {ResourcesPreset} [resourcesPreset] - Default sizing preset used when `resources` is omitted.
|
||||
|
||||
## @param {Registry} registry - Container image registry configuration.
|
||||
registry:
|
||||
replicas: 1
|
||||
resources: {}
|
||||
resourcesPreset: "t1.small"
|
||||
|
||||
@@ -112,7 +138,7 @@ trivy:
|
||||
|
||||
## @typedef {struct} Database - PostgreSQL database configuration (provisioned via CloudNativePG).
|
||||
## @field {quantity} size - Persistent Volume size for database storage.
|
||||
## @field {int} replicas - Number of database instances.
|
||||
## @field {int} replicas - Number of database instances. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset.
|
||||
|
||||
## @param {Database} database - PostgreSQL database configuration.
|
||||
database:
|
||||
@@ -121,7 +147,7 @@ database:
|
||||
|
||||
## @typedef {struct} Redis - Redis cache configuration (provisioned via redis-operator).
|
||||
## @field {quantity} size - Persistent Volume size for cache storage.
|
||||
## @field {int} replicas - Number of Redis replicas.
|
||||
## @field {int} replicas - Number of Redis replicas. Above 1, they are spread by the platform's `globalAppTopologySpreadConstraints`, or softly across zones when it is unset; the three sentinels always are.
|
||||
|
||||
## @param {Redis} redis - Redis cache configuration.
|
||||
redis:
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ spec:
|
||||
singular: harbor
|
||||
plural: harbors
|
||||
openAPISchema: |-
|
||||
{"title":"Chart Values","type":"object","properties":{"host":{"description":"Hostname for external access to Harbor (defaults to 'harbor' subdomain for the tenant host).","type":"string","default":""},"managementWhitelist":{"description":"IP addresses or CIDR ranges allowed to reach the Harbor web portal and API. `/v2/` and `/service/token`, which `docker login`, image pulls and pushes use, are not restricted by this list. For the portal and API it replaces the tenant ingress `whitelist` rather than narrowing it, and it is matched against the client address the ingress controller sees, which is a proxy or a forwarded header rather than the real client when something in front of the controller rewrites it. Empty allows every address. Requires Ingress publishing; rejected when the tenant publishes through Gateway API.","type":"array","default":[],"items":{"type":"string"}},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":"","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"core":{"description":"Core API server configuration.","type":"object","default":{},"properties":{"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]}}},"registry":{"description":"Container image registry configuration.","type":"object","default":{},"properties":{"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]}}},"jobservice":{"description":"Background job service configuration.","type":"object","default":{},"properties":{"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resourceLine truncated
|
||||
{"title":"Chart Values","type":"object","properties":{"host":{"description":"Hostname for external access to Harbor (defaults to 'harbor' subdomain for the tenant host).","type":"string","default":""},"managementWhitelist":{"description":"IP addresses or CIDR ranges allowed to reach the Harbor web portal and API. `/v2/` and `/service/token`, which `docker login`, image pulls and pushes use, are not restricted by this list. For the portal and API it replaces the tenant ingress `whitelist` rather than narrowing it, and it is matched against the client address the ingress controller sees, which is a proxy or a forwarded header rather than the real client when something in front of the controller rewrites it. Empty allows every address. Requires Ingress publishing; rejected when the tenant publishes through Gateway API.","type":"array","default":[],"items":{"type":"string"}},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":"","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}},"nginx":{"description":"Entry-point proxy configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of replicas of the proxy every `docker login`, pull and push goes through. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1}}},"portal":{"description":"Web portal configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of web portal replicas. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1}}},"core":{"description":"Core API server configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of core replicas, which issue the token every pull and push needs. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]}}},"registry":{"description":"Container image registry configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of registry replicas; they share the S3 bucket and no local state. Above 1, adds a PodDisruptionBudget and spreads the replicas by the platform's `globalAppTopologySpreadConstraints`, or softly across zones and nodes when it is unset.","type":"integer","default":1,"maximum":2147483647,"minimum":1},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `rLine truncated
|
||||
release:
|
||||
prefix: "harbor-"
|
||||
labels:
|
||||
@@ -27,7 +27,7 @@ spec:
|
||||
- registry
|
||||
- container
|
||||
icon: "PH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UzLjU5IDE3Ny42MWMwLTItLjE0LTQtLjIyLTUuOTNsLTMyLjIxLTIuMzEtMTQ3LjQ3LTEwLjU4TDMxOC4zNiAyMDlsMzAuNDEgMTAuNTVjLjA5LS4zNi4xOS0uNzEuMjgtMS4wOGExNzMuNjUgMTczLjY1IDAgMCAwIDQuNTctMzkuNDd2LTEuMzd6IiBjbGFzcz0iY2xzLTEiLz48L2NsaXBQYXRoPjxjbGlwUGF0aCBpZD0iY2xpcC1wYXRoLTgiPjxwYXRoIGQ9Ik0zNDguODQgMTM4LjYxYTE3Mi41NSAxNzIuNTUgMCAwIDAtMTMuODQtMzcuN2wtMzAuOTQgOS45NEwxNzUuOTIgMTUybDE0Mi00LjgzIDMyLjUtMS4xMWMtLjUtMi40OC0uOTktNC45OC0xLjU4LTcuNDV6IiBjbGFzcz0iY2xzLTEiLz48L2NsaXBQYXRoPjxzdHlsZT4uY2xzLTF7ZmlsbDpub25lfS5jbHMtMTN7ZmlsbDojNjk2NTY2fTwvc3R5bGU+PC9kZWZzPjxnIGlkPSJnMTIiPjxwYXRoIGlkPSJwYXRoMTQiIGZpbGw9IiNmZmYiIGQ9Ik0zMC44OSAxNzlhMTQ4Ljg3IDE0OC44NyAwIDEgMSAxNDguODcgMTQ4Ljg1QTE0OC44NyAxNDguODcgMCAwIDEgMzAuODkgMTc5Ii8+PGcgaWQ9ImczMCIgY2xpcC1wYXRoPSJ1cmwoI2NsaXAtcGF0aCkiLine truncated
|
||||
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "host"], ["spec", "managementWhitelist"], ["spec", "storageClass"], ["spec", "core"], ["spec", "core", "resources"], ["spec", "core", "resourcesPreset"], ["spec", "registry"], ["spec", "registry", "resources"], ["spec", "registry", "resourcesPreset"], ["spec", "jobservice"], ["spec", "jobservice", "resources"], ["spec", "jobservice", "resourcesPreset"], ["spec", "trivy"], ["spec", "trivy", "enabled"], ["spec", "trivy", "size"], ["spec", "trivy", "resources"], ["spec", "trivy", "resourcesPreset"], ["spec", "database"], ["spec", "database", "size"], ["spec", "database", "replicas"], ["spec", "redis"], ["spec", "redis", "size"], ["spec", "redis", "replicas"], ["spec", "schedulingClass"]]
|
||||
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "host"], ["spec", "managementWhitelist"], ["spec", "storageClass"], ["spec", "nginx"], ["spec", "nginx", "replicas"], ["spec", "portal"], ["spec", "portal", "replicas"], ["spec", "core"], ["spec", "core", "replicas"], ["spec", "core", "resources"], ["spec", "core", "resourcesPreset"], ["spec", "registry"], ["spec", "registry", "replicas"], ["spec", "registry", "resources"], ["spec", "registry", "resourcesPreset"], ["spec", "jobservice"], ["spec", "jobservice", "resources"], ["spec", "jobservice", "resourcesPreset"], ["spec", "trivy"], ["spec", "trivy", "enabled"], ["spec", "trivy", "size"], ["spec", "trivy", "resources"], ["spec", "trivy", "resourcesPreset"], ["spec", "database"], ["spec", "database", "size"], ["spec", "database", "replicas"], ["spec", "redis"], ["spec", "redis", "size"], ["spec", "redis", "replicas"], ["spec", "schedulingClass"]]
|
||||
secrets:
|
||||
exclude: []
|
||||
include:
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- /*
|
||||
Spread for the data tier: the cluster-wide
|
||||
scheduling.globalAppTopologySpreadConstraints when the platform sets one, as
|
||||
the other applications do, otherwise the defaults the caller passes. A
|
||||
constraint without a selector of its own gets the given pod labels, because
|
||||
kube-scheduler counts no pods for it otherwise; a selector the policy sets is
|
||||
kept, as in the keycloak chart.
|
||||
|
||||
Takes (list <root> <matchLabels> <default constraints>).
|
||||
*/}}
|
||||
{{- define "harbor.topologySpreadConstraints" -}}
|
||||
{{- $root := index . 0 }}
|
||||
{{- $selector := dict "matchLabels" (index . 1) }}
|
||||
{{- $constraints := index . 2 }}
|
||||
{{- with dig "scheduling" "globalAppTopologySpreadConstraints" "" ($root.Values._cluster | default dict) }}
|
||||
{{- $policy := fromYaml . }}
|
||||
{{- $constraints = dig "topologySpreadConstraints" (list) $policy }}
|
||||
{{- if or (not (kindIs "slice" $constraints)) (not $constraints) }}
|
||||
{{- fail (trim (printf "harbor: _cluster.scheduling.globalAppTopologySpreadConstraints must be YAML with a non-empty topologySpreadConstraints list. %s" (get $policy "Error"))) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $scoped := list }}
|
||||
{{- range $constraints }}
|
||||
{{- if kindIs "invalid" .labelSelector }}
|
||||
{{- $scoped = append $scoped (merge (dict "labelSelector" $selector) (omit . "labelSelector")) }}
|
||||
{{- else }}
|
||||
{{- $scoped = append $scoped . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- toYaml $scoped }}
|
||||
{{- end }}
|
||||
@@ -8,6 +8,13 @@ spec:
|
||||
{{- $existingCluster := lookup "postgresql.cnpg.io/v1" "Cluster" .Release.Namespace (printf "%s-db" .Values.harbor.fullnameOverride) }}
|
||||
{{- $image := dig "spec" "imageName" "ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie" $existingCluster }}
|
||||
imageName: {{ if regexMatch ":17\\." $image }}ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie{{ else if regexMatch ":[0-9]+\\.[0-9]+$" $image }}{{ printf "%s-standard-trixie" $image }}{{ else }}{{ $image }}{{ end }}
|
||||
{{- /* CloudNativePG's default anti-affinity is per node only. Spreading across
|
||||
zones on top of it, rather than moving its topologyKey to the zone, keeps
|
||||
instances off a shared node on a cluster that carries no zone labels. */}}
|
||||
{{- if gt (int .Values.db.replicas) 1 }}
|
||||
topologySpreadConstraints:
|
||||
{{- include "harbor.topologySpreadConstraints" (list . (dict "cnpg.io/cluster" (printf "%s-db" .Values.harbor.fullnameOverride) "cnpg.io/podRole" "instance") (list (dict "maxSkew" 1 "topologyKey" "topology.kubernetes.io/zone" "whenUnsatisfiable" "ScheduleAnyway"))) | nindent 2 }}
|
||||
{{- end }}
|
||||
storage:
|
||||
size: {{ .Values.db.size }}
|
||||
{{- with .Values.db.storageClass }}
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
{{- $spreadConstraints := list }}
|
||||
{{- with dig "scheduling" "globalAppTopologySpreadConstraints" "" (.Values._cluster | default dict) }}
|
||||
{{- $policy := fromYaml . }}
|
||||
{{- $spreadConstraints = dig "topologySpreadConstraints" (list) $policy }}
|
||||
{{- if or (not (kindIs "slice" $spreadConstraints)) (not $spreadConstraints) }}
|
||||
{{- fail (trim (printf "harbor: _cluster.scheduling.globalAppTopologySpreadConstraints must be YAML with a non-empty topologySpreadConstraints list. %s" (get $policy "Error"))) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
@@ -35,24 +27,17 @@ spec:
|
||||
# bump it as a deliberate, separate change.
|
||||
image: redis:6.2.6-alpine
|
||||
replicas: 3
|
||||
{{- if $spreadConstraints }}
|
||||
{{- /* Hard per node, because the operator's default anti-affinity is only
|
||||
a preference and a drain can leave two of three sentinels on one
|
||||
node, below quorum once it goes. pod-template-hash keeps a rollout's
|
||||
outgoing sentinels out of the count. Soft across zones on top, so a
|
||||
cluster without zone labels still schedules. The selector leaves
|
||||
out redisfailovers-role, which flips between master and slave at
|
||||
runtime. */}}
|
||||
{{- $nodeSpread := dict "maxSkew" 1 "topologyKey" "kubernetes.io/hostname" "whenUnsatisfiable" "DoNotSchedule" "nodeTaintsPolicy" "Ignore" }}
|
||||
{{- $zoneSpread := dict "maxSkew" 1 "topologyKey" "topology.kubernetes.io/zone" "whenUnsatisfiable" "ScheduleAnyway" }}
|
||||
topologySpreadConstraints:
|
||||
{{- range $spreadConstraints }}
|
||||
- {{- toYaml (ternary . (merge (deepCopy .) (dict "labelSelector" (dict "matchLabels" (dict "app.kubernetes.io/name" (printf "%s-redis" $.Values.harbor.fullnameOverride) "app.kubernetes.io/component" "sentinel")))) (not (kindIs "invalid" .labelSelector))) | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: kubernetes.io/hostname
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
nodeTaintsPolicy: Ignore
|
||||
matchLabelKeys:
|
||||
- pod-template-hash
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ .Values.harbor.fullnameOverride }}-redis
|
||||
app.kubernetes.io/component: sentinel
|
||||
{{- end }}
|
||||
{{- include "harbor.topologySpreadConstraints" (list . (dict "app.kubernetes.io/name" (printf "%s-redis" .Values.harbor.fullnameOverride) "app.kubernetes.io/component" "sentinel") (list (merge (dict "matchLabelKeys" (list "pod-template-hash")) $nodeSpread) $zoneSpread)) | nindent 4 }}
|
||||
resources:
|
||||
limits:
|
||||
cpu: 250m
|
||||
@@ -65,22 +50,8 @@ spec:
|
||||
# Harbor's dump.rdb into a 7.x format a platform rollback can no longer load.
|
||||
image: redis:6.2.6-alpine
|
||||
replicas: {{ .Values.redis.replicas }}
|
||||
{{- if $spreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- range $spreadConstraints }}
|
||||
- {{- toYaml (ternary . (merge (deepCopy .) (dict "labelSelector" (dict "matchLabels" (dict "app.kubernetes.io/name" (printf "%s-redis" $.Values.harbor.fullnameOverride) "app.kubernetes.io/component" "redis")))) (not (kindIs "invalid" .labelSelector))) | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: kubernetes.io/hostname
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
nodeTaintsPolicy: Ignore
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ .Values.harbor.fullnameOverride }}-redis
|
||||
app.kubernetes.io/component: redis
|
||||
{{- end }}
|
||||
{{- include "harbor.topologySpreadConstraints" (list . (dict "app.kubernetes.io/name" (printf "%s-redis" .Values.harbor.fullnameOverride) "app.kubernetes.io/component" "redis") (list $nodeSpread $zoneSpread)) | nindent 4 }}
|
||||
resources:
|
||||
limits:
|
||||
cpu: "1"
|
||||
|
||||
@@ -12,7 +12,7 @@ templates:
|
||||
- templates/redis.yaml
|
||||
|
||||
tests:
|
||||
- it: requires one sentinel and one Redis pod per node by default
|
||||
- it: requires one sentinel and one Redis pod per node by default, and prefers spreading them across zones
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: RedisFailover
|
||||
@@ -30,6 +30,13 @@ tests:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: harbor-test-redis
|
||||
app.kubernetes.io/component: sentinel
|
||||
- maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: harbor-test-redis
|
||||
app.kubernetes.io/component: sentinel
|
||||
- equal:
|
||||
path: spec.redis.topologySpreadConstraints
|
||||
value:
|
||||
@@ -41,6 +48,13 @@ tests:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: harbor-test-redis
|
||||
app.kubernetes.io/component: redis
|
||||
- maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: harbor-test-redis
|
||||
app.kubernetes.io/component: redis
|
||||
- notExists:
|
||||
path: spec.sentinel.affinity
|
||||
- notExists:
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
suite: zone spread of the data tier and the request path
|
||||
|
||||
release:
|
||||
name: harbor-system
|
||||
namespace: tenant-test
|
||||
|
||||
# The spread follows the platform's globalAppTopologySpreadConstraints when one
|
||||
# is set. Otherwise it is a soft zone spread, added through
|
||||
# topologySpreadConstraints so the per-node placement survives: moving
|
||||
# CloudNativePG's topologyKey to the zone would drop its per-node anti-affinity
|
||||
# on a cluster without zone labels, and Redis keeps its hard per-node spread
|
||||
# (redis_spread_test.yaml) underneath.
|
||||
set:
|
||||
harbor:
|
||||
fullnameOverride: harbor
|
||||
expose:
|
||||
type: clusterIP
|
||||
tls:
|
||||
enabled: false
|
||||
|
||||
tests:
|
||||
- it: spreads database instances across zones
|
||||
template: templates/database.yaml
|
||||
set:
|
||||
db:
|
||||
replicas: 3
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.topologySpreadConstraints
|
||||
value:
|
||||
- maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
cnpg.io/cluster: harbor-db
|
||||
cnpg.io/podRole: instance
|
||||
- notExists:
|
||||
path: spec.affinity
|
||||
|
||||
- it: leaves a single database instance unconstrained
|
||||
template: templates/database.yaml
|
||||
set:
|
||||
db:
|
||||
replicas: 1
|
||||
asserts:
|
||||
- notExists:
|
||||
path: spec.topologySpreadConstraints
|
||||
|
||||
- it: spreads redis pods and sentinels softly across zones on top of the per-node spread
|
||||
template: templates/redis.yaml
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: RedisFailover
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.redis.topologySpreadConstraints[1]
|
||||
value:
|
||||
maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: harbor-redis
|
||||
app.kubernetes.io/component: redis
|
||||
- equal:
|
||||
path: spec.sentinel.topologySpreadConstraints[1]
|
||||
value:
|
||||
maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: harbor-redis
|
||||
app.kubernetes.io/component: sentinel
|
||||
- notExists:
|
||||
path: spec.redis.affinity
|
||||
- notExists:
|
||||
path: spec.sentinel.affinity
|
||||
|
||||
- it: follows the cluster-wide spread policy for the database
|
||||
template: templates/database.yaml
|
||||
set:
|
||||
db:
|
||||
replicas: 3
|
||||
_cluster:
|
||||
scheduling:
|
||||
globalAppTopologySpreadConstraints: |
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: kubernetes.io/hostname
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
- maxSkew: 2
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.topologySpreadConstraints
|
||||
value:
|
||||
- maxSkew: 1
|
||||
topologyKey: kubernetes.io/hostname
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
cnpg.io/cluster: harbor-db
|
||||
cnpg.io/podRole: instance
|
||||
- maxSkew: 2
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
cnpg.io/cluster: harbor-db
|
||||
cnpg.io/podRole: instance
|
||||
|
||||
- it: keeps a selector the cluster-wide policy sets for the database
|
||||
template: templates/database.yaml
|
||||
set:
|
||||
db:
|
||||
replicas: 3
|
||||
_cluster:
|
||||
scheduling:
|
||||
globalAppTopologySpreadConstraints: |
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
example.org/spread: all
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.topologySpreadConstraints[0].labelSelector
|
||||
value:
|
||||
matchLabels:
|
||||
example.org/spread: all
|
||||
|
||||
# The values below are what packages/apps/harbor forwards for nginx.replicas: 2.
|
||||
# The API server rejects a PDB that sets both minAvailable and maxUnavailable,
|
||||
# and upstream defaults minAvailable to 1, so the forwarded zero has to reach
|
||||
# the rendered object as an absent field.
|
||||
- it: renders the upstream PodDisruptionBudget with maxUnavailable alone
|
||||
template: charts/harbor/templates/nginx/nginx-pdb.yaml
|
||||
set:
|
||||
harbor:
|
||||
nginx:
|
||||
replicas: 2
|
||||
podDisruptionBudget:
|
||||
enabled: true
|
||||
minAvailable: 0
|
||||
maxUnavailable: 1
|
||||
asserts:
|
||||
- isKind:
|
||||
of: PodDisruptionBudget
|
||||
- equal:
|
||||
path: spec.maxUnavailable
|
||||
value: 1
|
||||
- notExists:
|
||||
path: spec.minAvailable
|
||||
|
||||
- it: scopes the forwarded spread to the component's own pods
|
||||
template: charts/harbor/templates/core/core-dpl.yaml
|
||||
set:
|
||||
harbor:
|
||||
core:
|
||||
replicas: 2
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: topology.kubernetes.io/zone
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
- maxSkew: 1
|
||||
topologyKey: kubernetes.io/hostname
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.replicas
|
||||
value: 2
|
||||
- equal:
|
||||
path: spec.template.spec.topologySpreadConstraints[0].labelSelector.matchLabels.component
|
||||
value: core
|
||||
- equal:
|
||||
path: spec.template.spec.topologySpreadConstraints[1].labelSelector.matchLabels.component
|
||||
value: core
|
||||
- equal:
|
||||
path: spec.template.spec.topologySpreadConstraints[1].labelSelector.matchLabels.release
|
||||
value: harbor-system
|
||||
Reference in new issue
Block a user