Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions charts/grid-operator/crds/gridnetwork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,24 @@ spec:
items:
type: string
type: array
selectionPolicy:
description: |-
Local request distribution policy for the active selection group.

This is independent of scoring. When absent, the overlay carries no
selection override and Praxis uses deterministic selection.
nullable: true
properties:
mode:
description: Local selection mode used by the data-plane gateway.
enum:
- deterministic
- roundRobin
- random
type: string
required:
- mode
type: object
staleCandidateTtlSeconds:
description: |-
Maximum age in seconds before a stale (`fresh=false`) remote routing
Expand Down
17 changes: 17 additions & 0 deletions charts/grid-site/templates/gridnetwork.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
{{- if .Values.gridNetwork.name }}
{{- $existing := lookup "grid.praxis-proxy.io/v1alpha1" "GridNetwork" .Release.Namespace .Values.gridNetwork.name }}
{{- $configuredSelectionPolicy := .Values.gridNetwork.selectionPolicy }}
{{- $existingSelectionPolicy := dig "spec" "selectionPolicy" nil $existing }}
{{- $selectionPolicy := $configuredSelectionPolicy }}
{{- if not $selectionPolicy }}
{{- if $existingSelectionPolicy }}
{{- $selectionPolicy = $existingSelectionPolicy }}
{{- else if not $existing }}
{{- $selectionPolicy = dict "mode" "roundRobin" }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

charts/grid-site/tests/gridnetwork_test.yaml already has a helm-unittest suite for this template but doesn't cover the new selectionPolicy default logic (and isn't touched by this PR at all). At least the "no existing CR + no configured value → defaults to roundRobin" branch is testable today since lookup returns empty under helm-unittest — worth adding a case for it. The "preserve existing CR's policy" branch genuinely needs a live cluster; fine to leave that one uncovered here as long as it's called out.

{{- end }}
{{- end }}
apiVersion: grid.praxis-proxy.io/v1alpha1
kind: GridNetwork
metadata:
Expand Down Expand Up @@ -29,6 +40,12 @@ spec:
strategy: {{ .strategy | quote }}
{{- end }}
{{- end }}
{{- with $selectionPolicy }}
{{- if .mode }}
selectionPolicy:
mode: {{ .mode | quote }}
{{- end }}
{{- end }}
{{- with .Values.gridNetwork.metricsRefreshInterval }}
{{- if . }}
metricsRefreshInterval: {{ . | quote }}
Expand Down
11 changes: 11 additions & 0 deletions charts/grid-site/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@
}
}
},
"selectionPolicy": {
"type": "object",
"additionalProperties": false,
"required": ["mode"],
"properties": {
"mode": {
"type": "string",
"enum": ["deterministic", "roundRobin", "random"]
}
}
},
"metricsRefreshInterval": {
"type": "string",
"pattern": "^([1-9][0-9]*s|[1-9][0-9]{3,}ms)$"
Expand Down
18 changes: 18 additions & 0 deletions deploy/crds/gridnetwork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,24 @@ spec:
items:
type: string
type: array
selectionPolicy:
description: |-
Local request distribution policy for the active selection group.

This is independent of scoring. When absent, the overlay carries no
selection override and Praxis uses deterministic selection.
nullable: true
properties:
mode:
description: Local selection mode used by the data-plane gateway.
enum:
- deterministic
- roundRobin
- random
type: string
required:
- mode
type: object
staleCandidateTtlSeconds:
description: |-
Maximum age in seconds before a stale (`fresh=false`) remote routing
Expand Down
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
- [Routing](architecture/routing.md) — versioned overlay contract, revision
lifecycle, candidate ordering, `intelligent_route`, `peer_identity_trust`, and
provider-side request forwarding.
- [Provider Selection and Load Balancing](architecture/provider-selection-and-load-balancing.md) —

Check warning on line 12 in docs/README.md

View workflow job for this annotation

GitHub Actions / Detect hidden unicode characters

Unicode Safety [non-ascii-identifier]

U+2014 <unnamed U+2014> -- Non-ASCII U+2014 <unnamed U+2014> in identifier '—' (policy: ascii-only)
eligibility, routing groups, scoring, selection modes, affinity, and
overlay lifecycle.
- [Scoring](architecture/scoring.md) — operator-side candidate scoring,
metrics input, and request-time scoring boundaries.
- [Auth and Policy](architecture/auth.md) — provider authentication strategies,
Expand Down
Loading
Loading