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

volume shorts #94

Closed wlan0 closed 6 years ago

wlan0 commented 6 years ago

https://gist.github.com/wlan0/44dafc38822d32430f8933e636dc5925

ublubu commented 6 years ago
  volumes:
  - $name: $type:$selector
    ...

It's hard to pick out which key is the $name, since each volume entry could contain keys from any type of VolumeSource. If we kept a list of every key from every VolumeSource, then any key not in that list could be interpreted as $name, but I don't think that's good enough.

Since volume names are unique within a pod, volumes could be a dictionary:

  volumes:
    $name:
      type: $type:$selector
      ...

Thoughts? I'm not sure I like calling the field type, since it also includes instance-specific info like volume ID, but I haven't thought of a better key.

ublubu commented 6 years ago

Discussed offline with @wlan0.

volumes will be a dictionary. Each value (key is $name) will be either a string or a dictionary:

$name: $type:$selector

#or

$name:
  vol_type: $type
  vol_name: $selector
  ...
ublubu commented 6 years ago

downward API

$name:
  items:
    $pathToFile0:
      field: $fieldPath:$apiVersion # apiVersion is optional
      mode: $mode #optional
    $pathToFile1:
      resource: $containerName:$resource:$divisor # divisor is optional
      mode: $mode #optional
  mode: 0644 # default mode, optional
  vol_type: downward-api
ublubu commented 6 years ago

projected volume

$name:
  sources:
  - secret: $secretName
    items: $items # same format as secret volume spec
    required: $required # optional
  - config: $configName
    items: $items # same format as config-map volume spec
    required: $required # optional
  - items: $items # downward_api, same format as downward_api volume spec
  mode: 0644 # default mode, optional
  vol_type: projected