{"action":"created","issue":{"url":"https://api.github.com/repos/shyiko/kubetpl/issues/8","repository_url":"https://api.github.com/repos/shyiko/kubetpl","labels_url":"https://api.github.com/repos/shyiko/kubetpl/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/shyiko/kubetpl/issues/8/comments","events_url":"https://api.github.com/repos/shyiko/kubetpl/issues/8/events","html_url":"https://github.com/shyiko/kubetpl/issues/8","id":341307518,"node_id":"MDU6SXNzdWUzNDEzMDc1MTg=","number":8,"title":"Avoid `- null` values on templating.","user":{"login":"stafot","id":2853082,"node_id":"MDQ6VXNlcjI4NTMwODI=","avatar_url":"https://avatars3.githubusercontent.com/u/2853082?v=4","gravatar_id":"","url":"https://api.github.com/users/stafot","html_url":"https://github.com/stafot","followers_url":"https://api.github.com/users/stafot/followers","following_url":"https://api.github.com/users/stafot/following{/other_user}","gists_url":"https://api.github.com/users/stafot/gists{/gist_id}","starred_url":"https://api.github.com/users/stafot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stafot/subscriptions","organizations_url":"https://api.github.com/users/stafot/orgs","repos_url":"https://api.github.com/users/stafot/repos","events_url":"https://api.github.com/users/stafot/events{/privacy}","received_events_url":"https://api.github.com/users/stafot/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-15T09:41:40Z","updated_at":"2018-07-15T19:53:17Z","closed_at":"2018-07-15T19:53:17Z","author_association":"NONE","body":"I am not sure if the issue I will point is a minor bug or a feature request. Anyway I am using your `Kind: Template`  way of templating,  and in cases that I have non-required ENVs `kubetpl` adds `- null` value for the non-declared ENVs. This output cannot passed directly to `kubectl` as this output is not a valid input. \r\nMy simple workaround for this case was to add a `sed` pipe (`sed '/- null/d'`) in the middle that deletes all lines that have `- null` value and this way I produce a valid input which can be passed to `kubectl create -f -`\r\nExample to reproduce: \r\n```\r\n# kubetpl:syntax:template-kind\r\n\r\nkind: Template\r\napiVersion: v1\r\nmetadata:\r\n  name: dummy-yiic-template\r\n  annotations:\r\n    description: dummyyiic one off template\r\nobjects:\r\n- apiVersion: batch/v1\r\n  kind: Job\r\n  metadata:\r\n    name: dummyoneoff-$(COMMAND)\r\n  spec:\r\n   backoffLimit: 5\r\n   activeDeadlineSeconds: 600\r\n   template:\r\n     metadata:\r\n       name: dummyoneoff-$(COMMAND)\r\n       # These are the labels that pods will be given when created via this Job\r\n       labels:\r\n        app: dummy\r\n        tier: cli\r\n        framework: yii\r\n        version: $(BRANCH_AND_VERSION)\r\n     spec:\r\n\r\n       containers:\r\n       - name: yiic\r\n         image: dummy/dummy_fpm\r\n         imagePullPolicy: IfNotPresent\r\n         volumeMounts:\r\n         - name: app-volume\r\n           mountPath: /var/www/dummy\r\n         resources:\r\n           requests:\r\n             cpu: $(CPU_REQUEST)\r\n             memory: $(MEM_REQUEST)\r\n           limits:\r\n             cpu: $(CPU_LIMIT)\r\n             memory: $(MEM_LIMIT)\r\n         envFrom:\r\n         - configMapRef:\r\n             name: dummy\r\n         - secretRef:\r\n             name: dummy\r\n         command: [\"./yiic\", $(COMMAND), $(ACTION), $(ARGS)]\r\n       restartPolicy: Never\r\n       volumes:\r\n       - name: app-volume\r\n         emptyDir: {}\r\nparameters:\r\n- name: BRANCH_AND_VERSION\r\n  description: Branch and Version\r\n  required: true\r\n  parameterType: string\r\n- name: REPLICAS\r\n  description: Number of replicas\r\n  value: 1\r\n  required: true\r\n  parameterType: int\r\n- name: CPU_REQUEST\r\n  description: CPU Request\r\n  required: true\r\n  value: \"200m\"\r\n  parameterType: string\r\n- name: CPU_LIMIT\r\n  description: CPU Limit\r\n  required: true\r\n  value: 1\r\n  parameterType: string\r\n- name: MEM_REQUEST\r\n  description: Memory Request\r\n  required: true\r\n  value: \"256Mi\"\r\n  parameterType: string\r\n- name: MEM_LIMIT\r\n  description: Memory Limit\r\n  required: true\r\n  value: \"1Gi\"\r\n  parameterType: string\r\n- name: COMMAND\r\n  description: Command\r\n  parameterType: string\r\n- name: ACTION\r\n  description: Action\r\n  parameterType: string\r\n- name: ARGS\r\n  description: Arguments\r\n  parameterType: string\r\n```\r\n\r\nFails:\r\n\r\n`kubetpl render dummy-oneoff-yiic-template.yml -s BRANCH_AND_VERSION=test.yolo -s COMMAND=devops -s ACTION=demo | kubectl create -f -`\r\n`error: error validating \"STDIN\": error validating data: ValidationError(Job.spec.template.spec.containers[0].command): unknown object type \"nil\" in Job.spec.template.spec.containers[0].command[3]; if you choose to ignore these errors, turn validation off with --validate=false`\r\n\r\nSucceed:\r\n\r\n` kubetpl render dummy-oneoff-yiic-template.yml -s BRANCH_AND_VERSION=test.yolo -s COMMAND=devops -s ACTION=demo |  sed '/- null/d'  | kubectl create -f -`\r\n`job.batch \"dummyoneoff-devops\" created`\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/shyiko/kubetpl/issues/comments/405113939","html_url":"https://github.com/shyiko/kubetpl/issues/8#issuecomment-405113939","issue_url":"https://api.github.com/repos/shyiko/kubetpl/issues/8","id":405113939,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTExMzkzOQ==","user":{"login":"shyiko","id":370176,"node_id":"MDQ6VXNlcjM3MDE3Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/370176?v=4","gravatar_id":"","url":"https://api.github.com/users/shyiko","html_url":"https://github.com/shyiko","followers_url":"https://api.github.com/users/shyiko/followers","following_url":"https://api.github.com/users/shyiko/following{/other_user}","gists_url":"https://api.github.com/users/shyiko/gists{/gist_id}","starred_url":"https://api.github.com/users/shyiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shyiko/subscriptions","organizations_url":"https://api.github.com/users/shyiko/orgs","repos_url":"https://api.github.com/users/shyiko/repos","events_url":"https://api.github.com/users/shyiko/events{/privacy}","received_events_url":"https://api.github.com/users/shyiko/received_events","type":"User","site_admin":false},"created_at":"2018-07-15T19:53:17Z","updated_at":"2018-07-15T19:53:17Z","author_association":"OWNER","body":"Fixed in [0.7.0](https://github.com/shyiko/kubetpl/blob/master/CHANGELOG.md#070---2018-07-15) :balloon: "}}
{"actor":{"display_login":"shyiko"}}