VEBA v0.5.0 fixes and other Hints to Functions

December 14, 2020 0 By Allan Kjaer

During this weekend i “upgraded” the VEBA appliance in the test/demo environment to version v0.5.0, and during this I ran into a new problems with some of the functions.

In the earlier versions I also had some problems, that I had to do some things to workaround, so I decided to do a blog about them here.

Problem 1:

If you are using PowerCLI for the functions, there is a problem passing the event JSON “object” as parameters to the function. If there are vCenter objects that has a “spaces” in there name, the functions does not receive the JSON “object” if using the default function template.

The solution is to do a change to the “template/powercli/template.yml” file.

Origional file:

language: powercli
fprocess: xargs pwsh ./function/script.ps1

Updated file:

language: powercli
fprocess: xargs -0 pwsh ./function/script.ps1

The “-0” parameter is “items are separated by a null, not whitespace; disables quote and backslash processing and logical EOF processing“.

I have not check if this is also a problem with function written in Python/Go/…..

Problem 2:

Scaling the VEBA, in the version 4.x I had problem with functions that takes a “long” time, and the function was supposed to run multiple time, the VEBA some dropped some of the runs. For example doing “power on” on 6 VM at the same time, it only ran against 3-4 og the VMs , not all 6 VMs.

The solutions was in 2 part, first part is that I added 2 more vCPU’s to the Appliance.

The second part is that i did scale out on the functions (not sure if this is “supported”/tested by Team behind the fling, but i works. This is done by adding 3 lines to the “stack.yml” file in the “functions” section:

    labels:
      "com.openfaas.scale.min": "2"
      "com.openfaas.scale.max": "20"

I dont think the autoscale function works, I have never see it do auto scal. So i just sets the “com.openfaas.scale.min” parameter, what ever works. It’s not perfect, some time i see that all events do run in the same container.

Problem 3:

This is new to the v0.5.0, when added my functions to the newly deployed VEBA v0.5.0, I noticed that some of my functions ran 4 times, instead of 1.

I think that is due to the new features in this version.

I found that this happens if the function takes longer to run, I have one in PowerCLI that takes around 12 seconds the first time i runs, and afterwards it takes 8-9 seconds. and the function has a default of 5 seconds timeout.

This can be adjusted in the “stack.yml” file by adding 2 lines to the “functions”:”environment” section

      read_timeout: 15s
      write_timeout: 15s

Another way to solve this, is to call a VMware vRealize Orchestrator (vRO) workflow, instead of running complex script in the functions, that take a long time.

VMware vRealize Orchestrator

My favorite way of using the VEBA, is use a simple function that calls a vRO workflow.

Then function i way simple, just create a JSON “object” and call the vRO ReST to execute the workflow.

This makes it easier to do troubleshooting, in vRO you can see the inputs, and if they are correct. If the the input looks good, you can do changes to the workflow and rerun, till it works.

Stack.yml

Sceenshot for the fixes to problem 2 and 3, and the stack.yml file.

Please share this page if you find it usefull: