rancher/machine-controller

Name: machine-controller

Owner: Rancher

Description: Docker Machine Controller

Created: 2017-12-12 23:15:15.0

Updated: 2018-01-26 16:18:57.0

Pushed: 2018-01-26 05:03:34.0

Homepage: null

Size: 3985

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

machine-controller

Machine-Controller uses docker-machine and k8s CRD to provision machine on the cloud

Building

make

Usage
Creating Machine
Install Docker-Machine first

https://docs.docker.com/machine/install-machine/

Create machine custom resource definition

kubectl create -f example/machine-crd.yml

Run the machine controller

./bin/machine-controller --config ~/.kube/config

Create a digitalocean machine

kubectl create -f example/digitalocean-example.yml

kubectl create -f example/amazonec2-example.yml

Uploading Schemas

Each machine driver has its own driver options. We get these driver options and upload them to a schema CRD. Then later we can generate go type files base on these schemas.

Creating the schema CRD

kubectl create -f example/schema-crd.yml

Creating the Machine Driver CRD

kubectl create -f example/machine-driver-crd.yml

Creating machine drivers

kubectl create -f example/amazonec2-machine-driver.yml

kubectl create -f example/digitalocean-machine-driver.yml

bectl get machinedrivers                                                                                                                                                                                                                                                                                                                             1  BR master 
           KIND
onec2      MachineDriver.v3.management.cattle.io
talocean   MachineDriver.v3.management.cattle.io

Once the machine driver is created, a schema will be created automatically.

bectl get dynamicschema                                                                                                                                                                                                                                                                                                                                 BR master 
                 KIND
onec2config      DynamicSchema.v3.management.cattle.io
taloceanconfig   DynamicSchema.v3.management.cattle.io
Generate the go files base on schemas

go generate

age generator

 Amazonec2Config struct {

AccessKey string `json:"accessKey,omitempty"`

Ami string `json:"ami,omitempty"`

BlockDurationMinutes string `json:"blockDurationMinutes,omitempty"`

DeviceName string `json:"deviceName,omitempty"`

Endpoint string `json:"endpoint,omitempty"`

IamInstanceProfile string `json:"iamInstanceProfile,omitempty"`

InsecureTransport bool `json:"insecureTransport,omitempty"`

InstanceType string `json:"instanceType,omitempty"`

KeypairName string `json:"keypairName,omitempty"`

Monitoring bool `json:"monitoring,omitempty"`

OpenPort []string `json:"openPort,omitempty"`

PrivateAddressOnly bool `json:"privateAddressOnly,omitempty"`

Region string `json:"region,omitempty"`

RequestSpotInstance bool `json:"requestSpotInstance,omitempty"`

Retries string `json:"retries,omitempty"`

RootSize string `json:"rootSize,omitempty"`

SecretKey string `json:"secretKey,omitempty"`

SecurityGroup []string `json:"securityGroup,omitempty"`

SessionToken string `json:"sessionToken,omitempty"`

SpotPrice string `json:"spotPrice,omitempty"`

SshKeypath string `json:"sshKeypath,omitempty"`

SshUser string `json:"sshUser,omitempty"`

SubnetId string `json:"subnetId,omitempty"`

Tags string `json:"tags,omitempty"`

UseEbsOptimizedInstance bool `json:"useEbsOptimizedInstance,omitempty"`

UsePrivateAddress bool `json:"usePrivateAddress,omitempty"`

Userdata string `json:"userdata,omitempty"`

VolumeType string `json:"volumeType,omitempty"`

VpcId string `json:"vpcId,omitempty"`

Zone string `json:"zone,omitempty"`


Running

./bin/machine-controller

License

Copyright (c) 2014-2017 Rancher Labs, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.