Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

CLI should support temporarily ejecting an instance #1641

Open
shamsimam opened this issue Sep 2, 2022 · 0 comments
Open

CLI should support temporarily ejecting an instance #1641

shamsimam opened this issue Sep 2, 2022 · 0 comments
Labels
capstone-2022 Capstone Project cli core Changes to Waiter router CLojure code enhancement

Comments

@shamsimam
Copy link
Contributor

The Waiter CLI should expose a subcommand to temporarily (timeout flag) ejecting a specific instance.
Alternatively, we can expose ejecting and unejecting an instance.

There should be a mechanism to select instances.

In addition to marking the instance as ejected, it also needs to be tracked as an ejected instance in the responder.
Sample code that updates an annotation in a Kubernetes pod:

(defn mark-pod-for-ejection
  "Marks the pod for ejection  that marks the resulting instance with the flag :ejected."
  [{:keys [api-server-url] :as scheduler} {:keys [id] :as instance}]
  (let [pod-url (instance->pod-url api-server-url instance)]
    (log/info "marking instance for scale down" {:instance-id id})
    (patch-object-json pod-url
                       [;; The backslash becomes "~1" so "waiter/prepared-to-scale-down-at" becomes "waiter~1prepared-to-scale-down-at"
                        ;; Source https://stackoverflow.com/questions/55573724/create-a-patch-to-add-a-kubernetes-annotation
                        ;; Here is the RFC-6901 reference https://www.rfc-editor.org/rfc/rfc6901#section-3
                        {:op :add :path "/metadata/annotations/waiter~1pod-ejected" :value "true"}]
                       scheduler)))
@shamsimam shamsimam added enhancement cli capstone-2022 Capstone Project core Changes to Waiter router CLojure code labels Sep 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
capstone-2022 Capstone Project cli core Changes to Waiter router CLojure code enhancement
Projects
None yet
Development

No branches or pull requests

1 participant