Skip to content

Commit

Permalink
Add function isMultiTenantAware()
Browse files Browse the repository at this point in the history
This function returns the given instance's `_metadata.multi_tenant`
parameter if it exists or false otherwise.
  • Loading branch information
simu committed Dec 19, 2024
1 parent af545ef commit f907e42
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions syn-teams.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@ local teams(includeOwner=false) =
];


/**
* \brief Check if component instance with the given name supports ArgoCD * multi-tenancy
*
* \arg instance the component instance
*
* \returns true if component sets `._metadata.multi_tenant=true`, false otherwise
*/
local isMultiTenantAware(instance) =
local ikey = appKeys(instance)[0];
local iparams = std.get(inv.parameters, ikey, {});
local imeta = std.get(iparams, '_metadata', {});
std.get(imeta, 'multi_tenant', false);

{
// Values
applicationTeamMap: applicationTeamMap,
Expand All @@ -183,4 +196,5 @@ local teams(includeOwner=false) =
teamForApplication: teamForApplication,
applicationsForTeam: applicationsForTeam,
teams: teams,
isMultiTenantAware: isMultiTenantAware,
}

0 comments on commit f907e42

Please sign in to comment.