Support bridge and manifests on different machines #18872
Replies: 2 comments 4 replies
-
@allisonkarlitskaya , @mvollmer : This is my initial brain dump and investigation. I'd appreciate some thoughts and feedback from you! This may also be a good sprint topic, but I'd like to have a place to put down notes. |
Beta Was this translation helpful? Give feedback.
-
So one quick note: my initial idea for dealing with the bridge configurations on the beiboot bridge was to send the bridge stanzas (in the format received from On the side of how to resolve conditions, I imagined one of two possibilities:
Both of those would necessarily require some kind of a change to the |
Beta Was this translation helpful? Give feedback.
-
Goal
We want to serve pages from the webserver (cockpit/ws container, bastion host,
flatpak), which is often not the target machine. The remote machine only gets
the bridge sent through beipack, but not the pages. This makes it difficult to
evaluate manifest conditions in the bridge, as manifests and bridge are not on
the same machine.
The main difficulty is to do this in a backwards-compatible manner: Connecting
from a RHEL 7 or Debian stable old Shell to latest bridge in e.g. Fedora 39
needs to work. Same for the opposite direction (new Shell to old bridge).
Status quo
The main interface between Shell and bridge is /manifests.json. It is currently
indexed by the resolved "name" (either directory basename or
name:
explicitlygiven in the manifest).
For e.g. c-ostree it looks like this:
The bridge currently resolves priorities, conditions, and conflicts, and the
resulting manifests.json just contains the one which wins. The shell displays
everything in the sent map, and does not have any checks to
conditionalize/ignore entries.
The dict key determines the URL of the navigation entry. Changing it to e.g.
updates-ostree
or simply prepending anx
to everything for testing, breaksthe menu entries. manifests cannot override this by adding
"name":
or"path":
.Option 1: Send everything in manifests.json, resolve in the Shell
Export all available manifests in unresolved form to
manifests.json
, and letthe shell resolve priorities, renames, conflicts, and conditions. Disambiguate
conflicts by changing the manifests.json key names to the directory names.
The bridge explicitly adds
name:
to all manifest entries, by and largeignores the keys, and computes the URLs using
name:
.This would be straightforward for lockstep bridge + shell, but completely
breaks backwards compatibility in both directions. It would also change the
page URLs (bookmarks, documentation), but that may be less of a concern.
For maintaining backwards capability, there are some options below. With all of
those we have to keep the bridge code for at least resolving name conflicts and
priorities for several years (which seems fine, it's not very expensive). We
can take out the Python bridge's condition evaluation (as that hasn't been
released yet).
Capabilities
The shell could announce that it is capable of interpreting this "new"
manifests format. This would be very clean and elegant:
However, this just gets sent to
ws
and not relayed, because ws starts thebridge first, and loads the shell from it:
In other words, there is no way to communicate capabilities from the shell
to the bridge.
Same for
cockpit.transport.options.system.version
-- that's the version ofthe bridge for the UI's benefit, it doesn't work the other way round due to the
way the session is started.
New manifests.json API
The bridge could start to offer a
/manifests-all.json
with that newstructure. If it receives it, it uses that and resolves it, otherwise it falls
back to
/manifests.json
.This is inelegant as it would commit us to the -all name forever. It's not a
big deal, but a bit "meh".
Alternatively, the
GET
request for manifests.json in the new Shell could adda header like
X-Cockpit-Manifest: no-resolve
. Then in a few years this couldjust become the default. But it's a lot more magic and error prone.
Option 2: Send manifests to the bridge for resolution
Introduce a new channel type or internal D-Bus service in the bridge which
receives the unresolved manifest (with the new structure from above), let the
bridge resolve everything, and return with a manifest dict of the current
format.
Then the shell itself could gather locally available pages (which it would have
to do anyway somehow for the flatpak/ws use case) and send them to the bridge.
If that API does not exist, then the remote system has an old bridge installed,
and the Shell can fall back to using
/manifests.json
as usual.Option 3: Include local manifests into beipacks
Send them along with the Python code, and add the path to
$XDG_DATA_DIRS
so that the bridge finds them. The main benefit is that it's (probably) the easiest implemenation and has no backwards compatiblity concern. This might be the best "quick solution" to get this functionality working before working on option 1.Option 4: Parallel implementation for ws-hosted pages
If the shell gets an empty result for
/manifests.json
, query/manifests-ws.json
instead (or in parallel). cockpit-ws delivers the locally bundled pages then, in the above new format. Then the shell can easily do the resolution itself.Beta Was this translation helpful? Give feedback.
All reactions