Skip to content

Instantly share code, notes, and snippets.

@Amit-PivotalLabs
Last active December 10, 2021 21:33
Show Gist options
  • Star 36 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save Amit-PivotalLabs/c39528248b8cdc4ba8e347f8aa68abb6 to your computer and use it in GitHub Desktop.
Save Amit-PivotalLabs/c39528248b8cdc4ba8e347f8aa68abb6 to your computer and use it in GitHub Desktop.
BOSH Links: Why and How
@Alexvianet
Copy link

Alexvianet commented Apr 13, 2018

How i can link dynamic IP of the neighbor job to manifest, not to template, like we do with static_ips:

instance_groups:
  - name: web
    properties:
      key: (( jobs.postgres.networks.default.static_ips.[0] )) 

@Amit-PivotalLabs
Copy link
Author

Hey @Alexvianet you cannot get the value of a link to show up in a manifest. Without links, if job A needs to know the IP(s) of job B, you would have to:

  • assign static IPs to the instance group that job B is in (in the manifest)
  • ensure job A's spec defines a property that allows you to provide it B's IPs (in the BOSH release for job A)
  • copy the value of the static IPs for job B into the properties section for job A in whatever instance group it's in (in the manifest)

You may be using tools like spruce or spiff that make the static IP assignment and copying not entirely manual. However BOSH can now natively do IP assignment and property "copying" for you via Global Networking and Links, respectively. So instead the workflow would be:

  • ensure job B provides a link (in the release for job B)
  • ensure job A consumes a link, and ensure the ERB templates pull the IP info out of the link (in the release for job A)
  • if the type of the provided and consumed link match, and this is all within the same deployment manifest, then "implicit linking" will take over and you won't need to do anything else
  • otherwise, make sure you're explicit about the links being provided by job B in its instance group and consumed by job A in its instance group (in the deployment manifest)

@abh1kg
Copy link

abh1kg commented Sep 2, 2018

@Amit-PivotalLabs Firstly, a wonderful and insightful document on the usage of BOSH links.
On the topic of BOSH links, do deployment addon jobs support links as well? I have a deployment manifest with an addon job defined. The release spec of one of the component jobs of the addon release defines a provides section. In the same manifest, I have several instance groups and component jobs which need to consume the links defined in the addon job.
I end up with an error as below:

Task 7912 | 17:16:37 | Preparing deployment: Preparing deployment (00:00:02)
                     L Error: Failed to resolve links from deployment 'target-deployment'. See errors below:
  - Failed to resolve link 'my_link' with type 'my_link_class' from job 'job' in instance group 'instance_group1'. Multiple link providers found:
    - Link provider 'my_link' from job 'addon_job' in instance group 'instance_group1' in deployment 'target-deployment'
    - Link provider 'my_link' from job 'addon_job' in instance group 'instance_group2' in deployment 'target-deployment'

@Amit-PivotalLabs
Copy link
Author

Hey @abh1kg thanks for your praise, I'm glad you found this useful!

Unfortunately Gist comments don't result in notifications so I'm only seeing this now, apologies. I think the core BOSH team would be able to better answer your question. I've created a GitHub issue with your question here on your behalf.

Cheers!

@abh1kg
Copy link

abh1kg commented Oct 4, 2018

Thanks again @Amit-PivotalLabs. I'll follow the GitHub issue

Copy link

ghost commented Apr 23, 2019

Hi,
I am getting error while deploying harbor with Bosh release
Error: Link property admin_password_for_smoketest in template harbor is not defined in release spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment