Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend allInstances with the component names for instantiated compo…
Browse files Browse the repository at this point in the history
…nents

The design doc (SDD-0030) specifies that entries in `syn.<team>.instances`
must be component instances.

However, Commodore doesn't require that instance-aware components generate
an ArgoCD application per instance, and some existing components generate a
single ArgoCD application for all their instances.

For such components, individual instances can't be assigned to a team, but
the whole component can be assigned.

To accommodate this design choice, we keep both the instance and
component names in `allInstances` for instantiated components. This
ensures that library consumers can correctly look up the team for a
component which generates a single ArgoCD application for all instances.
simu committed Jan 8, 2025
1 parent aa01ebc commit b7cd6f4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions syn-teams.libsonnet
Original file line number Diff line number Diff line change
@@ -60,10 +60,15 @@ local appKeys(name, raw=false) =

// Extract all instances from `inv.applications`.
// The design doc (SDD-0030) specifies that entries in `syn.<team>.instances`
// must be component instances, so we don't need to worry about the component
// name for instantiated components.
// must be component instances.
// However, Commodore doesn't require that instance-aware components generate
// an ArgoCD application per instance, and some existing components generate a
// single ArgoCD application for all their instances. For such components,
// individual instances can't be assigned to a team, but the whole component
// can be assigned. To accommodate this design choice, we keep both the
// instance and component name in allInstances for instantiated components.
local allInstances = std.set(
std.map(function(app) appKeys(app, true)[0], inv.applications)
std.flattenArrays(std.map(function(app) appKeys(app, true), inv.applications))
);


0 comments on commit b7cd6f4

Please sign in to comment.