-
Notifications
You must be signed in to change notification settings - Fork 53
feat: Add --driver kubernetes
#560
base: master
Are you sure you want to change the base?
Conversation
This runs the invocation image inside of a Kubernetes cluster.
5cd1969 to
0cb1f0a
Compare
|
| case "KUBE_CONTEXT": | ||
| d.KubeContext = v | ||
| case "VERBOSE": | ||
| d.Verbose = v == "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one took some thinking on a Saturday evening...
| opts := meta.ListOptions{ | ||
| LabelSelector: fmt.Sprintf("heritage=duffle,release=%s,revision=%s", op.Installation, op.Revision), | ||
| } | ||
| req, err := d.Client.CoreV1().Pods(d.Namespace).Watch(opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh, this makes it so much cleaner than having an informer + controller (which is the solution I used when I tried this, a few Kubernetes versions ago).
| // Unhandled cases are Unknown and Pending, both of which should | ||
| // cause the loop to spin. | ||
| case "Running", "Succeeded": | ||
| req.Stop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for waiting here is a bit confusing - as the comment when calling this function is // Waid for the pod to run to completion., but this waits for the pod to either be in Running or Succeeded state, it means the function returns when the pod first enters Running state.
I think I understand that we need to know when the pod is in Running state so we can stream the logs, but the wording here is a bit confusing.
|
This looks really great! Some inspiration for attaching to the pod and streaming logs (if anyone gets to working on this before the beginning of next week) - it's for an older Kubernetes version, so there might be a shiny new way to do this. |
|
Tried to use a bundle that requires credentials, in this case a file path: |
This runs the invocation image inside of a Kubernetes cluster.
Use
--driver kubernetesor--driver k8sto use this driver.The driver respects the following env vars:
It works by creating a secret and a pod.