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



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

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



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

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 Allow discovery of an appropriate OpenStack flavor with 2+CPUs, 3+G RAM



47
48
49
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 47

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

#security_groupsObject



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

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



80
81
82
# File 'lib/bosh-bootstrap/microbosh_providers/openstack.rb', line 80

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