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

Ports Short syntax #37

Closed wlan0 closed 6 years ago

wlan0 commented 6 years ago

This should be implemented for all resources that expose ports

The conversion should be

expose:
     -  name: 
        $protocol://$ip:$host_port:$container_port

default protocol is TCP, and therefore, we do not need to print it if it is TCP.

Similarly, we do not print ://$ip if the $ip is not set.

so, the syntax should look like

expose:
  - 8080:80
  - UDP://127.0.0.1:8080:80
  - 10.10.0.53:8081:9090
  - 192.168.1.2:8090:80
    name: port_name

While converting to kube native type, if protocol is TCP, do not set it. It is the default, and it only makes the file worse to read.