Skip to content

Instantly share code, notes, and snippets.

@karampok
Last active August 16, 2018 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karampok/2a768f4d8dbbba83bfa9aaff96fee20c to your computer and use it in GitHub Desktop.
Save karampok/2a768f4d8dbbba83bfa9aaff96fee20c to your computer and use it in GitHub Desktop.

Deploying CFCR with cloud provider:

  1. Given a bosh director
  2. Create service-accounts for master and worker link and save the name into a var file.
cat <deploymentName.cc>.vars 
    cfcr_master_service_account_address: bbl-158293-cfcr-master@cf-pcf-kubo.iam.gserviceaccount.com
    cfcr_worker_service_account_address: bbl-158293-cfcr-worker@cf-pcf-kubo.iam.gserviceaccount.com

Note: These accounts are different per cfcr deployment (NOT per director)

  1. Modify the cloud config to include vm extensions, we can do that by using generic config of type cloud
cat vm_extensions.yml
vm_extensions:
- cloud_properties:
    service_account: ((cfcr_master_service_account_address))
    tags:
    - ((cfcr_master_target_pool))
    target_pool: ((cfcr_master_target_pool))
  name: cfcrWithCC-cfcr-master-cloud-properties
- cloud_properties:
    service_account: ((cfcr_worker_service_account_address))
  name: cfcrWithCC-cfcr-worker-cloud-properties
  
bosh int vm_extensions.yml -l <deploymentName.cc.vars  > vm_extension_<deploymentName>.yml
bosh update-config --type cloud --name <deploymentName>  vm_extensions_<deploymentName>.yml

Basically that file is same content as this link but isolated in a different cloud-config. Finally the config of type cloud should look like that

vm_extensions:
- cloud_properties:
    service_account: bbl-158293-cfcr-master@cf-pcf-kubo.iam.gserviceaccount.com #<--created in step 2
    tags:
    - bbl-158293331-cfcr-tcp-public
    target_pool: bbl-158293331-cfcr-tcp-public
  name: cfcrWithCC-cfcr-master-cloud-properties  #<--- should be unique per deployment
- cloud_properties:
    service_account: bbl-158293-cfcr-worker@cf-pcf-kubo.iam.gserviceaccount.com #<--created in step 2
  name: cfcrWithCC-cfcr-worker-cloud-properties #<--- should be unique per deployment
  1. Deploy CFCR
bosh deploy  -d cfcrWithCC ${KD}/manifests/cfcr.yml -o ${KD}/manifests/ops-files/rename.yml \
    -o ${KD}/manifests/ops-files/iaas/gcp/cloud-provider.yml 
    -o cfcr-ops.yml  -l cfcr.vars

where the cloud-provider.yml should look like

- type: replace
  path: /instance_groups/name=master/vm_extensions?/-
  value: ((deployment_name))-cfcr-master-cloud-properties

- type: replace
  path: /instance_groups/name=worker/vm_extensions?/-
  value: ((deployment_name))-cfcr-worker-cloud-properties
  
  <plus the content of kd/manifests/ops-files/iaas/gcp/cloud-provider.yml >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment