habitat-operator

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2017 License: Apache-2.0

README

Build Status Go Report Card

habitat-operator

This project is currently unstable - breaking changes may still land in the future.

Overview

The Habitat operator is a Kubernetes controller designed to solve running and auto-managing Habitat Services on Kubernetes. It does this by making use of Custom Resource Definitions.

To learn more about Habitat, please visit the Habitat website.

For a more detailed description of the Habitat operator API have a look at the API documentation.

Prerequisites

  • Habitat >= 0.36.0
  • Kubernetes >= 1.7.0.

Installing

go get -u github.com/kinvolk/habitat-operator/cmd/habitat-operator

Usage

Running outside of a Kubernetes cluster

Start the Habitat operator by running:

habitat-operator --kubeconfig ~/.kube/config
Running inside a Kubernetes cluster
Building image from source

First build the image:

make image

This will produce a kinvolk/habitat-operator image, which can then be deployed to your cluster.

The name of the generated docker image can be changed with an IMAGE variable, for example make image IMAGE=mycorp/my-habitat-operator. If the habitat-operator name is fine, then a REPO variable can be used like make image REPO=mycorp to generate the mycorp/habitat-operator image. Use the TAG variable to change the tag to something else (the default value is taken from git describe --tags --always) and a HUB variable to avoid using the default docker hub.

Using release image

Habitat operator images are located here, they are tagged with the release version.

Deploying Habitat operator

To deploy the operator inside the Kubernetes cluster use the Deployment manifest file located under the examples directory:

kubectl create -f examples/habitat-operator-deployment.yml
Deploying an example

To create an example service run:

kubectl create -f examples/standalone/habitat.yml

This will create a single-pod deployment of an nginx Habitat service. More examples are located in the example directory.

Contributing

Dependency management

This project uses go dep for dependency management.

If you add, remove or change an import, run:

dep ensure
Testing

To run unit tests locally, run:

make test

To run end-to-end tests locally you need to have minikube up and running. After that just run:

make TESTIMAGE=YOUR_OPERATOR_IMAGE e2e

Clean up after the tests with:

make clean-test

Directories

Path Synopsis
cmd
pkg
habitat/client
Package client wraps the `rest` package's client.
Package client wraps the `rest` package's client.
test
e2e/framework
Package framework sets up the test framework needed to run the end-to-end tests on Kubernetes.
Package framework sets up the test framework needed to run the end-to-end tests on Kubernetes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL