gce-machine-controller

command
v0.0.0-...-86ffc8e Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

README

GCE Machine Controller

The GCE Machine Controller is a machine controller implementation for clusters running on Google Compute Engine.

Development

The instructions below will enable you to get started with running your own version of the gce-machine-controller on a GCE Kubernetes cluster.

Prerequisites
  1. Follow the "Before you begin" section from the google cloud container registry pushing and pulling images documentation.
  2. From this directory, run make dev_push.
  3. Note from the ouput of the above step the name of the image. It should be in this format, gcr.io/MY-GCP-PROJECT-NAME/gce-machine-controller:VERSION-dev.
  4. From the same terminal in which you will create your cluster using gcp-deployer, run export MACHINE_CONTROLLER_IMAGE=gcr.io/MY-GCP-PROJECT-NAME/gce-machine-controller:VERSION-dev. Note that the value should be equal to the name of the image you noted in the output from the previous step.
  5. Follow the steps listed at gcp-deployer and create a new cluster.
  6. Run the following command to ensure that new images are fetched for every new gce-machine-controller container, kubectl patch deployment clusterapi -p "{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"gce-machine-controller\",\"imagePullPolicy\":\"Always\"}]}}}}".
Running a Custom GCE Machine Controller
  1. Make a change to gce-machine-controller. For example, edit main.go and insert the following print statement glog.Error("Hello World!") below logs.InitLogs().
  2. From this folder, run make dev_push.
  3. Run kubectl patch deployment clusterapi -p "{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"gce-machine-controller\",\"env\":[{\"name\":\"DATE\",\"value\":\"$(date +'%s')\"}]}]}}}}". This command inserts or updates an environment variable named DATE which triggers a new deployment.
Verifying Your Environment
  1. Install jq. Instructions can be found here.
  2. Run the following, kubectl get pods -o json | jq '.items[].status.containerStatuses[] | select(.name=="gce-machine-controller")'. Validate the the hash in the imageID field matches the image you built above.
  3. Run the following, it will store, in ${POD_NAME}, the name of your main clusterapi pod, POD_NAME=$(kubectl get pods -o json | jq '.items[] | select(.status.containerStatuses[].name=="gce-machine-controller") | .metadata.name' --raw-output).
  4. Run kubectl logs --namespace=default ${POD_NAME} -c gce-machine-controller. Look for the output or change that you added to gce-machine-controller.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

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