11

Extending Custom Naming with Custom Properties in Cloud Assembly (SKKB1046)

 3 years ago
source link: http://kaloferov.com/blog/skkb1046/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Extending Custom Naming with Custom Properties in Cloud Assembly (SKKB1046)

It's only fair to share...

In this article, we will look how to extend the custom naming dunctionality in VMware Cloud Assembly with custom properties .

Update Log:

Introduction

I’m back baby.

extend-custom-naming-image001.png

After few months pause, stuck at home due to you know what, I’ve decided to write few posts that have been in my to do list. So lets start !!!

As a VMware Cloud Assembly cloud or project administrator, you have a prescribed naming convention for resources in your environment, and you want the deployed resource to follow those conventions without user interaction. You can create a naming template for all deployments from a Cloud Assembly project.
There is a good example on how to set up custom naming provided in the link below, but I’m going to extend that example and show how to use custom properties to further customize the custom naming template.

How do I customize the names of deployed resources using Cloud Assembly?

https://docs.vmware.com/en/VMware-Cloud-Assembly/services/Using-and-Managing/GUID-AD400ED7-EB3A-4D36-B9A7-81E100FB3003.html

A dedicated post on custom properties will follow .

Issue and Solution

The specified template will substitute the auto-generated machine names. Make sure the template generates unique names for this project, otherwise the deployment may fail if a machine with the same name already exists.
Here are the available properties to use:

  • Resource properties: includes the resource name from blueprint template, custom properties assigned to the resource (from blueprint, project, etc.). e.g. ${resource.image}, ${resource.name}
  • Endpoint properties: use any endpoint or custom property assigned to the endpoint e.g. ${endpoint.endpointType}
  • Project properties: name and description e.g. ${project.name}
  • User name, user: ${userName}, ${user}
  • Number generator: add digits to generated names to make them unique. ${######} adds 6 digits.

Lets say though that these properties are not enough. I may want to provide a blueprint input value in the template. For example I want users to be able to specify during provisioning a server code that means something for by business and that server code to become part of the naming in the naming template. E.g. DES – for desktop machines, WEB for web servers, DB – for DB servers, ect…
As you can see this option is not there by default. So we will utilize custom properties to get the blueprint input and pass it to the custom naming template.

So let’s start first in the Blueprint.
I’m going to add inputs that specify the code for each machine resource. In my case I have a 2-tier Web app. So I want to specify the DB and WEB codes as inputs. Therefore, I will add 2 inputs:

  1.   webCode:
  2.     type: string
  3.     title: Web Code
  4.   dbCode:
  5.     type: string
  6.     title: DB Code

As you can see I’ve defined a custom property with name nameCode (same name for all machine resources) and I’ve passed it the input value for the code name.

  1.   web-tier:
  2.     type: Cloud.Machine
  3.     dependsOn:
  4.      - db-tier
  5.     properties:
  6.       nameCode: '${input.webCode}'
  7.   db-tier:
  8.     type: Cloud.Machine
  9.     properties:
  10.       nameCode: '${input.dbCode}'

Now lets go to our project and set a custom naming template.
I going to use other properties for my VM name like project name , number generator , ect.. which are available out of the box. Important part to note her is how to refer to the custom property in the custom naming template. Because I’ve created the custom property within the properties “bag” section in the Blueprint I can access it by using ${resource.nameCode} .My naming template looks like this:

${project.name}-${endpoint.endpointType}-${resource.nameCode}-${######}

extend-custom-naming-image002.png

During Blueprint provisioning I will specify the code names I want to use for both servers as inputs. In my case these are DB and WEB .

extend-custom-naming-image004.png

As you can see once the deployment finished the name of the machine resources contain the input codes I’ve specified.

extend-custom-naming-image006.png

Final Step

If all went well, go grab a beer.

GrabABeer_nobg2.png

DISCLAIMER; This is a personal blog. Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated. Any views or opinions are not intended to malign any religion, ethnic group, club, organization, company, or individual.
All content provided on this blog is for informational purposes only. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.
Photos
Unless stated, all photos are the work of the blog owner and are licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. If used with watermark, no need to credit to the blog owner. For any edit to photos, including cropping, please contact me first.
Recipes
Unless stated, all recipes are the work of the blog owner and are licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. Please credit all recipes to the blog owner and link back to the original blog post.
Downloadable Files
Any downloadable file, including but not limited to pdfs, docs, jpegs, pngs, is provided at the user’s own risk. The owner will not be liable for any losses, injuries, or damages resulting from a corrupted or damaged file.
Comments
Comments are welcome. However, the blog owner reserves the right to edit or delete any comments submitted to this blog without notice due to
– Comments deemed to be spam or questionable spam
– Comments including profanity
– Comments containing language or concepts that could be deemed offensive
– Comments containing hate speech, credible threats, or direct attacks on an individual or group
The blog owner is not responsible for the content in comments.
This policy is subject to change at anytime.

Mastering_vROps_250x308.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK