Skip to content

Instantly share code, notes, and snippets.

@Amit-PivotalLabs
Last active August 20, 2024 07:31
Show Gist options
  • 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
@Amit-PivotalLabs
Copy link
Author

Hey @claudio-benfatto, I migrated your question here, since it'll be hard to have a threaded conversation on this Gist's comments.

@ishustava
Copy link

@Amit-PivotalLabs,

I believe you still do need to specify deployment name both in ~/workspace/deployments/galileo_environment/my_app_future.yml and on the command line with the -d flag, otherwise BOSH CLI will error.

@pgoodwin
Copy link

I'm still fairly new to BOSH and had a difficult time with some parts of this. It would have been very useful to me if one of the first things explained is that links are a mechanism for making values available for template expansion and that the mechanism for users to add their own values to this context is by exporting properties defined by spec files. If they have other effects it would be good to explicitly describe those as well.
I still haven't been able to figure out the relationship between links and manifests. The examples go to some length to highlight the uninteresting parts of the manifest, but doesn't explain what is interesting about what remains. I think that what is interesting may be something that was not required by the manifest, but to my novice eye there is nothing that I would have expected to be in the manifest that is missing. What I did notice is that every property defined by the spec is still accounted for by either a default value or definition in the manifest, so links didn't seem to do anything to make writing the manifest easier. I think it would be good to add more explanatory text about what is supposed to be noticed about the manifest file and, perhaps, comments that include the code that would otherwise have had to be written could be added to the manifest to make the effect the links are having more clear.

@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