{"action":"created","issue":{"url":"https://api.github.com/repos/grafana/tanka/issues/110","repository_url":"https://api.github.com/repos/grafana/tanka","labels_url":"https://api.github.com/repos/grafana/tanka/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/grafana/tanka/issues/110/comments","events_url":"https://api.github.com/repos/grafana/tanka/issues/110/events","html_url":"https://github.com/grafana/tanka/issues/110","id":523077118,"node_id":"MDU6SXNzdWU1MjMwNzcxMTg=","number":110,"title":"Document expected structure of Jsonnet output","user":{"login":"lawrencejones","id":3518874,"node_id":"MDQ6VXNlcjM1MTg4NzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/3518874?v=4","gravatar_id":"","url":"https://api.github.com/users/lawrencejones","html_url":"https://github.com/lawrencejones","followers_url":"https://api.github.com/users/lawrencejones/followers","following_url":"https://api.github.com/users/lawrencejones/following{/other_user}","gists_url":"https://api.github.com/users/lawrencejones/gists{/gist_id}","starred_url":"https://api.github.com/users/lawrencejones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lawrencejones/subscriptions","organizations_url":"https://api.github.com/users/lawrencejones/orgs","repos_url":"https://api.github.com/users/lawrencejones/repos","events_url":"https://api.github.com/users/lawrencejones/events{/privacy}","received_events_url":"https://api.github.com/users/lawrencejones/received_events","type":"User","site_admin":false},"labels":[{"id":1455501845,"node_id":"MDU6TGFiZWwxNDU1NTAxODQ1","url":"https://api.github.com/repos/grafana/tanka/labels/component/docs","name":"component/docs","color":"cfd3d7","default":false},{"id":1455501848,"node_id":"MDU6TGFiZWwxNDU1NTAxODQ4","url":"https://api.github.com/repos/grafana/tanka/labels/help%20wanted","name":"help wanted","color":"008672","default":true},{"id":1455501847,"node_id":"MDU6TGFiZWwxNDU1NTAxODQ3","url":"https://api.github.com/repos/grafana/tanka/labels/kind/enhancement","name":"kind/enhancement","color":"b0fcae","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2019-11-14T20:07:07Z","updated_at":"2019-11-14T20:41:13Z","closed_at":null,"author_association":"NONE","body":"Hi team,\r\n\r\nWe're trying out tanka for managing our core kubernetes cluster configuration but have hit a few roadbumps.\r\n\r\nMost of our problems appear to stem from lack of understanding about what type of object tanka is expecting your jsonnet to generate from the environments file.\r\n\r\nFrom looking at your examples, it appears the implicit expectation is that tanka will recursively descend your jsonnet structure, assuming that your structure is a tree with kubernetes object leaf nodes. So that assumes that you have one global object which is a map of string to object, where that object is either a kubernetes resource or another tree.\r\n\r\n```haskell\r\ndata Resource = Resource {\r\n  apiVersion :: String, kind :: String, metadata :: Metadata\r\n}\r\ndata Environment = Resource || [(string, Environment)]\r\n```\r\n\r\nIf this is so, it would be great to document it. I suspect we might be missing something though, as tanka panics when we construct several otherwise valid configs, such as:\r\n\r\n```\r\n{\r\n  a: {\r\n    apiVersion: 'v1',\r\n    kind: 'List',\r\n    items: [/* valid k8s resources */],\r\n  },\r\n  b: self.a,\r\n}\r\n```\r\n\r\nLacking a clear explanation about what this format is makes it difficult to adopt tanka as a tool. All the advertising says tanka is a great `function`, but we don't know what the type signature is.\r\n\r\nCan you help us out? Cheers."},"comment":{"url":"https://api.github.com/repos/grafana/tanka/issues/comments/554070267","html_url":"https://github.com/grafana/tanka/issues/110#issuecomment-554070267","issue_url":"https://api.github.com/repos/grafana/tanka/issues/110","id":554070267,"node_id":"MDEyOklzc3VlQ29tbWVudDU1NDA3MDI2Nw==","user":{"login":"sh0rez","id":26971117,"node_id":"MDQ6VXNlcjI2OTcxMTE3","avatar_url":"https://avatars0.githubusercontent.com/u/26971117?v=4","gravatar_id":"","url":"https://api.github.com/users/sh0rez","html_url":"https://github.com/sh0rez","followers_url":"https://api.github.com/users/sh0rez/followers","following_url":"https://api.github.com/users/sh0rez/following{/other_user}","gists_url":"https://api.github.com/users/sh0rez/gists{/gist_id}","starred_url":"https://api.github.com/users/sh0rez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sh0rez/subscriptions","organizations_url":"https://api.github.com/users/sh0rez/orgs","repos_url":"https://api.github.com/users/sh0rez/repos","events_url":"https://api.github.com/users/sh0rez/events{/privacy}","received_events_url":"https://api.github.com/users/sh0rez/received_events","type":"User","site_admin":false},"created_at":"2019-11-14T20:41:13Z","updated_at":"2019-11-14T20:41:13Z","author_association":"MEMBER","body":"Tanka should never ever panic, if there is an error it needs a good error message that helps the user debug.\r\n\r\nTbh, I haven't really thought about the `List` type so far, because I have not seen a lot of value in it. Still, your use-case seems valid and it makes sense to flatten it. Would that have any unexpected side-effects that might not be immediately obvious to the user? After all we are mutating THEIR objects here .. they give us a list and `tk show` would hide that fact.\r\n\r\nSo we could either go down the path you just proposed, or **discourage outputting lists**, as it disallows features like Targets. \r\n\r\nThis whole issue could btw be solved on the Jsonnet level but just flattening the list there ;)"}}
{"actor":{"display_login":"sh0rez"}}