Vcenter Connector Save

Extend vCenter with OpenFaaS

Project README

OpenFaaS vcenter-connector

vcenter-connector is an OpenFaaS event-connector built to consume events from vCenter and to trigger functions.

Build Status

Overview

With this project your functions can subscribe to events generated by the changes (i.e. events) in your vCenter installation - for instance a VM being created, turned on or deleted. This allows you to extend vCenter's functionality by writing functions to execute each time an event is fired. An example may be tagging a VM with the date it was last turned on or applying a tag showing which user made a change to an object.

Status

This project uses the OpenFaaS Connector SDK. vCenter credentials are stored using Kubernetes secrets.

Supported Events

The following event types (incl. their subtypes) are supported and can be used to trigger functions:

  • Alarm Event, e.g. AlarmCreatedEvent
  • Datastore Event, e.g. DatastoreDestroyedEvent
  • Host Event, e.g. HostDisconnectedEvent
  • Resource Pool Event, e.g. ResourcePoolCreatedEvent
  • VM Event, e.g. VmPoweredOnEvent

For further details and naming see the vSphere Web Services API documentation.

A function can be subscribed to multiple events using a comma-delimited syntax in its stack configuration:

[...]
annotations:
    topic: "drs.vm.powered.on,vm.powered.off"

Note: Wildcards for event subscriptions, e.g. "vm.powered.*", are not supported.

Credentials

Credentials within Kubernetes

When using the connector in Kubernetes, you will need to create a secret for the connector in the openfaas namespace.

kubectl create secret generic vcenter-secrets \
  -n openfaas \
  --from-literal vcenter-username=user \
  --from-literal vcenter-password=pass

At runtime these secrets will be mounted at /var/openfaas/secrets/. See /yaml/kubernetes/connector-dep.yml for more.

Using credentials outside of Kubernetes

You can pass credentials via arguments (not recommended).

./vcenter-connector \
  -vc-user="admin" \
  -vc-pass="test1234" \

Or use a file and pass the name:

export secret_mount_path="/tmp/secrets/`

./vcenter-connector \
  -vc-user="" \
  -vc-pass="" \
  -vc-user-secret-name=vcenter-username \
  -vc-password-secret-name=vcenter-password

The default path is /var/openfaas/secrets/ which can be overridden by setting the secret_mount_path environment variable.

Examples / community

  • You can find a detailed example using vSphere tags for VmPoweredOnEvent here.

  • Robert Guske of VMware write up a detailed blog post on how he automated the integration between several VMware products with OpenFaaS and this vcenter-connector.

VEBA

VMware have released an appliance which packages OpenFaaS and the OpenFaaS vcenter-connector (this repository) and called it the "vCenter Event Broker Appliance". The appliance uses Photon OS.

Contributing

Please propose changes in an Issue before submitting a PR and sign-off commits.

See the contribution guide for OpenFaaS for more.

License

MIT

Acknowledgements

This project is hosted and maintained by OpenFaaS Ltd

It makes use of the following components:

  • govmomi project providing Golang bindings for vCenter by Doug MacEachern, VMware
  • vcsim simulator tool by Doug MacEachern, VMware

The contact for OpenFaaS Ltd is Alex Ellis

The contact for VMware is Michael Gasch (VMware)

Open Source Agenda is not affiliated with "Vcenter Connector" Project. README Source: openfaas-incubator/vcenter-connector
Stars
28
Open Issues
2
Last Commit
4 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating