Giter VIP home page Giter VIP logo

nova-kubernetes-drain's Introduction

nova-kubernetes-drain

Build Status Container Repository on Quay Go Report Card

The main goal of Nova-kubernetes-drain is to perform live-evacuation of OpenStack compute node when Kubernetes node is being drained. Nova-kubernetes-drain should be deployed as a Daemonset via Stackanetes.

Nova-kubernetes-drain can be run as a daemon or as one-off task. Those two modes are simple configure by command line flag.

Requirements

Nova-kubernetes-drain is based on the following clients:

  1. Kubernetes client: https://godoc.org/k8s.io/kubernetes/pkg/client/unversioned
  2. OpenStack client*: http://gophercloud.io/docs/compute/

* Rackspace client is deprecated, but the new client currently does not support live-migration. The Client should be switched when the client supports live-migration.

Configuration file

Nova-kubernetes-drain requires a configuration file, by default named config.yaml. Configuration file should contain all variables necessary to establish connection with openstack. config.yaml example:

IdentityEndpoint: "http://keystone-api:5000/v3/"
Username: "admin"
Password: "mysupersecretpassword"
TenantName: "admin"
DomainID: "default"

Run once

Run once is the default mode. To perform an evacuation, simply run the application without any additional flags. Flag -config-path is optional. Once the evacuation is successful, the application will exit without any error code.

To run it:

./drainer -config-path=<configuration-file-name>

The application will execute following actions:

  1. Get authorization data from configuration file.
  2. Determine the name of the running hypervisor in OpenStack.
  3. Disable scheduling of VMs on this node in OpenStack.
  4. Identify all VMs on this node.
  5. Trigger a live-migration.
  6. Exit the application if all VMs are migrated or timeout is reached.

Daemon

To run Nova-kubernetes-drain as a daemon. One has to pass additional -daemon flag.

./drainer -daemon -config-path=<configuration-file-name>

In this mode, the application will wait for specific Kubernetes events to take actions. A Kubernetes drain operation will disable scheduling of new VMs and perform live-evacuation of the currently running VMs. On the other hand, a Kubernetes uncordon operation will re-enable the scheduling.

Lifecycle of the application:

  1. Load Openstack authorization variables from file.
  2. Hook to Kubernetes event stream and wait for proper events.
  3. According to the event message, trigger the appropriate operation:
    1. Unschedulable event received:
      1. Disable nova-compute in Openstack.
      2. Identify all VMs on this nova-compute node.
      3. Trigger live-migration for each of those VMs.
    2. Schedulable event received:
      1. Enable nova-compute in Openstack.

nova-kubernetes-drain's People

Contributors

dtadrzak avatar quentin-m avatar ss7pro avatar

Watchers

James Cloos avatar Brandon B. Jozsa avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.