-
Trying to do something like this: local kap = import 'lib/kapitan.libjsonnet';
local inv = kap.inventory();
local projects = {
projects: inv.parameters.projects + inv.parameters.service_accounts,
};
{
namespaces: projects,
} How can i make it ignore the possible absence of inv.parameters.service_accounts and compile it properly? |
Beta Was this translation helpful? Give feedback.
Answered by
owlzq1
Mar 19, 2021
Replies: 1 comment
-
@ademariag suggested to look into utils.libjsonnet in kapitan-reference for the objectGet helper function. from kapitan.inputs.kadet import BaseObj, inventory
inv = inventory()
class Namespaces(BaseObj):
def body(self):
self.root.projects = inv.parameters.projects
if inv.parameters.service_accounts:
self.root.service_accounts = inv.parameters.service_accounts
def main():
obj = BaseObj()
obj.root.namespaces = Namespaces()
return obj |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ademariag
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ademariag suggested to look into utils.libjsonnet in kapitan-reference for the objectGet helper function.
But i decided to switch the component to kadet, where this issue solves more easily. Here is the snippet: