Kubernetes vCD operator
A python based proof of concept of an operator to manage VMware Cloud Director ressources.
- Free software: MIT license
- Documentation: kvcd.readthedocs.io.
Features
kvcd is a proof-of-concept of a python based kubernetes operator to manage VMware vCloud Director resources.
With this first preview release, you can manage the state of vApp objects with the following configuration properties:
- Parent Org (creation only)
- Parent Org VDC (creation only)
- Name (creation only)
- Description
- Fence mode (creation only)
- EULAs acceptance (creation only)
- Ownership
- Power status: on/off
- deploymentLease
- storageLease
- source catalog: if cloned from vCD library item
- source template: if cloned from vCD library item
- metadata: through the Kubernetes resources annotations: ReadOnly on vCloud Director side.
The operator also populates a status.backing dictionnary with the following properties according to the vCloud
Director data:
- UUID
- status
- vcd_vapp_href
- vcd_vdc_href
- owner
- deploymentLeaseInSeconds
- storageLeaseInSeconds
- metadata
If a deviation is detected with the declared specs of the object: a reconcialiation is made to apply the state from
the declared specs.
It may remains some use-case where the reconcialiation will fail like when trying to apply a power-on expected state on an expired object.*
The same reconcialiation process will occurs when a change is made to the specs object declaration to apply changes
to the backing object on vCloud Director.
Modification of some
specsproperties will be ignored, such asorg,vdc,fence_modeoraccept_all_eulas.
Installation
Stable release
To install Kubernetes vCD operator, run this command in your terminal:
pip install kvcd
This is the preferred method to install Kubernetes vCD operator, as it will always install the most recent stable release.
If you don't have pip installed, this Python installation guide can guide you through the process.
From sources
The sources for Kubernetes vCD operator can be downloaded from the Github repo.
You can clone the public repository:
git clone git://github.com/lrivallain/kvcd
Once you have a copy of the source, you can install it with:
pip install .
Usage
Configuration
Create a .venv file with the following content, according to your setup:
# Hostname of the vCloud instance
KVCD_VCD_HOST=vcloud.domain # mandatory
# HTTPS port to the vCloud instance
KVCD_VCD_PORT=443 # optional: 443 by default
# Organisation of the vCloud user
KVCD_VCD_ORG=orgX # mandatory
# vCloud credentials to use as a service account
KVCD_VCD_USERNAME=kvcd-svc # mandatory
KVCD_VCD_PASSWORD=********** # mandatory
# Verify the SSL certificate to connect to vCD instance
KVCD_VCD_VERIFY_SSL=yes # optional: yes by default
# Delay between two refresh of the vCD session
KVCD_VCD_REFRESH_SESSION_INTERVAL=3600 # optional: 3600 by default
# Refresh interval of the vCloud instance data for each object
KVCD_REFRESH_INTERVAL=10 # optional: 10 by default
# Warming up duration
KVCD_REFRESH_INITIAL_DELAY=30 # optional: 30 by default
# Reduce the number of timer checks when the ressource is changed
KVCD_REFRESH_IDLE_DELAY=10 # optional: 10 by default
Test namespace
For the test, we will deploy a test namespace on the Kubernetes cluster:
kubectl create namespace "test-kvcd"
Deploy the CRD
Deploy the Custom Resource Definition by using the following commands:
export KVCD_VERSION="v0.1.0"
kubectl apply -f https://github.com/lrivallain/kvcd/releases/download/${KVCD_VERSION}/kvcd-crds.yaml
This will deploy the definitions of objects that are managed by the current operator.
Run locally
The current PoC can be run locally or be embeded in a Kubernetes deployment (with pods, service...).
The local deployment is easier to debug and troubleshoot but requires that the script remain running to manage resources.
The embeded deployment is probably a better choice for a real-use-case but may be more complexe to troubleshoot.
For the early versions, the documentation will only cover a local execution of the operator backend.
# Run operator with kopf command and listen to specific namespaces
kopf run -m kvcd.main --namespace="test-kvcd" --verbose
Test
You can now deploy a test empty vApp to check the behavior of the operator:
cat << EOF | kubectl apply -f -
---
apiVersion: kvcd.lrivallain.dev/v1
kind: VcdVapp
metadata:
name: kvcd-test-vapp1
namespace: test-kvcd
annotations:
app: app01
isprod: "false"
version: "0.1.0"
spec:
description: Test description
org: <name of your org>
vdc: <name of your org VDC>
owner: <name of the owner to set>
EOF
kubectl get vcdvapp
After a couple of seconds, you should get something like this:
NAME ORG VDC STATUS UUID
kvcd-test-vapp1 <org> <org vdc> Resolved urn:vcloud:vapp:a2871e71-49ab-48a4-a6dc-4c11743b7ba7
You can now edit fields values, delete or manage the vApp like a kube object.
Cleanup
kubectl delete -n test-kvcd vcdvapp kvcd-test-vapp1
kubectl delete namespace test-kvcd
History
0.1.0 (2021-08-13)
- First release on PyPI.
kvcd is a proof-of-concept of a python based kubernetes operator to manage VMware vCloud Director resources.
With this first preview release, you can manage the state of vApp objects with the following configuration items:
- Org (creation only)
- Org VDC (creation only)
- Name (creation only)
- Description
- Fence mode (creation only)
- EULAs acceptance (creation only)
- Ownership
- Power status: on/off
- deploymentLease
- storageLease
- source catalog: if cloned from vCD library item
- source template: if cloned from vCD library item
- metadata: through the Kubernetes resources annotations: ReadOnly on vCloud Director side.
The operator also populates a status.backing dictionnary with the following properties according to the vCloud
Director data:
- UUID
- status
- vcd_vapp_href
- vcd_vdc_href
- owner
- deploymentLeaseInSeconds
- storageLeaseInSeconds
- metadata
If a deviation is detected with the declared specs of the object: a reconcialiation is made to apply the state from
the declared specs.
It may remains some use-case where the reconcialiation will fail like when trying to apply a power-on expected state on an expired object.*
The same reconcialiation process will occurs when a change is made to the specs object declaration to apply changes
to the backing object on vCloud Director.
Modification of some
specsproperties will be ignored, such asorg,vdc,fence_modeoraccept_all_eulas.
Metadata
Release files for kvcd 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kvcd-0.1.0.tar.gz | 19.3 kB | Without provenance | Details for kvcd-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kvcd-0.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for kvcd-0.1.0-py2.py3-none-any.whl |
Total release size: 32.9 kB
Release files / kvcd-0.1.0.tar.gz
| Download URL | kvcd-0.1.0.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f6d92e656aaee008a24914313f38961b2990cdcc9b58c035f15f7a434df6e7d
|
|
BLAKE2b-256 checksum How to use checksums |
0d1bff7e6af9752524618936d5463939619fcc494907f3a28e132256a09e5eb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.11
|
Release files / kvcd-0.1.0-py2.py3-none-any.whl
| Download URL | kvcd-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ccd5ac54aa1a79bc990db7493f5b870391a5bc3506981eaa5b05ab039ae02b1f
|
|
BLAKE2b-256 checksum How to use checksums |
c7a68bb3f293e764c66181e8daf5059d1777060d4e72c6190b83e783e9b34585
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.11
|
Security for kvcd 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.