update(schemas): relax environment id requirement in service upgraded#309
update(schemas): relax environment id requirement in service upgraded#309xibz wants to merge 1 commit into
Conversation
|
An environment in the target place where a service can be deployed (aka VPC, k8s cluster, Nomad cluster, maybe a namespace in a cluster). Often, teams have a naming convention to identify environments in their infrastructure, using a separator ( The field is TBH, in my use case, I don't have any environment subjects (tools extrapolate the existence from the relation), I used "environment" to point to named cluster. The audience (dev, prod, demo) is part of the id.
IMHO, introducing |
This fix addresses the docs saying each service event includes environments, but only has `id` and `source`. This fix ensures that the events match the docs. Signed-off-by: xibz <bjp@apple.com>
Problem
The
environmentobject inserviceUpgraded(and related service events) currently requires anidfield. This creates a real-world problem for CD tools that have no concept of a named environment, but they are forced to populateidwith a meaningless placeholder like"n/a".Environment vs. Cluster conflation
Many CD tools (e.g. Spinnaker) operate at the cluster or namespace level, not the environment level. In these systems, a deployment target is a:
cluster — a concrete infrastructure resource — not an abstract environment like "production" or "staging". These concepts are often conflated:
us-east-1-prodandeu-west-1-prod, both of which are "production" environments, but represented asdistinct clusters with no shared environment identifier.
prod,nonprod) with no stable ID to reference.Requiring
idforces these tools to either fabricate an identifier or skip the field entirely by violating the schema, neither of which is useful for consumers of the event. We need to be VERY clear on what is an environment and what is a cluster or target. Blending environment to mean cluster is ambiguous. This is out of scope for this PR, but needs to be addressed in the future, see #310Changes
namefield to theenvironmentobject withx-suggested-values: [prod, nonprod, unknown]to provide loose governance withoutrestricting the field to an enum.
required: [id]constraint toanyOf: [{required: [id]}, {required: [name]}], so producers must supply at least one ofidornamebut not necessarily both.This allows tools like Spinnaker to emit a meaningful
name(e.g."prod") without needing a stable environmentid, while tools that do have environment IDs continue to work as before.