Package: kvcd
Kubernetes vCD operatorA python based proof of concept of an operator to manage VMware Cloud Director ressources.Free software: MIT licenseDocumentation:kvcd.readthedocs.io.Featureskvcdis a proof-of-concept of a python based kubernetes operator to manage VMware vCloud Director resources.With this firstpreviewrelease, you can manage the state ofvAppobjects with the following configuration
properties:Parent Org (creation only)Parent Org VDC (creation only)Name (creation only)DescriptionFence mode (creation only)EULAs acceptance (creation only)OwnershipPower status: on/offdeploymentLeasestorageLeasesource catalog: if cloned from vCD library itemsource template: if cloned from vCD library itemmetadata: through the Kubernetes resources annotations: ReadOnly on vCloud Director side.The operator also populates astatus.backingdictionnary with the following properties according to the vCloud
Director data:UUIDstatusvcd_vapp_hrefvcd_vdc_hrefownerdeploymentLeaseInSecondsstorageLeaseInSecondsmetadataIf a deviation is detected with the declaredspecsof the object: a reconcialiation is made to apply the state from
the declaredspecs.It may remains some use-case where the reconcialiation will fail like when trying to apply a
power-on expected state on anexpiredobject.*The same reconcialiation process will occurs when a change is made to thespecsobject declaration to apply changes
to thebackingobject on vCloud Director.Modification of somespecsproperties will be ignored, such asorg,vdc,fence_modeoraccept_all_eulas.InstallationStable releaseTo install Kubernetes vCD operator, run this command in your terminal:pipinstallkvcdThis is the preferred method to install Kubernetes vCD operator, as it will always install the most recent stable release.If you don't havepipinstalled, thisPython installation guidecan guide you through the process.From sourcesThe sources for Kubernetes vCD operator can be downloaded from theGithub repo.You can clone the public repository:gitclonegit://github.com/lrivallain/kvcdOnce you have a copy of the source, you can install it with:pipinstall.UsageConfigurationCreate a.venvfile with the following content, according to your setup:# Hostname of the vCloud instanceKVCD_VCD_HOST=vcloud.domain# mandatory# HTTPS port to the vCloud instanceKVCD_VCD_PORT=443# optional: 443 by default# Organisation of the vCloud userKVCD_VCD_ORG=orgX# mandatory# vCloud credentials to use as a service accountKVCD_VCD_USERNAME=kvcd-svc# mandatoryKVCD_VCD_PASSWORD=**********# mandatory# Verify the SSL certificate to connect to vCD instanceKVCD_VCD_VERIFY_SSL=yes# optional: yes by default# Delay between two refresh of the vCD sessionKVCD_VCD_REFRESH_SESSION_INTERVAL=3600# optional: 3600 by default# Refresh interval of the vCloud instance data for each objectKVCD_REFRESH_INTERVAL=10# optional: 10 by default# Warming up durationKVCD_REFRESH_INITIAL_DELAY=30# optional: 30 by default# Reduce the number of timer checks when the ressource is changedKVCD_REFRESH_IDLE_DELAY=10# optional: 10 by defaultTest namespaceFor the test, we will deploy a test namespace on the Kubernetes cluster:kubectlcreatenamespace"test-kvcd"Deploy the CRDDeploy the Custom Resource Definition by using the following commands:exportKVCD_VERSION="v0.1.0"kubectlapply-fhttps://github.com/lrivallain/kvcd/releases/download/${KVCD_VERSION}/kvcd-crds.yamlThis will deploy the definitions of objects that are managed by the current operator.Run locallyThe 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 namespaceskopfrun-mkvcd.main--namespace="test-kvcd"--verboseTestYou can now deploy a test empty vApp to check the behavior of the operator:cat<< EOF | kubectl apply -f ----apiVersion: kvcd.lrivallain.dev/v1kind: VcdVappmetadata:name: kvcd-test-vapp1namespace: test-kvcdannotations:app: app01isprod: "false"version: "0.1.0"spec:description: Test descriptionorg: <name of your org>vdc: <name of your org VDC>owner: <name of the owner to set>EOFkubectlgetvcdvappAfter a couple of seconds, you should get something like this:NAMEORGVDCSTATUSUUID
kvcd-test-vapp1<org><orgvdc>Resolvedurn:vcloud:vapp:a2871e71-49ab-48a4-a6dc-4c11743b7ba7You can now edit fields values, delete or manage the vApp like a kube object.Cleanupkubectldelete-ntest-kvcdvcdvappkvcd-test-vapp1
kubectldeletenamespacetest-kvcdHistory0.1.0 (2021-08-13)First release on PyPI.kvcdis a proof-of-concept of a python based kubernetes operator to manage VMware vCloud Director resources.With this firstpreviewrelease, you can manage the state of vApp objects with the following configuration items:Org (creation only)Org VDC (creation only)Name (creation only)DescriptionFence mode (creation only)EULAs acceptance (creation only)OwnershipPower status: on/offdeploymentLeasestorageLeasesource catalog: if cloned from vCD library itemsource template: if cloned from vCD library itemmetadata: through the Kubernetes resources annotations: ReadOnly on vCloud Director side.The operator also populates astatus.backingdictionnary with the following properties according to the vCloud
Director data:UUIDstatusvcd_vapp_hrefvcd_vdc_hrefownerdeploymentLeaseInSecondsstorageLeaseInSecondsmetadataIf a deviation is detected with the declaredspecsof the object: a reconcialiation is made to apply the state from
the declaredspecs.It may remains some use-case where the reconcialiation will fail like when trying to apply a
power-on expected state on anexpiredobject.*The same reconcialiation process will occurs when a change is made to thespecsobject declaration to apply changes
to thebackingobject on vCloud Director.Modification of somespecsproperties will be ignored, such asorg,vdc,fence_modeoraccept_all_eulas.