bosh-google-cpi

module
v0.0.0-...-8586347 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2016 License: Apache-2.0

README

BOSH Google Compute Engine CPI Build Status

This is an experimental external BOSH CPI for Google Compute Engine.

Disclaimer

This is NOT presently a production ready CPI. This is a work in progress. It is suitable for experimentation and may not become supported in the future.

Usage

Deployment

This CPI can be deployed using the BOSH Google CPI release.

Installation

Using the standard go get:

$ go get github.com/frodenas/bosh-google-cpi/main
Configuration

Create a configuration file:

{
  "google": {
    "project": "my-gce-project",
    "default_zone": "us-central1-a",
    "json_key": "{\"private_key_id\": \"...\"}",
    "default_root_disk_size_gb": 20,
    "default_root_disk_type": ""
  },
  "actions": {
    "agent": {
      "mbus": "https://mbus:mbus@0.0.0.0:6868",
      "ntp": [
        "169.254.169.254"
      ],
      "blobstore": {
        "type": "local",
        "options": {}
      }
    },
    "registry": {
      "protocol": "http",
      "host": "127.0.0.1",
      "port": 25777,
      "username": "admin",
      "password": "admin",
      "tls": {
        "_comment": "TLS options only apply when using HTTPS protocol",
        "insecure_skip_verify": true,
        "certfile": "/path/to/public.pem",
        "keyfile": "/path/to/private.pem",
        "cacertfile": "/path/to/ca.pem"
      }
    }
  }
}
Option Required Type Description
google.project Y String Google Compute Engine Project
google.default_zone Y String Google Compute Engine default Zone
google.json_key N String Contents of the Google Compute Engine JSON file. Only required if you are not running the CPI inside a Google Compute Engine VM with compute and devstorage.full_control service scopes and/or the Google Cloud SDK has not been initialized
google.default_root_disk_size_gb N Integer The default size (in Gb) of the instance root disk (default is 10Gb)
google.default_root_disk_type N String The name of the default Google Compute Engine Disk Type the CPI will use when creating the instance root disk
actions.agent.mbus.endpoint Y String BOSH Message Bus URL used by deployed BOSH agents
actions.agent.ntp Y Array<String> List of NTP servers used by deployed BOSH agents
actions.agent.blobstore.type Y String Provider type for the BOSH Blobstore used by deployed BOSH agents (e.g. dav, s3)
actions.agent.blobstore.options Y Hash Options for the BOSH Blobstore used by deployed BOSH agents
actions.registry.protocol Y String BOSH Registry Protocol (http or https)
actions.registry.host Y String BOSH Registry Host
actions.registry.port Y Integer BOSH Registry port
actions.registry.username Y String BOSH Registry username
actions.registry.password Y String BOSH Registry password
actions.registry.tls.insecure_skip_verify When https Boolean Skip BOSH Registry server's certificate chain and host name verification
actions.registry.tls.certfile When https String BOSH Registry Client Certificate (PEM format) file location
actions.registry.tls.keyfile When https String BOSH Registry Client Key (PEM format) file location
actions.registry.tls.cacertfile When https String BOSH Registry Client Root CA certificates (PEM format) file location
Run

Run the cpi using the previously created configuration file:

$ echo "{\"method\": \"method_name\", \"arguments\": []}" | cpi -configFile="/path/to/configuration_file.json"

Features

BOSH Network options

The BOSH Google Compute Engine CPI supports these BOSH Networks Types:

Type Description
dynamic To use DHCP assigned IPs by Google Compute Engine
vip To use previously allocated Google Compute Engine Static IPs

These options are specified under cloud_properties at the networks section of a BOSH deployment manifest and are only valid for dynamic networks:

Option Required Type Description
network_name N String The name of the Google Compute Engine Network the CPI will use when creating the instance (if not set, by default it will use the default network)
subnetwork_name N String The name of the Google Compute Engine Subnet Network the CPI will use when creating the instance (if the network is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified)
ephemeral_external_ip N Boolean If instances must have an ephemeral external IP (false by default)
ip_forwarding N Boolean If instances must have IP forwarding enabled (false by default)
target_pool N String The name of the Google Compute Engine Target Pool the instances should be added to
instance_group N String The name of the Google Compute Engine Instance Group the instances should be added to
tags N Array<String> A list of tags to apply to the instances, useful if you want to apply firewall or routes rules based on tags
BOSH Resource pool options

These options are specified under cloud_properties at the resource_pools section of a BOSH deployment manifest:

