Skip to main content

Using descriptions AND source control for VCF Automation templates

·4 mins
VCF Automation VMware vExpert GitLab GitHub IaC
Photo by Caleb White on Unsplash
Much as I love working with VMware products, and VCF Automation in particular, it does have a couple of annoying issues that have never been properly addressed in version 8.x. The source control integration is one of those things.

I keep my templates for VCF Automation in a source control repository. (Specifically, it’s a GitLab repository hosted within my Homelab and replicated out to GitHub for good measure.) The repository is the source of truth for such templates. If I ever need to redeploy VCF Automation, or if I ever need to share a template, then they’re in a safe place. In terms of my template development process, I tend to work in the Assembler UI first until I have the bones of what I want to achieve and then I move the template code into GitLab and work from there.

It’s not the most efficient process but that’s because the source control integration for VCF Automation templates is uni-directional. It imports from source control but can’t make changes. Quite frustrating but I have learned to live with it!

Once my templates are in my GitLab repository, they show up in Assembler looking like the image below.

Screenshot showing VCF Automation templates added from GitLab source control.
Figure 1: Newly added templates in VCF Automation Assembler

Notice the nice green ticks against each template. It gives you a warm, fuzzy feeling that everything is right with the world.

With the templates imported from GitLab, we can release them to Service Broker to be consumed by users. However, by default the templates don’t have a description so how is anyone supposed to know what they’re for? (Ok, in the image below you can take an informed guess but they are simple templates. Anything more complicated might not be adequately described by the item name alone.)

Screenshot showing VCF Automation templates released to the Service Broker catalog.
Figure 2: Newly added catalog items in VCF Automation Service Broker

If you head back into Assembler, the description for the templates can be set by editing each one and typing (or pasting) in a description.

Screenshot showing a VCF Automation template being edited to add a description.
Figure 3: Templates can be edited to add a description

With a description added to the “Ubuntu” template, we’re starting to get a better looking and more useful catalog.

Screenshot showing VCF Automation templates released to the Service Broker catalog.
Figure 4: One of the templates has a description now!

So far, so simple. But here is where the annoying little problem comes in. What if I want to make a change to my template in GitLab and have it updated in VCF Automation? To demonstrate what happens, I’m just going to increment the version of the template and commit the change.

Screenshot showing the YAML of a VCF Automation template with an update to the version number.
Figure 5: Changing the template by incrementing the version number in VS Code.

If we check back in Assembler, the updated version is found and imported ok, but the warm fuzzy feeling that we had earlier with the raft of green ticks is gone!

Screenshot showing VCF Automation templates added / updated from GitLab source control.
Figure 6: One of the templates now carries a warning.

By clicking on the orange exclamation mark you get to see the following text:

Draft not updated as content has diverged from latest version.

It’s important to note that this doesn’t affect your ability to release versions of the templates out to the Service Broker catalog. That still works. The description that was applied is persisted too. The only thing that’s wrong is that little orange exclamation symbol. It bugs me though so I had to find a way to get rid of it.

What’s actually happening is that adding the description has created a modified “current draft” version of the template. Assembler is just complaining about that. So how do we make it go away?

Ideally, Assembler would read the description of the template from the YAML file in source control, but it doesn’t. Instead we must work around the limitation using the following steps:

  1. In the assembler UI, create a new version of the template. In the the example my last version in GitLab was 0.1.2 so I’m going to create 0.1.3.
Screenshot showing the creation of a new template version in the Assembler UI.
Figure 7: Creating a new template version in the Assembler UI.
  1. Update the template version in GitLab to 0.1.4. Commit the change and let Assembler sync the template.

Voila! The template’s latest version is from GitLab. The template has a description associated with it. The template has a green tick again. Fans of warm fuzzy feelings can rejoice!

Related

Using 'substring' in VCF Automation cloud templates
·3 mins
Automation VMware vExpert VCF Automation Homelab YAML IaC GitLab
Using the ‘substring’ expression in a VCF Automation template caused me a small issue recently. The fix is very simple!
Profile function for authenticating to VMware CCI
·2 mins
VCF Automation vExpert VMware Script Kubernetes Homelab vSphere CCI LazyOps
If you thought that using the vSphere plugin for kubectl required some typing, the CCI plugin requires more! Let’s simplify that process…
Profile function for authenticating to VMware VKS
·3 mins
VKS vExpert VMware Script Kubernetes Homelab vSphere Supervisor LazyOps
The vSphere plugin for kubectl allows you to authenticate to VMware VKS clusters with ease, but what if you’re a lazy typist? Lighten the load with this function!

comments powered by Disqus