vmware / go-vcloud-director

Golang SDK for VMware Cloud Director
Other
79 stars 76 forks source link

Add methods to support CRUD operations on CSE Kubernetes clusters #645

Closed adambarreiro closed 7 months ago

adambarreiro commented 8 months ago

Context

While the generic Runtime Defined Entity approach to create, read, update and delete Kubernetes clusters is completely valid and usable, it causes some challenges to the final users, as the process can be cumbersome at certain stages, and prone to errors.

The idea of this PR is to provide a set of abstractions that simplify the mentioned operations. These abstractions are accomplished by introducing several new public types and methods on these types.

Description

This PR adds some new types:

This PR adds some new methods:

File layout

Extra changes

Testing

Testing CSE methods

To run the CSE tests, one must set the TEST_VCD_CSE environment variable to any non-empty value. The reason is that CSE requires a very unique environment, and the tests take a long time to be executed.

The tests also require a special govcd_test_config.yaml file that is almost empty and contains the new cse section:

provider:
  user: administrator
  password: *****
  url: https://my-vcd.com/api
  sysOrg: System
vcd:
  org: tenant_org
  nsxt:
    vdc: tenant_vdc
logging:
  enabled: true
  logFileName: go-vcloud-director.log
  verboseCleanup: true
cse:
  version: "4.2.0"
  solutionsOrg: "solutions_org"
  storageProfile: "*"
  tenantOrg: "tenant_org"
  tenantVdc: "tenant_vdc"
  routedNetwork: "tenant_net_routed"
  edgeGateway: "tenant_edgegateway"
  ovaCatalog: "tkgm_catalog"
  ovaName: "ubuntu-2004-kube-v1.25.7+vmware.2-tkg.1-8a74b9f12e488c54605b3537acb683bc"

The one can run:

GOVCD_SKIP_VAPP_CREATION=1;TEST_VCD_CSE=1 go test -tags cse -check.f 'Test_Cse' -check.vv -timeout=0 | tee $HOME/test-cse.log

Testing other minor changes

To test other minor changes, like refactors and RDE minor improvements, the usual procedure can be used.