Pod sequencing functionality for Kubernetes
Go to file
2017-09-27 12:25:14 +02:00
client Fixing service bug and switching go-client to v1.5.1 2017-02-10 16:25:26 +01:00
dependencies Extend functionality of kubernetes-entrypoint with adding namespace per service option. 2017-09-27 12:25:14 +02:00
doc Create roadmap. 2017-02-10 13:50:19 +01:00
entrypoint Extend functionality of kubernetes-entrypoint with adding namespace per service option. 2017-09-27 12:25:14 +02:00
Godeps Fixing service bug and switching go-client to v1.5.1 2017-02-10 16:25:26 +01:00
logger Fix daemonset dependency panic when POD_NAME is unset 2017-01-18 10:53:34 +01:00
mocks Extend functionality of kubernetes-entrypoint with adding namespace per service option. 2017-09-27 12:25:14 +02:00
util Extend functionality of kubernetes-entrypoint with adding namespace per service option. 2017-09-27 12:25:14 +02:00
vendor Fixing service bug and switching go-client to v1.5.1 2017-02-10 16:25:26 +01:00
.codeclimate.yml Adding vendor to exclude_paths 2017-01-18 14:00:39 +01:00
.gitignore Extend functionality of kubernetes-entrypoint with adding namespace per service option. 2017-09-27 12:25:14 +02:00
.travis.yml Upgrade Go version in Travis config 2017-02-08 17:50:32 +01:00
AUTHORS Add initial license/contribution files 2016-07-18 18:51:08 +02:00
CONTRIBUTING.md Add initial license/contribution files 2016-07-18 18:51:08 +02:00
DCO Add initial license/contribution files 2016-07-18 18:51:08 +02:00
kubernetes-entrypoint Extend functionality of kubernetes-entrypoint with adding namespace per service option. 2017-09-27 12:25:14 +02:00
kubernetes-entrypoint.go Extend functionality of kubernetes-entrypoint with adding namespace per service option. 2017-09-27 12:25:14 +02:00
LICENSE Add initial license/contribution files 2016-07-18 18:51:08 +02:00
NOTICE Add initial license/contribution files 2016-07-18 18:51:08 +02:00
README.md Extend functionality of kubernetes-entrypoint with adding namespace per service option. 2017-09-27 12:25:14 +02:00

Kubernetes Entrypoint

Build Status Container Repository on Quay Go Report Card

============

Kubernetes-entrypoint enables complex deployments on top of Kubernetes.

Overview

Kubernetes-entrypoint is meant to be used as a container entrypoint, which means it has to bundled in the container. Before launching the desired application, the entrypoint verifies and waits for all specified dependencies to be met.

The Kubernetes-entrypoint queries directly the Kubernetes API and each container is self-aware of its dependencies and their states. Therefore, no centralized orchestration layer is required to manage deployments and scenarios such as failure recovery or pod migration become easy.

Usage

Kubernetes-entrypoint reads the dependencies out of environment variables passed into a container. There is only one required environment variable "COMMAND" which specifies a command (arguments delimited by whitespace) which has to be executed when all dependencies are resolved:

COMMAND="sleep inf"

Kubernetes-entrypoint introduces a wide variety of dependencies which can be used to better orchestrate once deployment.

Latest features

Extending functionality of kubernetes-entrypoint by adding an ability to specify dependencies in different namespaces. The new format for writing dependencies is namespace:name. To ensure backward compatibility if the dependency name is without colon, it behaves just like in previous versions so it esumes that dependecies is running at the same namespace as kubernetes-entrypoint. This feature is not implemented for container, config and socket dependency because in such cases the different namespace is irrelevant.

For instance: DEPENDENCY_SERVICE=mysql:mariadb,keystone-api

The new entrypoint will resolve mariadb in mysql namespace and keystone-api in the same namespace as entrypoint was deployed in.

Supported types of dependencies

All dependencies are passed as environement variables in format of DEPENDENCY_<NAME> delimited by colon. For dependencies to be effective please use readiness probes for all containers.

Service

Checks whether given kubernetes service has at least one endpoint. Example:

DEPENDENCY_SERVICE=mariadb,keystone-api

Container

Within a pod composed of multiple containers, it waits for the containers specified by their names to start. This dependency requires a POD_NAME environement variable which can be easily passed through the downward api. Example:

DEPENDENCY_CONTAINER=nova-libvirt,virtlogd

Daemonset

Checks if a specified daemonset is already running on the same host, this dependency requires a POD_NAME env which can be easily passed through the downward api. The POD_NAME variable is mandatory and is used to resolve dependencies. Example:

DEPENDENCY_DAEMONSET=openvswitch-agent

Simple example how to use downward API to get POD_NAME can be found here.

Job

Checks if a given job succeded at least once. Example:

DEPENDENCY_JOBS=nova-init,neutron-init

Config

This dependency performs a container level templating of configuration files. It can template an ip address {{ .IP }} and hostname {{ .HOSTNAME }}. Templated config has to be stored in an arbitrary directory /configmaps/<name_of_file>/<name_of_file>. This dependency requires INTERFACE_NAME environment variable to know which interface to use for obtain ip address. Example:

DEPENDENCY_CONFIG=/etc/nova/nova.conf

The Kubernetes-entrypoint will look for the configuration file /configmaps/nova.conf/nova.conf, template {{ .IP }} and {{ .HOSTNAME }} tags and save the file as /etc/nova/nova.conf.

Socket

Checks whether a given file exists and container has rights to read it. Example:

DEPENDENCY_SOCKET=/var/run/openvswitch/ovs.socket

Image

Build process for image is trigged after each commit. Can be found here, and pulled by executing: docker pull quay.io/stackanetes/kubernetes-entrypoint:v0.1.0

Examples

Stackanetes uses kubernetes-entrypoint to manage dependencies when deploying OpenStack on Kubernetes.