Repository navigation
fix(keystone): stop caching the service catalog (SPEC-034) - #119
Draft
uw-sc wants to merge 5 commits into
Conversation
added 5 commits
November 26, 2026 14:55
A server's security groups are now its ports' groups. Create, add and remove, interface attach and the port API all change the ports; the node's firewall and floating-IP NAT are applied after each change and undone compare-and-set if that fails, and the reconciler converges floating-IP state both ways. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
…ixes Specify, research, plan and break down the second round of SPEC-033. No code changes; implementation starts at T058. API, as upstream: - the security-group listing honours every filter; groups carry a revision number (If-Match honoured) and may be stateless - `default` cannot be deleted by a member, renamed or duplicated; other names may repeat, an ambiguous name answering 409 NoUniqueMatch - subnets store allocation pools; one allocator serves every address - floating-IP creates no longer race; associations need a router that joins the port's subnet to the floating network - routers get gateway ports with external_fixed_ips - administrators list, show and write every project's Networking API resources Real-mode layout, as upstream's legacy L3 and iptables drivers: - one network node holds every router and DHCP namespace; other nodes ask it to apply through a bounded node-to-node call - every port is firewalled on its node, both directions; the floating-IP filter is retired - deletions remove host state before their record; no request path logs a failed host step and answers success - namespaces survive pod restarts; br_netfilter is required Constitution v1.5.0 is refined in place: the node that holds the state applies a change, a new exception covers removals applied before their record, Article V describes the new isolation, and register entry 5 is narrowed to names. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
Security groups take every listing filter, revision numbers with If-Match and stateless groups, refuse changes to default as upstream does, and may share names. Subnets store their allocation pools, and one allocator serves ports, router gateways and floating IPs. A router's gateway is a port holding its address, and a floating IP finds its router as upstream's lookup does. Only a router's own records make a port its gateway or interface; a member's port claiming either is not one. Administrators list, show and change every project's networking resources. A port is its project’s and its network owner’s to read, as upstream’s: a shared network’s other ports stay hidden. Only an administrator or the network’s project gives a port a network: owner, as upstream’s policy has it. A server’s ports are those of its project that name it, for its group actions and its reported groups. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
Round 2 of SPEC-033's real-mode layout, as upstream's: one network node (neutron.network_node; without VXLAN every node is its own) holds every router in a qrouter-<id> namespace and each network's DHCP and metadata in a qdhcp-<network> namespace. Every port is firewalled on the node it is bound to (binding:host_id) by its own iptables chains, built from its groups with remote groups resolved to their members, in iptables and ebpf mode alike. The per-fixed-IP floating-IP filter is retired. - A request stores its change, has the node that holds the state apply it before the answer (a function call there, an authenticated one-second node call otherwise), and undoes its own change compare-and-set when that fails. A deletion removes the host state before its record and re-applies it when the record stays. - The DHCP port takes the lowest free pool address; dnsmasq serves static ranges with option 121; metadata is served in the namespace and identifies a guest by network and address. Ports honour fixed_ips. - Nova binds a port before the guest starts, a revived guest's too, and every domain names the guest's TAP for its port. - Each node's reconciler converges what it holds both ways, removing by "no record" only after a complete read; it removes what earlier layouts left where it recognises it, the uplink's stray proxy entries, and the VXLAN entries and devices no record holds. Teardown and its database-less fallback remove the new layout. - At start, real mode loads br_netfilter and turns on bridge-nf-call- iptables and -ip6tables; readiness fails, naming bridge-netfilter, while they do not hold. - The chart's pod and the KVM Compose file mount the host's /run/netns both ways and /lib/modules read-only; the teardown purge Job mounts /run/netns. The chart runs real mode privileged, as bidirectional propagation needs, and refuses multi-node VXLAN without neutron.networkNode. - Removed: TAPDeviceManager and the metadata DNAT remover, which nothing called any more, github.com/coreos/go-iptables, which nothing imports, and pkg/networking's eBPF wrapper, which lost its last caller with Neutron's TAP; pkg/networking/ebpf stays for the separate decision. - Docs: UPGRADING.md (round 2's answers, the clean break), EBPF_STATUS.md, the networking, VXLAN, configuration, troubleshooting, scaling and architecture docs, the chart README, CLAUDE.md; the host runbook; the Horizon compatibility report, recording instance Edit Security Groups as verified. - A security group rule is checked and stored as upstream's: its direction, ethertype, protocol, ports and remote prefix, each refusal a 400 under upstream's name. The port firewall writes a rule only as it parses it and leaves out what it cannot express: a newline in a rule's remote or protocol reached iptables-restore's input, which runs as root. - A subnet's DNS servers are checked as upstream's on create, and the DHCP configuration writes a gateway or DNS server only as an IPv4 address: a newline in one reached dnsmasq's configuration, which starts as root. - The branch review's findings (tasks T169-T239): router ports are the router's records, so the port API refuses them (ServicePortInUse) and no member's port is routed; a port forwarding finds its router from its internal port, as upstream's, and frees it with the last one; every undo takes the allocation lock and leaves an address someone took meanwhile; a revived guest's TAP is named and filtered; deletions re-check under their locks; a subnet's gateway change reaches its routers. Answers follow upstream: in-use refusals carry upstream's messages, If-Match is read as upstream reads it, a port's and a subnet's create and update answer as their show, listings and creates ensure the project's default group. The port firewall writes a MAC as iptables-save prints it, so an unchanged node is only read, which tests now check against captured iptables-save output. The node call is served before the users' auth, with plain absent and absent_ids; unit locks go with their last user; migration 077 keeps an index on security_groups (project_id, name), and its marker is "-- lightstack:foreign-keys-off", read on the file's first line only. - The second branch review's findings (tasks T242-T310): a subnet's ip_version must match its CIDR, and DHCP serves IPv4 subnets only, so no record stops the reconciler; a deleted port's still-running TAP is dropped both ways before any port's chains (ls-bound-in and -out); protocols are written as iptables prints them, so vrrp no longer fails a node's commit; a rule's delete locks its group first; a server's deletion frees its forwardings' floating IPs, and a losing deletion binds nothing back; requests waiting on a unit share one converge; one request gives each address once, and a gateway keeps the address it is not asked to change; a port forwarding's update is checked as its create; router:external stays while a gateway uses it; trunks take only ports the caller can see; add_router_interface takes a port. Answers follow upstream for trusted ports, an empty remote group, the rule listing's filters, fixed_ip_address without a port and zoned pools. The node call bypasses HTTP proxies, network_node is read trimmed, the chart refuses multi-node without VXLAN, and the turnkey Compose mounts the host's /run/netns. Run on one Kubernetes node (k3s, real libvirt, Horizon) on 2026-11-23 with the host runbook: every step passed. Two nodes are not supported yet, so their host run is dropped from the spec and the tasks. Known gap, outside this change: VXLAN devices have no flooding destination, so broadcast does not cross nodes and a guest off the network node gets no DHCP lease (follow-ups.md, 5.1). Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
With cache.enabled, the catalog was kept in Redis for 24 hours and never invalidated, so endpoint and service changes, a new scheme or object-storage endpoint, and catalog migrations reached no token until the entry expired. It is now read from the database on every token issue and validation. - Remove the catalog cache, catalogCacheable, and Keystone's unused cache fields and constructor parameters. Nova, Neutron and Glance keep the cache. - Tests: endpoint create, delete and a scheme change show in the next token; a partial read serves the built-in catalog. - Compose stacks no longer start Redis or set env vars the binary ignored; drop the unread service_catalog TTL from the config. - Docs: UPGRADING, CONFIGURATION, ARCHITECTURE; SPEC-034. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>
uw-sc
force-pushed
the
bugfix/581-keystone-service-catalog-cache-is-never-invalidated-and-caches-post-substitution-host-urls
branch
from
November 26, 2026 14:21
a85af3b to
d0530e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With
cache.enabled: true, Keystone kept each project's service catalog in Redis for 24 hours, alreadyresolved to URLs, and nothing ever removed it. Endpoint and service changes made through the Identity API,
a restart with a new scheme or object-storage endpoint, and a release whose migrations fix catalog rows all
reached no token until the entry expired. Redis is external, so a pod restart or a rollout did not clear it.
This drops the catalog cache rather than teaching it invalidation. The catalog is one join over about twenty
rows. It is now read from the database on every token issue and validation.
Closes cobaltcore-dev/cloud-storage#581
Spec, plan, tasks and host runbook:
docs/specs/034-drop-catalog-cache/.What's in it
BuildServiceCatalogneither reads nor writes the cache; the host-keyed cache key andcatalogCacheablego with it. Keystone used its cache for nothing else, soNewAuthServiceandkeystone.NewServicelose their cache parameter. A partial database read still serves the built-incatalog.
cache.enabledis set.deployments/docker-compose.ymlanddeployments/docker-compose-sqlite.ymlno longer starta Redis or set
LIGHTSTACK_REDIS_URL/LIGHTSTACK_CACHE_ENABLED. The binary never read either variable,so those stacks never ran with the cache on.
cache.ttl.service_catalogleavesconfig/lightstack.yaml.UPGRADING.mdgains "The service catalog is no longer cached".CONFIGURATION.mdloses thepassages on what the catalog cache was keyed on.
ARCHITECTURE.mdshows the new constructors.No schema change, no migration, no new module, no API change.
Operator notes
Only matters where
cache.enabledis on. It is off by default inconfig/lightstack.yamland the chart.service_catalog:<project>:<host>) are never read again and expirewithin 24 hours. Nothing to do. To drop them at once:
redis-cli --scan --pattern 'lightstack:service_catalog:*' | xargs -r redis-cli del(adjust the prefix if
cache.key_prefixis not the default).cache:in the configuration file. The removed variablesnever did it.
Testing
RED first. Three tests issue a token, change the catalog, and read the next one: an endpoint created,
an endpoint deleted, the scheme changed. They failed on the old code with the cache on, against an
in-process Redis stand-in, and passed with it off. The stand-in left with the cache parameter; the tests
stay. A fourth test proves a partial read serves the built-in catalog.
make lint0 issues.make teston SQLite: all packages pass. On PostgreSQL two failures, both identicalwithout this change: Nova's seeded-project race (green with
-p 1), and Glance'sTestTaskListAndGetAreOwnerScoped, which trips on stale task rows in a long-lived test database.Contract suite on SQLite, stub mode: 341 pass, 12 skip, 1 fail, identical without this change. The
failure is stub Glance storage returning zero bytes.
Host runbook (
HOST_TESTING.md) with a real Redis and the cache on, one script against both builds:catalog showcatalog showLIGHTSTACK_ENDPOINT_SCHEME=https, Redis kepthttphttps*service_catalog*With the cache on,
openstack flavor showstill writeslightstack:flavor:<id>.The runs above are from 2026-11-25. On the tip:
go build ./..., and thekeystone,cmd/lightstack,middlewareandneutrontests on SQLite, pass.Not in this PR
/v3/regionsis not routed, soopenstack endpoint create --region RegionOne, as in the ticket'sHow to test, fails. The runbook uses commands that work.
GET /v3/endpoints/{id}is not routed (405), soopenstack endpoint deletefails before it sends theDELETE.test/contract/README.mdsaysOS_USER_DOMAIN_NAME=default. Domain names match case-sensitively, soevery contract test gets 401;
Defaultworks.🤖 Generated with Claude Code