cf-operator

module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0

README

cf-operator

godoc master go report card Coveralls github

Nightly build nightly

cf-operator enables the deployment of BOSH Releases, especially Cloud Foundry, to Kubernetes.

It's implemented as a k8s operator, an active controller component which acts upon custom k8s resources.

Requirements

A working kubernetes cluster.

Install

The alpha release of cf-operator has to be built from source. The helm chart is not working yet.

git checkout v0.1.0

We need to build the binary, which can run out of cluster:

bin/build

When starting the operator it needs to be reachable from the kubernetes API, so the web hooks work.

export CF_OPERATOR_WEBHOOK_SERVICE_HOST=<your-public-ip>

We need to tell the operator which docker image it can use for template rendering:

export DOCKER_IMAGE_TAG=v0.1.0
export OPERATOR_DOCKER_ORGANIZATION=cfcontainerization

For template rendering the operators docker image needs to be accessible to the cluster:

docker build . -t $DOCKER_ORGANIZATION/cf-operator:$DOCKER_IMAGE_TAG

Apply the custom resource definitions to the cluster:

bin/apply-crds

Optionally create a namespace for the operator to work in:

kubectl create namespace test
export CF_OPERATOR_NAMESPACE=test

Finally run the operator

binaries/cf-operator

Development

For more information see docs/development.md and docs/testing.md

Requirements

Go 1.12.2 and install the tool chain:

make tools
Prepare
export GO111MODULE=on

# set to IP reachable from k8s API
export CF_OPERATOR_WEBHOOK_SERVICE_HOST=$(ip -4 a s dev `ip r l 0/0 | cut -f5 -d' '` | grep -oP 'inet \K\S+(?=/)')

# optionally, using vendor/ with GO111MODULE=off speeds up docker builds
go mod vendor
export GO111MODULE=off

# optionally, if using minikube, build the image directly on minikube's docker
# eval `minikube docker-env`
Start Operator Locally
make up
Run Integration tests

See docs/testing.md

Test with Example Data
kubectl apply -f docs/examples/fissile_v1alpha1_boshdeployment_cr.yaml
kubectl get boshdeployments.fissile.cloudfoundry.org
kubectl get pods --watch

# clean up
kubectl delete configmap bosh-manifest
kubectl delete configmap bosh-ops
kubectl delete secret bosh-ops-secret
kubectl delete boshdeployments.fissile.cloudfoundry.org example-boshdeployment

Directories

Path Synopsis
cmd
integration
pkg
bosh/manifest/fakes
Code generated by counterfeiter.
Code generated by counterfeiter.
credsgen/fakes
Code generated by counterfeiter.
Code generated by counterfeiter.
kube/client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
kube/client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
kube/client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
kube/client/clientset/versioned/typed/boshdeployment/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kube/client/clientset/versioned/typed/boshdeployment/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kube/client/clientset/versioned/typed/extendedjob/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kube/client/clientset/versioned/typed/extendedjob/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kube/client/clientset/versioned/typed/extendedsecret/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kube/client/clientset/versioned/typed/extendedsecret/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kube/client/clientset/versioned/typed/extendedstatefulset/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kube/client/clientset/versioned/typed/extendedstatefulset/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kube/controllers/fakes
Code generated by counterfeiter.
Code generated by counterfeiter.
kube/util/ctxlog
Package ctxlog extends ctxlog with events
Package ctxlog extends ctxlog with events
testhelper
Package testhelper has convenience functions for tests, like returning pointers to values.
Package testhelper has convenience functions for tests, like returning pointers to values.
Package testing contains methods to create test data.
Package testing contains methods to create test data.

Jump to

Keyboard shortcuts

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