Repository navigation
Description
Per UX review ( @steren @qelo ):
The API allows an N:N relation between Services and {Archetypes, Revisions}. This can be confusing to users and can be difficult to represent in user interfaces. Broken down:
N-1:
- one Archetype can be used by multiple services,
- a Revision can be referenced by multiple services.
Why is this a problem for the UI? The desire in the UI is to start with the main Services view and make things accessible from there, e.g. inside a service you see its revisions etc. However, this hierarchy is a lie compared to API and this creates incompatibilities and issues, e.g.:
Let’s say I have an Archetype without a Service (created via API or whatever) -- where in the UI I could see it? We would need a new “Archetypes” view, separate from our main “Services” view, which could be distracting to customers.
Let’s say I want to show details of a particular Revision. Assume the user got there from service X. I’d like to show the Revision in the context of X, and just say that the Revision is serving 50% for X, or is accessible at this URL etc. However, to fully show Revision details, the UI would need to determine that the Revision is also serving for unrelated service Y, or is routable with a different URL for service Z. This is magnified if you can reach the Revision from other paths, such as Archetype view or a Revision list view.
When a customer drills down to a Service, they want to be able to see a list of Revisions related to this service. If N:N relationships are present (and it can be difficult to determine if that is the case without a full list of resources in the namespace), it is difficult to suggest a query to find the relevant Revisions.
1-N: A service can use multiple Archetypes. This is another source of complexity:
We expect that the UI displays a single list of revisions (probably sorted by creation date). If these Revisions have been created by different Archetype, then displaying a single list might not map to the mental model of our users (they might consider them to in fact be multiple independent histories). Displaying multiple revision lists for a given Service complexifies the UI.
Activity
evankanderson commentedon Feb 3, 2018
My initial take:
It's easier to relax restrictions later, so I'm sympathetic to attempting to restrict this relationship to 1:1 between Service and Archetype at the moment.
One idea for how to do this (which would also simplify the initial deployment experience to a single API call):
This would turn around and create an ElaService like the following:
We could even set
metadata.ownerReferenceon either the Archetype or the ElaService if we want to perform automatic garbage collection when the other is deleted.Two concerns about this solution:
metadata.ownerReferencemanagement?metadata.ownerReference, which way should the ownership go? If we think that 1:N from ElaService to Archetype is the most common pattern (e.g. an experimental/rewrite release train and the main production train off the same DNS name) and we think that ElaService is the top-level concept that customers will think of, then it would make sense to make the Service own the Archetype. (Obviously, in complex scenarios, customers could simply remove the ownerReferences completely to avoid garbage collection.)dewitt commentedon Feb 3, 2018
If we wanted to go all in on the 1:1 relationship, we could address the naming problem of 'Archetype' (see issue #65) at the same time by inlining it into ElaService entirely.
mattmoor commentedon Feb 3, 2018
I like the separation we have, and leaving the door open to relaxing this later.
What we have supports a lot of interesting scenarios, without significantly complicating the 99% case (IMO).
I think that UX changes a lot over time, based on how folks use the product, so I'd rather not tie ourselves too closely to a particular model.
qelo commentedon Feb 3, 2018
+1 to @dewitt, that would be the most elegant way to maintain 1:1 and would avoid all the confusion coming from a separate object
Would be harder to relax back to n-n in the future, but: what if we embraced ElaService composition instead?
Like: You wanted two Archetypes? Just have two sub-services and route between them using other Ela primitives (we can design those separately, like a service that just splits traffic between other services).
I think service composition is a very powerful model, because we still allow for very sophisticated configurations/graphs, while the mental model of basic building blocks remains simple.
Otherwise, I like the approach that @evankanderson is exploring, but we will run into the number of problems:
vaikas commentedon Feb 3, 2018
mikehelmick commentedon Feb 5, 2018
The decoupling here between ElaService and Archetype is the least restrictive for future expansion and we should prefer keeping this separation in the API. The original inclusion of everything included in the Archetype in the service definition was indeed complicated, another reason for maintaining the separation.
For the future N:M case, if we go there, garbage collection may or may not be necessary or even desirable. There are configurations where and archetype could become temporarily orphaned. Detecting orphaned ElaService and/or Archetype objects could be easily done and clearly reflected in the status of the object. If we end up going that direction, l can see how we could go to configurable garbage collection for these entities.
The lack of explicit service creation isn't without precedent. Google App Engine services are created by creating the first version of that service. There is a nice parallel here with the ElaService being created by the creation of the Archetype. The user intent is the same. I want to create a new service, but the creation of a service without something to run isn't necessarily meaningful. I don't find creating the ElaService through the creation of the Archetype to be a problem in that respect, it ensures that the service has a way for revisions to be created.
evankanderson commentedon Feb 5, 2018
Pulling out and cleaning up the doc referenced by @vaikas-google; this is re-treading existing territory, but new people have entered the discussion with new opinions. The double goal here is to satisfy their concerns and to document the decision for future generations. :-)
evankanderson commentedon Feb 5, 2018
I did a little wire-framing of a possible UI treatment to address some of @qelo 's concerns. The idea is that the basic UI would (like the CLI) rely on a few conventions to cover the 98% case, and then have a more complete and complex UI which would expose all the concepts available for both the 2% case and for users who were curious about the underlying system architecture.
In the basic view, the system would display a list of Services with several workflows available based on the existence of the corresponding Archetype (e.g. "redeploy source", "update settings", etc). If the corresponding (same name) Archetype does not exist, the UI would degrade gracefully by offering a link to the Advanced view. Over time, the "same name" condition could be relaxed in cases where there was a single Archetype with a different name from the service, but this might not be desirable, as it might put an equivalent burden on other tools.

