koki / short

Manageable Kubernetes manifests through a composable, reusable syntax
https://docs.koki.io/short
Apache License 2.0
122 stars 14 forks source link

Replication Controller with empty Pod Template Panics #92

Closed wlan0 closed 6 years ago

wlan0 commented 6 years ago

If I pass this file to short

apiVersion: v1
kind: ReplicationController
metadata:
  name: meta_test
  labels:
    app: meta_test
  annotations:
    meta: _test 
  namespace: test
  clusterName: test_cluster

This happens

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xd72087]

goroutine 1 [running]:
github.com/koki/short/types.RCTemplateMetadataFromPod(0x0, 0xc420362840)
        /home/wlan0/code/go/src/github.com/koki/short/types/replicationcontroller.go:71 +0xb7
github.com/koki/short/types.(*ReplicationController).SetTemplate(0xc4201db500, 0x0)
        /home/wlan0/code/go/src/github.com/koki/short/types/replicationcontroller.go:84 +0x2f
github.com/koki/short/converter/converters.Convert_Kube_v1_ReplicationController_to_Koki_ReplicationController(0xc420362840, 0x88, 0x8, 0x0)
        /home/wlan0/code/go/src/github.com/koki/short/converter/converters/kube_v1_rc_to_koki_rc.go:31 +0x13e
github.com/koki/short/converter.DetectAndConvertFromKubeObj(0x1832060, 0xc420362840, 0xc420362840, 0x0, 0x0, 0xc4201db968)
        /home/wlan0/code/go/src/github.com/koki/short/converter/koki_converter.go:49 +0x5df
github.com/koki/short/converter.ConvertToKokiNative(0xc4200c2880, 0x1, 0x1, 0x1, 0xc4200c2880, 0x1, 0x1, 0x0)
        /home/wlan0/code/go/src/github.com/koki/short/converter/converter.go:37 +0xa6
github.com/koki/short/cmd.short(0x1825de0, 0xc4201f23c0, 0x0, 0x2, 0xc420093c20, 0x1012573)
        /home/wlan0/code/go/src/github.com/koki/short/cmd/root_cmd.go:177 +0xc74
github.com/koki/short/cmd.glob..func1(0x1825de0, 0xc4201f23c0, 0x0, 0x2, 0x0, 0x0)
        /home/wlan0/code/go/src/github.com/koki/short/cmd/root_cmd.go:28 +0x59
github.com/koki/short/vendor/github.com/spf13/cobra.(*Command).execute(0x1825de0, 0xc4200102b0, 0x2, 0x2, 0x1825de0, 0xc4200102b0)
        /home/wlan0/code/go/src/github.com/koki/short/vendor/github.com/spf13/cobra/command.go:698 +0x47b
github.com/koki/short/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x1825de0, 0x1825bc0, 0x0, 0x0)
        /home/wlan0/code/go/src/github.com/koki/short/vendor/github.com/spf13/cobra/command.go:783 +0x349
github.com/koki/short/vendor/github.com/spf13/cobra.(*Command).Execute(0x1825de0, 0xc4200001a0, 0xc4200001a0)
        /home/wlan0/code/go/src/github.com/koki/short/vendor/github.com/spf13/cobra/command.go:736 +0x2b
main.main()
        /home/wlan0/code/go/src/github.com/koki/short/main.go:10 +0x2d