├── .crd-ref-docs ├── config.yaml └── template │ ├── gv_list.tpl │ ├── type.tpl │ └── type_members.tpl ├── .dockerignore ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── configs │ └── labeler.yml └── workflows │ ├── ci.yml │ ├── post-coverage-to-pr.yml │ ├── pr-labeler.yml │ ├── pr-rtfd.yml │ └── testing-needed.yml ├── .gitignore ├── .golangci.yml ├── .markdownlint.yaml ├── .markdownlintrc ├── .readthedocs.yaml ├── CONTRIBUTING.md ├── Dockerfile ├── Dockerfile.docs ├── LICENSE.txt ├── Makefile ├── NOTICE.txt ├── PROJECT ├── README.md ├── api ├── LICENSE.txt ├── apis.go ├── go.mod ├── go.sum ├── utilconversion │ ├── conversion.go │ └── fuzztests │ │ └── conversion_fuzz.go ├── v1alpha1 │ ├── condition_consts.go │ ├── condition_conversion.go │ ├── condition_types.go │ ├── contentlibraryprovider_types.go │ ├── contentsource_types.go │ ├── contentsourcebinding_types.go │ ├── conversion_test.go │ ├── doc.go │ ├── groupversion_info.go │ ├── install │ │ └── install.go │ ├── v1alpha1_suite_test.go │ ├── virtualmachine_conversion.go │ ├── virtualmachine_conversion_test.go │ ├── virtualmachine_types.go │ ├── virtualmachineclass_conversion.go │ ├── virtualmachineclass_conversion_test.go │ ├── virtualmachineclass_types.go │ ├── virtualmachineclassbinding_types.go │ ├── virtualmachineimage_conversion.go │ ├── virtualmachineimage_conversion_test.go │ ├── virtualmachineimage_types.go │ ├── virtualmachinepublishrequest_conversion.go │ ├── virtualmachinepublishrequest_types.go │ ├── virtualmachineservice_conversion.go │ ├── virtualmachineservice_types.go │ ├── virtualmachinesetresourcepolicy_conversion.go │ ├── virtualmachinesetresourcepolicy_types.go │ ├── virtualmachinetempl_types.go │ ├── webconsolerequest_types.go │ ├── zz_generated.conversion.go │ └── zz_generated.deepcopy.go ├── v1alpha2 │ ├── cloudinit │ │ ├── cloudconfig.go │ │ └── zz_generated.deepcopy.go │ ├── common │ │ ├── types.go │ │ └── zz_generated.deepcopy.go │ ├── condition_consts.go │ ├── conversion_test.go │ ├── doc.go │ ├── groupversion_info.go │ ├── sysprep │ │ ├── conversion │ │ │ ├── v1alpha2 │ │ │ │ └── sysprep_conversion.go │ │ │ └── v1alpha4 │ │ │ │ └── sysprep_conversion.go │ │ ├── sysprep.go │ │ └── zz_generated.deepcopy.go │ ├── testdata │ │ ├── vm-with-cloudinit.yaml │ │ └── vm-with-sysprep.yaml │ ├── v1alpha2_suite_test.go │ ├── virtualmachine_bootstrap_types.go │ ├── virtualmachine_conversion.go │ ├── virtualmachine_conversion_test.go │ ├── virtualmachine_network_types.go │ ├── virtualmachine_readiness_types.go │ ├── virtualmachine_storage_types.go │ ├── virtualmachine_types.go │ ├── virtualmachineclass_conversion.go │ ├── virtualmachineclass_conversion_test.go │ ├── virtualmachineclass_types.go │ ├── virtualmachineimage_conversion.go │ ├── virtualmachineimage_types.go │ ├── virtualmachinepublishrequest_conversion.go │ ├── virtualmachinepublishrequest_types.go │ ├── virtualmachineservice_conversion.go │ ├── virtualmachineservice_types.go │ ├── virtualmachinesetresourcepolicy_conversion.go │ ├── virtualmachinesetresourcepolicy_types.go │ ├── virtualmachinetempl_types.go │ ├── virtualmachinewebconsolerequest_conversion.go │ ├── virtualmachinewebconsolerequest_types.go │ ├── zz_generated.conversion.go │ └── zz_generated.deepcopy.go ├── v1alpha3 │ ├── cloudinit │ │ ├── cloudconfig.go │ │ └── zz_generated.deepcopy.go │ ├── common │ │ ├── conversion │ │ │ ├── v1alpha3 │ │ │ │ └── common_conversion.go │ │ │ └── v1alpha4 │ │ │ │ └── common_conversion.go │ │ ├── types.go │ │ └── zz_generated.deepcopy.go │ ├── condition_consts.go │ ├── conversion_test.go │ ├── doc.go │ ├── groupversion_info.go │ ├── sysprep │ │ ├── sysprep.go │ │ └── zz_generated.deepcopy.go │ ├── testdata │ │ ├── vm-with-cloudinit.yaml │ │ └── vm-with-sysprep.yaml │ ├── v1alpha3_suite_test.go │ ├── virtualmachine_bootstrap_types.go │ ├── virtualmachine_conversion.go │ ├── virtualmachine_conversion_test.go │ ├── virtualmachine_network_types.go │ ├── virtualmachine_readiness_types.go │ ├── virtualmachine_storage_types.go │ ├── virtualmachine_types.go │ ├── virtualmachineclass_conversion.go │ ├── virtualmachineclass_types.go │ ├── virtualmachineimage_conversion.go │ ├── virtualmachineimage_types.go │ ├── virtualmachineimagecache_conversion.go │ ├── virtualmachineimagecache_types.go │ ├── virtualmachinepublishrequest_conversion.go │ ├── virtualmachinepublishrequest_types.go │ ├── virtualmachinereplicaset_types.go │ ├── virtualmachineservice_conversion.go │ ├── virtualmachineservice_types.go │ ├── virtualmachinesetresourcepolicy_conversion.go │ ├── virtualmachinesetresourcepolicy_types.go │ ├── virtualmachinetempl_types.go │ ├── virtualmachinewebconsolerequest_conversion.go │ ├── virtualmachinewebconsolerequest_types.go │ ├── zz_generated.conversion.go │ ├── zz_generated.deepcopy.go │ └── zz_virtualmachine_guestosid_generated.go └── v1alpha4 │ ├── cloudinit │ ├── cloudconfig.go │ └── zz_generated.deepcopy.go │ ├── common │ ├── types.go │ └── zz_generated.deepcopy.go │ ├── condition_consts.go │ ├── doc.go │ ├── groupversion_info.go │ ├── sysprep │ ├── sysprep.go │ └── zz_generated.deepcopy.go │ ├── testdata │ ├── vm-with-cloudinit.yaml │ └── vm-with-sysprep.yaml │ ├── virtualmachine_bootstrap_types.go │ ├── virtualmachine_conversion.go │ ├── virtualmachine_network_types.go │ ├── virtualmachine_readiness_types.go │ ├── virtualmachine_storage_types.go │ ├── virtualmachine_types.go │ ├── virtualmachineclass_conversion.go │ ├── virtualmachineclass_types.go │ ├── virtualmachineimage_conversion.go │ ├── virtualmachineimage_types.go │ ├── virtualmachineimagecache_conversion.go │ ├── virtualmachineimagecache_types.go │ ├── virtualmachinepublishrequest_conversion.go │ ├── virtualmachinepublishrequest_types.go │ ├── virtualmachinereplicaset_types.go │ ├── virtualmachineservice_conversion.go │ ├── virtualmachineservice_types.go │ ├── virtualmachinesetresourcepolicy_conversion.go │ ├── virtualmachinesetresourcepolicy_types.go │ ├── virtualmachinetempl_types.go │ ├── virtualmachinewebconsolerequest_conversion.go │ ├── virtualmachinewebconsolerequest_types.go │ ├── zz_generated.deepcopy.go │ └── zz_virtualmachine_guestosid_generated.go ├── cmd └── web-console-validator │ └── main.go ├── config ├── ccs-plugin │ └── plugin.yaml ├── certmanager │ ├── certificate.yaml │ ├── kustomization.yaml │ └── kustomizeconfig.yaml ├── crd │ ├── bases │ │ ├── vmoperator.vmware.com_clustervirtualmachineimages.yaml │ │ ├── vmoperator.vmware.com_contentlibraryproviders.yaml │ │ ├── vmoperator.vmware.com_contentsourcebindings.yaml │ │ ├── vmoperator.vmware.com_contentsources.yaml │ │ ├── vmoperator.vmware.com_virtualmachineclassbindings.yaml │ │ ├── vmoperator.vmware.com_virtualmachineclasses.yaml │ │ ├── vmoperator.vmware.com_virtualmachineimagecaches.yaml │ │ ├── vmoperator.vmware.com_virtualmachineimages.yaml │ │ ├── vmoperator.vmware.com_virtualmachinepublishrequests.yaml │ │ ├── vmoperator.vmware.com_virtualmachinereplicasets.yaml │ │ ├── vmoperator.vmware.com_virtualmachines.yaml │ │ ├── vmoperator.vmware.com_virtualmachineservices.yaml │ │ ├── vmoperator.vmware.com_virtualmachinesetresourcepolicies.yaml │ │ ├── vmoperator.vmware.com_virtualmachinewebconsolerequests.yaml │ │ └── vmoperator.vmware.com_webconsolerequests.yaml │ ├── external-crds │ │ ├── README.md │ │ ├── appplatform.vmware.com_supervisorproperties.yaml │ │ ├── cns.vmware.com_storagepolicyquotas.yaml │ │ ├── cns.vmware.com_storagepolicyusages.yaml │ │ ├── cnsnodevmattachment-crd.yaml │ │ ├── encryption.vmware.com_encryptionclasses.yaml │ │ ├── iaas.vmware.com_capabilities.yaml │ │ ├── imageregistry.vmware.com_clustercontentlibraries.yaml │ │ ├── imageregistry.vmware.com_clustercontentlibraryitems.yaml │ │ ├── imageregistry.vmware.com_contentlibraries.yaml │ │ ├── imageregistry.vmware.com_contentlibraryitemimportrequests.yaml │ │ ├── imageregistry.vmware.com_contentlibraryitems.yaml │ │ ├── netoperator.vmware.com_networkinterfaces.yaml │ │ ├── topology.tanzu.vmware.com_availabilityzones.yaml │ │ ├── topology.tanzu.vmware.com_vspherezones.yaml │ │ └── topology.tanzu.vmware.com_zones.yaml │ ├── kustomization.yaml │ ├── kustomizeconfig.yaml │ └── patches │ │ ├── cainjection_in_clustervirtualmachineimages.yaml │ │ ├── cainjection_in_virtualmachineclasses.yaml │ │ ├── cainjection_in_virtualmachineimages.yaml │ │ ├── cainjection_in_virtualmachinepublishrequests.yaml │ │ ├── cainjection_in_virtualmachinereplicasets.yaml │ │ ├── cainjection_in_virtualmachines.yaml │ │ ├── cainjection_in_virtualmachineservices.yaml │ │ ├── cainjection_in_virtualmachinesetresourcepolicies.yaml │ │ ├── cainjection_in_virtualmachinewebconsolerequests.yaml │ │ ├── crd_preserveUnknownFields.yaml │ │ ├── webhook_in_clustervirtualmachineimages.yaml │ │ ├── webhook_in_virtualmachineclasses.yaml │ │ ├── webhook_in_virtualmachineimages.yaml │ │ ├── webhook_in_virtualmachinepublishrequests.yaml │ │ ├── webhook_in_virtualmachinereplicasets.yaml │ │ ├── webhook_in_virtualmachines.yaml │ │ ├── webhook_in_virtualmachineservices.yaml │ │ ├── webhook_in_virtualmachinesetresourcepolicies.yaml │ │ └── webhook_in_virtualmachinewebconsolerequests.yaml ├── default │ ├── kustomization.yaml │ ├── manager_auth_proxy_patch.yaml │ ├── manager_default_container_patch.yaml │ ├── manager_leader_election_id_patch.yaml │ ├── manager_max_concurrent_reconciles_patch.yaml │ ├── manager_pod_info_patch.yaml │ ├── manager_prometheus_metrics_patch.yaml │ ├── manager_replicas_patch.yaml │ ├── manager_tolerations_patch.yaml │ ├── manager_update_strategy_patch.yaml │ └── manager_webhook_patch.yaml ├── local-vcsim │ ├── Makefile │ ├── kustomization.yaml │ ├── lb-xds.yaml │ ├── remove-node-selector-patch.yaml │ ├── sc.yaml │ └── vcsim-patch.yaml ├── local │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── kustomization.yaml │ └── vmoperator │ │ ├── cpu_resources_patch.yaml │ │ ├── kustomization.yaml │ │ ├── local_env_var_patch.yaml │ │ ├── namespace_patch.yaml │ │ └── revision_history_limit.yaml ├── manager │ ├── kustomization.yaml │ └── manager.yaml ├── prometheus │ ├── kustomization.yaml │ └── monitor.yaml ├── rbac │ ├── auth_proxy_role.yaml │ ├── auth_proxy_role_binding.yaml │ ├── auth_proxy_service.yaml │ ├── certman_role.yaml │ ├── certman_role_binding.yaml │ ├── contentlibraryprovider_editor_role.yaml │ ├── contentlibraryprovider_viewer_role.yaml │ ├── contentsource_editor_role.yaml │ ├── contentsource_viewer_role.yaml │ ├── contentsourcebinding_editor_role.yaml │ ├── contentsourcebinding_viewer_role.yaml │ ├── kustomization.yaml │ ├── leader_election_role.yaml │ ├── leader_election_role_binding.yaml │ ├── role.yaml │ ├── role_binding.yaml │ ├── virtualmachine_editor_role.yaml │ ├── virtualmachine_viewer_role.yaml │ ├── virtualmachineclass_editor_role.yaml │ ├── virtualmachineclass_viewer_role.yaml │ ├── virtualmachineclassbinding_editor_role.yaml │ ├── virtualmachineclassbinding_viewer_role.yaml │ ├── virtualmachineimage_editor_role.yaml │ ├── virtualmachineimage_viewer_role.yaml │ ├── virtualmachineservice_editor_role.yaml │ ├── virtualmachineservice_viewer_role.yaml │ ├── virtualmachinesetresourcepolicy_editor_role.yaml │ └── virtualmachinesetresourcepolicy_viewer_role.yaml ├── replacements │ └── kustomization.yaml ├── samples │ ├── vmoperator_v1alpha1_contentlibraryprovider.yaml │ ├── vmoperator_v1alpha1_contentsource.yaml │ ├── vmoperator_v1alpha1_virtualmachine.yaml │ ├── vmoperator_v1alpha1_virtualmachineclass.yaml │ ├── vmoperator_v1alpha1_virtualmachineimage.yaml │ ├── vmoperator_v1alpha1_virtualmachineservice.yaml │ └── vmoperator_v1alpha1_virtualmachinesetresourcepolicy.yaml ├── virtualmachineclasses │ ├── Makefile │ ├── kustomization.yaml │ ├── v1alpha1_vmclass_best_effort_2xlarge.yaml │ ├── v1alpha1_vmclass_best_effort_4xlarge.yaml │ ├── v1alpha1_vmclass_best_effort_8xlarge.yaml │ ├── v1alpha1_vmclass_best_effort_large.yaml │ ├── v1alpha1_vmclass_best_effort_medium.yaml │ ├── v1alpha1_vmclass_best_effort_small.yaml │ ├── v1alpha1_vmclass_best_effort_xlarge.yaml │ ├── v1alpha1_vmclass_best_effort_xsmall.yaml │ ├── v1alpha1_vmclass_guaranteed_2xlarge.yaml │ ├── v1alpha1_vmclass_guaranteed_4xlarge.yaml │ ├── v1alpha1_vmclass_guaranteed_8xlarge.yaml │ ├── v1alpha1_vmclass_guaranteed_large.yaml │ ├── v1alpha1_vmclass_guaranteed_medium.yaml │ ├── v1alpha1_vmclass_guaranteed_small.yaml │ ├── v1alpha1_vmclass_guaranteed_xlarge.yaml │ └── v1alpha1_vmclass_guaranteed_xsmall.yaml ├── wcp-no-configmap │ ├── Makefile │ └── kustomization.yaml ├── wcp │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── configmaps │ │ ├── kustomization.yaml │ │ ├── vmoperator_network_config.yaml │ │ └── vsphere_provider_config.yaml │ ├── kustomization.yaml │ └── vmoperator │ │ ├── anti_affinity_patch.yaml │ │ ├── certs_volume_patch.yaml │ │ ├── cpu_resources_patch.yaml │ │ ├── image_patch.yaml │ │ ├── kustomization.yaml │ │ ├── manager_env_var_patch.yaml │ │ ├── manager_metrics_port_patch.yaml │ │ ├── manager_metrics_scrape_patch.yaml │ │ ├── namespace_patch.yaml │ │ ├── network_patch.yaml │ │ ├── privileged_psp_role.yaml │ │ ├── privileged_psp_role_binding.yaml │ │ ├── proxy_metrics_port_patch.yaml │ │ ├── service_metrics_port_patch.yaml │ │ └── web_console_validator_patch.yaml ├── web-console-validator │ ├── kustomization.yaml │ └── web_console_validator.yaml └── webhook │ ├── kustomization.yaml │ ├── kustomizeconfig.yaml │ ├── manifests.yaml │ ├── manifests_label_patch.yaml │ ├── service.yaml │ ├── storage_quota_webhook_configuration.yaml │ └── webhookcainjection_patch.yaml ├── controllers ├── contentlibrary │ ├── clustercontentlibraryitem │ │ ├── clustercontentlibraryitem_controller.go │ │ ├── clustercontentlibraryitem_controller_intg_test.go │ │ └── clustercontentlibraryitem_controller_suite_test.go │ ├── contentlibraryitem │ │ ├── contentlibraryitem_controller.go │ │ ├── contentlibraryitem_controller_intg_test.go │ │ └── contentlibraryitem_controller_suite_test.go │ ├── controllers.go │ └── utils │ │ ├── constants.go │ │ ├── controller_builder.go │ │ ├── controller_builder_test.go │ │ ├── test_utils.go │ │ ├── utils.go │ │ ├── utils_suite_test.go │ │ └── utils_test.go ├── controllers.go ├── infra │ ├── capability │ │ ├── configmap │ │ │ ├── configmap_capability_controller.go │ │ │ ├── configmap_capability_controller_suite_test.go │ │ │ └── configmap_capability_controller_test.go │ │ ├── controllers.go │ │ └── crd │ │ │ ├── crd_capability_controller.go │ │ │ ├── crd_capability_controller_suite_test.go │ │ │ └── crd_capability_controller_test.go │ ├── configmap │ │ ├── infra_configmap.go │ │ ├── infra_configmap_controller.go │ │ ├── infra_configmap_controller_intg_test.go │ │ ├── infra_configmap_suite_test.go │ │ └── infra_configmap_test.go │ ├── controllers.go │ ├── node │ │ ├── infra_node_controller.go │ │ ├── infra_node_controller_intg_test.go │ │ └── infra_node_controller_suite_test.go │ ├── secret │ │ ├── infra_secret_controller.go │ │ ├── infra_secret_controller_intg_test.go │ │ └── infra_secret_controller_suite_test.go │ ├── validatingwebhookconfiguration │ │ ├── validatingwebhookconfiguration_controller.go │ │ ├── validatingwebhookconfiguration_controller_intg_test.go │ │ ├── validatingwebhookconfiguration_controller_suite_test.go │ │ └── validatingwebhookconfiguration_controller_unit_test.go │ └── zone │ │ ├── zone_controller.go │ │ ├── zone_controller_suite_test.go │ │ └── zone_controller_test.go ├── storageclass │ ├── storageclass_controller.go │ ├── storageclass_controller_intg_test.go │ ├── storageclass_controller_suite_test.go │ └── storageclass_controller_unit_test.go ├── storagepolicyquota │ ├── storagepolicyquota_controller.go │ ├── storagepolicyquota_controller_intg_test.go │ ├── storagepolicyquota_controller_suite_test.go │ └── storagepolicyquota_controller_unit_test.go ├── util │ ├── encoding │ │ ├── encoding.go │ │ ├── encoding_suite_test.go │ │ └── encoding_test.go │ └── remote │ │ └── remote.go ├── virtualmachine │ ├── controllers.go │ ├── storagepolicyusage │ │ ├── storagepolicyusage_controller.go │ │ ├── storagepolicyusage_controller_intg_test.go │ │ ├── storagepolicyusage_controller_suite_test.go │ │ └── storagepolicyusage_controller_unit_test.go │ ├── virtualmachine │ │ ├── virtualmachine_controller.go │ │ ├── virtualmachine_controller_intg_test.go │ │ ├── virtualmachine_controller_suite_test.go │ │ └── virtualmachine_controller_unit_test.go │ └── volume │ │ ├── volume_controller.go │ │ ├── volume_controller_intg_test.go │ │ ├── volume_controller_suite_test.go │ │ └── volume_controller_unit_test.go ├── virtualmachineclass │ ├── virtualmachineclass_controller.go │ ├── virtualmachineclass_controller_intg_test.go │ ├── virtualmachineclass_controller_suite_test.go │ └── virtualmachineclass_controller_unit_test.go ├── virtualmachineimagecache │ ├── internal │ │ └── virtualmachineimagecache_controller_internal.go │ ├── virtualmachineimagecache_controller.go │ ├── virtualmachineimagecache_controller_suite_test.go │ └── virtualmachineimagecache_controller_test.go ├── virtualmachinepublishrequest │ ├── virtualmachinepublishrequest_controller.go │ ├── virtualmachinepublishrequest_controller_intg_test.go │ ├── virtualmachinepublishrequest_controller_suite_test.go │ └── virtualmachinepublishrequest_controller_unit_test.go ├── virtualmachinereplicaset │ ├── virtualmachinereplicaset_controller.go │ ├── virtualmachinereplicaset_controller_intg_test.go │ ├── virtualmachinereplicaset_controller_suite_test.go │ └── virtualmachinereplicaset_delete_policy.go ├── virtualmachineservice │ ├── providers │ │ ├── loadbalancer_provider.go │ │ ├── loadbalancer_provider_suite_test.go │ │ └── loadbalancer_provider_test.go │ ├── utils │ │ ├── constants.go │ │ └── endpoints.go │ ├── virtualmachineservice_controller.go │ ├── virtualmachineservice_controller_intg_test.go │ ├── virtualmachineservice_controller_suite_test.go │ └── virtualmachineservice_controller_unit_test.go ├── virtualmachinesetresourcepolicy │ ├── virtualmachinesetresourcepolicy_controller.go │ ├── virtualmachinesetresourcepolicy_controller_intg_test.go │ ├── virtualmachinesetresourcepolicy_controller_suite_test.go │ └── virtualmachinesetresourcepolicy_controller_unit_test.go └── virtualmachinewebconsolerequest │ ├── controllers.go │ ├── v1alpha1 │ ├── conditions │ │ ├── conditions_suite_test.go │ │ ├── getter.go │ │ ├── getter_test.go │ │ ├── matcher.go │ │ ├── matcher_test.go │ │ ├── merge.go │ │ ├── merge_strategies.go │ │ ├── merge_strategies_test.go │ │ ├── merge_test.go │ │ ├── patch.go │ │ ├── patch_test.go │ │ ├── setter.go │ │ ├── setter_test.go │ │ ├── unstructured.go │ │ ├── unstructured_test.go │ │ └── utils.go │ ├── patch │ │ ├── options.go │ │ ├── patch.go │ │ ├── patch_test.go │ │ ├── suite_test.go │ │ ├── utils.go │ │ └── utils_test.go │ ├── webconsolerequest_controller.go │ ├── webconsolerequest_intg_test.go │ ├── webconsolerequest_suite_test.go │ └── webconsolerequest_unit_test.go │ ├── webconsolerequest_controller.go │ ├── webconsolerequest_intg_test.go │ ├── webconsolerequest_suite_test.go │ └── webconsolerequest_unit_test.go ├── docs ├── README.md ├── concepts │ ├── README.md │ ├── api.md │ ├── components.md │ ├── images │ │ ├── README.md │ │ ├── pub-vm-image.md │ │ └── vm-image.md │ ├── services-networking │ │ ├── README.md │ │ ├── guest-net-config.md │ │ └── vm-service.md │ └── workloads │ │ ├── README.md │ │ ├── guest.md │ │ ├── vm-class.md │ │ ├── vm-controller.md │ │ ├── vm-example.yaml │ │ ├── vm-web-console.md │ │ └── vm.md ├── favicon.svg ├── ref │ ├── README.md │ ├── api │ │ ├── README.md │ │ ├── v1alpha1.md │ │ ├── v1alpha2.md │ │ ├── v1alpha3.md │ │ └── v1alpha4.md │ ├── config │ │ ├── README.md │ │ └── manager.md │ └── proj │ │ ├── README.md │ │ ├── build.md │ │ ├── docs.md │ │ └── release.md ├── requirements.txt ├── start │ ├── README.md │ ├── about │ │ ├── README.md │ │ ├── license.md │ │ ├── release-notes.md │ │ └── roadmap.md │ ├── contrib │ │ ├── README.md │ │ ├── report-issue.md │ │ ├── submit-change.md │ │ └── suggest-change.md │ ├── help.md │ └── quick.md ├── tutorials │ ├── README.md │ ├── deploy-apps │ │ ├── README.md │ │ └── nfs-server-and-client.md │ ├── deploy-vm │ │ ├── README.md │ │ ├── cloudinit.md │ │ ├── iso.md │ │ ├── vappconfig.md │ │ └── with-pvc.md │ └── troubleshooting │ │ ├── README.md │ │ ├── deploy-vm.md │ │ ├── get-console-session.md │ │ ├── ip-assignment.md │ │ └── publish-vm.md └── www │ ├── css │ ├── anchor.css │ ├── dropdown.css │ ├── first-of-type.css │ ├── hX.css │ ├── hide-rtd-footer.css │ ├── vm-operator-font.css │ └── vm-operator.css │ ├── fonts │ ├── vm-operator.eot │ ├── vm-operator.svg │ ├── vm-operator.ttf │ └── vm-operator.woff │ ├── js │ └── anchor.js │ └── themes │ └── material │ ├── .icons │ └── vm-op │ │ ├── logo-black-solid.svg │ │ ├── logo-black.svg │ │ ├── logo-white-solid.svg │ │ └── logo-white.svg │ └── main.html ├── external ├── appplatform │ ├── api │ │ └── v1alpha1 │ │ │ ├── doc.go │ │ │ ├── register.go │ │ │ ├── supervisorprops_types.go │ │ │ └── zz_generated.deepcopy.go │ ├── go.mod │ └── go.sum ├── byok │ ├── api │ │ └── v1alpha1 │ │ │ ├── doc.go │ │ │ ├── encryptionclass_types.go │ │ │ ├── groupversion_info.go │ │ │ └── zz_generated.deepcopy.go │ ├── go.mod │ └── go.sum ├── capabilities │ ├── api │ │ └── v1alpha1 │ │ │ ├── capabilities_types.go │ │ │ ├── doc.go │ │ │ ├── groupversion_info.go │ │ │ └── zz_generated.deepcopy.go │ ├── go.mod │ └── go.sum ├── ncp │ ├── api │ │ └── v1alpha1 │ │ │ ├── doc.go │ │ │ ├── register.go │ │ │ ├── virtualnetwork_types.go │ │ │ ├── virtualnetworkinterface_types.go │ │ │ └── zz_generated.deepcopy.go │ ├── go.mod │ └── go.sum ├── storage-policy-quota │ ├── api │ │ ├── v1alpha1 │ │ │ ├── doc.go │ │ │ ├── groupversion_info.go │ │ │ ├── storagepolicyquota_types.go │ │ │ ├── storagepolicyusage_types.go │ │ │ ├── storagequota_types.go │ │ │ └── zz_generated.deepcopy.go │ │ └── v1alpha2 │ │ │ ├── groupversion_info.go │ │ │ ├── storagepolicyquota_types.go │ │ │ ├── storagepolicyusage_types.go │ │ │ ├── storagequota_types.go │ │ │ └── zz_generated.deepcopy.go │ ├── go.mod │ └── go.sum ├── tanzu-topology │ ├── api │ │ └── v1alpha1 │ │ │ ├── availability_zone.go │ │ │ ├── groupversion_info.go │ │ │ ├── vsphere_zone.go │ │ │ ├── zone.go │ │ │ └── zz_generated.deepcopy.go │ ├── go.mod │ └── go.sum └── vsphere-csi-driver │ └── pkg │ └── syncer │ └── cnsoperator │ └── apis │ ├── cnsnodevmattachment │ └── v1alpha1 │ │ ├── cnsnodevmattachment_types.go │ │ └── zz_generated.deepcopy.go │ └── groupversion_info.go ├── go.mod ├── go.sum ├── hack ├── boilerplate │ └── boilerplate.generatego.txt ├── build-container.sh ├── build-vmoperator.sh ├── deploy-local-certmanager.sh ├── deploy-local.sh ├── deploy-wcp.sh ├── dev-setup.sh ├── ensure-go.sh ├── lint-md.sh ├── lint-shell.sh ├── lint.sh ├── quicktype │ ├── .gitignore │ ├── Dockerfile │ ├── Makefile │ ├── package-lock.json │ └── package.json ├── test.sh ├── tools │ ├── Makefile │ ├── go.mod │ ├── go.sum │ └── tools.go └── verify-codegen.sh ├── main.go ├── mkdocs.yml ├── pkg ├── backup │ └── api │ │ ├── backup_types.go │ │ └── go.mod ├── bitmask │ ├── bitmask.go │ ├── bitmask_suite_test.go │ └── bitmask_test.go ├── builder │ ├── auth.go │ ├── auth_test.go │ ├── builder_suite_test.go │ ├── constants.go │ ├── mutating_webhook.go │ ├── mutating_webhook_test.go │ ├── validating_webhook.go │ └── validating_webhook_test.go ├── buildinfo.go ├── conditions │ ├── conditions.go │ ├── conditions_suite_test.go │ ├── conditions_test.go │ ├── getter.go │ ├── getter_test.go │ ├── matcher.go │ ├── matcher_test.go │ ├── merge.go │ ├── merge_strategies.go │ ├── merge_strategies_test.go │ ├── merge_test.go │ ├── patch.go │ ├── patch_test.go │ ├── setter.go │ ├── setter_test.go │ ├── unstructured.go │ ├── unstructured_test.go │ └── utils.go ├── config │ ├── capabilities │ │ ├── capabilities_suite_test.go │ │ ├── capabilities_test.go │ │ └── capabilties.go │ ├── collections.go │ ├── collections_test.go │ ├── config.go │ ├── config_suite_test.go │ ├── config_test.go │ ├── context.go │ ├── context_test.go │ ├── default.go │ ├── env.go │ ├── env │ │ ├── env.go │ │ ├── env_suite_test.go │ │ └── env_test.go │ └── env_test.go ├── constants │ ├── constants.go │ └── testlabels │ │ ├── go.mod │ │ └── test_labels.go ├── context │ ├── controller_manager_context.go │ ├── fake │ │ ├── constants.go │ │ ├── fake_controller_manager_context.go │ │ ├── fake_webhook_context.go │ │ └── fake_webhook_request_context.go │ ├── generic │ │ ├── generic_context.go │ │ ├── generic_context_test.go │ │ └── generic_suite_test.go │ ├── operation │ │ ├── operation_context.go │ │ ├── operation_context_test.go │ │ └── operation_suite_test.go │ ├── virtualmachine_context.go │ ├── virtualmachineclass_context.go │ ├── virtualmachinepublishrequest_context.go │ ├── virtualmachinereplicaset_context.go │ ├── virtualmachineservice_context.go │ ├── virtualmachinesetresourcepolicy_context.go │ ├── volume_context.go │ ├── webconsolerequest_context.go │ ├── webhook_context.go │ └── webhook_request_context.go ├── docs │ └── concepts │ │ ├── concepts_suite_test.go │ │ └── vm-class_test.go ├── errors │ ├── errors_suite_test.go │ ├── requeue_error.go │ ├── requeue_error_test.go │ ├── vmicache_not_ready_error.go │ └── vmicache_not_ready_error_test.go ├── exit │ ├── exit.go │ ├── exit_suite_test.go │ └── exit_test.go ├── gen │ └── guestosid │ │ └── guestosid.go ├── manager │ ├── cache.go │ ├── constants.go │ ├── init │ │ └── init_providers.go │ ├── manager.go │ ├── options.go │ └── test │ │ ├── cache_test.go │ │ └── manager_suite_test.go ├── mem │ ├── mem.go │ ├── mem_suite_test.go │ └── mem_test.go ├── metrics │ ├── clitem_metrics.go │ ├── constants.go │ ├── vmpub_metrics.go │ └── vmservice_metrics.go ├── patch │ ├── options.go │ ├── patch.go │ ├── patch_test.go │ ├── suite_test.go │ ├── utils.go │ └── utils_test.go ├── prober │ ├── context │ │ └── probe_context.go │ ├── fake │ │ ├── fake_prober_manager.go │ │ ├── probe │ │ │ └── fake_probe.go │ │ └── worker │ │ │ └── fake_prober_worker.go │ ├── probe │ │ ├── guestinfo.go │ │ ├── guestinfo_test.go │ │ ├── heartbeat.go │ │ ├── heartbeat_test.go │ │ ├── probe.go │ │ ├── tcp.go │ │ └── tcp_test.go │ ├── prober_manager.go │ ├── prober_manager_test.go │ └── worker │ │ ├── prober_worker.go │ │ ├── readiness_worker.go │ │ └── readiness_worker_test.go ├── providers │ ├── fake │ │ └── fake_vm_provider.go │ ├── vm_provider_interface.go │ └── vsphere │ │ ├── client │ │ └── client.go │ │ ├── clustermodules │ │ ├── cluster_modules_provider.go │ │ ├── cluster_modules_suite_test.go │ │ ├── cluster_modules_test.go │ │ ├── cluster_modules_utils.go │ │ └── cluster_modules_utils_test.go │ │ ├── config │ │ ├── config.go │ │ ├── config_suite_test.go │ │ └── config_test.go │ │ ├── constants │ │ └── constants.go │ │ ├── contentlibrary │ │ ├── content_library.go │ │ ├── content_library_provider.go │ │ ├── content_library_suite_test.go │ │ ├── content_library_test.go │ │ ├── content_library_utils.go │ │ └── content_library_utils_test.go │ │ ├── credentials │ │ ├── credentials.go │ │ ├── credentials_suite_test.go │ │ └── credentials_test.go │ │ ├── internal │ │ └── internal.go │ │ ├── network │ │ ├── devices.go │ │ ├── devices_test.go │ │ ├── gosc.go │ │ ├── gosc_test.go │ │ ├── list_interfaces.go │ │ ├── list_interfaces_test.go │ │ ├── netplan.go │ │ ├── netplan_test.go │ │ ├── network.go │ │ ├── network_suite_test.go │ │ ├── network_test.go │ │ └── nsxt.go │ │ ├── placement │ │ ├── cluster_placement.go │ │ ├── cluster_placement_test.go │ │ ├── placement_suite_test.go │ │ ├── zone_placement.go │ │ └── zone_placement_test.go │ │ ├── resources │ │ └── vm.go │ │ ├── session │ │ ├── session.go │ │ ├── session_suite_test.go │ │ ├── session_vm.go │ │ ├── session_vm_update.go │ │ └── session_vm_update_test.go │ │ ├── storage │ │ ├── provisioning.go │ │ ├── storage.go │ │ ├── storage_suite_test.go │ │ └── storage_test.go │ │ ├── sysprep │ │ ├── secret.go │ │ ├── secret_test.go │ │ └── suite_test.go │ │ ├── vcenter │ │ ├── cluster.go │ │ ├── cluster_test.go │ │ ├── folder.go │ │ ├── folder_test.go │ │ ├── getvm.go │ │ ├── getvm_test.go │ │ ├── host.go │ │ ├── host_test.go │ │ ├── resourcepool.go │ │ ├── resourcepool_test.go │ │ └── vcenter_suite_test.go │ │ ├── virtualmachine │ │ ├── backup.go │ │ ├── backup_test.go │ │ ├── ccr.go │ │ ├── ccr_test.go │ │ ├── cdrom.go │ │ ├── cdrom_test.go │ │ ├── configspec.go │ │ ├── configspec_test.go │ │ ├── conversion.go │ │ ├── conversion_test.go │ │ ├── delete.go │ │ ├── delete_test.go │ │ ├── devices.go │ │ ├── guestinfo.go │ │ ├── guestinfo_test.go │ │ ├── heartbeat.go │ │ ├── publish.go │ │ ├── publish_test.go │ │ ├── storage.go │ │ ├── virtualmachine_suite_test.go │ │ ├── webconsole_ticket.go │ │ └── webconsole_ticket_test.go │ │ ├── vmlifecycle │ │ ├── bootstrap.go │ │ ├── bootstrap_cloudinit.go │ │ ├── bootstrap_cloudinit_test.go │ │ ├── bootstrap_linuxprep.go │ │ ├── bootstrap_linuxprep_test.go │ │ ├── bootstrap_sysprep.go │ │ ├── bootstrap_sysprep_test.go │ │ ├── bootstrap_templatedata.go │ │ ├── bootstrap_templatedata_test.go │ │ ├── bootstrap_test.go │ │ ├── bootstrap_vappconfig.go │ │ ├── bootstrap_vappconfig_test.go │ │ ├── create.go │ │ ├── create_clone.go │ │ ├── create_contentlibrary.go │ │ ├── create_fastdeploy.go │ │ ├── update_status.go │ │ ├── update_status_test.go │ │ └── vmlifecycle_suite_test.go │ │ ├── vmprovider.go │ │ ├── vmprovider_resourcepolicy.go │ │ ├── vmprovider_resourcepolicy_test.go │ │ ├── vmprovider_test.go │ │ ├── vmprovider_vm.go │ │ ├── vmprovider_vm2_test.go │ │ ├── vmprovider_vm_resize_test.go │ │ ├── vmprovider_vm_test.go │ │ ├── vmprovider_vm_utils.go │ │ ├── vmprovider_vm_utils_test.go │ │ └── vsphere_suite_test.go ├── record │ ├── recorder.go │ ├── recorder_context.go │ ├── recorder_context_test.go │ ├── recorder_suite_test.go │ └── recorder_test.go ├── topology │ ├── availability_zones.go │ ├── availability_zones_suite_test.go │ └── availability_zones_test.go ├── util │ ├── bootstrap_condition.go │ ├── bootstrap_condition_test.go │ ├── cache.go │ ├── cache_test.go │ ├── cloudinit │ │ ├── cloudconfig.go │ │ ├── cloudconfig_secret.go │ │ ├── cloudconfig_secret_test.go │ │ ├── cloudconfig_test.go │ │ ├── cloudinit_suite_test.go │ │ ├── schema │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── cloudconfig.go │ │ │ └── schema-cloud-config-v1.json │ │ └── validate │ │ │ ├── testdata │ │ │ ├── README.md │ │ │ ├── invalid-cloud-config-1.yaml │ │ │ └── valid-cloud-config-1.yaml │ │ │ ├── validate.go │ │ │ ├── validate_suite_test.go │ │ │ └── validate_test.go │ ├── cns.go │ ├── configspec.go │ ├── configspec_test.go │ ├── constants.go │ ├── devices.go │ ├── devices_test.go │ ├── enc.go │ ├── enc_test.go │ ├── ensure_disk_controller.go │ ├── ensure_disk_controller_test.go │ ├── hash.go │ ├── hash_test.go │ ├── http_errors.go │ ├── http_errors_test.go │ ├── image │ │ ├── image_suite_test.go │ │ ├── status_to_label.go │ │ └── status_to_label_test.go │ ├── kube │ │ ├── cource │ │ │ ├── cource_context.go │ │ │ ├── cource_context_test.go │ │ │ └── cource_suite_test.go │ │ ├── crypto.go │ │ ├── crypto_test.go │ │ ├── gvk.go │ │ ├── gvk_test.go │ │ ├── internal │ │ │ ├── internal_kube_constants.go │ │ │ ├── internal_kube_storage.go │ │ │ ├── internal_kube_storage_test.go │ │ │ └── internal_kube_suite_test.go │ │ ├── kube_suite_test.go │ │ ├── predicates.go │ │ ├── predicates_test.go │ │ ├── proxyaddr │ │ │ ├── proxy_address.go │ │ │ ├── proxy_address_test.go │ │ │ └── proxyaddr_suite_test.go │ │ ├── spq │ │ │ ├── spq.go │ │ │ ├── spq_context.go │ │ │ ├── spq_context_test.go │ │ │ ├── spq_suite_test.go │ │ │ └── spq_test.go │ │ ├── storage.go │ │ ├── storage_test.go │ │ ├── vm.go │ │ └── vm_test.go │ ├── lock_pool.go │ ├── lock_pool_test.go │ ├── netplan │ │ ├── netplan.go │ │ ├── netplan_suite_test.go │ │ ├── netplan_test.go │ │ └── schema │ │ │ ├── .gitignore │ │ │ ├── Dockerfile │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── main.rs │ │ │ ├── netplan.go │ │ │ └── schema.json │ ├── network.go │ ├── network_test.go │ ├── nil.go │ ├── nil_test.go │ ├── option_values.go │ ├── option_values_test.go │ ├── ovfcache │ │ ├── internal │ │ │ ├── ovfcache_internal.go │ │ │ ├── ovfcache_internal_suite_test.go │ │ │ └── ovfcache_internal_test.go │ │ ├── ovfcache.go │ │ ├── ovfcache_suite_test.go │ │ └── ovfcache_test.go │ ├── paused │ │ ├── paused.go │ │ ├── paused_suite_test.go │ │ └── paused_test.go │ ├── ptr │ │ ├── ptr.go │ │ ├── ptr_suite_test.go │ │ └── ptr_test.go │ ├── replicaset_label.go │ ├── replicaset_label_test.go │ ├── resize │ │ ├── backings.go │ │ ├── backings_test.go │ │ ├── configspec.go │ │ ├── configspec_devices.go │ │ ├── configspec_devices_test.go │ │ ├── configspec_pci_devcies_test.go │ │ ├── configspec_pci_devices.go │ │ ├── configspec_test.go │ │ └── resize_suite_test.go │ ├── secret.go │ ├── testdata │ │ └── virtualMachineConfigInfo.json │ ├── util_suite_test.go │ ├── vapi.go │ ├── vmopv1 │ │ ├── image.go │ │ ├── image_test.go │ │ ├── instancestorage.go │ │ ├── instancestorage_test.go │ │ ├── network.go │ │ ├── network_test.go │ │ ├── resize.go │ │ ├── resize_overwrite.go │ │ ├── resize_overwrite_test.go │ │ ├── resize_test.go │ │ ├── vm.go │ │ ├── vm_test.go │ │ └── vmopv1_suite_test.go │ └── vsphere │ │ ├── client │ │ ├── client.go │ │ ├── client_suite_test.go │ │ └── client_test.go │ │ ├── library │ │ ├── item_cache.go │ │ ├── item_cache_test.go │ │ └── library_suite_test.go │ │ ├── vm │ │ ├── guest_id.go │ │ ├── guest_id_test.go │ │ ├── hardware_version.go │ │ ├── hardware_version_test.go │ │ ├── internal │ │ │ └── power_state_context_keys.go │ │ ├── power_state.go │ │ ├── power_state_test.go │ │ ├── vm.go │ │ ├── vm_suite_test.go │ │ └── vm_test.go │ │ └── watcher │ │ ├── watcher.go │ │ ├── watcher_context.go │ │ ├── watcher_context_test.go │ │ ├── watcher_suite_test.go │ │ └── watcher_test.go ├── vmconfig │ ├── crypto │ │ ├── crypto_reconciler.go │ │ ├── crypto_reconciler_post.go │ │ ├── crypto_reconciler_post_test.go │ │ ├── crypto_reconciler_pre.go │ │ ├── crypto_reconciler_pre_test.go │ │ ├── crypto_reconciler_suite_test.go │ │ ├── crypto_reconciler_test.go │ │ └── internal │ │ │ └── crypto_reconciler_context.go │ ├── diskpromo │ │ ├── diskpromo_reconciler.go │ │ ├── diskpromo_reconciler_suite_test.go │ │ └── diskpromo_reconciler_test.go │ ├── vmconfig_reconciler.go │ ├── vmconfig_reconciler_context.go │ ├── vmconfig_reconciler_context_test.go │ └── vmconfig_reconciler_suite_test.go ├── vmoperator.go └── webconsolevalidation │ ├── server.go │ ├── server_suite_test.go │ └── server_test.go ├── services ├── services.go └── vm-watcher │ ├── vm_watcher_service.go │ ├── vm_watcher_service_suite_test.go │ └── vm_watcher_service_test.go ├── test ├── builder │ ├── dummies.go │ ├── fake.go │ ├── flags.go │ ├── intg_test_context.go │ ├── net.go │ ├── pki.go │ ├── test_suite.go │ ├── testdata │ │ └── images │ │ │ ├── ttylinux-pc_i486-16.1-2.nvram │ │ │ ├── ttylinux-pc_i486-16.1-disk1.vmdk │ │ │ ├── ttylinux-pc_i486-16.1.iso │ │ │ ├── ttylinux-pc_i486-16.1.mf │ │ │ ├── ttylinux-pc_i486-16.1.ova │ │ │ └── ttylinux-pc_i486-16.1.ovf │ ├── unit_test_context.go │ ├── util.go │ └── vcsim_test_context.go ├── resource │ └── photon-ova.ovf └── testutil │ └── util.go └── webhooks ├── common ├── common_suite_test.go ├── response.go └── response_test.go ├── conversion ├── v1alpha1 │ └── webhooks.go ├── v1alpha2 │ └── webhooks.go ├── v1alpha3 │ └── webhooks.go ├── v1alpha4 │ └── webhooks.go └── webhooks.go ├── persistentvolumeclaim ├── validation │ ├── persistentvolumeclaim_validator.go │ ├── persistentvolumeclaim_validator_intg_test.go │ ├── persistentvolumeclaim_validator_suite_test.go │ └── persistentvolumeclaim_validator_unit_test.go └── webhook.go ├── unifiedstoragequota ├── validation │ ├── unifiedstoragequota_validator.go │ ├── unifiedstoragequota_validator_intg_test.go │ ├── unifiedstoragequota_validator_suite_test.go │ └── unifiedstoragequota_validator_unit_test.go └── webhooks.go ├── virtualmachine ├── mutation │ ├── virtualmachine_mutator.go │ ├── virtualmachine_mutator_intg_test.go │ ├── virtualmachine_mutator_suite_test.go │ └── virtualmachine_mutator_unit_test.go ├── validation │ ├── virtualmachine_validator.go │ ├── virtualmachine_validator_intg_test.go │ ├── virtualmachine_validator_suite_test.go │ └── virtualmachine_validator_unit_test.go └── webhooks.go ├── virtualmachineclass ├── mutation │ ├── virtualmachineclass_mutator.go │ ├── virtualmachineclass_mutator_intg_test.go │ ├── virtualmachineclass_mutator_suite_test.go │ └── virtualmachineclass_mutator_unit_test.go ├── validation │ ├── virtualmachineclass_validator.go │ ├── virtualmachineclass_validator_intg_test.go │ ├── virtualmachineclass_validator_suite_test.go │ └── virtualmachineclass_validator_unit_test.go └── webhooks.go ├── virtualmachinepublishrequest ├── validation │ ├── virtualmachinepublishrequest_validator.go │ ├── virtualmachinepublishrequest_validator_intg_test.go │ ├── virtualmachinepublishrequest_validator_suite_test.go │ └── virtualmachinepublishrequest_validator_unit_test.go └── webhooks.go ├── virtualmachinereplicaset ├── mutation │ └── virtualmachinereplicaset_mutator.go ├── validation │ ├── virtualmachinereplicaset_validator.go │ ├── virtualmachinereplicaset_validator_intg_test.go │ ├── virtualmachinereplicaset_validator_suite_test.go │ └── virtualmachinereplicaset_validator_unit_test.go └── webhooks.go ├── virtualmachineservice ├── mutation │ ├── virtualmachineservice_mutator.go │ ├── virtualmachineservice_mutator_intg_test.go │ ├── virtualmachineservice_mutator_suite_test.go │ └── virtualmachineservice_mutator_unit_test.go ├── validation │ ├── virtualmachineservice_validator.go │ ├── virtualmachineservice_validator_intg_test.go │ ├── virtualmachineservice_validator_suite_test.go │ └── virtualmachineservice_validator_unit_test.go └── webhooks.go ├── virtualmachinesetresourcepolicy ├── validation │ ├── virtualmachinesetresourcepolicy_validator.go │ ├── virtualmachinesetresourcepolicy_validator_intg_test.go │ ├── virtualmachinesetresourcepolicy_validator_suite_test.go │ └── virtualmachinesetresourcepolicy_validator_unit_test.go └── webhooks.go ├── virtualmachinewebconsolerequest ├── v1alpha1 │ ├── validation │ │ ├── webconsolerequest_validator.go │ │ ├── webconsolerequest_validator_intg_test.go │ │ ├── webconsolerequest_validator_suite_test.go │ │ └── webconsolerequest_validator_unit_test.go │ └── webhooks.go ├── validation │ ├── webconsolerequest_validator.go │ ├── webconsolerequest_validator_intg_test.go │ ├── webconsolerequest_validator_suite_test.go │ └── webconsolerequest_validator_unit_test.go └── webhooks.go └── webhooks.go /.crd-ref-docs/config.yaml: -------------------------------------------------------------------------------- 1 | processor: 2 | ignoreTypes: 3 | - ".*List$" 4 | ignoreFields: 5 | - "TypeMeta$" 6 | render: 7 | kubernetesVersion: 1.24 8 | -------------------------------------------------------------------------------- /.crd-ref-docs/template/gv_list.tpl: -------------------------------------------------------------------------------- 1 | {{- define "gvList" -}} 2 | {{- $groupVersions := . -}} 3 | {{- $gv := index $groupVersions 0 -}} 4 | 5 | # {{ $gv.Version }} 6 | 7 | {{ $gv.Doc }} 8 | 9 | --- 10 | 11 | {{ if $gv.Kinds -}} 12 | 13 | ## Kinds 14 | 15 | {{ range $gv.SortedKinds }} 16 | {{- with $type := $gv.TypeForKind . }} 17 | {{ template "type" . }} 18 | {{- end -}} 19 | {{- end -}} 20 | {{- end }} 21 | 22 | ## Types 23 | 24 | {{- range $gv.SortedTypes }} 25 | {{- if not .GVK }} 26 | {{ template "type" . }} 27 | {{- end }} 28 | {{- end }} 29 | 30 | {{- end -}} 31 | -------------------------------------------------------------------------------- /.crd-ref-docs/template/type_members.tpl: -------------------------------------------------------------------------------- 1 | {{- define "type_members" -}} 2 | {{- $field := . -}} 3 | {{- if eq $field.Name "metadata" -}} 4 | Refer to Kubernetes API documentation for fields of `metadata`. 5 | {{- else -}} 6 | {{ $field.Doc }} 7 | {{- end -}} 8 | {{- end -}} -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | *.tar 2 | -------------------------------------------------------------------------------- /.github/configs/labeler.yml: -------------------------------------------------------------------------------- 1 | # Please ensure to update the corresponding command in the testing-needed.yml 2 | # workflow file when modifying the following exclude-file list. 3 | defaults: &defaults 4 | exclude-files: 5 | - ".*_generated.go" 6 | - ".*_generated.deepcopy.go" 7 | - ".*_generated.conversion.go" 8 | - "config\\/crd\\/bases\\/.*" 9 | - "docs\\/ref\\/api\\/v.*.md" 10 | - "go.sum" 11 | 12 | version: 1 13 | labels: 14 | - label: "size/XS" 15 | size: 16 | below: 10 17 | <<: *defaults 18 | - label: "size/S" 19 | size: 20 | above: 9 21 | below: 30 22 | <<: *defaults 23 | - label: "size/M" 24 | size: 25 | above: 29 26 | below: 100 27 | <<: *defaults 28 | - label: "size/L" 29 | size: 30 | above: 99 31 | below: 500 32 | <<: *defaults 33 | - label: "size/XL" 34 | size: 35 | above: 499 36 | below: 1000 37 | <<: *defaults 38 | - label: "size/XXL" 39 | size: 40 | above: 999 41 | <<: *defaults 42 | -------------------------------------------------------------------------------- /.github/workflows/pr-labeler.yml: -------------------------------------------------------------------------------- 1 | name: pr-labeler 2 | on: 3 | - pull_request_target 4 | 5 | jobs: 6 | add-labels: 7 | permissions: 8 | contents: read 9 | pull-requests: write 10 | runs-on: ubuntu-latest 11 | steps: 12 | # This action originates from https://github.com/srvaroa/labeler. We are 13 | # using this action instead of the GitHub labeler action as the former 14 | # supports adding labels based on the number of changed, lines-of-code. 15 | # 16 | # * GitHub labeler LoC support: 17 | # https://github.com/actions/labeler/issues/486 18 | # 19 | - uses: srvaroa/labeler@v1.10.1 20 | with: 21 | config_path: .github/configs/labeler.yml 22 | env: 23 | GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 24 | -------------------------------------------------------------------------------- /.github/workflows/pr-rtfd.yml: -------------------------------------------------------------------------------- 1 | name: pr-rtfd 2 | on: 3 | pull_request_target: 4 | types: 5 | - opened 6 | - reopened 7 | - synchronize 8 | paths: 9 | - docs/** 10 | 11 | permissions: 12 | pull-requests: write 13 | 14 | jobs: 15 | pull-request-links: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: readthedocs/actions/preview@v1 19 | with: 20 | project-slug: vm-operator 21 | -------------------------------------------------------------------------------- /.markdownlint.yaml: -------------------------------------------------------------------------------- 1 | extends: ./.markdownlintrc 2 | -------------------------------------------------------------------------------- /.markdownlintrc: -------------------------------------------------------------------------------- 1 | default: false 2 | 3 | # line_length 4 | MD013: false 5 | 6 | # no-inline-html 7 | MD033: 8 | # Allow these elements for rendering a collapsible table-of-contents 9 | allowed_elements: 10 | - details 11 | - summary 12 | - strong 13 | - code 14 | - a 15 | - br 16 | - style 17 | - table 18 | - tbody 19 | - tr 20 | - td 21 | - th 22 | - em 23 | - abbr 24 | - strike 25 | 26 | # no-hard-tabs 27 | MD010: 28 | # Allow tabs in code blocks 29 | code_blocks: false 30 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | build: 3 | os: ubuntu-20.04 4 | tools: 5 | python: "3.9" 6 | mkdocs: 7 | configuration: mkdocs.yml 8 | python: 9 | install: 10 | - requirements: docs/requirements.txt 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to VM Operator 2 | 3 | It's still early days for VM Operator, but we would love to connect with people who are as passionate about Kubernetes and Virtual Machines as we are! 4 | 5 | Please raise issues and feel free to open PRs. 6 | 7 | Any suggestions on usability, readability, clarity or architecture are all welcome. 8 | 9 | We will be building out the roadmap and starting a weekly design meeting soon! -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | VM Operator 2 | Copyright Broadcom, Inc. 3 | 4 | This product is licensed to you under the Apache 2.0 license (the "License"). You may not use this product except in compliance with the Apache 2.0 License. 5 | 6 | This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. 7 | -------------------------------------------------------------------------------- /PROJECT: -------------------------------------------------------------------------------- 1 | domain: vmware.com 2 | repo: github.com/vmware-tanzu/vm-operator 3 | resources: 4 | - group: vmoperator 5 | kind: VirtualMachine 6 | version: v1alpha1 7 | - group: vmoperator 8 | kind: VirtualMachineClass 9 | version: v1alpha1 10 | - group: vmoperator 11 | kind: VirtualMachineSetResourcePolicy 12 | version: v1alpha1 13 | - group: vmoperator 14 | kind: VirtualMachineService 15 | version: v1alpha1 16 | - group: vmoperator 17 | kind: VirtualMachineImage 18 | version: v1alpha1 19 | - group: vmoperator 20 | kind: ContentSource 21 | version: v1alpha1 22 | - group: vmoperator 23 | kind: ContentLibraryProvider 24 | version: v1alpha1 25 | version: "2" 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VM Operator for Kubernetes 2 | 3 | VM Operator enables management of virtual machines with a Kubernetes-style, declarative API. 4 | 5 | ## Getting Started 6 | 7 | If you are passionate about VMs in Kubernetes, are interested in learning about our roadmap or have ideas about the project, we'd love to hear from you! 8 | 9 | Please see the [documentation](https://vm-operator.rtfd.io) for more information. 10 | 11 | ## Community 12 | - Find us on Slack at [#ug-vmware](https://kubernetes.slack.com/messages/ug-vmware) 13 | - Regular working group [meetings](https://docs.google.com/document/d/1B2oUAuNbYc8nXjRrN353Pt-mDPtwyLrBO3cok7BfV4s/edit?usp=sharing) 14 | - Reach out directly via VMware liaison [Ellen Mei](mailto:meie@vmware.com) 15 | -------------------------------------------------------------------------------- /api/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // Package v1alpha1 contains the VM Operator v1alpha1 APIs. 6 | // 7 | // +k8s:openapi-gen=true 8 | // +kubebuilder:object:generate=true 9 | // +groupName=vmoperator.vmware.com 10 | // +k8s:conversion-gen=github.com/vmware-tanzu/vm-operator/api/v1alpha4 11 | package v1alpha1 12 | -------------------------------------------------------------------------------- /api/v1alpha1/install/install.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // Package install installs the API group, making it available as 6 | // an option to all of the API encoding/decoding machinery. 7 | package install 8 | 9 | import ( 10 | "k8s.io/apimachinery/pkg/runtime" 11 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 12 | 13 | vmopv1a1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1" 14 | ) 15 | 16 | // Install registers the API group and adds types to a scheme. 17 | func Install(scheme *runtime.Scheme) { 18 | utilruntime.Must(vmopv1a1.AddToScheme(scheme)) 19 | } 20 | -------------------------------------------------------------------------------- /api/v1alpha1/v1alpha1_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha1_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestV1Alpha1(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "v1alpha1 Suite") 17 | } 18 | -------------------------------------------------------------------------------- /api/v1alpha2/condition_consts.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha2 6 | 7 | const ( 8 | // ReadyConditionType is the Ready condition type that summarizes the operational state of a VM Operator API object. 9 | ReadyConditionType = "Ready" 10 | ) 11 | -------------------------------------------------------------------------------- /api/v1alpha2/doc.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // +k8s:openapi-gen=true 6 | // +kubebuilder:object:generate=true 7 | // +groupName=vmoperator.vmware.com 8 | // +k8s:conversion-gen=github.com/vmware-tanzu/vm-operator/api/v1alpha4 9 | 10 | package v1alpha2 11 | -------------------------------------------------------------------------------- /api/v1alpha2/v1alpha2_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha2_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestV1Alpha2(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "v1alpha2 Suite") 17 | } 18 | -------------------------------------------------------------------------------- /api/v1alpha3/condition_consts.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha3 6 | 7 | const ( 8 | // ReadyConditionType is the Ready condition type that summarizes the operational state of a VM Operator API object. 9 | ReadyConditionType = "Ready" 10 | ) 11 | -------------------------------------------------------------------------------- /api/v1alpha3/doc.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // +k8s:openapi-gen=true 6 | // +kubebuilder:object:generate=true 7 | // +groupName=vmoperator.vmware.com 8 | // +k8s:conversion-gen=github.com/vmware-tanzu/vm-operator/api/v1alpha4 9 | 10 | // Package v1alpha3 is one of the schemas for VM Operator. 11 | package v1alpha3 12 | -------------------------------------------------------------------------------- /api/v1alpha3/v1alpha3_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha3_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestV1Alpha3(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "v1alpha3 Suite") 17 | } 18 | -------------------------------------------------------------------------------- /api/v1alpha4/condition_consts.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha4 6 | 7 | const ( 8 | // ReadyConditionType is the Ready condition type that summarizes the operational state of a VM Operator API object. 9 | ReadyConditionType = "Ready" 10 | ) 11 | -------------------------------------------------------------------------------- /api/v1alpha4/doc.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // +k8s:openapi-gen=true 6 | // +kubebuilder:object:generate=true 7 | // +groupName=vmoperator.vmware.com 8 | 9 | // Package v1alpha4 is one of the schemas for VM Operator. 10 | package v1alpha4 11 | -------------------------------------------------------------------------------- /api/v1alpha4/virtualmachine_conversion.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha4 6 | 7 | // Hub marks VirtualMachine as a conversion hub. 8 | func (*VirtualMachine) Hub() {} 9 | 10 | // Hub marks VirtualMachineList as a conversion hub. 11 | func (*VirtualMachineList) Hub() {} 12 | -------------------------------------------------------------------------------- /api/v1alpha4/virtualmachineclass_conversion.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha4 6 | 7 | // Hub marks VirtualMachineClass as a conversion hub. 8 | func (*VirtualMachineClass) Hub() {} 9 | 10 | // Hub marks VirtualMachineClassList as a conversion hub. 11 | func (*VirtualMachineClassList) Hub() {} 12 | -------------------------------------------------------------------------------- /api/v1alpha4/virtualmachineimage_conversion.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha4 6 | 7 | // Hub marks VirtualMachineImage as a conversion hub. 8 | func (*VirtualMachineImage) Hub() {} 9 | 10 | // Hub marks VirtualMachineImageList as a conversion hub. 11 | func (*VirtualMachineImageList) Hub() {} 12 | 13 | // Hub marks ClusterVirtualMachineImage as a conversion hub. 14 | func (*ClusterVirtualMachineImage) Hub() {} 15 | 16 | // Hub marks ClusterVirtualMachineImageList as a conversion hub. 17 | func (*ClusterVirtualMachineImageList) Hub() {} 18 | -------------------------------------------------------------------------------- /api/v1alpha4/virtualmachineimagecache_conversion.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha4 6 | 7 | // Hub marks VirtualMachineImageCache as a conversion hub. 8 | func (*VirtualMachineImageCache) Hub() {} 9 | 10 | // Hub marks VirtualMachineImageCacheList as a conversion hub. 11 | func (*VirtualMachineImageCacheList) Hub() {} 12 | -------------------------------------------------------------------------------- /api/v1alpha4/virtualmachinepublishrequest_conversion.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha4 6 | 7 | // Hub marks VirtualMachinePublishRequest as a conversion hub. 8 | func (*VirtualMachinePublishRequest) Hub() {} 9 | 10 | // Hub marks VirtualMachinePublishRequestList as a conversion hub. 11 | func (*VirtualMachinePublishRequestList) Hub() {} 12 | -------------------------------------------------------------------------------- /api/v1alpha4/virtualmachineservice_conversion.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha4 6 | 7 | // Hub marks VirtualMachineService as a conversion hub. 8 | func (*VirtualMachineService) Hub() {} 9 | 10 | // Hub marks VirtualMachineServiceList as a conversion hub. 11 | func (*VirtualMachineServiceList) Hub() {} 12 | -------------------------------------------------------------------------------- /api/v1alpha4/virtualmachinesetresourcepolicy_conversion.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha4 6 | 7 | // Hub marks VirtualMachineSetResourcePolicy as a conversion hub. 8 | func (*VirtualMachineSetResourcePolicy) Hub() {} 9 | 10 | // Hub marks VirtualMachineSetResourcePolicy as a conversion hub. 11 | func (*VirtualMachineSetResourcePolicyList) Hub() {} 12 | -------------------------------------------------------------------------------- /api/v1alpha4/virtualmachinewebconsolerequest_conversion.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha4 6 | 7 | // Hub marks VirtualMachineWebConsoleRequest as a conversion hub. 8 | func (*VirtualMachineWebConsoleRequest) Hub() {} 9 | 10 | // Hub marks VirtualMachineWebConsoleRequestList as a conversion hub. 11 | func (*VirtualMachineWebConsoleRequestList) Hub() {} 12 | -------------------------------------------------------------------------------- /config/ccs-plugin/plugin.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: appplatform.wcp.vmware.com/v1alpha1 2 | kind: CCSPlugin 3 | metadata: 4 | name: vmservice-plugin 5 | namespace: vmware-system-vmop 6 | spec: 7 | description: "VM Service plugin allows DevOps persona to create and manage Virtual Machine based workloads on vSphere infrastructure." 8 | displayName: "VM Service Plugin" 9 | fetch: 10 | http: 11 | url: 12 | sha256: 13 | version: 14 | -------------------------------------------------------------------------------- /config/certmanager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - certificate.yaml 6 | 7 | configurations: 8 | - kustomizeconfig.yaml 9 | -------------------------------------------------------------------------------- /config/certmanager/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # nameReference teaches Kustomize which fields represent a resource name. 2 | nameReference: 3 | - kind: Issuer 4 | group: cert-manager.io 5 | fieldSpecs: 6 | - kind: Certificate 7 | group: cert-manager.io 8 | path: spec/issuerRef/name 9 | -------------------------------------------------------------------------------- /config/crd/external-crds/README.md: -------------------------------------------------------------------------------- 1 | # External CRDs for testing only 2 | 3 | ## Content 4 | 5 | * `cnsnodevmattachment-crd.yaml` is used by virtualmachine_controller_suite_test.go for the integration tests 6 | * `topology.tanzu.vmware.com_availabilityzones.yaml` is used by the VM Operator integration tests 7 | * `imageregistry.vmware.com_contentlibraries.yaml` is used by virtualmachinepublishrequest_controller_suite_test.go for the integration tests 8 | * `imageregistry.vmware.com_clustercontentlibraryitems.yaml` is used by the clustercontentlibraryitem_controller_suite_test.go for the integration tests 9 | * `imageregistry.vmware.com_contentlibraryitems.yaml` is used by the contentlibraryitem_controller_suite_test.go for the integration tests 10 | -------------------------------------------------------------------------------- /config/crd/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # nameReference teaches Kustomize which fields represent a resource name. 2 | nameReference: 3 | - kind: Service 4 | version: v1 5 | fieldSpecs: 6 | - kind: CustomResourceDefinition 7 | group: apiextensions.k8s.io 8 | path: spec/conversion/webhook/clientConfig/service/name 9 | 10 | # namespace teaches Kustomize which fields represent a resource namespace. 11 | namespace: 12 | - kind: CustomResourceDefinition 13 | group: apiextensions.k8s.io 14 | path: spec/conversion/webhook/clientConfig/service/namespace 15 | create: false 16 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_clustervirtualmachineimages.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: WEBHOOK_CERTIFICATE_NAMESPACE_PLACEHOLDER/WEBHOOK_CERTIFICATE_NAME_PLACEHOLDER 8 | name: clustervirtualmachineimages.vmoperator.vmware.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_virtualmachineclasses.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: WEBHOOK_CERTIFICATE_NAMESPACE_PLACEHOLDER/WEBHOOK_CERTIFICATE_NAME_PLACEHOLDER 8 | name: virtualmachineclasses.vmoperator.vmware.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_virtualmachineimages.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: WEBHOOK_CERTIFICATE_NAMESPACE_PLACEHOLDER/WEBHOOK_CERTIFICATE_NAME_PLACEHOLDER 8 | name: virtualmachineimages.vmoperator.vmware.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_virtualmachinepublishrequests.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: WEBHOOK_CERTIFICATE_NAMESPACE_PLACEHOLDER/WEBHOOK_CERTIFICATE_NAME_PLACEHOLDER 8 | name: virtualmachinepublishrequests.vmoperator.vmware.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_virtualmachinereplicasets.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: WEBHOOK_CERTIFICATE_NAMESPACE_PLACEHOLDER/WEBHOOK_CERTIFICATE_NAME_PLACEHOLDER 8 | name: virtualmachinereplicasets.vmoperator.vmware.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_virtualmachines.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: WEBHOOK_CERTIFICATE_NAMESPACE_PLACEHOLDER/WEBHOOK_CERTIFICATE_NAME_PLACEHOLDER 8 | name: virtualmachines.vmoperator.vmware.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_virtualmachineservices.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: WEBHOOK_CERTIFICATE_NAMESPACE_PLACEHOLDER/WEBHOOK_CERTIFICATE_NAME_PLACEHOLDER 8 | name: virtualmachineservices.vmoperator.vmware.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_virtualmachinesetresourcepolicies.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: WEBHOOK_CERTIFICATE_NAMESPACE_PLACEHOLDER/WEBHOOK_CERTIFICATE_NAME_PLACEHOLDER 8 | name: virtualmachinesetresourcepolicies.vmoperator.vmware.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_virtualmachinewebconsolerequests.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | cert-manager.io/inject-ca-from: WEBHOOK_CERTIFICATE_NAMESPACE_PLACEHOLDER/WEBHOOK_CERTIFICATE_NAME_PLACEHOLDER 8 | name: virtualmachinewebconsolerequests.vmoperator.vmware.com 9 | -------------------------------------------------------------------------------- /config/crd/patches/crd_preserveUnknownFields.yaml: -------------------------------------------------------------------------------- 1 | # To upgrade CRD from v1beta1 to v1 and get working "kubectl explain", 2 | # we manually add this since controller-gen is NOT adding it. 3 | # See https://github.com/kubernetes-sigs/controller-tools/issues/476. 4 | - op: add 5 | path: /spec/preserveUnknownFields 6 | value: false 7 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_clustervirtualmachineimages.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: clustervirtualmachineimages.vmoperator.vmware.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_virtualmachineclasses.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: virtualmachineclasses.vmoperator.vmware.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_virtualmachineimages.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: virtualmachineimages.vmoperator.vmware.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_virtualmachinepublishrequests.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: virtualmachinepublishrequests.vmoperator.vmware.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_virtualmachinereplicasets.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: virtualmachinereplicasets.vmoperator.vmware.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | clientConfig: 12 | service: 13 | namespace: system 14 | name: webhook-service 15 | path: /convert 16 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_virtualmachines.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: virtualmachines.vmoperator.vmware.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_virtualmachineservices.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: virtualmachineservices.vmoperator.vmware.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_virtualmachinesetresourcepolicies.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: virtualmachinesetresourcepolicies.vmoperator.vmware.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_virtualmachinewebconsolerequests.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables conversion webhook for CRD 2 | # CRD conversion requires k8s 1.13 or later. 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | name: virtualmachinewebconsolerequests.vmoperator.vmware.com 7 | spec: 8 | conversion: 9 | strategy: Webhook 10 | webhook: 11 | conversionReviewVersions: ["v1", "v1beta1"] 12 | clientConfig: 13 | service: 14 | namespace: system 15 | name: webhook-service 16 | path: /convert 17 | -------------------------------------------------------------------------------- /config/default/manager_auth_proxy_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch inject a sidecar container which is a HTTP proxy for the controller manager. 2 | # It performs RBAC authorization against the Kubernetes API using SubjectAccessReviews. 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: controller-manager 7 | namespace: system 8 | spec: 9 | template: 10 | spec: 11 | containers: 12 | - name: manager 13 | args: 14 | - "--metrics-addr=127.0.0.1:8080" 15 | - name: kube-rbac-proxy 16 | image: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.0 17 | args: 18 | - "--secure-listen-address=0.0.0.0:8443" 19 | - "--upstream=http://127.0.0.1:8080/" 20 | - "--tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" 21 | - "--logtostderr=true" 22 | - "--v=10" 23 | ports: 24 | - containerPort: 8443 25 | name: metrics-server 26 | -------------------------------------------------------------------------------- /config/default/manager_default_container_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch marks "manager" as the default container. This means `kubectl logs` and 2 | # `kubectl exec` will pick the "manager" container unless a different container is 3 | # specified using the --container flag. 4 | apiVersion: apps/v1 5 | kind: Deployment 6 | metadata: 7 | name: controller-manager 8 | namespace: system 9 | annotations: 10 | kubectl.kubernetes.io/default-container: manager 11 | -------------------------------------------------------------------------------- /config/default/manager_leader_election_id_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | env: 12 | - name: LEADER_ELECTION_ID 13 | value: LEADER_ELECTION_ID_PLACEHOLDER-runtime 14 | -------------------------------------------------------------------------------- /config/default/manager_max_concurrent_reconciles_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | env: 12 | - name: MAX_CONCURRENT_RECONCILES 13 | value: "20" 14 | -------------------------------------------------------------------------------- /config/default/manager_pod_info_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | env: 12 | - name: DEPLOYMENT_NAME 13 | value: DEPLOYMENT_NAME 14 | - name: POD_NAMESPACE 15 | valueFrom: 16 | fieldRef: 17 | fieldPath: metadata.namespace 18 | - name: POD_NAME 19 | valueFrom: 20 | fieldRef: 21 | fieldPath: metadata.name 22 | - name: POD_SERVICE_ACCOUNT_NAME 23 | valueFrom: 24 | fieldRef: 25 | fieldPath: spec.serviceAccountName -------------------------------------------------------------------------------- /config/default/manager_prometheus_metrics_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch enables Prometheus scraping for the manager pod. 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: controller-manager 6 | namespace: system 7 | spec: 8 | template: 9 | metadata: 10 | annotations: 11 | prometheus.io/scrape: 'true' 12 | spec: 13 | containers: 14 | # Expose the prometheus metrics on default port 15 | - name: manager 16 | ports: 17 | - containerPort: 8080 18 | name: metrics 19 | protocol: TCP 20 | -------------------------------------------------------------------------------- /config/default/manager_replicas_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | replicas: 3 8 | -------------------------------------------------------------------------------- /config/default/manager_tolerations_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | tolerations: 10 | - key: node-role.kubernetes.io/master 11 | operator: "Exists" 12 | effect: "NoSchedule" 13 | - key: node-role.kubernetes.io/control-plane 14 | operator: "Exists" 15 | effect: "NoSchedule" 16 | - key: kubeadmNode 17 | operator: "Equal" 18 | value: "master" 19 | effect: "NoSchedule" 20 | -------------------------------------------------------------------------------- /config/default/manager_update_strategy_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | strategy: 8 | rollingUpdate: 9 | maxSurge: 0 10 | maxUnavailable: 1 11 | type: RollingUpdate 12 | -------------------------------------------------------------------------------- /config/local-vcsim/Makefile: -------------------------------------------------------------------------------- 1 | # Ensure Make is run with bash shell as some syntax below is bash-specific 2 | SHELL := /usr/bin/env bash 3 | 4 | .DEFAULT_GOAL := help 5 | 6 | INFRASTRUCTURE_COMPONENTS := infrastructure-components.yaml 7 | 8 | ## -------------------------------------- 9 | ## Help 10 | ## -------------------------------------- 11 | 12 | help: ## Display this help 13 | @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) 14 | 15 | .PHONY: $(INFRASTRUCTURE_COMPONENTS) 16 | infrastructure-components: $(INFRASTRUCTURE_COMPONENTS) 17 | infrastructure-components: ## Build the local infrastructure components 18 | $(INFRASTRUCTURE_COMPONENTS): 19 | kustomize build --load-restrictor LoadRestrictionsNone >$@ 20 | 21 | 22 | -------------------------------------------------------------------------------- /config/local-vcsim/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - ../local 6 | - sc.yaml 7 | - lb-xds.yaml 8 | 9 | components: 10 | - ../replacements 11 | 12 | patches: 13 | - target: 14 | group: apps 15 | version: v1 16 | kind: Deployment 17 | name: vmware-system-vmop-controller-manager 18 | namespace: vmware-system-vmop 19 | patch: |- 20 | - op: replace 21 | path: /spec/replicas 22 | value: 1 23 | - target: 24 | group: apps 25 | version: v1 26 | kind: Deployment 27 | name: vmware-system-vmop-controller-manager 28 | namespace: vmware-system-vmop 29 | path: remove-node-selector-patch.yaml 30 | - target: 31 | group: apps 32 | version: v1 33 | kind: Deployment 34 | name: vmware-system-vmop-web-console-validator 35 | namespace: vmware-system-vmop 36 | path: remove-node-selector-patch.yaml 37 | 38 | - path: vcsim-patch.yaml 39 | -------------------------------------------------------------------------------- /config/local-vcsim/lb-xds.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: vmware-system-vmop-lb-xds 5 | namespace: vmware-system-vmop 6 | spec: 7 | type: NodePort 8 | ports: 9 | - port: 31799 10 | nodePort: 31799 11 | targetPort: 31799 12 | name: http 13 | selector: 14 | name: vmoperator-controller-manager 15 | -------------------------------------------------------------------------------- /config/local-vcsim/remove-node-selector-patch.yaml: -------------------------------------------------------------------------------- 1 | - op: remove 2 | path: /spec/template/spec/nodeSelector 3 | value: 4 | node-role.kubernetes.io/control-plane: "" -------------------------------------------------------------------------------- /config/local-vcsim/sc.yaml: -------------------------------------------------------------------------------- 1 | # Add storage classes and resource quota to local vcsim deployment 2 | apiVersion: storage.k8s.io/v1 3 | kind: StorageClass 4 | metadata: 5 | name: cp-storage-class 6 | provisioner: kubernetes.io/vsphere-volume 7 | parameters: 8 | storagePolicyID: "test-policy-id" 9 | --- 10 | apiVersion: storage.k8s.io/v1 11 | kind: StorageClass 12 | metadata: 13 | name: worker-storage-class 14 | provisioner: kubernetes.io/vsphere-volume 15 | parameters: 16 | storagePolicyID: "test-policy-id" 17 | --- 18 | apiVersion: v1 19 | kind: ResourceQuota 20 | metadata: 21 | name: default-rq 22 | namespace: default 23 | spec: 24 | hard: 25 | cp-storage-class.storageclass.storage.k8s.io/requests.storage: 1Gi 26 | worker-storage-class.storageclass.storage.k8s.io/requests.storage: 1Gi 27 | -------------------------------------------------------------------------------- /config/local-vcsim/vcsim-patch.yaml: -------------------------------------------------------------------------------- 1 | # Patch to start a local deployment against vcsim 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: vmware-system-vmop-controller-manager 6 | namespace: vmware-system-vmop 7 | spec: 8 | template: 9 | spec: 10 | containers: 11 | - name: manager 12 | env: 13 | # Add extraConfig to the VirtualMachines to tell vcsim to run a container per VM 14 | - name: "JSON_EXTRA_CONFIG" 15 | value: | 16 | {"RUN.container":"[\"--privileged\", \"-v=/lib/modules:/lib/modules:ro\", \"{{.Name}}\"]"} 17 | -------------------------------------------------------------------------------- /config/local/.gitignore: -------------------------------------------------------------------------------- 1 | infrastructure-components*.yaml* -------------------------------------------------------------------------------- /config/local/Makefile: -------------------------------------------------------------------------------- 1 | # Ensure Make is run with bash shell as some syntax below is bash-specific 2 | SHELL := /usr/bin/env bash 3 | 4 | .DEFAULT_GOAL := help 5 | 6 | INFRASTRUCTURE_COMPONENTS := infrastructure-components.yaml 7 | 8 | ## -------------------------------------- 9 | ## Help 10 | ## -------------------------------------- 11 | 12 | help: ## Display this help 13 | @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) 14 | 15 | .PHONY: $(INFRASTRUCTURE_COMPONENTS) 16 | infrastructure-components: $(INFRASTRUCTURE_COMPONENTS) 17 | infrastructure-components: ## Build the local infrastructure components 18 | $(INFRASTRUCTURE_COMPONENTS): 19 | kustomize build --load-restrictor LoadRestrictionsNone >$@ 20 | -------------------------------------------------------------------------------- /config/local/README.md: -------------------------------------------------------------------------------- 1 | # Local infrastructure components 2 | 3 | This directory contains the tools required to build the VM Operator 4 | infrastructure components for deploying VM Operator to a local Kind 5 | cluster. 6 | 7 | ## Quickstart 8 | 9 | To build the infrastructure components for VM Operator on a local Kind 10 | cluster, please execute the following: 11 | 12 | ```shell 13 | make infrastructure-components 14 | ``` 15 | 16 | This should result in the creation of a file `infrastructure-components.yaml`. 17 | 18 | ## Requirements 19 | 20 | Building the infrastructure components requires the following: 21 | 22 | * Kustomize v3+ 23 | * GNU Make 4+ 24 | -------------------------------------------------------------------------------- /config/local/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ./vmoperator/ 5 | 6 | components: 7 | - ../replacements 8 | 9 | -------------------------------------------------------------------------------- /config/local/vmoperator/cpu_resources_patch.yaml: -------------------------------------------------------------------------------- 1 | # Speeds up local testing 2 | --- 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: controller-manager 7 | namespace: system 8 | spec: 9 | template: 10 | spec: 11 | containers: 12 | - name: manager 13 | resources: 14 | limits: 15 | cpu: 2000m 16 | memory: 300Mi 17 | requests: 18 | cpu: 100m 19 | memory: 75Mi 20 | -------------------------------------------------------------------------------- /config/local/vmoperator/namespace_patch.yaml: -------------------------------------------------------------------------------- 1 | - op: replace 2 | path: /metadata/name 3 | value: vmware-system-vmop 4 | -------------------------------------------------------------------------------- /config/local/vmoperator/revision_history_limit.yaml: -------------------------------------------------------------------------------- 1 | # Speeds up local testing 2 | --- 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: controller-manager 7 | namespace: system 8 | spec: 9 | revisionHistoryLimit: 1 10 | -------------------------------------------------------------------------------- /config/manager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - manager.yaml 3 | -------------------------------------------------------------------------------- /config/prometheus/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - monitor.yaml 3 | -------------------------------------------------------------------------------- /config/prometheus/monitor.yaml: -------------------------------------------------------------------------------- 1 | 2 | # Prometheus Monitor Service (Metrics) 3 | apiVersion: monitoring.coreos.com/v1 4 | kind: ServiceMonitor 5 | metadata: 6 | labels: 7 | control-plane: controller-manager 8 | name: controller-manager-metrics-monitor 9 | namespace: system 10 | spec: 11 | endpoints: 12 | - path: /metrics 13 | port: https 14 | selector: 15 | control-plane: controller-manager 16 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: proxy-role 5 | rules: 6 | - apiGroups: ["authentication.k8s.io"] 7 | resources: 8 | - tokenreviews 9 | verbs: ["create"] 10 | - apiGroups: ["authorization.k8s.io"] 11 | resources: 12 | - subjectaccessreviews 13 | verbs: ["create"] 14 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: proxy-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: proxy-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | control-plane: controller-manager 6 | name: controller-manager-metrics-service 7 | namespace: system 8 | spec: 9 | ports: 10 | - name: https 11 | port: 8443 12 | targetPort: metrics-server 13 | selector: 14 | control-plane: controller-manager 15 | -------------------------------------------------------------------------------- /config/rbac/certman_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for certman cert secret access 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: certman-role 6 | rules: 7 | - apiGroups: 8 | - "" 9 | resources: 10 | - secrets 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | -------------------------------------------------------------------------------- /config/rbac/certman_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: certman-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: certman-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/contentlibraryprovider_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do edit contentlibraryproviders. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: contentlibraryprovider-editor-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - contentlibraryproviders 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - vmoperator.vmware.com 21 | resources: 22 | - contentlibraryproviders/status 23 | verbs: 24 | - get 25 | - patch 26 | - update 27 | -------------------------------------------------------------------------------- /config/rbac/contentlibraryprovider_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do viewer contentlibraryproviders. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: contentlibraryprovider-viewer-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - contentlibraryproviders 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - vmoperator.vmware.com 17 | resources: 18 | - contentlibraryproviders/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/contentsource_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do edit contentsources. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: contentsource-editor-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - contentsources 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - vmoperator.vmware.com 21 | resources: 22 | - contentsources/status 23 | verbs: 24 | - get 25 | - patch 26 | - update 27 | -------------------------------------------------------------------------------- /config/rbac/contentsource_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do viewer contentsources. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: contentsource-viewer-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - contentsources 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - vmoperator.vmware.com 17 | resources: 18 | - contentsources/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/contentsourcebinding_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do edit contentsourcebindings. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: contentsourcebinding-editor-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - contentsourcebindings 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch -------------------------------------------------------------------------------- /config/rbac/contentsourcebinding_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do view contentsourcebindings. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: contentsourcebinding-viewer-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - contentsourcebindings 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | -------------------------------------------------------------------------------- /config/rbac/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - role.yaml 3 | - role_binding.yaml 4 | - leader_election_role.yaml 5 | - leader_election_role_binding.yaml 6 | - certman_role.yaml 7 | - certman_role_binding.yaml 8 | # Comment the following 3 lines if you want to disable 9 | # the auth proxy (https://github.com/brancz/kube-rbac-proxy) 10 | # which protects your /metrics endpoint. 11 | - auth_proxy_service.yaml 12 | - auth_proxy_role.yaml 13 | - auth_proxy_role_binding.yaml 14 | -------------------------------------------------------------------------------- /config/rbac/leader_election_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do leader election. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: Role 4 | metadata: 5 | name: leader-election-role 6 | rules: 7 | - apiGroups: 8 | - "" 9 | resources: 10 | - configmaps 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - create 16 | - update 17 | - patch 18 | - delete 19 | - apiGroups: 20 | - "" 21 | resources: 22 | - configmaps/status 23 | verbs: 24 | - get 25 | - update 26 | - patch 27 | - apiGroups: 28 | - "" 29 | resources: 30 | - events 31 | verbs: 32 | - create 33 | - apiGroups: 34 | - "coordination.k8s.io" 35 | resources: 36 | - leases 37 | verbs: 38 | - get 39 | - list 40 | - watch 41 | - create 42 | - update 43 | - patch 44 | - delete 45 | -------------------------------------------------------------------------------- /config/rbac/leader_election_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: leader-election-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: Role 8 | name: leader-election-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: manager-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: manager-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: default 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/virtualmachine_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do edit virtualmachines. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachine-editor-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachines 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - vmoperator.vmware.com 21 | resources: 22 | - virtualmachines/status 23 | verbs: 24 | - get 25 | - patch 26 | - update 27 | -------------------------------------------------------------------------------- /config/rbac/virtualmachine_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do viewer virtualmachines. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachine-viewer-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachines 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - vmoperator.vmware.com 17 | resources: 18 | - virtualmachines/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/virtualmachineclass_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do edit virtualmachineclasses. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachineclass-editor-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachineclasses 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - vmoperator.vmware.com 21 | resources: 22 | - virtualmachineclasses/status 23 | verbs: 24 | - get 25 | - patch 26 | - update 27 | -------------------------------------------------------------------------------- /config/rbac/virtualmachineclass_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do viewer virtualmachineclasses. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachineclass-viewer-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachineclasses 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - vmoperator.vmware.com 17 | resources: 18 | - virtualmachineclasses/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/virtualmachineclassbinding_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do edit virtualmachineclassbindings. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachineclassbinding-editor-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachineclassbindings 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | -------------------------------------------------------------------------------- /config/rbac/virtualmachineclassbinding_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do viewer virtualmachineclassbindings. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachineclassbinding-viewer-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachineclassbindings 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | -------------------------------------------------------------------------------- /config/rbac/virtualmachineimage_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do edit virtualmachineimages. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachineimage-editor-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachineimages 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - vmoperator.vmware.com 21 | resources: 22 | - virtualmachineimages/status 23 | verbs: 24 | - get 25 | - patch 26 | - update 27 | -------------------------------------------------------------------------------- /config/rbac/virtualmachineimage_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do viewer virtualmachineimages. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachineimage-viewer-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachineimages 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - vmoperator.vmware.com 17 | resources: 18 | - virtualmachineimages/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/virtualmachineservice_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do edit virtualmachineservices. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachineservice-editor-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachineservices 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - vmoperator.vmware.com 21 | resources: 22 | - virtualmachineservices/status 23 | verbs: 24 | - get 25 | - patch 26 | - update 27 | -------------------------------------------------------------------------------- /config/rbac/virtualmachineservice_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do viewer virtualmachineservices. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachineservice-viewer-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachineservices 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - vmoperator.vmware.com 17 | resources: 18 | - virtualmachineservices/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/virtualmachinesetresourcepolicy_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do edit virtualmachinesetresourcepolicies. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachinesetresourcepolicy-editor-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachinesetresourcepolicies 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - vmoperator.vmware.com 21 | resources: 22 | - virtualmachinesetresourcepolicies/status 23 | verbs: 24 | - get 25 | - patch 26 | - update 27 | -------------------------------------------------------------------------------- /config/rbac/virtualmachinesetresourcepolicy_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do viewer virtualmachinesetresourcepolicies. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: virtualmachinesetresourcepolicy-viewer-role 6 | rules: 7 | - apiGroups: 8 | - vmoperator.vmware.com 9 | resources: 10 | - virtualmachinesetresourcepolicies 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - vmoperator.vmware.com 17 | resources: 18 | - virtualmachinesetresourcepolicies/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/samples/vmoperator_v1alpha1_contentlibraryprovider.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: ContentLibraryProvider 3 | metadata: 4 | name: contentlibraryprovider-sample 5 | spec: 6 | uuid: contentlibrary-uuid 7 | -------------------------------------------------------------------------------- /config/samples/vmoperator_v1alpha1_contentsource.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: ContentSource 3 | metadata: 4 | name: contentsource-sample 5 | spec: 6 | providerref: 7 | apiVersion: vmoperator.com/v1alpha1 8 | kind: ContentLibraryProvider 9 | name: contentlibrary-sample 10 | -------------------------------------------------------------------------------- /config/samples/vmoperator_v1alpha1_virtualmachine.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachine 3 | metadata: 4 | name: virtualmachine-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/vmoperator_v1alpha1_virtualmachineclass.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: virtualmachineclass-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/vmoperator_v1alpha1_virtualmachineimage.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineImage 3 | metadata: 4 | name: virtualmachineimage-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/vmoperator_v1alpha1_virtualmachineservice.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineService 3 | metadata: 4 | name: virtualmachineservice-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/samples/vmoperator_v1alpha1_virtualmachinesetresourcepolicy.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineSetResourcePolicy 3 | metadata: 4 | name: virtualmachinesetresourcepolicy-sample 5 | spec: 6 | # Add fields here 7 | foo: bar 8 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/Makefile: -------------------------------------------------------------------------------- 1 | # Ensure Make is run with bash shell as some syntax below is bash-specific 2 | SHELL := /usr/bin/env bash 3 | 4 | .DEFAULT_GOAL := help 5 | 6 | DEFAULT_VMCLASSES := default-vmclasses.yaml 7 | 8 | ## -------------------------------------- 9 | ## Help 10 | ## -------------------------------------- 11 | 12 | help: ## Display this help 13 | @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) 14 | 15 | .PHONY: $(DEFAULT_VMCLASSES) 16 | default-vmclasses: $(DEFAULT_VMCLASSES) 17 | default-vmclasses: ## Generate the default VirtualMachineClasses yaml 18 | $(DEFAULT_VMCLASSES): 19 | kustomize build >$@ 20 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - v1alpha1_vmclass_guaranteed_xsmall.yaml 3 | - v1alpha1_vmclass_guaranteed_small.yaml 4 | - v1alpha1_vmclass_guaranteed_medium.yaml 5 | - v1alpha1_vmclass_guaranteed_large.yaml 6 | - v1alpha1_vmclass_guaranteed_xlarge.yaml 7 | - v1alpha1_vmclass_guaranteed_2xlarge.yaml 8 | - v1alpha1_vmclass_guaranteed_4xlarge.yaml 9 | - v1alpha1_vmclass_guaranteed_8xlarge.yaml 10 | - v1alpha1_vmclass_best_effort_xsmall.yaml 11 | - v1alpha1_vmclass_best_effort_small.yaml 12 | - v1alpha1_vmclass_best_effort_medium.yaml 13 | - v1alpha1_vmclass_best_effort_large.yaml 14 | - v1alpha1_vmclass_best_effort_xlarge.yaml 15 | - v1alpha1_vmclass_best_effort_2xlarge.yaml 16 | - v1alpha1_vmclass_best_effort_4xlarge.yaml 17 | - v1alpha1_vmclass_best_effort_8xlarge.yaml 18 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_best_effort_2xlarge.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: best-effort-2xlarge 5 | spec: 6 | hardware: 7 | cpus: 8 8 | memory: 64Gi 9 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_best_effort_4xlarge.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: best-effort-4xlarge 5 | spec: 6 | hardware: 7 | cpus: 16 8 | memory: 128Gi 9 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_best_effort_8xlarge.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: best-effort-8xlarge 5 | spec: 6 | hardware: 7 | cpus: 32 8 | memory: 128Gi 9 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_best_effort_large.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: best-effort-large 5 | spec: 6 | hardware: 7 | cpus: 4 8 | memory: 16Gi 9 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_best_effort_medium.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: best-effort-medium 5 | spec: 6 | hardware: 7 | cpus: 2 8 | memory: 8Gi 9 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_best_effort_small.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: best-effort-small 5 | spec: 6 | hardware: 7 | cpus: 2 8 | memory: 4Gi 9 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_best_effort_xlarge.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: best-effort-xlarge 5 | spec: 6 | hardware: 7 | cpus: 4 8 | memory: 32Gi 9 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_best_effort_xsmall.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: best-effort-xsmall 5 | spec: 6 | hardware: 7 | cpus: 2 8 | memory: 2Gi 9 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_guaranteed_2xlarge.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: guaranteed-2xlarge 5 | spec: 6 | hardware: 7 | cpus: 8 8 | memory: 64Gi 9 | policies: 10 | resources: 11 | requests: 12 | cpu: 8000m 13 | memory: 64Gi 14 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_guaranteed_4xlarge.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: guaranteed-4xlarge 5 | spec: 6 | hardware: 7 | cpus: 16 8 | memory: 128Gi 9 | policies: 10 | resources: 11 | requests: 12 | cpu: 16000m 13 | memory: 128Gi 14 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_guaranteed_8xlarge.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: guaranteed-8xlarge 5 | spec: 6 | hardware: 7 | cpus: 32 8 | memory: 128Gi 9 | policies: 10 | resources: 11 | requests: 12 | cpu: 32000m 13 | memory: 128Gi 14 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_guaranteed_large.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: guaranteed-large 5 | spec: 6 | hardware: 7 | cpus: 4 8 | memory: 16Gi 9 | policies: 10 | resources: 11 | requests: 12 | cpu: 4000m 13 | memory: 16Gi 14 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_guaranteed_medium.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: guaranteed-medium 5 | spec: 6 | hardware: 7 | cpus: 2 8 | memory: 8Gi 9 | policies: 10 | resources: 11 | requests: 12 | cpu: 2000m 13 | memory: 8Gi 14 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_guaranteed_small.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: guaranteed-small 5 | spec: 6 | hardware: 7 | cpus: 2 8 | memory: 4Gi 9 | policies: 10 | resources: 11 | requests: 12 | cpu: 2000m 13 | memory: 4Gi 14 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_guaranteed_xlarge.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: guaranteed-xlarge 5 | spec: 6 | hardware: 7 | cpus: 4 8 | memory: 32Gi 9 | policies: 10 | resources: 11 | requests: 12 | cpu: 4000m 13 | memory: 32Gi 14 | -------------------------------------------------------------------------------- /config/virtualmachineclasses/v1alpha1_vmclass_guaranteed_xsmall.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha1 2 | kind: VirtualMachineClass 3 | metadata: 4 | name: guaranteed-xsmall 5 | spec: 6 | hardware: 7 | cpus: 2 8 | memory: 2Gi 9 | policies: 10 | resources: 11 | requests: 12 | cpu: 2000m 13 | memory: 2Gi 14 | -------------------------------------------------------------------------------- /config/wcp-no-configmap/Makefile: -------------------------------------------------------------------------------- 1 | # Ensure Make is run with bash shell as some syntax below is bash-specific 2 | SHELL := /usr/bin/env bash 3 | 4 | .DEFAULT_GOAL := help 5 | 6 | INFRASTRUCTURE_COMPONENTS := infrastructure-components.yaml 7 | 8 | WCP_DIR := ../wcp/ 9 | 10 | export KUSTOMIZE_TYPE="wcp-no-configmap" 11 | 12 | ## -------------------------------------- 13 | ## Help 14 | ## -------------------------------------- 15 | 16 | help: ## Display this help 17 | @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) 18 | 19 | .PHONY: $(INFRASTRUCTURE_COMPONENTS) 20 | infrastructure-components: ## Build the WCP infrastructure components 21 | infrastructure-components: 22 | $(MAKE) -C $(WCP_DIR) infrastructure-components 23 | cp $(WCP_DIR)/$(INFRASTRUCTURE_COMPONENTS) . 24 | -------------------------------------------------------------------------------- /config/wcp-no-configmap/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - ./../wcp/vmoperator 6 | 7 | components: 8 | - ../replacements 9 | -------------------------------------------------------------------------------- /config/wcp/.gitignore: -------------------------------------------------------------------------------- 1 | infrastructure-components*.yaml* -------------------------------------------------------------------------------- /config/wcp/README.md: -------------------------------------------------------------------------------- 1 | # Local infrastructure components 2 | 3 | This directory contains the tools required to build the VM Operator 4 | infrastructure components for deploying VM Operator to a WCP cluster. 5 | 6 | ## Quickstart 7 | 8 | To build the infrastructure components for VM Operator on a WCP 9 | cluster, please execute the following: 10 | 11 | ```shell 12 | make infrastructure-components 13 | ``` 14 | 15 | This should result in the creation of a file `infrastructure-components.yaml`. 16 | 17 | ## Requirements 18 | 19 | Building the infrastructure components requires the following: 20 | 21 | * Kustomize v3+ 22 | * GNU Make 4+ 23 | -------------------------------------------------------------------------------- /config/wcp/configmaps/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | namespace: vmware-system-vmop 5 | 6 | resources: 7 | - vsphere_provider_config.yaml 8 | - vmoperator_network_config.yaml 9 | -------------------------------------------------------------------------------- /config/wcp/configmaps/vmoperator_network_config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: vmoperator-network-config 5 | namespace: vmware-system-vmop 6 | data: 7 | nameservers: 8 | --- 9 | -------------------------------------------------------------------------------- /config/wcp/configmaps/vsphere_provider_config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: vsphere.provider.config.vmoperator.vmware.com 5 | namespace: vmware-system-vmop 6 | data: 7 | # Keys below should match the ones used in support/install/kube-offline-configure-kubeadm.sh in CSP 8 | VcPNID: 9 | VcCredsSecretName: wcp-vmop-sa-vc-auth 10 | Datacenter: 11 | Cluster: 12 | StorageClassRequired: "true" 13 | ContentSource: 14 | UseInventoryAsContentSource: "false" 15 | CAFilePath: "/etc/vmware/wcp/tls/vmca.pem" 16 | InsecureSkipTLSVerify: "false" 17 | IsRestrictedNetwork: -------------------------------------------------------------------------------- /config/wcp/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - ./vmoperator 6 | - ./configmaps 7 | 8 | components: 9 | - ../replacements 10 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/certs_volume_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | # controller-manager needs access to the VC cert bundle. 12 | volumeMounts: 13 | - mountPath: /etc/vmware/wcp/tls 14 | name: vmca-certs 15 | volumes: 16 | - hostPath: 17 | path: /etc/vmware/wcp/tls 18 | type: Directory 19 | name: vmca-certs 20 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/cpu_resources_patch.yaml: -------------------------------------------------------------------------------- 1 | # Speeds up local testing 2 | --- 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: controller-manager 7 | namespace: system 8 | spec: 9 | template: 10 | spec: 11 | containers: 12 | - name: manager 13 | resources: 14 | limits: 15 | cpu: 1500m 16 | memory: 1Gi 17 | requests: 18 | cpu: 100m 19 | memory: 75Mi 20 | --- 21 | apiVersion: apps/v1 22 | kind: Deployment 23 | metadata: 24 | name: web-console-validator 25 | namespace: system 26 | spec: 27 | template: 28 | spec: 29 | containers: 30 | - name: web-console-validator 31 | resources: 32 | limits: 33 | cpu: 100m 34 | memory: 100Mi 35 | requests: 36 | cpu: 50m 37 | memory: 50Mi 38 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/image_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | image: vmware/vmop:0.0.1 12 | imagePullPolicy: IfNotPresent 13 | - name: kube-rbac-proxy 14 | image: localhost:5000/vmware/kube-rbac-proxy:0.0.1 15 | imagePullPolicy: IfNotPresent 16 | command: 17 | - /kube-rbac-proxy 18 | --- 19 | apiVersion: apps/v1 20 | kind: Deployment 21 | metadata: 22 | name: web-console-validator 23 | namespace: system 24 | spec: 25 | template: 26 | spec: 27 | containers: 28 | - name: web-console-validator 29 | image: vmware/vmop:0.0.1 30 | imagePullPolicy: IfNotPresent 31 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/manager_metrics_port_patch.yaml: -------------------------------------------------------------------------------- 1 | - op: replace 2 | path: /spec/template/spec/containers/0/args/0 3 | value: --metrics-addr=127.0.0.1:8083 4 | - op: replace 5 | path: /spec/template/spec/containers/1/args/1 6 | value: --upstream=http://127.0.0.1:8083 7 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/manager_metrics_scrape_patch.yaml: -------------------------------------------------------------------------------- 1 | # The following annotations are required for scraping metrics by Telegraf. 2 | # See https://github.com/influxdata/telegraf/blob/master/plugins/inputs/prometheus/README.md#kubernetes-scraping for more detail. 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: controller-manager 7 | namespace: system 8 | spec: 9 | template: 10 | metadata: 11 | annotations: 12 | prometheus.io/port: "9848" 13 | prometheus.io/scheme: "https" 14 | prometheus.io/scrape: "true" 15 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/namespace_patch.yaml: -------------------------------------------------------------------------------- 1 | - op: replace 2 | path: /metadata/name 3 | value: vmware-system-vmop 4 | - op: add 5 | path: /metadata/labels 6 | value: 7 | pod-security.kubernetes.io/enforce: privileged 8 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/network_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | hostNetwork: true 10 | --- 11 | apiVersion: apps/v1 12 | kind: Deployment 13 | metadata: 14 | name: web-console-validator 15 | namespace: system 16 | spec: 17 | template: 18 | spec: 19 | hostNetwork: true 20 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/privileged_psp_role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: wcp-privileged-psp 5 | rules: 6 | - apiGroups: 7 | - policy 8 | resourceNames: 9 | - wcp-privileged-psp 10 | resources: 11 | - podsecuritypolicies 12 | verbs: 13 | - use 14 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/privileged_psp_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: vmware-system-vmop:psp 5 | namespace: vmware-system-vmop 6 | roleRef: 7 | apiGroup: rbac.authorization.k8s.io 8 | kind: ClusterRole 9 | name: wcp-privileged-psp 10 | subjects: 11 | - apiGroup: rbac.authorization.k8s.io 12 | kind: Group 13 | name: system:nodes 14 | - apiGroup: rbac.authorization.k8s.io 15 | kind: Group 16 | name: system:serviceaccounts:vmware-system-vmop 17 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/proxy_metrics_port_patch.yaml: -------------------------------------------------------------------------------- 1 | - op: replace 2 | path: /spec/template/spec/containers/1/args/0 3 | value: --secure-listen-address=0.0.0.0:9848 4 | - op: replace 5 | path: /spec/template/spec/containers/1/ports/0/containerPort 6 | value: 9848 7 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/service_metrics_port_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: controller-manager-metrics-service 5 | namespace: system 6 | annotations: 7 | prometheus.io/port: "9848" 8 | spec: 9 | ports: 10 | - name: https 11 | port: 9848 12 | targetPort: metrics-server 13 | - $patch: replace 14 | -------------------------------------------------------------------------------- /config/wcp/vmoperator/web_console_validator_patch.yaml: -------------------------------------------------------------------------------- 1 | - op: replace 2 | path: /spec/template/spec/containers/0/args/0 3 | value: --server-port=9868 4 | - op: replace 5 | path: /spec/template/spec/containers/0/args/1 6 | value: --server-path=/validate 7 | - op: replace 8 | path: /spec/template/spec/containers/0/ports/0/containerPort 9 | value: 9868 10 | -------------------------------------------------------------------------------- /config/web-console-validator/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - web_console_validator.yaml 3 | -------------------------------------------------------------------------------- /config/webhook/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | configurations: 5 | - kustomizeconfig.yaml 6 | 7 | resources: 8 | - service.yaml 9 | - manifests.yaml 10 | - storage_quota_webhook_configuration.yaml 11 | 12 | patches: 13 | - path: manifests_label_patch.yaml 14 | - path: webhookcainjection_patch.yaml 15 | -------------------------------------------------------------------------------- /config/webhook/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # nameReference teaches Kustomize which fields represent a resource name. 2 | nameReference: 3 | - kind: Service 4 | version: v1 5 | fieldSpecs: 6 | - kind: MutatingWebhookConfiguration 7 | group: admissionregistration.k8s.io 8 | path: webhooks/clientConfig/service/name 9 | - kind: ValidatingWebhookConfiguration 10 | group: admissionregistration.k8s.io 11 | path: webhooks/clientConfig/service/name 12 | 13 | # namespace teaches Kustomize which fields represent a resource namespace. 14 | namespace: 15 | - kind: MutatingWebhookConfiguration 16 | group: admissionregistration.k8s.io 17 | path: webhooks/clientConfig/service/namespace 18 | create: true 19 | - kind: ValidatingWebhookConfiguration 20 | group: admissionregistration.k8s.io 21 | path: webhooks/clientConfig/service/namespace 22 | create: true 23 | -------------------------------------------------------------------------------- /config/webhook/manifests_label_patch.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: admissionregistration.k8s.io/v1 3 | kind: ValidatingWebhookConfiguration 4 | metadata: 5 | name: validating-webhook-configuration 6 | labels: 7 | webhooks.vmoperator.vmware.com: "true" 8 | 9 | --- 10 | apiVersion: admissionregistration.k8s.io/v1 11 | kind: MutatingWebhookConfiguration 12 | metadata: 13 | name: mutating-webhook-configuration 14 | labels: 15 | "webhooks.vmoperator.vmware.com": "true" 16 | -------------------------------------------------------------------------------- /config/webhook/service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: webhook-service 6 | namespace: system 7 | spec: 8 | ports: 9 | - name: https 10 | port: 443 11 | targetPort: webhook-server 12 | selector: 13 | control-plane: controller-manager 14 | -------------------------------------------------------------------------------- /config/webhook/webhookcainjection_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch add annotation to admission webhook config and 2 | # the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize. 3 | # uncomment the following lines to enable mutating webhook 4 | apiVersion: admissionregistration.k8s.io/v1 5 | kind: MutatingWebhookConfiguration 6 | metadata: 7 | name: mutating-webhook-configuration 8 | annotations: 9 | cert-manager.io/inject-ca-from: WEBHOOK_CERTIFICATE_NAMESPACE_PLACEHOLDER/WEBHOOK_CERTIFICATE_NAME_PLACEHOLDER 10 | --- 11 | apiVersion: admissionregistration.k8s.io/v1 12 | kind: ValidatingWebhookConfiguration 13 | metadata: 14 | name: validating-webhook-configuration 15 | annotations: 16 | cert-manager.io/inject-ca-from: WEBHOOK_CERTIFICATE_NAMESPACE_PLACEHOLDER/WEBHOOK_CERTIFICATE_NAME_PLACEHOLDER 17 | -------------------------------------------------------------------------------- /controllers/contentlibrary/controllers.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package contentlibrary 6 | 7 | import ( 8 | "sigs.k8s.io/controller-runtime/pkg/manager" 9 | 10 | "github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/clustercontentlibraryitem" 11 | "github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/contentlibraryitem" 12 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 13 | ) 14 | 15 | // AddToManager adds the controller to the provided manager. 16 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr manager.Manager) error { 17 | if err := clustercontentlibraryitem.AddToManager(ctx, mgr); err != nil { 18 | return err 19 | } 20 | return contentlibraryitem.AddToManager(ctx, mgr) 21 | } 22 | -------------------------------------------------------------------------------- /controllers/contentlibrary/utils/utils_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package utils_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/utils" 14 | "github.com/vmware-tanzu/vm-operator/pkg/util/ptr" 15 | ) 16 | 17 | func TestContentLibraryItemControllerUtils(t *testing.T) { 18 | utils.SkipNameValidation = ptr.To(true) 19 | RegisterFailHandler(Fail) 20 | RunSpecs(t, "ContentLibraryItem Controller Utils Test Suite") 21 | } 22 | -------------------------------------------------------------------------------- /controllers/infra/zone/zone_controller_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package zone_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "github.com/vmware-tanzu/vm-operator/controllers/infra/zone" 14 | "github.com/vmware-tanzu/vm-operator/pkg/util/ptr" 15 | ) 16 | 17 | func TestZoneController(t *testing.T) { 18 | RegisterFailHandler(Fail) 19 | RunSpecs(t, "Zone Controller Test Suite") 20 | } 21 | 22 | var _ = BeforeSuite(func() { 23 | zone.SkipNameValidation = ptr.To(true) 24 | }) 25 | -------------------------------------------------------------------------------- /controllers/util/encoding/encoding_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package encoding_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestUtilities(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Encoding Utils Suite") 17 | } 18 | -------------------------------------------------------------------------------- /controllers/virtualmachineclass/virtualmachineclass_controller_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachineclass_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/controllers/virtualmachineclass" 13 | pkgcfg "github.com/vmware-tanzu/vm-operator/pkg/config" 14 | "github.com/vmware-tanzu/vm-operator/pkg/manager" 15 | "github.com/vmware-tanzu/vm-operator/test/builder" 16 | ) 17 | 18 | var suite = builder.NewTestSuiteForControllerWithContext( 19 | pkgcfg.NewContextWithDefaultConfig(), 20 | virtualmachineclass.AddToManager, 21 | manager.InitializeProvidersNoopFn) 22 | 23 | func TestVirtualMachineClass(t *testing.T) { 24 | suite.Register(t, "VirtualMachineClass controller suite", intgTests, unitTests) 25 | } 26 | 27 | var _ = BeforeSuite(suite.BeforeSuite) 28 | 29 | var _ = AfterSuite(suite.AfterSuite) 30 | -------------------------------------------------------------------------------- /controllers/virtualmachineimagecache/internal/virtualmachineimagecache_controller_internal.go: -------------------------------------------------------------------------------- 1 | // // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package internal 6 | 7 | type contextKey uint8 8 | 9 | const ( 10 | // NewCacheStorageURIsClientContextKey is used for testing. 11 | NewCacheStorageURIsClientContextKey contextKey = iota 12 | 13 | // NewContentLibraryProviderContextKey is used for testing. 14 | NewContentLibraryProviderContextKey 15 | ) 16 | -------------------------------------------------------------------------------- /controllers/virtualmachineimagecache/virtualmachineimagecache_controller_suite_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Broadcom. All Rights Reserved. 2 | // Broadcom Confidential. The term "Broadcom" refers to Broadcom Inc. 3 | // and/or its subsidiaries. 4 | 5 | package virtualmachineimagecache_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "github.com/vmware-tanzu/vm-operator/controllers/virtualmachineimagecache" 14 | "github.com/vmware-tanzu/vm-operator/pkg/util/ptr" 15 | ) 16 | 17 | func TestVirtualMachineImageCacheController(t *testing.T) { 18 | RegisterFailHandler(Fail) 19 | RunSpecs(t, "VirtualMachineImageCache Controller Test Suite") 20 | } 21 | 22 | var _ = BeforeSuite(func() { 23 | virtualmachineimagecache.SkipNameValidation = ptr.To(true) 24 | }) 25 | -------------------------------------------------------------------------------- /controllers/virtualmachineservice/providers/loadbalancer_provider_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package providers_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestLoadBalancerProvider(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "LoadBalancer Provider Suite") 17 | } 18 | -------------------------------------------------------------------------------- /controllers/virtualmachineservice/utils/constants.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package utils 6 | 7 | const ( 8 | AnnotationServiceExternalTrafficPolicyKey = "virtualmachineservice.vmoperator.vmware.com/service.externalTrafficPolicy" 9 | AnnotationServiceHealthCheckNodePortKey = "virtualmachineservice.vmoperator.vmware.com/service.healthCheckNodePort" 10 | ) 11 | -------------------------------------------------------------------------------- /controllers/virtualmachineservice/virtualmachineservice_controller_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachineservice_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice" 13 | pkgcfg "github.com/vmware-tanzu/vm-operator/pkg/config" 14 | "github.com/vmware-tanzu/vm-operator/pkg/manager" 15 | "github.com/vmware-tanzu/vm-operator/test/builder" 16 | ) 17 | 18 | var suite = builder.NewTestSuiteForControllerWithContext( 19 | pkgcfg.NewContextWithDefaultConfig(), 20 | virtualmachineservice.AddToManager, 21 | manager.InitializeProvidersNoopFn) 22 | 23 | func TestVirtualMachineService(t *testing.T) { 24 | suite.Register(t, "VirtualMachineService controller suite", intgTests, unitTests) 25 | } 26 | 27 | var _ = BeforeSuite(suite.BeforeSuite) 28 | 29 | var _ = AfterSuite(suite.AfterSuite) 30 | -------------------------------------------------------------------------------- /controllers/virtualmachinewebconsolerequest/controllers.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachinewebconsolerequest 6 | 7 | import ( 8 | "sigs.k8s.io/controller-runtime/pkg/manager" 9 | 10 | "github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha1" 11 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 12 | ) 13 | 14 | // AddToManager adds the controller to the provided manager. 15 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr manager.Manager) error { 16 | if err := addToManager(ctx, mgr); err != nil { 17 | return err 18 | } 19 | // NOTE: In v1a1 this CRD has a different name - WebConsoleRequest - so this is 20 | // still required until we stop supporting v1a1. 21 | return v1alpha1.AddToManager(ctx, mgr) 22 | } 23 | -------------------------------------------------------------------------------- /controllers/virtualmachinewebconsolerequest/v1alpha1/conditions/conditions_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package conditions 6 | 7 | import ( 8 | _ "github.com/onsi/ginkgo/v2" 9 | ) 10 | 11 | // This is require so the Gingko flags are added (specifically gingko.noColor) 12 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | Title: VM Operator 3 | hide: 4 | - navigation 5 | - toc 6 | --- 7 | 8 | 19 | 20 | # VM Operator 21 | 22 | Self-service management of virtual machines (VM) via Kubernetes. 23 | -------------------------------------------------------------------------------- /docs/concepts/README.md: -------------------------------------------------------------------------------- 1 | # Concepts 2 | 3 | The Concepts section helps you learn about the parts of VM Operator that are managed by administrators, those which you can directly influence, and helps you obtain a deeper understanding of how VM Operator works. 4 | 5 | * [Workloads](./workloads/README.md) 6 | 7 | Virtual machines (VM) on Kubernetes 8 | 9 | * [Images](./images/README.md) 10 | 11 | The images from which VMs are deployed 12 | 13 | * [Services & Networking](./services-networking/README.md) 14 | 15 | Concepts related to using Services with VM's and VM networking 16 | -------------------------------------------------------------------------------- /docs/concepts/api.md: -------------------------------------------------------------------------------- 1 | # API 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#104](https://github.com/vmware-tanzu/vm-operator/issues/104)) -------------------------------------------------------------------------------- /docs/concepts/components.md: -------------------------------------------------------------------------------- 1 | # Components 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#103](https://github.com/vmware-tanzu/vm-operator/issues/103)) -------------------------------------------------------------------------------- /docs/concepts/images/README.md: -------------------------------------------------------------------------------- 1 | # Images 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#108](https://github.com/vmware-tanzu/vm-operator/issues/108)) 4 | -------------------------------------------------------------------------------- /docs/concepts/images/pub-vm-image.md: -------------------------------------------------------------------------------- 1 | # Publish Virtual Machine Image 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#110](https://github.com/vmware-tanzu/vm-operator/issues/110)) 4 | -------------------------------------------------------------------------------- /docs/concepts/services-networking/guest-net-config.md: -------------------------------------------------------------------------------- 1 | # Guest Networking Configuration 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#113](https://github.com/vmware-tanzu/vm-operator/issues/113)) 4 | -------------------------------------------------------------------------------- /docs/concepts/workloads/vm-example.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: vmoperator.vmware.com/v1alpha4 2 | kind: VirtualMachine 3 | metadata: 4 | name: my-vm 5 | spec: 6 | className: my-vm-class 7 | imageName: vmi-0a0044d7c690bcbea 8 | storageClass: my-storage-class 9 | bootstrap: 10 | cloudInit: 11 | cloudConfig: {} 12 | -------------------------------------------------------------------------------- /docs/concepts/workloads/vm-web-console.md: -------------------------------------------------------------------------------- 1 | # WebConsoleRequest 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#106](https://github.com/vmware-tanzu/vm-operator/issues/106)) 4 | -------------------------------------------------------------------------------- /docs/ref/README.md: -------------------------------------------------------------------------------- 1 | # Reference 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#114](https://github.com/vmware-tanzu/vm-operator/issues/114)) 4 | -------------------------------------------------------------------------------- /docs/ref/api/README.md: -------------------------------------------------------------------------------- 1 | # API 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#126](https://github.com/vmware-tanzu/vm-operator/issues/126)) 4 | -------------------------------------------------------------------------------- /docs/ref/config/README.md: -------------------------------------------------------------------------------- 1 | # Configuration 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#115](https://github.com/vmware-tanzu/vm-operator/issues/115)) 4 | -------------------------------------------------------------------------------- /docs/ref/config/manager.md: -------------------------------------------------------------------------------- 1 | # Manager Pod 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#116](https://github.com/vmware-tanzu/vm-operator/issues/116)) -------------------------------------------------------------------------------- /docs/ref/proj/README.md: -------------------------------------------------------------------------------- 1 | # Project 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#117](https://github.com/vmware-tanzu/vm-operator/issues/117)) 4 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | mkdocs >= 1.6.1 2 | mkdocs-material >= 9.6.14 3 | pymdown-extensions >= 10.15 4 | pygments >= 2.19.1 5 | mkdocs-git-committers-plugin-2 >= 2.5.0 6 | mkdocs-git-revision-date-localized-plugin >= 1.4.5 7 | mkdocs-markdownextradata-plugin >= 0.2.6 8 | -------------------------------------------------------------------------------- /docs/start/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | This documentation provides information on: 4 | 5 | * [How to ask for help](./help.md) 6 | * [Contributing to VM Operator](./contrib/README.md) 7 | * [The project in general](./about/README.md) 8 | * [Concepts related to VM Operator](../concepts/README.md) 9 | * [Tutorials on useful tasks](../tutorials/README.md) 10 | * [A reference section for everything else](../ref/README.md) 11 | -------------------------------------------------------------------------------- /docs/start/about/README.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#100](https://github.com/vmware-tanzu/vm-operator/issues/100)) -------------------------------------------------------------------------------- /docs/start/about/license.md: -------------------------------------------------------------------------------- 1 | # Licensing 2 | 3 | ``` title="LICENSE.txt" 4 | --8<-- "./LICENSE.txt" 5 | ``` 6 | -------------------------------------------------------------------------------- /docs/start/about/roadmap.md: -------------------------------------------------------------------------------- 1 | # Roadmap 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#101](https://github.com/vmware-tanzu/vm-operator/issues/101)) -------------------------------------------------------------------------------- /docs/start/contrib/README.md: -------------------------------------------------------------------------------- 1 | # Contribute 2 | 3 | We welcome all-comers interested in improving VM Operator. There are a myriad of ways to help, including: 4 | 5 | * [Suggest a change](./suggest-change.md) such as an idea to improve the documentation, an API enhancement request, or a nifty new, GitHub action, just to name a few. 6 | * [Report an issue](./report-issue.md) if you find a bug, spelling mistake, etc. 7 | * [Submit a change](./submit-change.md) to update or create new documentation, fix a bug, or create a bespoke feature! 8 | -------------------------------------------------------------------------------- /docs/start/contrib/report-issue.md: -------------------------------------------------------------------------------- 1 | # Report an Issue 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#98](https://github.com/vmware-tanzu/vm-operator/issues/98)) 4 | -------------------------------------------------------------------------------- /docs/start/contrib/suggest-change.md: -------------------------------------------------------------------------------- 1 | # Suggest a Change 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#97](https://github.com/vmware-tanzu/vm-operator/issues/97)) -------------------------------------------------------------------------------- /docs/start/help.md: -------------------------------------------------------------------------------- 1 | # Talk to Us 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#96](https://github.com/vmware-tanzu/vm-operator/issues/96)) 4 | -------------------------------------------------------------------------------- /docs/tutorials/README.md: -------------------------------------------------------------------------------- 1 | # Tutorials 2 | 3 | // TODO ([github.com/vmware-tanzu/vm-operator#120](https://github.com/vmware-tanzu/vm-operator/issues/120)) 4 | -------------------------------------------------------------------------------- /docs/tutorials/deploy-apps/README.md: -------------------------------------------------------------------------------- 1 | # Deploy applications 2 | 3 | This section reviews how to deploy different types of applications with VM Operator. 4 | -------------------------------------------------------------------------------- /docs/tutorials/troubleshooting/README.md: -------------------------------------------------------------------------------- 1 | # Troubleshooting 2 | This page reviews troubleshooting procedures related to VM Operator. This page is designed to assist you in identifying and resolving common issues that you might encounter while using VM Operator. Please follow the sections below for troubleshooting different scenarios. 3 | 4 | ## Common issues users may encounter: 5 | - [VM Deployment](https://vm-operator.readthedocs.io/en/stable/tutorials/troubleshooting/deploy-vm) 6 | - [IP Assignment](https://vm-operator.readthedocs.io/en/stable/tutorials/troubleshooting/ip-assignment) 7 | - [VM Publish](https://vm-operator.readthedocs.io/en/stable/tutorials/troubleshooting/publish-vm) 8 | 9 | ## Web console 10 | In situations where Virtual Machines become inaccessible through the normal network, a console session via the VM Web Console can be an invaluable tool for diagnosing and resolving issues. Refer to [Get a Console Session](https://vm-operator.readthedocs.io/en/stable/tutorials/troubleshooting/get-console-session) 11 | -------------------------------------------------------------------------------- /docs/tutorials/troubleshooting/publish-vm.md: -------------------------------------------------------------------------------- 1 | # Publish Virtual Machine 2 | 3 | // TODO (github.com/vmware-tanzu/vm-operator#200) 4 | -------------------------------------------------------------------------------- /docs/www/css/anchor.css: -------------------------------------------------------------------------------- 1 | .svg-anchor { 2 | float: left; 3 | padding-right: 4px; 4 | margin-left: -20px; 5 | line-height: 1; 6 | 7 | opacity: 0; 8 | /* 9 | -webkit-transition: opacity 0.2s ease-in-out 0.1s; 10 | -moz-transition: opacity 0.2s ease-in-out 0.1s; 11 | -ms-transition: opacity 0.2s ease-in-out 0.1s; 12 | */ 13 | } 14 | 15 | h2:hover .svg-anchor, 16 | h3:hover .svg-anchor, 17 | h4:hover .svg-anchor, 18 | h5:hover .svg-anchor, 19 | h6:hover .svg-anchor { 20 | opacity: 1; 21 | } 22 | -------------------------------------------------------------------------------- /docs/www/css/dropdown.css: -------------------------------------------------------------------------------- 1 | .dropdown-submenu>a:after { 2 | padding-right: 5px; 3 | } 4 | -------------------------------------------------------------------------------- /docs/www/css/first-of-type.css: -------------------------------------------------------------------------------- 1 | div.col-md-9 h1:first-of-type { 2 | text-align: center; 3 | font-size: 60px; 4 | font-weight: 300; 5 | text-shadow: 2px 2px 3px rgba(0, 0, 0, .25); 6 | } 7 | 8 | div.col-md-9 > p:first-of-type { 9 | text-align: center; 10 | text-shadow: 2px 2px 3px rgba(0, 0, 0, .15); 11 | } 12 | 13 | div.col-md-9 p.admonition-title:first-of-type { 14 | text-align: left; 15 | } 16 | 17 | div.col-md-9 h1:first-of-type .headerlink { 18 | display: none; 19 | } 20 | -------------------------------------------------------------------------------- /docs/www/css/hX.css: -------------------------------------------------------------------------------- 1 | h2 { 2 | padding-top: 55px; 3 | margin-top: -40px; 4 | } 5 | 6 | h2:not(:first-of-type)::after { 7 | content: " "; 8 | display: block; 9 | border-bottom: 1px solid rgba(0, 0, 0, 0.1); 10 | } 11 | 12 | h3 { 13 | padding-top: 50px; 14 | margin-top: -40px; 15 | } 16 | h3::after{ 17 | content: " "; 18 | display: block; 19 | border-bottom: 1px solid rgba(0, 0, 0, 0.1); 20 | } 21 | 22 | h4 { 23 | padding-top: 45px; 24 | margin-top: -40px; 25 | } 26 | h4::after { 27 | content: " "; 28 | display: block; 29 | border-bottom: 1px solid rgba(0, 0, 0, 0.1); 30 | } 31 | -------------------------------------------------------------------------------- /docs/www/css/hide-rtd-footer.css: -------------------------------------------------------------------------------- 1 | div.injected { 2 | display: none !important; 3 | } 4 | -------------------------------------------------------------------------------- /docs/www/css/vm-operator.css: -------------------------------------------------------------------------------- 1 | h1#vm-operator::before { 2 | content: "v"; 3 | display: block; 4 | font-family: "vm-operator" !important; 5 | height: 150px; 6 | font-size: 192px; 7 | margin-top: -50px; 8 | margin-bottom: 25px; 9 | text-shadow: 2px 2px 3px rgba(0, 0, 0, .25); 10 | } 11 | 12 | /* h1 { 13 | text-align: center; 14 | } */ -------------------------------------------------------------------------------- /docs/www/fonts/vm-operator.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vmware-tanzu/vm-operator/213b585390c276d742ff7817d4dee745152650d4/docs/www/fonts/vm-operator.eot -------------------------------------------------------------------------------- /docs/www/fonts/vm-operator.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vmware-tanzu/vm-operator/213b585390c276d742ff7817d4dee745152650d4/docs/www/fonts/vm-operator.ttf -------------------------------------------------------------------------------- /docs/www/fonts/vm-operator.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vmware-tanzu/vm-operator/213b585390c276d742ff7817d4dee745152650d4/docs/www/fonts/vm-operator.woff -------------------------------------------------------------------------------- /docs/www/js/anchor.js: -------------------------------------------------------------------------------- 1 | $("h2, h3, h4, h5, h6").each(function(i, el) { 2 | var $el, svg, id; 3 | $el = $(el); 4 | id = $el.attr('id'); 5 | svg = ''; 6 | if (id) { 7 | return $el.prepend($("").addClass( 8 | "svg-anchor").attr("aria-hidden", "true").attr( 9 | "href", "#" + id).html(svg)); 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /docs/www/themes/material/main.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block announce %} 4 | 5 |
6 | 7 | ✨ Please check out 8 | 9 | Image Names 10 | and 11 | 12 | Name Resolution 13 | 14 | to learn about changes to VirtualMachineImage and 15 | ClusterVirtualMachineImage resources in vSphere 8.0U2+ ✨ 16 |
17 | 18 | {% endblock %} 19 | -------------------------------------------------------------------------------- /external/appplatform/api/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // Package v1alpha1 contains API Schema definitions for the appplatform.vmware.com v1alpha1 API group 6 | // This is different from the older appplatform.wcp.vmware.com. 7 | // +k8s:openapi-gen=true 8 | // +k8s:deepcopy-gen=package,register 9 | // +k8s:conversion-gen=wcp-appplatform-operator/api 10 | // +k8s:defaulter-gen=TypeMeta 11 | // +groupName=appplatform.vmware.com 12 | // +versionName=v1alpha1 13 | package v1alpha1 14 | -------------------------------------------------------------------------------- /external/byok/api/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // +kubebuilder:object:generate=true 6 | // +groupName=encryption.vmware.com 7 | 8 | // Package v1alpha1 contains API Schema definitions for the encryption v1alpha1 9 | // API group. 10 | package v1alpha1 11 | -------------------------------------------------------------------------------- /external/byok/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/vmware-tanzu/vm-operator/external/byok 2 | 3 | go 1.17 4 | 5 | require k8s.io/apimachinery v0.17.4 6 | 7 | require ( 8 | github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d // indirect 9 | github.com/google/gofuzz v1.0.0 // indirect 10 | golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 // indirect 11 | golang.org/x/text v0.3.2 // indirect 12 | gopkg.in/inf.v0 v0.9.1 // indirect 13 | k8s.io/klog v1.0.0 // indirect 14 | ) 15 | -------------------------------------------------------------------------------- /external/capabilities/api/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // +kubebuilder:object:generate=true 6 | // +groupName=iaas.vmware.com 7 | 8 | // Package v1alpha1 contains API Schema definitions for the supervisor v1alpha1 9 | // API group. 10 | package v1alpha1 11 | -------------------------------------------------------------------------------- /external/capabilities/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/vmware-tanzu/vm-operator/external/capabilities 2 | 3 | go 1.17 4 | 5 | require k8s.io/apimachinery v0.17.4 6 | 7 | require ( 8 | github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d // indirect 9 | github.com/google/gofuzz v1.0.0 // indirect 10 | golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 // indirect 11 | golang.org/x/text v0.3.2 // indirect 12 | gopkg.in/inf.v0 v0.9.1 // indirect 13 | k8s.io/klog v1.0.0 // indirect 14 | ) 15 | -------------------------------------------------------------------------------- /external/ncp/api/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // +k8s:deepcopy-gen=package,register 2 | 3 | // +groupName=vmware.com 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /external/ncp/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/vmware-tanzu/vm-operator/external/ncp 2 | 3 | go 1.17 4 | 5 | require k8s.io/apimachinery v0.17.4 6 | 7 | require ( 8 | github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d // indirect 9 | github.com/google/gofuzz v1.0.0 // indirect 10 | golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 // indirect 11 | golang.org/x/text v0.3.2 // indirect 12 | gopkg.in/inf.v0 v0.9.1 // indirect 13 | k8s.io/klog v1.0.0 // indirect 14 | ) 15 | -------------------------------------------------------------------------------- /external/storage-policy-quota/api/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | // +kubebuilder:object:generate=true 6 | // +groupName=cns.vmware.com 7 | package v1alpha1 8 | -------------------------------------------------------------------------------- /external/storage-policy-quota/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/vmware-tanzu/vm-operator/external/storage-policy-quota 2 | 3 | go 1.17 4 | 5 | require k8s.io/apimachinery v0.17.4 6 | 7 | require ( 8 | github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d // indirect 9 | github.com/google/gofuzz v1.0.0 // indirect 10 | golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 // indirect 11 | golang.org/x/text v0.3.2 // indirect 12 | gopkg.in/inf.v0 v0.9.1 // indirect 13 | k8s.io/klog v1.0.0 // indirect 14 | ) 15 | -------------------------------------------------------------------------------- /external/tanzu-topology/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/vmware-tanzu/vm-operator/external/tanzu-topology 2 | 3 | go 1.17 4 | 5 | require k8s.io/apimachinery v0.19.16 6 | 7 | require ( 8 | github.com/go-logr/logr v0.2.0 // indirect 9 | github.com/gogo/protobuf v1.3.2 // indirect 10 | github.com/google/gofuzz v1.1.0 // indirect 11 | github.com/json-iterator/go v1.1.10 // indirect 12 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 13 | github.com/modern-go/reflect2 v1.0.1 // indirect 14 | golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect 15 | golang.org/x/text v0.3.3 // indirect 16 | gopkg.in/inf.v0 v0.9.1 // indirect 17 | gopkg.in/yaml.v2 v2.2.8 // indirect 18 | k8s.io/klog/v2 v2.2.0 // indirect 19 | sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect 20 | ) 21 | -------------------------------------------------------------------------------- /hack/boilerplate/boilerplate.generatego.txt: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /hack/build-vmoperator.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | # Change directories to the parent directory of the one in which this 8 | # script is located. 9 | cd "$(dirname "${BASH_SOURCE[0]}")/.." 10 | 11 | make tools 12 | make manager web-console-validator 13 | -------------------------------------------------------------------------------- /hack/deploy-local-certmanager.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Deploy cert-manager to the local cluster 3 | 4 | set -o errexit 5 | set -o pipefail 6 | set -o nounset 7 | set -x 8 | 9 | CERT_MANAGER_URL="${CERT_MANAGER_URL:-https://github.com/cert-manager/cert-manager/releases/download/v1.16.1/cert-manager.yaml}" 10 | CERT_MANAGER_YAML="artifacts/cert-manager.yaml" 11 | 12 | mkdir -p "$(dirname "${CERT_MANAGER_YAML}")" 13 | 14 | curl -Lo "${CERT_MANAGER_YAML}" "${CERT_MANAGER_URL}" 15 | 16 | kubectl apply -f "${CERT_MANAGER_YAML}" 17 | -------------------------------------------------------------------------------- /hack/dev-setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o pipefail 5 | set -o nounset 6 | 7 | isInstalled() { 8 | command -v "$1" &> /dev/null 9 | } 10 | 11 | installApps() { 12 | isInstalled "git" || brew install git 13 | isInstalled "kubectl" || brew install kubernetes-cli 14 | isInstalled "docker" || brew cask install docker 15 | } 16 | 17 | installGo() { 18 | isInstalled "go" || brew install golang 19 | isInstalled "kind" || go get -u "sigs.k8s.io/kind" 20 | } 21 | 22 | if ! isInstalled "brew" ; then 23 | echo "Install homebrew. See https://docs.brew.sh/Installation" 24 | exit 1 25 | fi 26 | 27 | installApps 28 | installGo 29 | 30 | # vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=sh 31 | -------------------------------------------------------------------------------- /hack/lint-md.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o pipefail 5 | set -o nounset 6 | set -x 7 | 8 | if docker 2>/dev/null; then 9 | docker run --rm -v "$(pwd)":/build gcr.io/cluster-api-provider-vsphere/extra/mdlint:0.17.0 10 | else 11 | if markdownlint >/dev/null; then 12 | markdownlint -i vendor . 13 | else 14 | echo "No markdown linter found" 15 | exit 1 16 | fi 17 | fi 18 | -------------------------------------------------------------------------------- /hack/lint-shell.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o pipefail 5 | set -o nounset 6 | set -x 7 | 8 | if docker 2>/dev/null; then 9 | docker run --rm -t -v "$(pwd)":/build:ro gcr.io/cluster-api-provider-vsphere/extra/shellcheck 10 | else 11 | if shellcheck -V >/dev/null; then 12 | find . -path ./vendor -prune -o -name "*.*sh" -type f -print0 | xargs -0 shellcheck "${@}" 13 | else 14 | echo "No shellcheck linter found" 15 | exit 1 16 | fi 17 | fi 18 | -------------------------------------------------------------------------------- /hack/lint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | # Change directories to the parent directory of the one in which this 8 | # script is located. 9 | cd "$(dirname "${BASH_SOURCE[0]}")/.." 10 | 11 | make lint 12 | -------------------------------------------------------------------------------- /hack/quicktype/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .receipt-* -------------------------------------------------------------------------------- /hack/quicktype/Dockerfile: -------------------------------------------------------------------------------- 1 | # © Broadcom. All Rights Reserved. 2 | # The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | ARG BASE_IMAGE_BUILD=node:22 6 | ARG BASE_IMAGE_WORK=gcr.io/distroless/nodejs22-debian12 7 | 8 | FROM ${BASE_IMAGE_BUILD} AS build 9 | WORKDIR /quicktype 10 | COPY package.json package-lock.json* ./ 11 | RUN npm ci --prefix /quicktype quicktype 12 | 13 | FROM ${BASE_IMAGE_WORK} 14 | COPY --from=build /quicktype /quicktype 15 | WORKDIR /output 16 | -------------------------------------------------------------------------------- /hack/quicktype/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "quicktype": "^23.0.80" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /hack/tools/tools.go: -------------------------------------------------------------------------------- 1 | //go:build vmop_tools 2 | // +build vmop_tools 3 | 4 | // © Broadcom. All Rights Reserved. 5 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 6 | // SPDX-License-Identifier: Apache-2.0 7 | 8 | // Package tools manages the version of tooling used to build this project. 9 | package tools 10 | 11 | import ( 12 | _ "github.com/AlekSi/gocov-xml" 13 | _ "github.com/axw/gocov/gocov" 14 | _ "github.com/elastic/crd-ref-docs" 15 | _ "github.com/golangci/golangci-lint/cmd/golangci-lint" 16 | _ "github.com/onsi/ginkgo/v2/ginkgo" 17 | _ "golang.org/x/tools/cmd/goimports" 18 | _ "golang.org/x/vuln/cmd/govulncheck" 19 | _ "k8s.io/code-generator" 20 | _ "sigs.k8s.io/controller-runtime/tools/setup-envtest" 21 | _ "sigs.k8s.io/controller-tools/cmd/controller-gen" 22 | _ "sigs.k8s.io/kind" 23 | _ "sigs.k8s.io/kubebuilder/v3/cmd" 24 | _ "sigs.k8s.io/kustomize/kustomize/v5" 25 | ) 26 | -------------------------------------------------------------------------------- /pkg/backup/api/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/vmware-tanzu/vm-operator/pkg/backup/api 2 | 3 | go 1.18 4 | -------------------------------------------------------------------------------- /pkg/bitmask/bitmask_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package bitmask_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestSuite(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Bitmask Test Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/builder/constants.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package builder 6 | 7 | const ( 8 | AdmitMesgUpdateOnDeleting = "Update is allowed during deletion in order to remove the finalizers." 9 | 10 | SkipValidationAllowed = "Allowed due to skipping validation" 11 | SkipValidationDenied = "Denied due to skipping validation" 12 | 13 | // kubeAdminUser is the username of the kube admin account. 14 | kubeAdminUser = "kubernetes-admin" 15 | ) 16 | -------------------------------------------------------------------------------- /pkg/buildinfo.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package pkg 6 | 7 | var ( 8 | BuildCommit string 9 | BuildNumber string 10 | BuildVersion string 11 | BuildType string 12 | ) 13 | -------------------------------------------------------------------------------- /pkg/config/capabilities/capabilities_suite_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Broadcom. All Rights Reserved. 2 | // Broadcom Confidential. The term "Broadcom" refers to Broadcom Inc. 3 | // and/or its subsidiaries. 4 | 5 | package capabilities_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | func init() { 18 | klog.SetOutput(GinkgoWriter) 19 | logf.SetLogger(klog.Background()) 20 | } 21 | 22 | func TestCapabilities(t *testing.T) { 23 | RegisterFailHandler(Fail) 24 | RunSpecs(t, "Capabilities Suite") 25 | } 26 | -------------------------------------------------------------------------------- /pkg/config/config_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package config_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestConfig(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Config Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/config/env/env_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package env_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestEnv(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Env Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/constants/testlabels/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels 2 | 3 | go 1.13 4 | -------------------------------------------------------------------------------- /pkg/context/fake/fake_webhook_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package fake 6 | 7 | import ( 8 | clientrecord "k8s.io/client-go/tools/record" 9 | 10 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 11 | "github.com/vmware-tanzu/vm-operator/pkg/record" 12 | ) 13 | 14 | // NewWebhookContext returns a fake WebhookContext for unit testing 15 | // webhooks with a fake client. 16 | func NewWebhookContext(ctx *pkgctx.ControllerManagerContext) *pkgctx.WebhookContext { 17 | return &pkgctx.WebhookContext{ 18 | Context: ctx, 19 | Name: WebhookName, 20 | Namespace: ctx.Namespace, 21 | Logger: ctx.Logger.WithName(WebhookName), 22 | Recorder: record.New(clientrecord.NewFakeRecorder(1024)), 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /pkg/context/fake/fake_webhook_request_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package fake 6 | 7 | import ( 8 | "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" 9 | 10 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 11 | ) 12 | 13 | // NewWebhookRequestContext returns a fake WebhookRequestContext for unit 14 | // testing webhooks with a fake client. 15 | func NewWebhookRequestContext(ctx *pkgctx.WebhookContext, obj, oldObj *unstructured.Unstructured) *pkgctx.WebhookRequestContext { 16 | return &pkgctx.WebhookRequestContext{ 17 | WebhookContext: ctx, 18 | Obj: obj, 19 | OldObj: oldObj, 20 | Logger: ctx.Logger.WithName(obj.GetName()), 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pkg/context/generic/generic_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package generic_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | func init() { 18 | klog.SetOutput(GinkgoWriter) 19 | logf.SetLogger(klog.Background()) 20 | } 21 | 22 | func TestSuite(t *testing.T) { 23 | RegisterFailHandler(Fail) 24 | RunSpecs(t, "Generic Context Test Suite") 25 | } 26 | -------------------------------------------------------------------------------- /pkg/context/operation/operation_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package operation_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | func init() { 18 | klog.SetOutput(GinkgoWriter) 19 | logf.SetLogger(klog.Background()) 20 | } 21 | 22 | func TestSuite(t *testing.T) { 23 | RegisterFailHandler(Fail) 24 | RunSpecs(t, "Operation Context Test Suite") 25 | } 26 | -------------------------------------------------------------------------------- /pkg/context/virtualmachine_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package context 6 | 7 | import ( 8 | "context" 9 | "fmt" 10 | 11 | "github.com/go-logr/logr" 12 | "github.com/vmware/govmomi/vim25/mo" 13 | 14 | vmopv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha4" 15 | ) 16 | 17 | // VirtualMachineContext is the context used for VirtualMachineControllers. 18 | type VirtualMachineContext struct { 19 | context.Context 20 | Logger logr.Logger 21 | VM *vmopv1.VirtualMachine 22 | MoVM mo.VirtualMachine 23 | } 24 | 25 | func (v *VirtualMachineContext) String() string { 26 | return fmt.Sprintf("%s %s/%s", v.VM.GroupVersionKind(), v.VM.Namespace, v.VM.Name) 27 | } 28 | -------------------------------------------------------------------------------- /pkg/context/virtualmachineclass_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package context 6 | 7 | import ( 8 | "context" 9 | "fmt" 10 | 11 | "github.com/go-logr/logr" 12 | 13 | vmopv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha4" 14 | ) 15 | 16 | // VirtualMachineClassContext is the context used for VirtualMachineClassControllers. 17 | type VirtualMachineClassContext struct { 18 | context.Context 19 | Logger logr.Logger 20 | VMClass *vmopv1.VirtualMachineClass 21 | } 22 | 23 | func (v *VirtualMachineClassContext) String() string { 24 | return fmt.Sprintf("%s %s/%s", v.VMClass.GroupVersionKind(), v.VMClass.Namespace, v.VMClass.Name) 25 | } 26 | -------------------------------------------------------------------------------- /pkg/context/virtualmachinereplicaset_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package context 6 | 7 | import ( 8 | "context" 9 | "fmt" 10 | 11 | "github.com/go-logr/logr" 12 | 13 | vmopv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha4" 14 | ) 15 | 16 | // VirtualMachineReplicaSetContext is the context used for VirtualMachineReplicaSetContext reconciliation. 17 | type VirtualMachineReplicaSetContext struct { 18 | context.Context 19 | Logger logr.Logger 20 | ReplicaSet *vmopv1.VirtualMachineReplicaSet 21 | } 22 | 23 | func (v *VirtualMachineReplicaSetContext) String() string { 24 | return fmt.Sprintf("%s %s/%s", v.ReplicaSet.GroupVersionKind(), v.ReplicaSet.Namespace, v.ReplicaSet.Name) 25 | } 26 | -------------------------------------------------------------------------------- /pkg/context/virtualmachineservice_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package context 6 | 7 | import ( 8 | "context" 9 | "fmt" 10 | 11 | "github.com/go-logr/logr" 12 | 13 | vmopv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha4" 14 | ) 15 | 16 | // VirtualMachineServiceContext is the context used for VirtualMachineServiceController. 17 | type VirtualMachineServiceContext struct { 18 | context.Context 19 | Logger logr.Logger 20 | VMService *vmopv1.VirtualMachineService 21 | } 22 | 23 | func (v *VirtualMachineServiceContext) String() string { 24 | return fmt.Sprintf("%s %s/%s", v.VMService.GroupVersionKind(), v.VMService.Namespace, v.VMService.Name) 25 | } 26 | -------------------------------------------------------------------------------- /pkg/context/virtualmachinesetresourcepolicy_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package context 6 | 7 | import ( 8 | "context" 9 | "fmt" 10 | 11 | "github.com/go-logr/logr" 12 | 13 | vmopv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha4" 14 | ) 15 | 16 | // VirtualMachineSetResourcePolicyContext is the context used for VirtualMachineControllers. 17 | type VirtualMachineSetResourcePolicyContext struct { 18 | context.Context 19 | Logger logr.Logger 20 | ResourcePolicy *vmopv1.VirtualMachineSetResourcePolicy 21 | } 22 | 23 | func (v *VirtualMachineSetResourcePolicyContext) String() string { 24 | return fmt.Sprintf("%s %s/%s", v.ResourcePolicy.GroupVersionKind(), v.ResourcePolicy.Namespace, v.ResourcePolicy.Name) 25 | } 26 | -------------------------------------------------------------------------------- /pkg/context/volume_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package context 6 | 7 | import ( 8 | "context" 9 | "fmt" 10 | 11 | "github.com/go-logr/logr" 12 | 13 | vmopv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha4" 14 | ) 15 | 16 | // VolumeContext is the context used for VolumeController. 17 | type VolumeContext struct { 18 | context.Context 19 | Logger logr.Logger 20 | VM *vmopv1.VirtualMachine 21 | } 22 | 23 | func (v *VolumeContext) String() string { 24 | return fmt.Sprintf("%s %s/%s", v.VM.GroupVersionKind(), v.VM.Namespace, v.VM.Name) 25 | } 26 | -------------------------------------------------------------------------------- /pkg/context/webhook_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package context 6 | 7 | import ( 8 | "context" 9 | "fmt" 10 | 11 | "github.com/go-logr/logr" 12 | 13 | "github.com/vmware-tanzu/vm-operator/pkg/record" 14 | ) 15 | 16 | // WebhookContext is the context of a webhook. 17 | type WebhookContext struct { 18 | context.Context 19 | 20 | // Name is the name of the webhook. 21 | Name string 22 | 23 | // Namespace is the namespace the webhook is running in. 24 | Namespace string 25 | 26 | // ServiceAccountName is the service account name of the pod. 27 | ServiceAccountName string 28 | 29 | // Logger is the webhook's logger. 30 | Logger logr.Logger 31 | 32 | // Recorder is used to record events. 33 | Recorder record.Recorder 34 | } 35 | 36 | // String returns WebhookName. 37 | func (c *WebhookContext) String() string { 38 | return fmt.Sprintf("%s/%s", c.Namespace, c.Name) 39 | } 40 | -------------------------------------------------------------------------------- /pkg/docs/concepts/concepts_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package concepts 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestConcepts(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Docs Concepts Test Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/errors/errors_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package errors_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestErrors(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Errors Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/exit/exit_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package exit_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestExit(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Exit Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/manager/init/init_providers.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package manager 6 | 7 | import ( 8 | "fmt" 9 | 10 | ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager" 11 | 12 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 13 | "github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere" 14 | "github.com/vmware-tanzu/vm-operator/pkg/record" 15 | ) 16 | 17 | func InitializeProviders( 18 | ctx *pkgctx.ControllerManagerContext, 19 | mgr ctrlmgr.Manager) error { 20 | 21 | vmProviderName := fmt.Sprintf("%s/%s/vmProvider", ctx.Namespace, ctx.Name) 22 | recorder := record.New(mgr.GetEventRecorderFor(vmProviderName)) 23 | ctx.VMProvider = vsphere.NewVSphereVMProviderFromClient(ctx, mgr.GetClient(), recorder) 24 | return nil 25 | } 26 | -------------------------------------------------------------------------------- /pkg/manager/test/manager_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package manager_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels" 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | func integTests() { 17 | Describe("Cache", Ordered, Label(testlabels.EnvTest), cacheTests) 18 | } 19 | 20 | var suite = builder.NewTestSuite() 21 | 22 | func TestManager(t *testing.T) { 23 | suite.SetManagerNewCacheFunc(newCacheProxy) 24 | suite.Register(t, "Manager Suite", integTests, nil) 25 | } 26 | 27 | var _ = BeforeSuite(suite.BeforeSuite) 28 | 29 | var _ = AfterSuite(suite.AfterSuite) 30 | -------------------------------------------------------------------------------- /pkg/mem/mem_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package mem_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestMem(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Mem Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/metrics/constants.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package metrics 6 | 7 | const ( 8 | // If this changes, the metrics collection configs (e.g. telegraf) will need to be updated as well. 9 | metricsNamespace = "vmservice" 10 | 11 | // VM related metrics labels. 12 | vmNameLabel = "vm_name" 13 | vmNamespaceLabel = "vm_namespace" 14 | conditionTypeLabel = "condition_type" 15 | conditionReasonLabel = "condition_reason" 16 | phaseLabel = "phase" 17 | specLabel = "spec" 18 | statusLabel = "status" 19 | 20 | // VMImage related metrics labels (from image registry service). 21 | vmiNameLabel = "vmi_name" 22 | vmiNamespaceLabel = "vmi_namespace" 23 | ) 24 | -------------------------------------------------------------------------------- /pkg/prober/context/probe_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package context 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/go-logr/logr" 11 | 12 | vmopv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha4" 13 | "github.com/vmware-tanzu/vm-operator/pkg/patch" 14 | ) 15 | 16 | // ProbeContext is the context used for VM Probes. 17 | type ProbeContext struct { 18 | context.Context 19 | Logger logr.Logger 20 | PatchHelper *patch.Helper 21 | VM *vmopv1.VirtualMachine 22 | ProbeType string 23 | PeriodSeconds int32 24 | } 25 | 26 | // String returns probe type. 27 | func (p *ProbeContext) String() string { 28 | return p.ProbeType 29 | } 30 | -------------------------------------------------------------------------------- /pkg/prober/fake/probe/fake_probe.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package probe 6 | 7 | import ( 8 | "sync" 9 | 10 | "github.com/vmware-tanzu/vm-operator/pkg/prober/context" 11 | "github.com/vmware-tanzu/vm-operator/pkg/prober/probe" 12 | ) 13 | 14 | type funcs struct { 15 | ProbeFn func(ctx *context.ProbeContext) (probe.Result, error) 16 | } 17 | 18 | type FakeProbe struct { 19 | sync.Mutex 20 | funcs 21 | } 22 | 23 | func NewFakeProbe() probe.Probe { 24 | return &FakeProbe{} 25 | } 26 | 27 | func (p *FakeProbe) Probe(ctx *context.ProbeContext) (probe.Result, error) { 28 | p.Lock() 29 | defer p.Unlock() 30 | 31 | if p.ProbeFn != nil { 32 | return p.ProbeFn(ctx) 33 | } 34 | 35 | return probe.Unknown, nil 36 | } 37 | -------------------------------------------------------------------------------- /pkg/prober/worker/prober_worker.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package worker 6 | 7 | import ( 8 | "k8s.io/client-go/util/workqueue" 9 | 10 | vmopv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha4" 11 | 12 | "github.com/vmware-tanzu/vm-operator/pkg/prober/context" 13 | "github.com/vmware-tanzu/vm-operator/pkg/prober/probe" 14 | ) 15 | 16 | type DelayingInterface = workqueue.TypedDelayingInterface[any] 17 | 18 | // Worker represents a prober worker interface. 19 | type Worker interface { 20 | GetQueue() DelayingInterface 21 | CreateProbeContext(vm *vmopv1.VirtualMachine) (*context.ProbeContext, error) 22 | DoProbe(ctx *context.ProbeContext) error 23 | ProcessProbeResult(ctx *context.ProbeContext, res probe.Result, resErr error) error 24 | } 25 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/clustermodules/cluster_modules_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package clustermodules_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels" 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | func vcSimTests() { 17 | Describe("ClusterModules Provider", Label(testlabels.VCSim), cmTests) 18 | } 19 | 20 | var suite = builder.NewTestSuite() 21 | 22 | func TestClusterModules(t *testing.T) { 23 | suite.Register(t, "vSphere Provider Cluster Modules Suite", nil, vcSimTests) 24 | } 25 | 26 | var _ = BeforeSuite(suite.BeforeSuite) 27 | 28 | var _ = AfterSuite(suite.AfterSuite) 29 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/config/config_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package config_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels" 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | func vcSimTests() { 17 | Describe("Config", Label(testlabels.VCSim), configTests) 18 | } 19 | 20 | var suite = builder.NewTestSuite() 21 | 22 | func TestConfig(t *testing.T) { 23 | suite.Register(t, "vSphere Provider Config Suite", nil, vcSimTests) 24 | } 25 | 26 | var _ = BeforeSuite(suite.BeforeSuite) 27 | 28 | var _ = AfterSuite(suite.AfterSuite) 29 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/contentlibrary/content_library.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package contentlibrary 6 | 7 | import ( 8 | logf "sigs.k8s.io/controller-runtime/pkg/log" 9 | ) 10 | 11 | var log = logf.Log.WithName("vsphere").WithName("contentlibrary") 12 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/contentlibrary/content_library_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package contentlibrary_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels" 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | func vcSimTests() { 17 | Describe("ContentLibrary Provider", Label(testlabels.VCSim), clTests) 18 | } 19 | 20 | var suite = builder.NewTestSuite() 21 | 22 | func TestContentLibrary(t *testing.T) { 23 | suite.Register(t, "vSphere Provider ContentLibrary Suite", nil, vcSimTests) 24 | } 25 | 26 | var _ = BeforeSuite(suite.BeforeSuite) 27 | 28 | var _ = AfterSuite(suite.AfterSuite) 29 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/credentials/credentials_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package credentials_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestCredentials(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "vSphere Provider Credentials Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/network/network_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package network_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | var suite = builder.NewTestSuite() 17 | var _ = BeforeSuite(suite.BeforeSuite) 18 | var _ = AfterSuite(suite.AfterSuite) 19 | 20 | func TestNetwork(t *testing.T) { 21 | RegisterFailHandler(Fail) 22 | RunSpecs(t, "vSphere Provider Network Suite") 23 | } 24 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/placement/placement_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package placement_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels" 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | func vcSimTests() { 17 | Describe("Placement", Label(testlabels.VCSim), vcSimPlacement) 18 | } 19 | 20 | var suite = builder.NewTestSuite() 21 | 22 | func TestPlacement(t *testing.T) { 23 | suite.Register(t, "VMProvider Placement", nil, vcSimTests) 24 | } 25 | 26 | var _ = BeforeSuite(suite.BeforeSuite) 27 | 28 | var _ = AfterSuite(suite.AfterSuite) 29 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/session/session_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package session_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | var suite = builder.NewTestSuite() 17 | 18 | var _ = BeforeSuite(suite.BeforeSuite) 19 | var _ = AfterSuite(suite.AfterSuite) 20 | 21 | func TestSession(t *testing.T) { 22 | RegisterFailHandler(Fail) 23 | RunSpecs(t, "vSphere Provider Session Suite") 24 | } 25 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/storage/storage_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package storage_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | func init() { 18 | klog.SetOutput(GinkgoWriter) 19 | logf.SetLogger(klog.Background()) 20 | } 21 | 22 | func TestStorage(t *testing.T) { 23 | RegisterFailHandler(Fail) 24 | RunSpecs(t, "vSphere Provider Storage Suite") 25 | } 26 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/sysprep/suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package sysprep_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | var suite = builder.NewTestSuite() 17 | var _ = BeforeSuite(suite.BeforeSuite) 18 | var _ = AfterSuite(suite.AfterSuite) 19 | 20 | func TestCloudInit(t *testing.T) { 21 | RegisterFailHandler(Fail) 22 | RunSpecs(t, "vSphere Provider Sysprep Suite") 23 | } 24 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/vcenter/vcenter_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package vcenter_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels" 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | var suite = builder.NewTestSuite() 17 | 18 | func vcSimTests() { 19 | Describe("Cluster", Label(testlabels.VCSim), clusterTests) 20 | Describe("Folder", Label(testlabels.VCSim), folderTests) 21 | Describe("GetVM", Label(testlabels.VCSim), getVMTests) 22 | Describe("Host", Label(testlabels.VCSim), hostTests) 23 | Describe("ResourcePool", Label(testlabels.VCSim), resourcePoolTests) 24 | } 25 | 26 | func TestVCenter(t *testing.T) { 27 | suite.Register(t, "VMProvider VCenter Tests", nil, vcSimTests) 28 | } 29 | 30 | var _ = BeforeSuite(suite.BeforeSuite) 31 | 32 | var _ = AfterSuite(suite.AfterSuite) 33 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/virtualmachine/ccr.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachine 6 | 7 | import ( 8 | "context" 9 | "fmt" 10 | 11 | "github.com/vmware/govmomi/object" 12 | ) 13 | 14 | // GetVMClusterComputeResource returns the VM's ClusterComputeResource. 15 | func GetVMClusterComputeResource( 16 | ctx context.Context, 17 | vcVM *object.VirtualMachine) (*object.ClusterComputeResource, error) { 18 | 19 | rp, err := vcVM.ResourcePool(ctx) 20 | if err != nil { 21 | return nil, err 22 | } 23 | 24 | ccrRef, err := rp.Owner(ctx) 25 | if err != nil { 26 | return nil, err 27 | } 28 | 29 | cluster, ok := ccrRef.(*object.ClusterComputeResource) 30 | if !ok { 31 | return nil, fmt.Errorf("VM Owner is not a ClusterComputeResource but %T", ccrRef) 32 | } 33 | 34 | return cluster, nil 35 | } 36 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/virtualmachine/conversion.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachine 6 | 7 | import ( 8 | "math" 9 | 10 | "k8s.io/apimachinery/pkg/api/resource" 11 | ) 12 | 13 | func MemoryQuantityToMb(q resource.Quantity) int64 { 14 | return int64(math.Ceil(float64(q.Value()) / float64(1024*1024))) 15 | } 16 | 17 | func CPUQuantityToMhz(q resource.Quantity, cpuFreqMhz uint64) int64 { 18 | return int64(math.Ceil(float64(q.MilliValue()) * float64(cpuFreqMhz) / float64(1000))) 19 | } 20 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/virtualmachine/heartbeat.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachine 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/vmware/govmomi/object" 11 | "github.com/vmware/govmomi/vim25/mo" 12 | 13 | vmopv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha4" 14 | ) 15 | 16 | func GetGuestHeartBeatStatus( 17 | ctx context.Context, 18 | vm *object.VirtualMachine) (vmopv1.GuestHeartbeatStatus, error) { 19 | 20 | var o mo.VirtualMachine 21 | if err := vm.Properties(ctx, vm.Reference(), []string{"guestHeartbeatStatus"}, &o); err != nil { 22 | return "", err 23 | } 24 | 25 | return vmopv1.GuestHeartbeatStatus(o.GuestHeartbeatStatus), nil 26 | } 27 | -------------------------------------------------------------------------------- /pkg/providers/vsphere/vmlifecycle/vmlifecycle_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package vmlifecycle_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | var suite = builder.NewTestSuite() 17 | var _ = BeforeSuite(suite.BeforeSuite) 18 | var _ = AfterSuite(suite.AfterSuite) 19 | 20 | func TestVMLifecycle(t *testing.T) { 21 | RegisterFailHandler(Fail) 22 | RunSpecs(t, "vSphere Provider VM Lifecycle Suite") 23 | } 24 | -------------------------------------------------------------------------------- /pkg/record/recorder_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package record 6 | 7 | import ( 8 | "context" 9 | 10 | ctxgen "github.com/vmware-tanzu/vm-operator/pkg/context/generic" 11 | ) 12 | 13 | type contextKeyType uint8 14 | 15 | const contextKeyValue contextKeyType = 0 16 | 17 | type contextValueType = Recorder 18 | 19 | // FromContext returns the recorder from the specified context. 20 | func FromContext(ctx context.Context) contextValueType { 21 | return ctxgen.FromContext( 22 | ctx, 23 | contextKeyValue, 24 | func(val contextValueType) contextValueType { 25 | return val 26 | }) 27 | } 28 | 29 | // WithContext returns a new recorder context. 30 | func WithContext(parent context.Context, val contextValueType) context.Context { 31 | if val == nil { 32 | panic("recorder is nil") 33 | } 34 | return ctxgen.WithContext( 35 | parent, 36 | contextKeyValue, 37 | func() contextValueType { return val }) 38 | } 39 | -------------------------------------------------------------------------------- /pkg/record/recorder_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package record_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestServices(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Event Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/topology/availability_zones_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package topology_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestTopology(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Topology Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/util/cloudinit/cloudinit_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package cloudinit_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | var suite = builder.NewTestSuite() 17 | var _ = BeforeSuite(suite.BeforeSuite) 18 | var _ = AfterSuite(suite.AfterSuite) 19 | 20 | func TestCloudInit(t *testing.T) { 21 | RegisterFailHandler(Fail) 22 | RunSpecs(t, "vSphere Provider Cloud-Init Suite") 23 | } 24 | 25 | func addrOf[T any](t T) *T { 26 | return &t 27 | } 28 | -------------------------------------------------------------------------------- /pkg/util/cloudinit/schema/Makefile: -------------------------------------------------------------------------------- 1 | # © Broadcom. All Rights Reserved. 2 | # The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | TOOLS_DIR := ../../../../hack/tools 6 | SCHEMA_IN := schema-cloud-config-v1.json 7 | OUTPUT_GO := cloudconfig.go 8 | QUICK_DIR := ../../../../hack/quicktype 9 | START_TYP := Cloudconfig 10 | 11 | include $(QUICK_DIR)/Makefile 12 | -------------------------------------------------------------------------------- /pkg/util/cloudinit/schema/README.md: -------------------------------------------------------------------------------- 1 | # Cloud-Init schemas 2 | 3 | ## Overview 4 | 5 | This directory contains schema files relates to Cloud-Init: 6 | 7 | * [`schema-cloud-config-v1.json`](./schema-cloud-config-v1.json) 8 | 9 | * **`Copied`** `2023/12/14` 10 | * **`Source`** https://github.com/canonical/cloud-init/blob/main/cloudinit/config/schemas/schema-cloud-config-v1.json 11 | * **`--help`** The Cloud-Init CloudConfig schema that may be used to validate user and vendor data 12 | 13 | ## Generating the Go source code 14 | 15 | Run `make generate-go` to generate the Go source code. If the local system has `npm`, it is used, otherwise a container image is used with either Docker or Podman. 16 | -------------------------------------------------------------------------------- /pkg/util/cloudinit/validate/testdata/README.md: -------------------------------------------------------------------------------- 1 | # Cloud-Init test data for validation 2 | 3 | ## Overview 4 | 5 | This directory contains test data files relates to Cloud-Init: 6 | 7 | ## Valid test data 8 | 9 | * [`valid-cloud-config-1.yaml`](./valid-cloud-config-1.yaml) 10 | 11 | * **`Copied`** `2023/12/14` 12 | * **`Source`** https://cloudinit.readthedocs.io/en/latest/reference/examples.html#including-users-and-groups 13 | * **`--help`** An example, valid CloudConfig that includes several users and groups 14 | 15 | ## Invalid test data 16 | 17 | * [`invalid-cloud-config-1.yaml`](./valid-cloud-config-1.yaml) 18 | 19 | * **`--help`** A copy of `valid-cloud-config-1.yaml`, where the first, non-default user has a name that is an array rather than a string. 20 | 21 | -------------------------------------------------------------------------------- /pkg/util/cloudinit/validate/validate_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package validate_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | var suite = builder.NewTestSuite() 17 | var _ = BeforeSuite(suite.BeforeSuite) 18 | var _ = AfterSuite(suite.AfterSuite) 19 | 20 | func TestCloudInit(t *testing.T) { 21 | RegisterFailHandler(Fail) 22 | RunSpecs(t, "vSphere Provider Cloud-Init Validation Suite") 23 | } 24 | -------------------------------------------------------------------------------- /pkg/util/cns.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package util 6 | 7 | // CNSAttachmentNameForVolume returns the name of the CnsNodeVmAttachment based 8 | // on the VM and Volume name. 9 | // This matches the naming used in previous code but there are situations where 10 | // we may get a collision between VMs and Volume names. I'm not sure if there is 11 | // an absolute way to avoid that: the same situation can happen with the 12 | // claimName. 13 | // Ideally, we would use GenerateName, but we lack the back-linkage to match 14 | // Volumes and CnsNodeVmAttachment up. 15 | // The VM webhook validate that this result will be a valid k8s name. 16 | func CNSAttachmentNameForVolume(vmName, volumeName string) string { 17 | return vmName + "-" + volumeName 18 | } 19 | -------------------------------------------------------------------------------- /pkg/util/constants.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package util 6 | 7 | const ( 8 | // XsiNamespace indicates the XML schema instance namespace. 9 | XsiNamespace = "http://www.w3.org/2001/XMLSchema-instance" 10 | ) 11 | -------------------------------------------------------------------------------- /pkg/util/hash.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package util 6 | 7 | import ( 8 | "crypto/sha1" //nolint:gosec // used for creating safe names 9 | "encoding/hex" 10 | "io" 11 | "strings" 12 | ) 13 | 14 | // SHA1Sum17 returns the first 17 characters of the base64-encoded, SHA1 15 | // sum created from the provided string. 16 | func SHA1Sum17(s string) string { 17 | h := sha1.New() //nolint:gosec // used for creating safe names 18 | _, _ = io.WriteString(h, s) 19 | return hex.EncodeToString(h.Sum(nil))[:17] 20 | } 21 | 22 | // VMIName returns the VMI name for a given library item ID. 23 | func VMIName(itemID string) string { 24 | return "vmi-" + SHA1Sum17(strings.ReplaceAll(itemID, "-", "")) 25 | } 26 | -------------------------------------------------------------------------------- /pkg/util/http_errors.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package util 6 | 7 | import ( 8 | "net/http" 9 | "strings" 10 | ) 11 | 12 | func IsNotFoundError(err error) bool { 13 | return strings.HasSuffix(err.Error(), http.StatusText(http.StatusNotFound)) 14 | } 15 | -------------------------------------------------------------------------------- /pkg/util/http_errors_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package util_test 6 | 7 | import ( 8 | "fmt" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "github.com/vmware-tanzu/vm-operator/pkg/util" 14 | ) 15 | 16 | var _ = Describe("IsNotFoundError", func() { 17 | Context("when a NotFound error is passed", func() { 18 | It("should return true", func() { 19 | err := fmt.Errorf("404 Not Found") 20 | Expect(util.IsNotFoundError(err)).To(BeTrue()) 21 | }) 22 | }) 23 | 24 | Context("when an error other than NotFound is passed", func() { 25 | It("should return false", func() { 26 | err := fmt.Errorf("some-other-error") 27 | Expect(util.IsNotFoundError(err)).To(BeFalse()) 28 | }) 29 | }) 30 | }) 31 | -------------------------------------------------------------------------------- /pkg/util/image/image_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package image_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestImage(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Image Util Test Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/util/kube/cource/cource_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package cource_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | func init() { 18 | klog.SetOutput(GinkgoWriter) 19 | logf.SetLogger(klog.Background()) 20 | } 21 | 22 | func TestSuite(t *testing.T) { 23 | RegisterFailHandler(Fail) 24 | RunSpecs(t, "Cource Util Test Suite") 25 | } 26 | -------------------------------------------------------------------------------- /pkg/util/kube/internal/internal_kube_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package internal_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | func init() { 18 | klog.SetOutput(GinkgoWriter) 19 | logf.SetLogger(klog.Background()) 20 | } 21 | 22 | func TestKube(t *testing.T) { 23 | RegisterFailHandler(Fail) 24 | RunSpecs(t, "Kube Util Internal Test Suite") 25 | } 26 | -------------------------------------------------------------------------------- /pkg/util/kube/kube_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package kube_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "github.com/go-logr/logr" 14 | 15 | "k8s.io/klog/v2" 16 | logf "sigs.k8s.io/controller-runtime/pkg/log" 17 | ) 18 | 19 | const fakeString = "fake" 20 | 21 | func init() { 22 | klog.SetOutput(GinkgoWriter) 23 | logf.SetLogger(klog.Background()) 24 | } 25 | 26 | func getLogger() logr.Logger { 27 | return logf.Log 28 | } 29 | 30 | func TestKube(t *testing.T) { 31 | RegisterFailHandler(Fail) 32 | RunSpecs(t, "Kube Util Test Suite") 33 | } 34 | -------------------------------------------------------------------------------- /pkg/util/kube/proxyaddr/proxyaddr_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package proxyaddr 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestImage(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Proxy Address Suite Test") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/util/kube/spq/spq_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package spq 6 | 7 | import ( 8 | "context" 9 | 10 | "sigs.k8s.io/controller-runtime/pkg/event" 11 | 12 | "github.com/vmware-tanzu/vm-operator/pkg/util/kube/cource" 13 | ) 14 | 15 | type contextKeyType uint8 16 | 17 | const contextKeyValue contextKeyType = 0 18 | 19 | // FromContext returns the channel on which an event for a namespaced 20 | // StorageClass resource may be sent to signal the sync of the usage for VMs 21 | // in that namespace using that StorageClass. 22 | func FromContext(ctx context.Context) chan event.GenericEvent { 23 | return cource.FromContext(ctx, contextKeyValue) 24 | } 25 | -------------------------------------------------------------------------------- /pkg/util/kube/spq/spq_context_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package spq_test 6 | 7 | import ( 8 | . "github.com/onsi/ginkgo/v2" 9 | . "github.com/onsi/gomega" 10 | 11 | "github.com/vmware-tanzu/vm-operator/pkg/util/kube/cource" 12 | spqutil "github.com/vmware-tanzu/vm-operator/pkg/util/kube/spq" 13 | ) 14 | 15 | var _ = Describe("FromContext", func() { 16 | Specify("two calls should return the same object", func() { 17 | ctx := cource.NewContext() 18 | obj1 := spqutil.FromContext(ctx) 19 | obj2 := spqutil.FromContext(ctx) 20 | Expect(obj1).To(Equal(obj2)) 21 | }) 22 | }) 23 | -------------------------------------------------------------------------------- /pkg/util/kube/spq/spq_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package spq_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | func init() { 18 | klog.SetOutput(GinkgoWriter) 19 | logf.SetLogger(klog.Background()) 20 | } 21 | 22 | func TestKube(t *testing.T) { 23 | RegisterFailHandler(Fail) 24 | RunSpecs(t, "StoragePolicyQuota Util Test Suite") 25 | } 26 | 27 | const ( 28 | defaultNamespace = "default" 29 | myStorageClass = "my-storage-class" 30 | fakeString = "fake" 31 | sc1PolicyID = "my-storage-policy-id-1" 32 | sc2PolicyID = "my-storage-policy-id-2" 33 | ) 34 | -------------------------------------------------------------------------------- /pkg/util/kube/vm.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package kube 6 | 7 | const ( 8 | // CAPWClusterRoleLabelKey is the key for the label applied to a VM that was 9 | // created by CAPW. 10 | CAPWClusterRoleLabelKey = "capw.vmware.com/cluster.role" //nolint:gosec 11 | 12 | // CAPVClusterRoleLabelKey is the key for the label applied to a VM that was 13 | // created by CAPV. 14 | CAPVClusterRoleLabelKey = "capv.vmware.com/cluster.role" 15 | ) 16 | 17 | // HasCAPILabels returns true if the VM has a label indicating it was created by 18 | // Cluster API such as CAPW or CAPV. 19 | func HasCAPILabels(vmLabels map[string]string) bool { 20 | _, hasCAPWLabel := vmLabels[CAPWClusterRoleLabelKey] 21 | _, hasCAPVLabel := vmLabels[CAPVClusterRoleLabelKey] 22 | 23 | return hasCAPWLabel || hasCAPVLabel 24 | } 25 | -------------------------------------------------------------------------------- /pkg/util/netplan/netplan.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package netplan 6 | 7 | import ( 8 | "sigs.k8s.io/yaml" 9 | 10 | "github.com/vmware-tanzu/vm-operator/pkg/util/netplan/schema" 11 | ) 12 | 13 | // Config describes the desired network configuration from 14 | // https://netplan.readthedocs.io/en/stable/netplan-yaml/. 15 | type Config = schema.Config 16 | 17 | type Network = schema.NetworkConfig 18 | 19 | type Ethernet = schema.EthernetConfig 20 | 21 | type Match = schema.MatchConfig 22 | 23 | type Nameserver = schema.NameserverConfig 24 | 25 | type Route = schema.RoutingConfig 26 | 27 | type Address = schema.AddressMapping 28 | 29 | type Renderer = schema.Renderer 30 | 31 | func MarshalYAML(in Config) ([]byte, error) { 32 | return yaml.Marshal(in) 33 | } 34 | 35 | func UnmarshalYAML(data []byte) (Config, error) { 36 | var out Config 37 | err := yaml.Unmarshal(data, &out) 38 | return out, err 39 | } 40 | -------------------------------------------------------------------------------- /pkg/util/netplan/netplan_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package netplan_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestNetplan(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Netplan Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/util/netplan/schema/.gitignore: -------------------------------------------------------------------------------- 1 | .receipt-* -------------------------------------------------------------------------------- /pkg/util/netplan/schema/Dockerfile: -------------------------------------------------------------------------------- 1 | # © Broadcom. All Rights Reserved. 2 | # The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | ARG BASE_IMAGE=rust@sha256:96d0c6fc967aad12993be9592eb4a76c23268c4f8ff49dbe96b10226c267b712 6 | 7 | FROM ${BASE_IMAGE} AS build 8 | WORKDIR /work 9 | RUN git clone https://github.com/TobiasDeBruijn/netplan-types . 10 | COPY main.rs src/ 11 | RUN cargo add serde_json 12 | RUN cargo build --features schemars 13 | 14 | 15 | FROM ${BASE_IMAGE} 16 | COPY --from=build /work/ /work/ 17 | WORKDIR /work 18 | CMD ["/bin/sh", "-c", "cargo run --features schemars >/output/schema.json"] -------------------------------------------------------------------------------- /pkg/util/netplan/schema/README.md: -------------------------------------------------------------------------------- 1 | # Netplan schemas 2 | 3 | ## Overview 4 | 5 | This directory contains schema files relates to Netplan: 6 | 7 | * [`schema.json`](./schema.json) 8 | 9 | * **`Copied`** `2024/11/112` 10 | * **`Source`** https://github.com/TobiasDeBruijn/netplan-types 11 | * **`--help`** Generate the schema with `make schema.json` 12 | 13 | ## Generating the Go source code 14 | 15 | Run `make generate-go` to generate the Go source code. If the local system has `npm`, it is used, otherwise a container image is used with either Docker or Podman. 16 | -------------------------------------------------------------------------------- /pkg/util/netplan/schema/main.rs: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | fn main() { 6 | let schema = schemars::schema_for!(netplan_types::NetplanConfig); 7 | println!("{}", serde_json::to_string_pretty(&schema).unwrap()); 8 | } -------------------------------------------------------------------------------- /pkg/util/nil.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import "reflect" 4 | 5 | // IsNil returns true if v is nil, including a nil check against possible 6 | // interface data. 7 | func IsNil(v any) bool { 8 | if v == nil { 9 | return true 10 | } 11 | if vv := reflect.ValueOf(v); vv.Kind() == reflect.Ptr { 12 | return vv.IsNil() 13 | } 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /pkg/util/ovfcache/internal/ovfcache_internal_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package internal_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestOVFCacheInternal(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "OVF Cache Internal Test Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/util/ovfcache/ovfcache_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package ovfcache_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestOVFCache(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "OVF Cache Test Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/util/paused/paused.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package paused 6 | 7 | import ( 8 | "github.com/vmware/govmomi/object" 9 | "github.com/vmware/govmomi/vim25/mo" 10 | 11 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 12 | 13 | vmopv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha4" 14 | ) 15 | 16 | func ByDevOps(vm *vmopv1.VirtualMachine) bool { 17 | return metav1.HasAnnotation(vm.ObjectMeta, vmopv1.PauseAnnotation) 18 | } 19 | 20 | func ByAdmin(moVM mo.VirtualMachine) bool { 21 | if moVM.Config == nil { 22 | return false 23 | } 24 | return object.OptionValueList(moVM.Config.ExtraConfig). 25 | IsTrue(vmopv1.PauseVMExtraConfigKey) 26 | } 27 | -------------------------------------------------------------------------------- /pkg/util/paused/paused_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package paused_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | func init() { 18 | klog.SetOutput(GinkgoWriter) 19 | logf.SetLogger(klog.Background()) 20 | } 21 | 22 | func TestPtr(t *testing.T) { 23 | RegisterFailHandler(Fail) 24 | RunSpecs(t, "Paused Util Test Suite") 25 | } 26 | -------------------------------------------------------------------------------- /pkg/util/ptr/ptr_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package ptr_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | func init() { 18 | klog.SetOutput(GinkgoWriter) 19 | logf.SetLogger(klog.Background()) 20 | } 21 | 22 | func TestPtr(t *testing.T) { 23 | RegisterFailHandler(Fail) 24 | RunSpecs(t, "Ptr Util Test Suite") 25 | } 26 | -------------------------------------------------------------------------------- /pkg/util/resize/resize_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package resize_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestResize(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Resize Test Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/util/util_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package util_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestUtil(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Util Test Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/util/vapi.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package util 6 | 7 | import ( 8 | "context" 9 | "net/http" 10 | 11 | "github.com/vmware/govmomi/vapi/rest" 12 | ) 13 | 14 | // vapiActivationIDHeader is the HTTP header to pass to a VAPI API in order 15 | // to influence the activationID of the vim.Task spawned by the VAPI API. 16 | const vapiActivationIDHeader = "vapi-ctx-actid" 17 | 18 | // WithVAPIActivationID adds the specified id to the context to be used as the 19 | // VAPI REST client's activation ID -- the value assigned to the activationId 20 | // field to the vim.Task the VAPI API may spawn. 21 | func WithVAPIActivationID( 22 | ctx context.Context, 23 | client *rest.Client, 24 | id string) context.Context { 25 | 26 | return client.WithHeader( 27 | ctx, 28 | http.Header{vapiActivationIDHeader: []string{id}}, 29 | ) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/util/vmopv1/vmopv1_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package vmopv1_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | pkgcfg "github.com/vmware-tanzu/vm-operator/pkg/config" 14 | "github.com/vmware-tanzu/vm-operator/test/builder" 15 | ) 16 | 17 | var suite = builder.NewTestSuiteWithContext( 18 | pkgcfg.WithConfig( 19 | pkgcfg.Config{ 20 | BuildVersion: "v1", 21 | })) 22 | 23 | func TestVmopv1(t *testing.T) { 24 | RegisterFailHandler(Fail) 25 | RunSpecs(t, "Vmopv1 util suite") 26 | } 27 | 28 | var _ = BeforeSuite(suite.BeforeSuite) 29 | 30 | var _ = AfterSuite(suite.AfterSuite) 31 | -------------------------------------------------------------------------------- /pkg/util/vsphere/client/client_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package client_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestClient(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "vSphere Client Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/util/vsphere/library/library_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package library_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestContentLibrary(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "ContentLibrary Test Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/util/vsphere/vm/guest_id.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package vm 6 | 7 | import ( 8 | "strings" 9 | 10 | vimtypes "github.com/vmware/govmomi/vim25/types" 11 | ) 12 | 13 | // GuestIDProperty is the property name for the guest ID in the config spec. 14 | const GuestIDProperty = "configSpec.guestId" 15 | 16 | // IsTaskInfoErrorInvalidGuestID returns true if the provided taskInfo contains 17 | // an error with a fault that indicates the underlying cause is an invalid guest 18 | // ID. 19 | func IsTaskInfoErrorInvalidGuestID(taskInfo *vimtypes.TaskInfo) bool { 20 | if taskInfo == nil { 21 | return false 22 | } 23 | if taskInfo.Error == nil { 24 | return false 25 | } 26 | if f, ok := taskInfo.Error.Fault.(*vimtypes.InvalidArgument); ok { 27 | return strings.Contains(f.InvalidProperty, GuestIDProperty) 28 | } 29 | return false 30 | } 31 | -------------------------------------------------------------------------------- /pkg/util/vsphere/vm/internal/power_state_context_keys.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package internal 6 | 7 | type powerStateContextKey uint8 8 | 9 | const ( 10 | // SoftTimeoutKey is the context key for the time.Duration value that may 11 | // be stored in the context. If this value is not present, then a default 12 | // timeout of five minutes is used. 13 | // Used for testing. 14 | SoftTimeoutKey powerStateContextKey = iota 15 | ) 16 | -------------------------------------------------------------------------------- /pkg/util/vsphere/vm/vm.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package vm 6 | 7 | import ( 8 | "github.com/vmware/govmomi/object" 9 | "github.com/vmware/govmomi/vim25/mo" 10 | vimtypes "github.com/vmware/govmomi/vim25/types" 11 | ) 12 | 13 | func ManagedObjectFromMoRef(moRef vimtypes.ManagedObjectReference) mo.VirtualMachine { 14 | return mo.VirtualMachine{ 15 | ManagedEntity: mo.ManagedEntity{ 16 | ExtensibleManagedObject: mo.ExtensibleManagedObject{ 17 | Self: moRef, 18 | }, 19 | }, 20 | } 21 | } 22 | 23 | func ManagedObjectFromObject(obj *object.VirtualMachine) mo.VirtualMachine { 24 | return ManagedObjectFromMoRef(obj.Reference()) 25 | } 26 | -------------------------------------------------------------------------------- /pkg/util/vsphere/vm/vm_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package vm_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels" 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | ) 15 | 16 | const doesNotExist = "does-not-exist" 17 | 18 | func vcSimTests() { 19 | Describe("Power State", Label(testlabels.VCSim), powerStateTests) 20 | Describe("Hardware Version", Label(testlabels.VCSim), hardwareVersionTests) 21 | Describe("Managed Object", managedObjectTests) 22 | Describe("Guest ID", guestIDTests) 23 | } 24 | 25 | var suite = builder.NewTestSuite() 26 | 27 | func TestVSphereVirtualMachine(t *testing.T) { 28 | suite.Register(t, "vSphere VirtualMachine Suite", nil, vcSimTests) 29 | } 30 | 31 | var _ = BeforeSuite(suite.BeforeSuite) 32 | 33 | var _ = AfterSuite(suite.AfterSuite) 34 | -------------------------------------------------------------------------------- /pkg/util/vsphere/watcher/watcher_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package watcher_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestWatcher(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "vSphere Watcher Suite") 17 | } 18 | -------------------------------------------------------------------------------- /pkg/vmconfig/crypto/crypto_reconciler_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package crypto_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | const fakeString = "fake" 18 | 19 | func init() { 20 | klog.SetOutput(GinkgoWriter) 21 | logf.SetLogger(klog.Background()) 22 | } 23 | 24 | func TestSuite(t *testing.T) { 25 | RegisterFailHandler(Fail) 26 | RunSpecs(t, "Crypto Reconciler Test Suite") 27 | } 28 | -------------------------------------------------------------------------------- /pkg/vmconfig/crypto/crypto_reconciler_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package crypto_test 6 | 7 | import ( 8 | . "github.com/onsi/ginkgo/v2" 9 | . "github.com/onsi/gomega" 10 | 11 | "github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels" 12 | "github.com/vmware-tanzu/vm-operator/pkg/vmconfig/crypto" 13 | ) 14 | 15 | var _ = Describe("New", Label(testlabels.Crypto), func() { 16 | It("should return a reconciler", func() { 17 | Expect(crypto.New()).ToNot(BeNil()) 18 | }) 19 | }) 20 | 21 | var _ = Describe("Name", Label(testlabels.Crypto), func() { 22 | It("should return crypto", func() { 23 | Expect(crypto.New().Name()).To(Equal("crypto")) 24 | }) 25 | }) 26 | -------------------------------------------------------------------------------- /pkg/vmconfig/crypto/internal/crypto_reconciler_context.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package internal 6 | 7 | import ( 8 | "context" 9 | 10 | ctxgen "github.com/vmware-tanzu/vm-operator/pkg/context/generic" 11 | ) 12 | 13 | type ContextKeyType uint8 14 | 15 | const ContextKeyValue ContextKeyType = 0 16 | 17 | type State struct { 18 | Operation string 19 | } 20 | 21 | func FromContext(ctx context.Context) State { 22 | return ctxgen.FromContext( 23 | ctx, 24 | ContextKeyValue, 25 | func(val State) State { 26 | return val 27 | }) 28 | } 29 | 30 | func SetOperation(ctx context.Context, op string) { 31 | ctxgen.SetContext( 32 | ctx, 33 | ContextKeyValue, 34 | func(val State) State { 35 | val.Operation = op 36 | return val 37 | }) 38 | } 39 | -------------------------------------------------------------------------------- /pkg/vmconfig/diskpromo/diskpromo_reconciler_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package diskpromo_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | func init() { 18 | klog.SetOutput(GinkgoWriter) 19 | logf.SetLogger(klog.Background()) 20 | } 21 | 22 | func TestSuite(t *testing.T) { 23 | RegisterFailHandler(Fail) 24 | RunSpecs(t, "DiskPromo Reconciler Test Suite") 25 | } 26 | -------------------------------------------------------------------------------- /pkg/vmconfig/vmconfig_reconciler_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package vmconfig_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | 13 | "k8s.io/klog/v2" 14 | logf "sigs.k8s.io/controller-runtime/pkg/log" 15 | ) 16 | 17 | func init() { 18 | klog.SetOutput(GinkgoWriter) 19 | logf.SetLogger(klog.Background()) 20 | } 21 | 22 | func TestSuite(t *testing.T) { 23 | RegisterFailHandler(Fail) 24 | RunSpecs(t, "Reconfig Reconciler Test Suite") 25 | } 26 | -------------------------------------------------------------------------------- /pkg/vmoperator.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package pkg 6 | 7 | const ( 8 | // VMOperatorKey is the base FQDN for VM operator. 9 | VMOperatorKey string = "vmoperator.vmware.com" 10 | ) 11 | -------------------------------------------------------------------------------- /pkg/webconsolevalidation/server_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package webconsolevalidation_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/test/builder" 13 | ) 14 | 15 | var suite = builder.NewTestSuite() 16 | 17 | var _ = BeforeSuite(suite.BeforeSuite) 18 | 19 | var _ = AfterSuite(suite.AfterSuite) 20 | 21 | func TestWebConsoleValidationServer(t *testing.T) { 22 | suite.Register(t, "web-console validation server test suite", nil, serverUnitTests) 23 | } 24 | -------------------------------------------------------------------------------- /services/services.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package services 6 | 7 | import ( 8 | "sigs.k8s.io/controller-runtime/pkg/manager" 9 | 10 | pkgcfg "github.com/vmware-tanzu/vm-operator/pkg/config" 11 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 12 | vmwatcher "github.com/vmware-tanzu/vm-operator/services/vm-watcher" 13 | ) 14 | 15 | // AddToManager adds all services to the provided manager. 16 | func AddToManager( 17 | ctx *pkgctx.ControllerManagerContext, 18 | mgr manager.Manager) error { 19 | 20 | if pkgcfg.FromContext(ctx).AsyncSignalEnabled { 21 | if err := vmwatcher.AddToManager(ctx, mgr); err != nil { 22 | return err 23 | } 24 | } 25 | 26 | return nil 27 | } 28 | -------------------------------------------------------------------------------- /services/vm-watcher/vm_watcher_service_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package vmwatcher_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestVMWatcherService(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "VM Watcher Service Test Suite") 17 | } 18 | -------------------------------------------------------------------------------- /test/builder/flags.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package builder 6 | 7 | import ( 8 | "flag" 9 | ) 10 | 11 | // testFlags contains the configurations we'd like to get from the command line, 12 | // that could be used to tune tests behavior. 13 | type testFlags struct { 14 | // rootDir is the root directory of the checked-out project and is set with 15 | // the -root-dir flag. 16 | // Defaults to ../../ 17 | RootDir string 18 | } 19 | 20 | var ( 21 | flags testFlags 22 | ) 23 | 24 | func init() { 25 | flags = testFlags{} 26 | 27 | // We still need to add the flags to the default flagset, because otherwise 28 | // Ginkgo will complain that the flags are not recognized. 29 | flag.StringVar(&flags.RootDir, "root-dir", "../..", "Root project directory") 30 | } 31 | -------------------------------------------------------------------------------- /test/builder/testdata/images/ttylinux-pc_i486-16.1-2.nvram: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vmware-tanzu/vm-operator/213b585390c276d742ff7817d4dee745152650d4/test/builder/testdata/images/ttylinux-pc_i486-16.1-2.nvram -------------------------------------------------------------------------------- /test/builder/testdata/images/ttylinux-pc_i486-16.1-disk1.vmdk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vmware-tanzu/vm-operator/213b585390c276d742ff7817d4dee745152650d4/test/builder/testdata/images/ttylinux-pc_i486-16.1-disk1.vmdk -------------------------------------------------------------------------------- /test/builder/testdata/images/ttylinux-pc_i486-16.1.iso: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vmware-tanzu/vm-operator/213b585390c276d742ff7817d4dee745152650d4/test/builder/testdata/images/ttylinux-pc_i486-16.1.iso -------------------------------------------------------------------------------- /test/builder/testdata/images/ttylinux-pc_i486-16.1.mf: -------------------------------------------------------------------------------- 1 | SHA1 (ttylinux-pc_i486-16.1.ovf) = 87271da9a5ae979f29e0ce7be824df428c178914 2 | SHA1 (ttylinux-pc_i486-16.1-disk1.vmdk) = ed64564a37366bfe1c93af80e2ead0cbd398c3d3 3 | SHA1 (ttylinux-pc_i486-16.1-2.nvram) = 701e98837a28018430889f021571d171ba2252c4 4 | -------------------------------------------------------------------------------- /test/builder/testdata/images/ttylinux-pc_i486-16.1.ova: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vmware-tanzu/vm-operator/213b585390c276d742ff7817d4dee745152650d4/test/builder/testdata/images/ttylinux-pc_i486-16.1.ova -------------------------------------------------------------------------------- /webhooks/common/common_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package common 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | . "github.com/onsi/gomega" 12 | ) 13 | 14 | func TestLib(t *testing.T) { 15 | RegisterFailHandler(Fail) 16 | RunSpecs(t, "Webhook Common Suite") 17 | } 18 | -------------------------------------------------------------------------------- /webhooks/persistentvolumeclaim/validation/persistentvolumeclaim_validator_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package validation_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/test/builder" 13 | "github.com/vmware-tanzu/vm-operator/webhooks/persistentvolumeclaim/validation" 14 | ) 15 | 16 | // suite is used for unit and integration testing this webhook. 17 | var suite = builder.NewTestSuiteForValidatingWebhook( 18 | validation.AddToManager, 19 | validation.NewValidator, 20 | "default.validating.persistentvolumeclaim.vmoperator.vmware.com") 21 | 22 | func TestWebhook(t *testing.T) { 23 | suite.Register(t, "Validation webhook suite", intgTests, unitTests) 24 | } 25 | 26 | var _ = BeforeSuite(suite.BeforeSuite) 27 | 28 | var _ = AfterSuite(suite.AfterSuite) 29 | -------------------------------------------------------------------------------- /webhooks/persistentvolumeclaim/webhook.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package persistentvolumeclaim 6 | 7 | import ( 8 | "fmt" 9 | 10 | ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager" 11 | 12 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 13 | "github.com/vmware-tanzu/vm-operator/webhooks/persistentvolumeclaim/validation" 14 | ) 15 | 16 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr ctrlmgr.Manager) error { 17 | if err := validation.AddToManager(ctx, mgr); err != nil { 18 | return fmt.Errorf("failed to initialize validation webhook: %w", err) 19 | } 20 | return nil 21 | } 22 | -------------------------------------------------------------------------------- /webhooks/unifiedstoragequota/validation/unifiedstoragequota_validator_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package validation_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | pkgcfg "github.com/vmware-tanzu/vm-operator/pkg/config" 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | 15 | "github.com/vmware-tanzu/vm-operator/webhooks/unifiedstoragequota/validation" 16 | ) 17 | 18 | // suite is used for unit and integration testing this webhook. 19 | var suite = builder.NewTestSuiteForValidatingWebhookWithContext( 20 | pkgcfg.NewContext(), 21 | validation.AddToManager, 22 | nil, 23 | "vmservice.cns.vsphere.vmware.com") 24 | 25 | func TestWebhook(t *testing.T) { 26 | suite.Register(t, "Validation webhook suite", intgTests, unitTests) 27 | } 28 | 29 | var _ = BeforeSuite(suite.BeforeSuite) 30 | 31 | var _ = AfterSuite(suite.AfterSuite) 32 | -------------------------------------------------------------------------------- /webhooks/unifiedstoragequota/webhooks.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package unifiedstoragequota 6 | 7 | import ( 8 | ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager" 9 | 10 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 11 | "github.com/vmware-tanzu/vm-operator/webhooks/unifiedstoragequota/validation" 12 | ) 13 | 14 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr ctrlmgr.Manager) error { 15 | return validation.AddToManager(ctx, mgr) 16 | } 17 | -------------------------------------------------------------------------------- /webhooks/virtualmachine/validation/virtualmachine_validator_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package validation_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | pkgcfg "github.com/vmware-tanzu/vm-operator/pkg/config" 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/validation" 15 | ) 16 | 17 | // suite is used for unit and integration testing this webhook. 18 | var suite = builder.NewTestSuiteForValidatingWebhookWithContext( 19 | pkgcfg.NewContext(), 20 | validation.AddToManager, 21 | validation.NewValidator, 22 | "default.validating.virtualmachine.v1alpha4.vmoperator.vmware.com") 23 | 24 | func TestWebhook(t *testing.T) { 25 | suite.Register(t, "Validation webhook suite", intgTests, unitTests) 26 | } 27 | 28 | var _ = BeforeSuite(suite.BeforeSuite) 29 | 30 | var _ = AfterSuite(suite.AfterSuite) 31 | -------------------------------------------------------------------------------- /webhooks/virtualmachine/webhooks.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachine 6 | 7 | import ( 8 | ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager" 9 | 10 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 11 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/mutation" 12 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/validation" 13 | ) 14 | 15 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr ctrlmgr.Manager) error { 16 | if err := mutation.AddToManager(ctx, mgr); err != nil { 17 | return err 18 | } 19 | return validation.AddToManager(ctx, mgr) 20 | } 21 | -------------------------------------------------------------------------------- /webhooks/virtualmachineclass/mutation/virtualmachineclass_mutator_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package mutation_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | pkgcfg "github.com/vmware-tanzu/vm-operator/pkg/config" 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/mutation" 15 | ) 16 | 17 | // suite is used for unit and integration testing this webhook. 18 | var suite = builder.NewTestSuiteForMutatingWebhookWithContext( 19 | pkgcfg.NewContext(), 20 | mutation.AddToManager, 21 | mutation.NewMutator, 22 | "default.mutating.virtualmachineclass.v1alpha4.vmoperator.vmware.com") 23 | 24 | func TestWebhook(t *testing.T) { 25 | suite.Register(t, "Mutating webhook suite", intgTests, uniTests) 26 | } 27 | 28 | var _ = BeforeSuite(suite.BeforeSuite) 29 | 30 | var _ = AfterSuite(suite.AfterSuite) 31 | -------------------------------------------------------------------------------- /webhooks/virtualmachineclass/webhooks.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachineclass 6 | 7 | import ( 8 | ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager" 9 | 10 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 11 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/mutation" 12 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/validation" 13 | ) 14 | 15 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr ctrlmgr.Manager) error { 16 | if err := mutation.AddToManager(ctx, mgr); err != nil { 17 | return err 18 | } 19 | return validation.AddToManager(ctx, mgr) 20 | } 21 | -------------------------------------------------------------------------------- /webhooks/virtualmachinepublishrequest/webhooks.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachinepublishrequest 6 | 7 | import ( 8 | ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager" 9 | 10 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 11 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinepublishrequest/validation" 12 | ) 13 | 14 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr ctrlmgr.Manager) error { 15 | return validation.AddToManager(ctx, mgr) 16 | } 17 | -------------------------------------------------------------------------------- /webhooks/virtualmachinereplicaset/webhooks.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachinereplicaset 6 | 7 | import ( 8 | ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager" 9 | 10 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 11 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinereplicaset/mutation" 12 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinereplicaset/validation" 13 | ) 14 | 15 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr ctrlmgr.Manager) error { 16 | if err := mutation.AddToManager(ctx, mgr); err != nil { 17 | return err 18 | } 19 | 20 | return validation.AddToManager(ctx, mgr) 21 | } 22 | -------------------------------------------------------------------------------- /webhooks/virtualmachineservice/mutation/virtualmachineservice_mutator_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package mutation_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | pkgcfg "github.com/vmware-tanzu/vm-operator/pkg/config" 13 | "github.com/vmware-tanzu/vm-operator/test/builder" 14 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/mutation" 15 | ) 16 | 17 | // suite is used for unit and integration testing this webhook. 18 | var suite = builder.NewTestSuiteForMutatingWebhookWithContext( 19 | pkgcfg.NewContext(), 20 | mutation.AddToManager, 21 | mutation.NewMutator, 22 | "default.mutating.virtualmachineservice.v1alpha4.vmoperator.vmware.com") 23 | 24 | func TestWebhook(t *testing.T) { 25 | suite.Register(t, "Mutating webhook suite", intgTests, uniTests) 26 | } 27 | 28 | var _ = BeforeSuite(suite.BeforeSuite) 29 | 30 | var _ = AfterSuite(suite.AfterSuite) 31 | -------------------------------------------------------------------------------- /webhooks/virtualmachineservice/webhooks.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachineservice 6 | 7 | import ( 8 | ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager" 9 | 10 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 11 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/mutation" 12 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/validation" 13 | ) 14 | 15 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr ctrlmgr.Manager) error { 16 | if err := mutation.AddToManager(ctx, mgr); err != nil { 17 | return err 18 | } 19 | return validation.AddToManager(ctx, mgr) 20 | } 21 | -------------------------------------------------------------------------------- /webhooks/virtualmachinesetresourcepolicy/webhooks.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachinesetresourcepolicy 6 | 7 | import ( 8 | ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager" 9 | 10 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 11 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinesetresourcepolicy/validation" 12 | ) 13 | 14 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr ctrlmgr.Manager) error { 15 | return validation.AddToManager(ctx, mgr) 16 | } 17 | -------------------------------------------------------------------------------- /webhooks/virtualmachinewebconsolerequest/v1alpha1/validation/webconsolerequest_validator_suite_test.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package validation_test 6 | 7 | import ( 8 | "testing" 9 | 10 | . "github.com/onsi/ginkgo/v2" 11 | 12 | "github.com/vmware-tanzu/vm-operator/test/builder" 13 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/v1alpha1/validation" 14 | ) 15 | 16 | // suite is used for unit and integration testing this webhook. 17 | var suite = builder.NewTestSuiteForValidatingWebhook( 18 | validation.AddToManager, 19 | validation.NewValidator, 20 | "default.validating.webconsolerequest.v1alpha1.vmoperator.vmware.com") 21 | 22 | func TestWebhook(t *testing.T) { 23 | suite.Register(t, "Validation webhook suite", intgTests, unitTests) 24 | } 25 | 26 | var _ = BeforeSuite(suite.BeforeSuite) 27 | 28 | var _ = AfterSuite(suite.AfterSuite) 29 | -------------------------------------------------------------------------------- /webhooks/virtualmachinewebconsolerequest/v1alpha1/webhooks.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package v1alpha1 6 | 7 | import ( 8 | "fmt" 9 | 10 | ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager" 11 | 12 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 13 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/v1alpha1/validation" 14 | ) 15 | 16 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr ctrlmgr.Manager) error { 17 | if err := validation.AddToManager(ctx, mgr); err != nil { 18 | return fmt.Errorf("failed to initialize validation webhook: %w", err) 19 | } 20 | return nil 21 | } 22 | -------------------------------------------------------------------------------- /webhooks/virtualmachinewebconsolerequest/webhooks.go: -------------------------------------------------------------------------------- 1 | // © Broadcom. All Rights Reserved. 2 | // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | package virtualmachinewebconsolerequest 6 | 7 | import ( 8 | ctrlmgr "sigs.k8s.io/controller-runtime/pkg/manager" 9 | 10 | pkgctx "github.com/vmware-tanzu/vm-operator/pkg/context" 11 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/v1alpha1" 12 | "github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/validation" 13 | ) 14 | 15 | func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr ctrlmgr.Manager) error { 16 | if err := validation.AddToManager(ctx, mgr); err != nil { 17 | return err 18 | } 19 | // NOTE: In v1a1 this CRD has a different name - WebConsoleRequest - so this is 20 | // still required until we stop supporting v1a1. 21 | return v1alpha1.AddToManager(ctx, mgr) 22 | } 23 | --------------------------------------------------------------------------------