项目作者: orange-cloudfoundry

项目描述 :
a bosh external CPI Provider for CloudStack Iaas
高级语言: Shell
项目地址: git://github.com/orange-cloudfoundry/bosh-cloudstack-cpi-release.git
创建时间: 2015-06-09T10:10:27Z
项目社区:https://github.com/orange-cloudfoundry/bosh-cloudstack-cpi-release

开源协议:Apache License 2.0

下载


Build Status

Dependency Status

This repo is deprecated, please refer to https://github.com/orange-cloudfoundry/bosh-go-cpi-cloudstack and https://github.com/orange-cloudfoundry/bosh-cpi-cloudstack

bosh-cloudstack-cpi-release

This is now quite a stable CPI. Feedbacks welcome (use issues).
The cloudstack cpi is available on bosh.io
The cpi has been presented in CF Summit Berlin 2015

Design :

  • this CPI is a Bosh external CPI i.e a dedicated bosh release wich must be deployed alongside a bosh release OR configured with bosh release in a bosh-init yml manifest
  • CPI business logic is in a dedicated Spring Boot app, included in bosh-cloudstack-cpi-release, called cpi-core. This java component has a dedicated template / monit service.
  • leverages Apache Jclouds support for CloudStack, nice java adapter for Cloudstack API
  • supports Cloudstack advanced zone
  • secondary / ephemeral implemented as cloudstack volume (no ephemeral disk concept in CloudStack).
  • Uses a webdav http server to enable stemcell / template loading by cloudstack (other option was create volume and transform to template, required bosh / bosh-init to be hosted in the target cloud / tenant). This webdav server is started from the spring boot cpi core jvm
  • leverages Spring Cloud Hystrix to control the iaas flow (timeout, limit concurrent access, circuit breaker)
  • leverages Spring Cache / ehcache, for “static” cloudstack inventory api access
  • offers an optional zipkin/spring cloud sleuth http connector

Alt text

  • detailed diagram sequence

Alt text

  • Out of Scope : security groups provisioning / CS Basic Zones, Cloudstack VPC, see issues for current limitations

Current Status:

Global status

  • validated on cloudstack 4.7, xen 6.5 with stemcell 3262
  • bosh-init / micro-bosh creation (with an externally launched cpi-core process)
  • cpi able to manage most director operation on cloudstack advanced deployment
  • use isolated / dedicated networks for bosh vms avanced-network
  • provision ssh keys
    generate keypair with cloudstack API (no support on portail)
    use keypair name + private key in bosh.yml
    see cloudstack-keypair
    see cloudstack-template

Typical bosh.yml configuration to activate the CloudStack external CPI

  1. # add the cpi bosh release
  2. releases:
  3. - {name: bosh, version: latest}
  4. - {name: bosh-cloudstack-cpi, version: latest}
  5. # add the template for cpi-core rest server
  6. jobs:
  7. - name: bosh_apidata
  8. templates:
  9. - {name: nats, release: bosh}
  10. # - {name: redis, release: bosh} #<-- redis no more required on recent bosh version 256+
  11. - {name: postgres, release: bosh}
  12. - {name: blobstore, release: bosh}
  13. - {name: director, release: bosh}
  14. - {name: health_monitor, release: bosh}
  15. - {name: powerdns, release: bosh}
  16. # - {name: registry, release: bosh} #<-- registry. commented, cpi brings it own registry
  17. - {name: cloudstack_cpi, release: bosh-cloudstack-cpi} # <-- add the external CPI
  18. # activate external cpi
  19. properties:
  20. director:
  21. cpi_job: cloudstack_cpi
  22. # set external cpi credentials
  23. cloudstack:
  24. endpoint: <your_cloudstack api end_point_url> # Ask for your administrator
  25. api_key: <your_api_key> # You can find at your user page
  26. secret_access_key: <your_secret_access_key> # Same as above
  27. default_key_name: <default_keypair_name> # Your keypair name (see the next section)
  28. private_key: <path_to_your_private_key> # The path to the private key file of your key pair
  29. state_timeout: 600
  30. state_timeout_volume: 1200
  31. stemcell_public_visibility: true
  32. default_zone: <default_zone_name> # Zone name
  33. proxy_host: <proxy to cloudstack api> #proxy acces active if set
  34. proxy_port: <proxy port>
  35. proxy_user: <proxy user>
  36. proxy_password: <proxy password>
  37. cpi:
  38. webdav_host: *bosh_static_ip
  39. default_disk_offering: "DO1 - Small STD"
  40. default_ephemeral_disk_offering: "DO1 - Small STD"
  41. vm_expunge_delay: 40 # <-- set to 40s. default is 30s after vm delete.
  42. force_expunge: true
  43. registry:
  44. endpoint: http://<bosh_ip>:8080
  45. blobstore:
  46. address: *bosh_static_ip
  47. port: 25251
  48. provider: dav
  49. agent: {user: agent, password: agent-password}
  50. agent:
  51. mbus: "nats://nats:nats-password@<bosh_ip>:4222"
  52. ntp: [10.1.1.1 ,10.1.1.2]
  53. # define disk_pool, refering to cloudstack disk offering
  54. disk_pools:
  55. - name: disks
  56. disk_size: 10000
  57. cloud_properties:
  58. disk_offering: "DO2 - Medium STD" #<--- Replace with your disk offering name for persistent disk
  59. # define vm pool, refering to cloudstack compute offering
  60. resource_pools:
  61. - name: vms
  62. stemcell:
  63. name: bosh-cloudstack-xen-ubuntu-trusty-go_agent
  64. version: latest
  65. network: private
  66. size: 1
  67. cloud_properties:
  68. compute_offering: "m1.small" #<--- Replace with your compute offering name
  69. disk: 20000
  70. ephemeral_disk_offering : "Data disk" #<--- Replace with the disk offering u want for ephemeral disk

