Class: Bosh::Bootstrap::MicroboshProviders::OpenStack

Inherits:
Base
  • Object
show all
Defined in:
lib/bosh-bootstrap/microbosh_providers/openstack.rb

Instance Attribute Summary

Attributes inherited from Base

#manifest_path, #settings

Instance Method Summary collapse

Methods inherited from Base

#create_microbosh_yml, #download_stemcell, #initialize, #jenkins_bucket, #microbosh_name, #private_key_path, #public_ip, #salted_password, #stemcell_dir

Constructor Details

This class inherits a constructor from Bosh::Bootstrap::MicroboshProviders::Base

Instance Method Details

#cloud_propertiesObject



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 53

def cloud_properties
  {
    "auth_url"=>settings.provider.credentials.openstack_auth_url,
    "username"=>settings.provider.credentials.openstack_username,
    "api_key"=>settings.provider.credentials.openstack_api_key,
    "tenant"=>settings.provider.credentials.openstack_tenant,
    "region"=>region,
    "default_security_groups"=>security_groups,
    "default_key_name"=>microbosh_name,
    "private_key"=>private_key_path}
end

#network_configurationObject

network:

type: dynamic
ip: 1.2.3.4


36
37
38
39
40
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 36

def network_configuration
  {"type"=>"dynamic",
    "vip"=>public_ip
  }
end

#persistent_diskObject



42
43
44
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 42

def persistent_disk
  settings.bosh.persistent_disk
end

#regionObject



65
66
67
68
69
70
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 65

def region
  if settings.provider.credentials.openstack_region && !settings.provider.credentials.openstack_region.empty?
   return settings.provider.credentials.openstack_region
  end
  nil
end

#resources_cloud_propertiesObject

TODO discover m1.microbosh via cyoi (a VM with ephemeral volume) Create m1.microboh with: nova flavor-create m1.microbosh 6 2048 20 2 –ephemeral 20 –rxtx-factor 1 –is-public true



49
50
51
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 49

def resources_cloud_properties
  {"instance_type"=>"m1.microbosh"}
end

#security_groupsObject



72
73
74
75
76
77
78
79
80
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 72

def security_groups
  ["ssh",
   "dns_server",
   "bosh_agent_https",
   "bosh_nats_server",
   "bosh_blobstore",
   "bosh_director",
   "bosh_registry"]
end

#stemcellObject



5
6
7
8
9
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 5

def stemcell
  unless settings.exists?("bosh.stemcell")
    download_stemcell
  end
end

#stemcell_uriObject



82
83
84
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 82

def stemcell_uri
  "http://bosh-jenkins-artifacts.s3.amazonaws.com/bosh-stemcell/openstack/bosh-stemcell-latest-openstack-kvm-ubuntu.tgz"
end

#to_hashObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 11

def to_hash
  super.merge({
   "network"=>network_configuration,
   "resources"=>
    {"persistent_disk"=>persistent_disk,
     "cloud_properties"=>resources_cloud_properties},
   "cloud"=>
    {"plugin"=>"openstack",
     "properties"=>
      {"openstack"=>cloud_properties}},
   "apply_spec"=>
    {"agent"=>
      {"blobstore"=>{"address"=>public_ip},
       "nats"=>{"address"=>public_ip}},
     "properties"=>
       {"director"=>
         {"max_threads"=>3},
        "hm"=>{"resurrector_enabled" => true},
        "ntp"=>["0.north-america.pool.ntp.org","1.north-america.pool.ntp.org"]}}
  })
end