Option Required Type Description
machine_type Y String The name of the Google Compute Engine Machine Type the CPI will use when creating the instance (required if not using cpu and ram)
cpu Y Integer Number of vCPUs (Google Compute Engine Custom Machine Types) the CPI will use when creating the instance (required if not using machine_type)
ram Y Integer Amount of memory (Google Compute Engine Custom Machine Types) the CPI will use when creating the instance (required if not using machine_type)
zone N String The name of the Google Compute Engine Zone where the instance must be created
root_disk_size_gb N Integer The size (in Gb) of the instance root disk (default is 10Gb)
root_disk_type N String The name of the Google Compute Engine Disk Type the CPI will use when creating the instance root disk
automatic_restart N Boolean If the instances should be restarted automatically if they are terminated for non-user-initiated reasons (false by default)
on_host_maintenance N String Instance behavior on infrastructure maintenance that may temporarily impact instance performance (supported values are MIGRATE (default) or TERMINATE)
preemptible N Boolean If the instances should be preemptible (false by default)
service_scopes N Array<String> Authorization scope names for your default service account that determine the level of access your instance has to other Google services (no scope is assigned to the instance by default)
BOSH Persistent Disks options

These options are specified under cloud_properties at the disk_pools section of a BOSH deployment manifest:

Option Required Type Description
type N String The name of the Google Compute Engine Disk Type

Deployment Manifest Example

This is an example of how Google Compute Engine CPI specific properties are used in a BOSH deployment manifest:

---
name: example
director_uuid: 38ce80c3-e9e9-4aac-ba61-97c676631b91

...

networks:
  - name: private
    type: dynamic
    dns:
      - 8.8.8.8
      - 8.8.4.4
    cloud_properties:
      network_name: default
      subnetwork_name: my-subnetwork
      ephemeral_external_ip: false
      ip_forwarding: false
      target_pool: my-load-balancer
      tags:
        - bosh

  - name: public
    type: vip
    cloud_properties: {}
...

resource_pools:
  - name: vms
    network: private
    stemcell:
      name: bosh-google-kvm-ubuntu-trusty-go_agent
      version: latest
    cloud_properties:
      instance_type: n1-standard-2
      zone: us-central1-a
      root_disk_size_gb: 20
      root_disk_type: pd-ssd
      automatic_restart: false
      on_host_maintenance: MIGRATE
      service_scopes:
        - compute.readonly
        - devstorage.read_write
...

disk_pools:
  - name: disks
    disk_size: 32_768
    cloud_properties:
      type: pd-ssd
...

Contributing

In the spirit of free software, everyone is encouraged to help improve this project.

Here are some ways you can contribute:

  • by using alpha, beta, and prerelease versions
  • by reporting bugs
  • by suggesting new features
  • by writing or editing documentation
  • by writing specifications
  • by writing code (no patch is too small: fix typos, add comments, clean up inconsistent whitespace)
  • by refactoring code
  • by closing issues
  • by reviewing patches
Submitting an Issue

We use the GitHub issue tracker to track bugs and features. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted. You can indicate support for an existing issue by voting it up. When submitting a bug report, please include a Gist that includes a stack trace and any details that may be necessary to reproduce the bug, including your gem version, Ruby version, and operating system. Ideally, a bug report should include a pull request with failing specs.

Submitting a Pull Request
  1. Fork the project.
  2. Create a topic branch.
  3. Implement your feature or bug fix.
  4. Commit and push your changes.
  5. Submit a pull request.