In the Advanced View, each resource would be represented graphically. Services and Archetypes (and their corresponding Revision histories) would be connected via "sends traffic to" arrows to represent arbitrarily complex configurations. While more accurate to the underlying resources, this view would require users to understand all three of the resource concepts in the API. I also forgot to draw the blue "deploy" button on Archetypes in these mocks. (oops!)

Note that both of these designs use a "stacked file" icon to represent the set of Revisions descended from an Archetype (see #65 for possible renaming), as I found that it was somewhat difficult to create individual graphical representations of all existing Revisions. For the Advanced view, it would be possible to have the actual live Revisions present as a third column in the UI; it would be expected that a single Service might link to 10 revisions (possibly via Archetype
latestReadyRevisionNamereference), but the number would typically be bounded even smaller than that.evankanderson commentedon Feb 5, 2018
Some example scenarios for each direction of 1:N and N:1 between Service and Archetype:
1:N
N:1
These are slightly more esoteric; I've done these in previous production environments by slipping a separate load-balancer in front to provide the additional naming.
18 remaining items
cooperneil commentedon Feb 9, 2018
@dewitt, yep exactly - nice illustration. Borrowed this to help explain the rationale for a separate Archetype resource in issue #102
mchmarny commentedon Feb 9, 2018
Capturing decision from today's sync on this:
Will close this issue when the related PRs are committed to master.
evankanderson commentedon Feb 9, 2018
Details on proposed implementation:
(via validation prior to etcd commit)
For each Revision directly or indirectly referenced in the Route configuration, look up the Configuration from
Revision.metadata.labels[elafros.dev/configuration]. The Route should then ensure that (for each such Configuration), theConfiguration.metadata.labels[elafros.dev/route]label is either non-existent, or points to this Route. If the label is non-existent, update the Configuration to point theelafros.dev/routelabel to this Route.grantr commentedon Feb 12, 2018
I'm just catching up to the latest on this, so forgive me if this isn't relevant, but was there consideration of whether this automatic ownership field should be part of the Route Status instead of Labels? I don't have an argument either way, but I'd like to see the reasoning documented.
Relevant k8s docs:
https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#references-to-related-objects
evankanderson commentedon Feb 12, 2018
Two reasons why I'd suggested a label (I'd originally thought annotation):
It may be convenient for the UI to be able to list all the Configurations that a Route points to using a label query rather than needing to perform the scatter/gather across referenced Revisions.
We're not 100% sure whether this restriction rules out important use cases. Since it's easier to expand an API than restrict it*, I'd thought that implementing this restriction in a label might avoid making schema changes which would need to be backed out later.
I'm not sure either of these is strongly compelling, so we could do this as a Status field as well.
jurekPapiorek commentedon Feb 13, 2018
I'd like to understand argument 1) better, as I've seen it used in other contexts too.
API clients will want to filter by many different attributes of Elafros resource objects - some of them will belong to the spec, some to the status, some could be labels. Is converting all filterable attributes into labels the only solution that k8s provides for filtering?
evankanderson commentedon Feb 13, 2018
mattmoor commentedon Mar 15, 2018
I believe this is now done. We set labels on
Configurations that are used in aRoute:elafros.dev/route: <route name>Auto-update dependencies (knative#63)