Typical bosh-int configuration to create a micro-bosh with CloudStack external CPI

bosh-init configuration : micro-bosh.yml

  • necessary configuration to activate on the TARGET bosh (micro-bosh) ie : CPI used from micro-bosh to create other deployments
  • bosh init must use the cpi external release, and have the necessary configuration to create the microbosh vm.

cpi-core config: application.yml

  • exposes a webdav server (used by cloudstack iaas to get the template extracted from the stemcell)
  • exposes a registry to the microbosh vm for bootstrapping purpose. cpi-core will generate the correct json setting. Bosh agents will copy it to /var/vcap/bosh/settings.json
  • generates adequate vm userdata when creating the vm, giving registry endpoint

The cpi-core must be launched separately, see the inception directory which provides a sample script and application.yml configuration.

As the bosh-init bootstrapping is quite cumbersome, its recommended to provision a bosh deployment from the microbosh and operate from that full managed bosh (best practice anyway).

  1. ---
  2. name: micro-bosh
  3. releases:
  4. - name: bosh
  5. url: https://bosh.io/d/github.com/cloudfoundry/bosh?v=257.1
  6. sha1: 94e2514f59a6ff290ae35de067a966ba779688d7
  7. - name: bosh-cloudstack-cpi-release
  8. url: https://bosh.io/d/github.com/cloudfoundry-community/bosh-cloudstack-cpi-release?v=12
  9. sha1: 9438a7d28791b68efe5fbcfbb8a3e298e5798912
  10. resource_pools:
  11. - name: vms
  12. network: private
  13. stemcell:
  14. url: https://orange-candidate-cloudstack-xen-stemcell.s3.amazonaws.com/bosh-stemcell/cloudstack/bosh-stemcell-3262.3-cloudstack-xen-ubuntu-trusty-go_agent.tgz
  15. sha1: cf6f6925d133d0b579d154694025c027bc64ef88
  16. cloud_properties:
  17. compute_offering: "m1.small" # <--- Replace with compute offering name
  18. disk: 20_000
  19. ephemeral_disk_offering: "Data disk"
  20. disk_pools:
  21. - name: disks
  22. disk_size: 10000
  23. cloud_properties:
  24. disk_offering: "Data disk" # <--- Replace with persistent disk offering name
  25. networks:
  26. - name: private
  27. type: manual
  28. subnets:
  29. - range: 10.0.0.128/26
  30. gateway: 10.0.0.129
  31. dns: [10.234.50.180,10.234.71.124]
  32. cloud_properties: {name: "100mb-net"} # <--- Replace with Network name
  33. jobs:
  34. - name: bosh
  35. instances: 1
  36. templates:
  37. - {name: nats, release: bosh}
  38. #- {name: redis, release: bosh}
  39. - {name: postgres, release: bosh}
  40. - {name: blobstore, release: bosh}
  41. - {name: director, release: bosh}
  42. - {name: health_monitor, release: bosh}
  43. - {name: powerdns, release: bosh}
  44. - {name: cloudstack_cpi, release: bosh-cloudstack-cpi-release}
  45. resource_pool: vms
  46. persistent_disk_pool: disks
  47. networks:
  48. - {name: private, static_ips: [ µ_bosh_static_ip <micro_bosh_ip>]}
  49. # ip range in cloudstack 150 to 160
  50. properties:
  51. nats:
  52. address: 127.0.0.1
  53. user: nats
  54. password: nats-password
  55. redis:
  56. listen_addresss: 127.0.0.1
  57. address: 127.0.0.1
  58. password: redis-password
  59. postgres: &db
  60. host: 127.0.0.1
  61. user: postgres
  62. password: postgres-password
  63. database: bosh
  64. adapter: postgres
  65. blobstore:
  66. address: *micro_bosh_static_ip
  67. port: 25250
  68. provider: dav
  69. director: {user: director, password: director-password}
  70. agent: {user: agent, password: agent-password}
  71. director:
  72. address: 127.0.0.1
  73. name: micro-bosh
  74. db: *db
  75. cpi_job: cloudstack_cpi
  76. #max_threads: 4
  77. enable_snapshots: false
  78. hm:
  79. http: {user: hm, password: hm-password}
  80. director_account: {user: admin, password: admin}
  81. resurrector_enabled: true
  82. dns:
  83. address: *micro_bosh_static_ipp recursor: 10.234.50.180
  84. db: *db
  85. cloudstack: &cloudstack # <--- Replace values below
  86. endpoint: http://10.x.x.x:8080/client/api
  87. api_key: <cloudstack api key>
  88. secret_access_key: <cloudstack acces key>
  89. default_key_name: bosh-keypair #<-- set ssh keypair name
  90. private_key: zz #<-- unused
  91. state_timeout: 600
  92. state_timeout_volume: 600
  93. stemcell_public_visibility: true
  94. default_zone: <cloudstack zone>
  95. proxy_host: ""
  96. proxy_port: 8080
  97. proxy_user: xx
  98. proxy_password: ""
  99. cpi:
  100. default_disk_offering: "Data disk"
  101. default_ephemeral_disk_offering: "Data disk"
  102. webdav_host: *micro_bosh_static_ip
  103. webdav_port: 8080
  104. webdav_directory: "/var/vcap/store/cloudstack_cpi/webdav"
  105. registry:
  106. endpoint: http://admin:admin@<micro_bosh_ip>:8080
  107. user: admin
  108. password: admin
  109. blobstore:
  110. address: *micro_bosh_static_ip
  111. port: 25250
  112. provider: dav
  113. agent: {user: agent, password: agent-password}
  114. agent:
  115. mbus: "nats://nats:nats-password@<micro_bosh_ip>:4222"
  116. ntp: ""
  117. agent: {mbus: "nats://nats:nats-password@<micro_bosh_ip>:4222"}
  118. ntp: &ntp [10.234.50.245 ,10.234.50.246]
  119. cloud_provider:
  120. template: {name: cloudstack_cpi, release: bosh-cloudstack-cpi-release}
  121. mbus: "https://mbus:mbus-password@<micro_bosh_ip>:6868"
  122. properties:
  123. cloudstack: *cloudstack
  124. cpi:
  125. webdav_host: <inception_vm_ip>
  126. webdav_port: 8080
  127. default_disk_offering: "Data disk" # <-- default offering must be shared. custom size
  128. default_ephemeral_disk_offering: "Data disk"
  129. registry:
  130. endpoint: http://<inception_vm_ip>:8080
  131. user: admin
  132. password: admin
  133. agent:
  134. mbus: "https://mbus:mbus-password@0.0.0.0:6868"
  135. ntp: ""
  136. agent: {mbus: "https://mbus:mbus-password@0.0.0.0:6868"}
  137. blobstore: {provider: local, path: /var/vcap/micro_bosh/data/cache}
  138. ntp: *ntp

cloudstack stemcell

A cloudstack xen stemcell is under development, following bosh official stemcells. Will soon prepare a PR to bosh project.

Alt text

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.