Copyright (c) 2015-2016 Ferran Rodenas. See LICENSE for details.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/frodenas/bosh-registry/client
Package registry provides some functions to interact with the BOSH Registry (http://bosh.io/docs/bosh-components.html#registry)
Package registry provides some functions to interact with the BOSH Registry (http://bosh.io/docs/bosh-components.html#registry)
_workspace/src/github.com/onsi/ginkgo
Ginkgo is a BDD-style testing framework for Golang
Ginkgo is a BDD-style testing framework for Golang
_workspace/src/github.com/onsi/ginkgo/config
Ginkgo accepts a number of configuration options.
Ginkgo accepts a number of configuration options.
The Ginkgo CLI
_workspace/src/github.com/onsi/ginkgo/internal/remote
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
Ginkgo's Default Reporter
_workspace/src/github.com/onsi/gomega
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
_workspace/src/github.com/onsi/gomega/format
Gomega's format package pretty-prints objects.
Gomega's format package pretty-prints objects.
_workspace/src/github.com/onsi/gomega/gbytes
Package gbytes provides a buffer that supports incrementally detecting input.
Package gbytes provides a buffer that supports incrementally detecting input.
_workspace/src/github.com/onsi/gomega/gexec
Package gexec provides support for testing external processes.
Package gexec provides support for testing external processes.
_workspace/src/github.com/onsi/gomega/ghttp
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
_workspace/src/github.com/onsi/gomega/ghttp/protobuf
Package protobuf is a generated protocol buffer package.
Package protobuf is a generated protocol buffer package.
Gomega matchers
_workspace/src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
_workspace/src/golang.org/x/net/context/ctxhttp
Package ctxhttp provides helper functions for performing context-aware HTTP requests.
Package ctxhttp provides helper functions for performing context-aware HTTP requests.
_workspace/src/golang.org/x/oauth2
Package oauth2 provides support for making OAuth2 authorized and authenticated HTTP requests.
Package oauth2 provides support for making OAuth2 authorized and authenticated HTTP requests.
_workspace/src/golang.org/x/oauth2/bitbucket
Package bitbucket provides constants for using OAuth2 to access Bitbucket.
Package bitbucket provides constants for using OAuth2 to access Bitbucket.
_workspace/src/golang.org/x/oauth2/clientcredentials
Package clientcredentials implements the OAuth2.0 "client credentials" token flow, also known as the "two-legged OAuth 2.0".
Package clientcredentials implements the OAuth2.0 "client credentials" token flow, also known as the "two-legged OAuth 2.0".
_workspace/src/golang.org/x/oauth2/facebook
Package facebook provides constants for using OAuth2 to access Facebook.
Package facebook provides constants for using OAuth2 to access Facebook.
_workspace/src/golang.org/x/oauth2/github
Package github provides constants for using OAuth2 to access Github.
Package github provides constants for using OAuth2 to access Github.
_workspace/src/golang.org/x/oauth2/google
Package google provides support for making OAuth2 authorized and authenticated HTTP requests to Google APIs.
Package google provides support for making OAuth2 authorized and authenticated HTTP requests to Google APIs.
_workspace/src/golang.org/x/oauth2/internal
Package internal contains support packages for oauth2 package.
Package internal contains support packages for oauth2 package.
_workspace/src/golang.org/x/oauth2/jws
Package jws provides encoding and decoding utilities for signed JWS messages.
Package jws provides encoding and decoding utilities for signed JWS messages.
_workspace/src/golang.org/x/oauth2/jwt
Package jwt implements the OAuth 2.0 JSON Web Token flow, commonly known as "two-legged OAuth 2.0".
Package jwt implements the OAuth 2.0 JSON Web Token flow, commonly known as "two-legged OAuth 2.0".
_workspace/src/golang.org/x/oauth2/linkedin
Package linkedin provides constants for using OAuth2 to access LinkedIn.
Package linkedin provides constants for using OAuth2 to access LinkedIn.
_workspace/src/golang.org/x/oauth2/microsoft
Package microsoft provides constants for using OAuth2 to access Windows Live ID.
Package microsoft provides constants for using OAuth2 to access Windows Live ID.
_workspace/src/golang.org/x/oauth2/odnoklassniki
Package odnoklassniki provides constants for using OAuth2 to access Odnoklassniki.
Package odnoklassniki provides constants for using OAuth2 to access Odnoklassniki.
_workspace/src/golang.org/x/oauth2/paypal
Package paypal provides constants for using OAuth2 to access PayPal.
Package paypal provides constants for using OAuth2 to access PayPal.
_workspace/src/golang.org/x/oauth2/slack
Package slack provides constants for using OAuth2 to access Slack.
Package slack provides constants for using OAuth2 to access Slack.
_workspace/src/golang.org/x/oauth2/vk
Package vk provides constants for using OAuth2 to access VK.com.
Package vk provides constants for using OAuth2 to access VK.com.
_workspace/src/google.golang.org/api/compute/v1
Package compute provides access to the Compute Engine API.
Package compute provides access to the Compute Engine API.
_workspace/src/google.golang.org/api/gensupport
Package gensupport is an internal implementation detail used by code generated by the google-api-go-generator tool.
Package gensupport is an internal implementation detail used by code generated by the google-api-go-generator tool.
_workspace/src/google.golang.org/api/googleapi
Package googleapi contains the common code shared by all Google API libraries.
Package googleapi contains the common code shared by all Google API libraries.
_workspace/src/google.golang.org/api/googleapi/internal/uritemplates
Package uritemplates is a level 3 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).
Package uritemplates is a level 3 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).
_workspace/src/google.golang.org/api/googleapi/transport
Package transport contains HTTP transports used to make authenticated API requests.
Package transport contains HTTP transports used to make authenticated API requests.
_workspace/src/google.golang.org/api/storage/v1
Package storage provides access to the Cloud Storage JSON API.
Package storage provides access to the Cloud Storage JSON API.
_workspace/src/google.golang.org/cloud/compute/metadata
Package metadata provides access to Google Compute Engine (GCE) metadata and API service accounts.
Package metadata provides access to Google Compute Engine (GCE) metadata and API service accounts.
_workspace/src/google.golang.org/cloud/internal
Package internal provides support for the cloud packages.
Package internal provides support for the cloud packages.
_workspace/src/google.golang.org/cloud/internal/datastore
Package datastore is a generated protocol buffer package.
Package datastore is a generated protocol buffer package.
_workspace/src/google.golang.org/cloud/internal/opts
Package opts holds the DialOpts struct, configurable by cloud.ClientOptions to set up transports for cloud packages.
Package opts holds the DialOpts struct, configurable by cloud.ClientOptions to set up transports for cloud packages.
_workspace/src/google.golang.org/cloud/internal/testutil
Package testutil contains helper functions for writing tests.
Package testutil contains helper functions for writing tests.
api
google

Jump to

Keyboard shortcuts

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