Skip to content

join multiple target keys if they exist and compile into one file with jsonnet. #716

Answered by owlzq1
owlzq1 asked this question in Q&A
Discussion options

You must be logged in to vote

@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:

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

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ademariag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant