Clear Web UI session on 401 and keep API/Ingress errors as JSON.
Include the missing resource id in not-found messages, expire auth to Guest after 401, and document Ingress annotations so nginx does not rewrite 404/405 bodies into branded HTML.
This commit is contained in:
@@ -54,6 +54,10 @@ What this does:
|
||||
5. Deploys nginx **api-gateway** with OpenStack default ports (5000, 8774, 9696, …).
|
||||
6. Creates `ClusterIssuer` resources (`letsencrypt-prod` / `letsencrypt-staging`).
|
||||
7. Creates an Ingress → gateway `:5000` (Keystone + Web UI) with TLS.
|
||||
8. Sets Ingress annotations so nginx does not replace API JSON 404/405 with
|
||||
branded HTML error pages (`proxy-intercept-errors: false`, narrow
|
||||
`custom-http-errors`). See
|
||||
[Troubleshooting](troubleshooting.md#ingress-returns-branded-html-404--nginx-405-instead-of-json).
|
||||
|
||||
DNS for `os-sim.example.com` must point at your Ingress controller. Then:
|
||||
|
||||
|
||||
@@ -54,6 +54,10 @@ helm upgrade --install os-sim ./helm/openstack-api-simulator \
|
||||
5. Разворачивается nginx **api-gateway** со стандартными портами OpenStack (5000, 8774, 9696, …).
|
||||
6. Создаются ресурсы `ClusterIssuer` (`letsencrypt-prod` / `letsencrypt-staging`).
|
||||
7. Создаётся Ingress → gateway `:5000` (Keystone + Web UI) с TLS.
|
||||
8. Ставит annotations Ingress, чтобы nginx не подменял JSON 404/405
|
||||
брендированными HTML-страницами (`proxy-intercept-errors: false`, узкий
|
||||
`custom-http-errors`). См.
|
||||
[Устранение неполадок](troubleshooting.md#ingress-отдаёт-брендированный-html-404--nginx-405-вместо-json).
|
||||
|
||||
DNS для `os-sim.example.com` должен указывать на Ingress controller. Затем:
|
||||
|
||||
|
||||
@@ -13,6 +13,50 @@
|
||||
- Неверный user/password/domain (`Default`)
|
||||
- Отсутствует project scope для project-scoped API
|
||||
- Токен от другого экземпляра simulator (reseed меняет ID)
|
||||
- В Web UI HTTP 401 очищает локальную сессию Keystone и показывает **Guest**
|
||||
в шапке; войдите снова через Environment
|
||||
|
||||
## Ingress отдаёт брендированный HTML 404 / nginx 405 вместо JSON
|
||||
|
||||
Симулятор отвечает на ошибки API JSON (`error` / `itemNotFound` / `message`).
|
||||
Если видите HTML «page not found» или голую страницу nginx **405**, тело
|
||||
подменил **Ingress / reverse proxy** (часто `custom-http-errors` у
|
||||
ingress-nginx).
|
||||
|
||||
Исправьте annotations Ingress для этого хоста (см.
|
||||
`helm/openstack-api-simulator/values-ingress-example.yaml`):
|
||||
|
||||
```yaml
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/proxy-intercept-errors: "false"
|
||||
nginx.ingress.kubernetes.io/custom-http-errors: "502,503"
|
||||
```
|
||||
|
||||
Проверьте с `Accept: application/json`. Отсутствующий compute instance должен
|
||||
вернуться JSON (не HTML), например:
|
||||
|
||||
```json
|
||||
{"itemNotFound": {"code": 404, "message": "Instance 'missing-id' could not be found"}}
|
||||
```
|
||||
|
||||
### Корректная authenticated mutation (OpenStack)
|
||||
|
||||
Токен Keystone в заголовке и JSON-тело (OpenStack API — JSON, не
|
||||
form-urlencoded):
|
||||
|
||||
```bash
|
||||
# после POST /v3/auth/tokens → X-Subject-Token
|
||||
TOKEN=...
|
||||
curl -sS -X POST "https://HOST:8774/v2.1/servers" \
|
||||
-H "X-Auth-Token: $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Accept: application/json" \
|
||||
-d '{"server":{"name":"demo","flavorRef":"...","imageRef":"...","networks":[{"uuid":"..."}]}}'
|
||||
```
|
||||
|
||||
Keystone/UI через Ingress обычно `:443→5000`; порты Nova и других сервисов
|
||||
по-прежнему нуждаются в port-forward / LoadBalancer / TCP Ingress, если вы не
|
||||
ходите через multi-port gateway Service.
|
||||
|
||||
## Пустые списки после lifecycle probe
|
||||
|
||||
|
||||
@@ -13,6 +13,50 @@
|
||||
- Wrong user/password/domain (`Default`)
|
||||
- Project scope missing for project-scoped APIs
|
||||
- Token from a different simulator instance (reseed rotates IDs)
|
||||
- In the Web UI, HTTP 401 clears the local Keystone session and shows **Guest**
|
||||
in the header; sign in again from Environment
|
||||
|
||||
## Ingress returns branded HTML 404 / nginx 405 instead of JSON
|
||||
|
||||
The simulator answers API errors as JSON (`error` / `itemNotFound` / `message`).
|
||||
If you see a site HTML “page not found” or plain nginx **405** page, the
|
||||
**Ingress / reverse proxy** replaced the upstream body (often via
|
||||
`custom-http-errors` on the ingress-nginx controller).
|
||||
|
||||
Fix on the Ingress for this host (see
|
||||
`helm/openstack-api-simulator/values-ingress-example.yaml`):
|
||||
|
||||
```yaml
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/proxy-intercept-errors: "false"
|
||||
nginx.ingress.kubernetes.io/custom-http-errors: "502,503"
|
||||
```
|
||||
|
||||
Then re-check with `Accept: application/json`. A missing compute instance should
|
||||
look like JSON (not HTML), for example:
|
||||
|
||||
```json
|
||||
{"itemNotFound": {"code": 404, "message": "Instance 'missing-id' could not be found"}}
|
||||
```
|
||||
|
||||
### Correct authenticated mutation (OpenStack)
|
||||
|
||||
Use a Keystone token header and JSON body (OpenStack APIs are JSON, not
|
||||
form-urlencoded):
|
||||
|
||||
```bash
|
||||
# after POST /v3/auth/tokens → X-Subject-Token
|
||||
TOKEN=...
|
||||
curl -sS -X POST "https://HOST:8774/v2.1/servers" \
|
||||
-H "X-Auth-Token: $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Accept: application/json" \
|
||||
-d '{"server":{"name":"demo","flavorRef":"...","imageRef":"...","networks":[{"uuid":"..."}]}}'
|
||||
```
|
||||
|
||||
Keystone/UI via Ingress is usually `:443→5000`; Nova and other service ports
|
||||
still need port-forward / LoadBalancer / TCP Ingress unless you only call
|
||||
through the multi-port gateway Service.
|
||||
|
||||
## Empty lists after lifecycle probe
|
||||
|
||||
|
||||
Reference in New Issue
Block a user