Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@
"allowedVersions": "<2.0.0"
},
{
"description": "SearXNG publishes many tags a day, and the tests hold the engine names of the pinned image. A tag has no minimum release age (CONTRIBUTING.md, Dependency Versions), so a person refreshes the engine names at each bump. Each tag ends in a commit hash, which the versioning ignores.",
"description": "SearXNG publishes many tags a day. A tag has no minimum release age (CONTRIBUTING.md, Dependency Versions). Each tag ends in a commit hash, which the versioning ignores.",
"matchPackageNames": ["searxng/searxng", "docker.io/searxng/searxng"],
"versioning": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)-[0-9a-f]+$",
"prBodyNotes": [
"Before the merge, follow the bump steps in `docs/CLUSTER.md`, section SearXNG: refresh `tests/fixtures/searxng/default_engine_names.txt` from the new image and read its notes on the engines that the settings keep."
"Before the merge, read the notes of the release on the engines that the settings keep, and run `devops k8s searxng-check` against the new image on the cluster (`docs/CLUSTER.md`, section SearXNG)."
]
},
{
Expand Down
9 changes: 4 additions & 5 deletions docs/CLUSTER.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,11 @@ The rule group `crawl4ai` in `k8s/devops/monitoring/prometheus-rules-values.yaml
- **The secret.** Secret `searxng` holds `SEARXNG_SECRET` (see [Cluster Secrets](../k8s/README.md#cluster-secrets)). A person creates it with `devops k8s push-secrets --stack devops` before the first sync. The settings file holds no secret.
- **The address.** The pod serves nothing to the Service until `search.searxng_url` is set in the live ConfigMap `devops-cli-config`, with `ai.allow_private_network`. Without it the provider `searxng` is skipped and the search goes to the next provider. `k8s/devops/configmap.example.yaml` holds the line.
- **The engines.** `keep_only` in `searxng-settings` keeps nine engines that need no key: `duckduckgo`, `wikipedia`, `github`, `stackoverflow`, `askubuntu`, `superuser`, `arxiv`, `mdn` and `docker hub`. The scraping engines of Google, Bing, Brave, Startpage, Mojeek and Qwant are not kept: their upstream sites suspended them in October 2026 (SearXNG issues 6866 and 6819). The keyed Brave engine is not used either. A test holds this. A request that names no category asks only the `general` engines (`duckduckgo`, and `wikipedia` as an infobox with no result); the technical engines answer when the request names `it` (`github`, `stackoverflow`, `askubuntu`, `superuser`, `mdn`, `docker hub`) or `science` (`arxiv`). The provider asks `general,it,science`. `pypi` is not kept: `pypi.org` serves a Client Challenge page to a scraper, and in the live check of 2026-11-07 the engine returned no hit for any query, with no error. `github` and `duckduckgo` refused the address of the test host after about 30 queries within minutes (`Suspended: access denied` and `CAPTCHA`), and answered again later; the rate that a cluster node address gets is not known. SearXNG suspends a refusing engine (CAPTCHA and access denied for 86400 s, too many requests for 3600 s), but `duckduckgo` raises its CAPTCHA with no suspension, so the next query asks it again. The settings add no retry loop.
- **The pin.** The image names a date tag with the commit and the digest of its index. Renovate reads `k8s/**/*.yaml` and bumps the tag and the digest in one pull request. SearXNG publishes many tags a day and has no release feed, so Renovate proposes a new tag only on Monday, also for a patch. A tag has no minimum release age (Dependency Versions in [`CONTRIBUTING.md`](../CONTRIBUTING.md#1-development-philosophy--core-invariants)), and the pull request text tells the person to refresh the engine names. To bump by hand or to review a bump:
1. Choose the newest tag that passes the tests of step 4 (the tag list of `https://hub.docker.com/r/searxng/searxng/tags`). Take a tag with a security fix or a bug fix on the day it is published.
- **The pin.** The image names a date tag with the commit and the digest of its index. Renovate reads `k8s/**/*.yaml` and bumps the tag and the digest in one pull request. SearXNG publishes many tags a day and has no release feed, so Renovate proposes a new tag only on Monday, also for a patch. A tag has no minimum release age (Dependency Versions in [`CONTRIBUTING.md`](../CONTRIBUTING.md#1-development-philosophy--core-invariants)), and the pull request text names step 3. A SearXNG bump updates like any other image: no test compares a file or a constant with the pin (owner, 2026-11-16, #6063). To bump by hand or to review a bump:
1. Choose the newest tag (the tag list of `https://hub.docker.com/r/searxng/searxng/tags`). Take a tag with a security fix or a bug fix on the day it is published.
2. Set the tag and the digest in `deployment.yaml`.
3. Refresh `tests/fixtures/searxng/default_engine_names.txt` (the first line names the tag): `docker run --rm --entrypoint cat <image> /usr/local/searxng/searx/settings.yml | python3 -c "import sys, yaml; print(*sorted(e['name'] for e in yaml.safe_load(sys.stdin)['engines']), sep='\n')"`. If a name of `keep_only` is gone, a test fails: read the notes of the release for the new name.
4. Run `devops ci test tests/invariants/test_k8s_searxng.py`, then run `devops k8s searxng-check` against the new image (see the next bullet) and set `SEARXNG_IMAGE` in `src/devops_cli/k8s/searxng_check.py`.
- **The check.** `devops k8s searxng-check` tests the running service for the points that a new digest can change. Through a `kubectl port-forward` it sends six `GET /search` requests with `format=json` and no credential: one for each category of the provider (`general`, `it`, `science`), a query `!google ...` that must stay text, a query `!!g ...` whose redirect is recorded and never followed, and a category that no kept engine serves. It fails a row when a reply lacks one of the seven keys (`answers`, `corrections`, `infoboxes`, `query`, `results`, `suggestions`, `unresponsive_engines`), when HTTP 403 shows that `json` is not in `search.formats`, when a category has no hit, or when an engine that must stay off (Brave, Google, Bing, Startpage, Mojeek, Qwant) shows in `results` or in `unresponsive_engines`. It also starts two throwaway pods and tries three connects: a pod that is not a client of the service must not reach port 8080, and a pod with the label of the service must reach neither the metadata address nor a private ClusterIP. The report names each pod and target by a role. A person runs the command at each bump of the digest. Until `SEARXNG_IMAGE` names the new image, the `k8s` row of `devops ci` fails. The query count stays at six, below the about 30 queries after which the upstream sites suspend an engine. If a row fails on the pinned image, do not add code for it: file the evidence as an issue. `devops k8s searxng-check --dry-run` lists every call and makes none.
3. Read the notes of the release for a change of an engine that `keep_only` names, and run `devops k8s searxng-check` against the new image (see the next bullet).
- **The check.** `devops k8s searxng-check` tests the running service for the points that a new digest can change. Through a `kubectl port-forward` it sends six `GET /search` requests with `format=json` and no credential: one for each category of the provider (`general`, `it`, `science`), a query `!google ...` that must stay text, a query `!!g ...` whose redirect is recorded and never followed, and a category that no kept engine serves. It fails a row when a reply lacks one of the seven keys (`answers`, `corrections`, `infoboxes`, `query`, `results`, `suggestions`, `unresponsive_engines`), when HTTP 403 shows that `json` is not in `search.formats`, when a category has no hit, or when an engine that must stay off (Brave, Google, Bing, Startpage, Mojeek, Qwant) shows in `results` or in `unresponsive_engines`. It also starts two throwaway pods and tries three connects: a pod that is not a client of the service must not reach port 8080, and a pod with the label of the service must reach neither the metadata address nor a private ClusterIP. The report names each pod and target by a role. A person runs the command at each bump of the digest. The query count stays at six, below the about 30 queries after which the upstream sites suspend an engine. If a row fails on the pinned image, do not add code for it: file the evidence as an issue. `devops k8s searxng-check --dry-run` lists every call and makes none.
- **The log.** `kubectl -n devops logs deploy/searxng` shows the engines that failed. A line `CAPTCHA` from `duckduckgo` or `Suspended: access denied` from `github` means that the engine refused the pod address for a while. The pod answers with the other engines, and the search passes to the next provider when no engine gives a hit. The start prints a warning that `/var/cache/searxng` is not owned by `searxng:searxng`: the group of the volume is 977 (`fsGroup`), and the pod writes to it.
- **The limits.** Measured with the pinned image under the controls of the pod: it idles at 114 MiB, 20 queries one after another peak at 117 MiB, and 10 at once peak at 122 MiB and 0.8 CPU. On the cluster the worker grows about 50 MiB a day (160 MiB to 364 MiB in 4 days, nearly all resident memory), and the old limit of 384 Mi OOM-killed it on 2026-11-12 (#4939). `GRANIAN_WORKERS_MAX_RSS` (512 MiB) makes Granian replace the worker before the limit. The Deployment asks for 256 Mi and 50m, with the limits 1 Gi and 1 CPU: the main process (about 35 MiB), the resource tracker (about 15 MiB), a worker at 512 MiB and the new worker while Granian replaces it fit under the limit.
- **The updates.** A person runs `devops k8s searxng-check` against each new image on the cluster, so a SearXNG update waits for an approval on the Dependency Dashboard. After the approval it comes in its own pull request (branch `renovate/searxng` or `renovate/patch-searxng`), apart from the group of the other container images (#6051).
Expand Down
2 changes: 1 addition & 1 deletion k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ affinity:

Kubernetes puts the label `node-role.kubernetes.io/control-plane` on each control-plane node, so the rule needs no label of its own. The affinity has an effect on a new volume and on a moved volume. A bound volume keeps its pod on its node.

`tests/core/test_k8s_local_path_placement.py` fails when a pod that mounts a claim has no such affinity, in a chart values file or in a manifest under `k8s/`. It reads a CloudNativePG `Cluster` that sets `spec.storage` as a pod on a claim, and it takes the affinity of that pod from `spec.affinity`: the operator makes a claim from `spec.storage` and applies `spec.affinity` to the database pods. It also fails when an Argo CD Application installs a chart, or pins a chart version, that the claim table `CHART_CLAIMS` does not name, because each chart keeps its claims and its affinity at different values and a chart release can move them. A person who bumps a chart reads the claim values of the new version again and changes the key of its entry.
`tests/core/test_k8s_local_path_placement.py` fails when a pod that mounts a claim has no such affinity, in a chart values file or in a manifest under `k8s/`. It reads a CloudNativePG `Cluster` that sets `spec.storage` as a pod on a claim, and it takes the affinity of that pod from `spec.affinity`: the operator makes a claim from `spec.storage` and applies `spec.affinity` to the database pods. It also fails when an Argo CD Application installs a chart that the claim table `CHART_CLAIMS` does not name, because each chart keeps its claims and its affinity at different values.

The table `_CONTROL_PLANE_CLAIM_EXEMPTIONS` of the test names each pod that may stay on the control-plane node, with its reason. It holds two entries, and each entry goes when its item moves the volume:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-16
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Design

## Decisions
- Drop `SEARXNG_IMAGE` and not read the image from the live Deployment: the constant only named the image in the success message, and the check tests the running service whatever image it runs. Reading the Deployment would add a `kubectl` call for a line of text.
- The table tests compare chart names: `{chart for chart, _ in pinned_charts()}` against the table keys. `pinned_charts()` stays, because the deploy-stack version test reads it.
- `test_the_dead_engines_file_gives_a_date_and_a_reason` keeps the format check of the file and drops the comparison with the engine names of the image.
- The SearXNG note of Renovate keeps the steps that a person can still do: read the notes of the release and run `devops k8s searxng-check`.

## Rejected alternatives
- Keep the version keys and let Renovate bump them with a custom manager: the owner rejected checks of manifest values (#6060).
- Read the engine names from the image in a test: it needs the image and a network pull in the test run, and it still checks a manifest value.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Proposal: #6063

## Why
Each Renovate update of SearXNG and each chart update failed until a person edited the tests: the `k8s` gate row compared the SearXNG image with `SEARXNG_IMAGE`, two SearXNG tests compared fixtures with the pinned image, and the claim and token tables keyed each entry on the chart version (PRs #6029, #6046, #6055). The owner decided on 2026-11-16 (#6060, comment "Owner decisions, 2026-11-16"): remove the SearXNG gate and its pin tests, so a SearXNG image updates like any other, and drop the chart versions from the tables, so a chart update no longer touches them. Closes #6063.

## What Changes
- The `k8s` gate row no longer compares the image of Deployment `searxng` with `SEARXNG_IMAGE`.
- `SEARXNG_IMAGE` is removed. `devops k8s searxng-check` tests the running service and its report names no image.
- The engine-names tests of `tests/invariants/test_k8s_searxng.py`, the saved-reply test and the image test of `tests/k8s/test_searxng_check.py` are removed, with `default_engine_names.txt` and `search_reply_image.txt`. `search_reply.json` stays, because the provider tests read it.
- `CHART_CLAIMS` and `_CHART_TOKENS` key each entry on the chart name. Their tests still fail when a pinned chart has no entry; the claim and token rules stay.
- The SearXNG note and description of `.github/renovate.json`, `docs/CLUSTER.md` and `k8s/README.md` describe the result. The test of the note, which read a `renovate.json` value, is removed.

## Capabilities
- `k8s-searxng-check`: the requirements "Pinned image" and "Reply fixture from the pinned image" are removed.
- `searxng-service`: the requirements on the kept engines and on the note of a bump change.

## Impact
- The closed Renovate updates for SearXNG and the charts pass the gate and these tests when Renovate opens them again.
- `docs/SDLC.md` names `_CHART_TOKENS` in a sentence that PR #6057 rewrites; this change leaves that line to #6057, so the two pull requests do not conflict.

## Feasibility
- PR #6055 (grafana 14.4.2) failed only at the two table tests and the deploy-stack version tests; the table tests pass with name keys.
- `SEARXNG_IMAGE` had one runtime use: the image named in the success message of `devops k8s searxng-check`.
- `rg search_reply.json tests` shows `tests/ai/test_web_search_searxng.py` reads the reply, so the reply stays.

## Existing Tool Considered
No tool is needed: the change removes checks. The open validators that CI runs keep checking the manifest form.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## REMOVED Requirements

### Requirement: Pinned image
**Reason**: The owner decided on 2026-11-16 (#6060) that a SearXNG image updates like any other image, so no check compares the Deployment with an image of the command.
**Migration**: None. `devops k8s searxng-check` tests the running service, whatever image it runs.

### Requirement: Reply fixture from the pinned image
**Reason**: The test compared the fixture with `SEARXNG_IMAGE`, which is removed (#6063). The provider tests still read `search_reply.json`.
**Migration**: None.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## REMOVED Requirements

### Requirement: The settings keep only engines that need no key
**Reason**: Its scenarios compared the kept names and the names file with the pinned image. The owner decided on 2026-11-16 (#6060) that no test compares a file with the pinned image.
**Migration**: "The settings keep only keyless engines" holds the rest of the requirement.

### Requirement: A bump of the image tells the person what to check
**Reason**: The note named the engine names file, which is removed (#6063).
**Migration**: "A SearXNG bump updates like any other image" holds the note.

## ADDED Requirements

### Requirement: The settings keep only keyless engines
The settings SHALL keep, with `use_default_settings` and `engines.keep_only`, the engines `duckduckgo`, `wikipedia`, `github`, `stackoverflow`, `askubuntu`, `superuser`, `arxiv`, `mdn` and `docker hub`, and no other. They SHALL keep none of `brave`, `braveapi`, `google`, `bing`, `startpage`, `mojeek` and `qwant`.

#### Scenario: A suspended engine is kept
- **WHEN** a test reads `keep_only`
- **THEN** no kept name is a forbidden engine

### Requirement: A SearXNG bump updates like any other image
No test SHALL compare a file or a constant with the pinned SearXNG image. The Renovate rule of the image SHALL give the pull request a note that names `devops k8s searxng-check` and names no age of the tag.

#### Scenario: A bump of the image
- **WHEN** Renovate opens a pull request that moves the SearXNG image
- **THEN** its text names `devops k8s searxng-check`, and no test fails only because the image moved
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Tasks

## 1. SearXNG

- [x] 1.1 Write the failing test that a passing `devops k8s searxng-check` names no image of its own
- Verification: `$ uv run devops ci test tests/commands/k8s/test_k8s_searxng_check.py`
- [x] 1.2 Remove `SEARXNG_IMAGE`, the image of the success message, the gate assertion, the engine-names tests, the saved-reply and image tests, and the two fixtures
- Verification: `$ uv run devops ci test tests/commands/k8s/test_k8s_searxng_check.py tests/k8s/test_searxng_check.py tests/invariants/test_k8s_searxng.py tests/ai/test_web_search_searxng.py`

## 2. Chart tables

- [x] 2.1 Key `CHART_CLAIMS` and `_CHART_TOKENS` on the chart name, and compare the chart names in their tests
- Verification: `$ uv run devops ci test tests/core/test_k8s_local_path_placement.py tests/invariants/test_k8s_manifests.py`

## 3. Documents

- [x] 3.1 Update the SearXNG note of `.github/renovate.json`, remove its test, and update `docs/CLUSTER.md` and `k8s/README.md`
- Verification: `$ uv run devops ci docs`
14 changes: 0 additions & 14 deletions openspec/specs/k8s-searxng-check/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,6 @@ The command SHALL start a throwaway pod with a neutral label that is not the lab
- **WHEN** the connect from the pod with the label of `searxng` to the metadata address succeeds
- **THEN** the command exits 1 and the report names the SearXNG pod and the metadata role as `reached`.

### Requirement: Pinned image
An offline check of the `k8s` row of `devops ci` MUST compare the image of Deployment `searxng` with the image that the command names.

#### Scenario: Image bump
- **WHEN** the Deployment pins an image that differs from `SEARXNG_IMAGE`
- **THEN** the check fails, names both images and the command that a person runs again.

### Requirement: Roles in the output
The command and its output MUST name each pod and each target by a role and MUST NOT hold a private host name or a private address.

Expand All @@ -127,13 +120,6 @@ The command SHALL pass `--context` to every `kubectl` call.
- **WHEN** a person runs the command with `--context test-ctx`
- **THEN** every recorded `kubectl` call names the context `test-ctx`.

### Requirement: Reply fixture from the pinned image
The reply fixture of the SearXNG provider tests SHALL be a reply that the pinned image gave, and a file next to it SHALL name that image.

#### Scenario: Fixture names the image
- **WHEN** a test reads the fixture and `SEARXNG_IMAGE`
- **THEN** the fixture holds the seven reply keys and the file next to it holds `SEARXNG_IMAGE`.

### Requirement: Hermetic tests
The tests of the command MUST run with the process and HTTP fakes and MUST NOT skip on the state of the host.

Expand Down
Loading