Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ISO support in supervisor builder #501

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .web-docs/components/builder/vsphere-supervisor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ for more information on the VM Service functionality in vSphere with Tanzu.
- It uses a `kubeconfig` file to connect to the vSphere Supervisor cluster.
- It uses the [VM-Operator API](https://vm-operator.readthedocs.io/en/latest/concepts/) to deploy
and configure the source virtual machine.
- It cna use Packer provisioners to customize the virtual machine after establishing a successful
- It can use Packer provisioners to customize the virtual machine after establishing a successful
connection.
- It publishes the customized virtual machine as a new virtual machine image to the designated
content library in vSphere.
Expand Down Expand Up @@ -144,7 +144,7 @@ items are listed below as well as the _optional_ configurations.
- `import_target_location_name` (string) - Name of a writable and import-allowed ContentLibrary resource in the namespace where the image will be imported.

- `import_target_image_type` (string) - The type of imported image.
Defaults to `ovf`. Available options include `ovf`.
Defaults to suffix of the source URL. Available options include `ovf` and `iso`.
dilyar85 marked this conversation as resolved.
Show resolved Hide resolved

- `import_target_image_name` (string) - Name of the imported image.
Defaults to the file name of the image referenced in the source URL.
Expand Down Expand Up @@ -173,10 +173,6 @@ items are listed below as well as the _optional_ configurations.

- `source_name` (string) - Name of the source VM. Limited to 15 characters. Defaults to `source-<random-5-digit-suffix>`.

- `network_type` (string) - Name of the network type to attach to the source VM's network interface. Defaults to empty.

- `network_name` (string) - Name of the network to attach to the source VM's network interface. Defaults to empty.

- `keep_input_artifact` (bool) - Preserve all the created objects in Supervisor cluster after the build finishes. Defaults to `false`.

- `bootstrap_provider` (string) - Name of the bootstrap provider to use for configuring the source VM.
Expand All @@ -185,6 +181,12 @@ items are listed below as well as the _optional_ configurations.
- `bootstrap_data_file` (string) - Path to a file with bootstrap configuration data. Required if `bootstrap_provider` is not set to `CloudInit`.
Defaults to a basic cloud config that sets up the user account from the SSH communicator config.

- `guest_id` (string) - Name of the desired guest operating system identifier for source VM.
dilyar85 marked this conversation as resolved.
Show resolved Hide resolved
Defaults to `otherGuest`.

- `iso_boot_disk_size` (string) - Size of the PVC that will be used as the boot disk when deploying an ISO VM.
dilyar85 marked this conversation as resolved.
Show resolved Hide resolved
Defaults to `20Gi`.

<!-- End of code generated from the comments of the CreateSourceConfig struct in builder/vsphere/supervisor/step_create_source.go; -->


Expand All @@ -194,7 +196,7 @@ items are listed below as well as the _optional_ configurations.

<!-- Code generated from the comments of the WatchSourceConfig struct in builder/vsphere/supervisor/step_watch_source.go; DO NOT EDIT MANUALLY -->

- `watch_source_timeout_sec` (int) - The timeout in seconds to wait for the source VM to be ready. Defaults to `1800`.
- `watch_source_timeout_sec` (int) - The timeout in seconds to wait for the source VM to be ready. Defaults to `3600`.

<!-- End of code generated from the comments of the WatchSourceConfig struct in builder/vsphere/supervisor/step_watch_source.go; -->

Expand Down
8 changes: 4 additions & 4 deletions builder/vsphere/supervisor/config.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions builder/vsphere/supervisor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,6 @@ func TestConfig_Values(t *testing.T) {
t.Errorf("unexpected result: expected '%s' for 'source_name', but returned '%s'",
providedConfigs["source_name"], c.SourceName)
}
if c.NetworkType != providedConfigs["network_type"] {
t.Errorf("unexpected result: expected '%s' for 'network_name', but returned '%s'",
providedConfigs["network_type"], c.NetworkType)
}
if c.NetworkName != providedConfigs["network_name"] {
t.Errorf("unexpected result: expected '%s' for 'network_name', but returned '%s'",
providedConfigs["network_name"], c.NetworkName)
}
if c.WatchSourceTimeoutSec != providedConfigs["watch_source_timeout_sec"] {
t.Errorf("unexpected result: expected '%d' for 'watch_publish_timeout_sec', but returned '%d'",
providedConfigs["watch_source_timeout_sec"], c.WatchSourceTimeoutSec)
Expand Down Expand Up @@ -131,8 +123,6 @@ func getCompleteConfig(t *testing.T) map[string]interface{} {
"storage_class": "test-storage",
"supervisor_namespace": "test-namespace",
"source_name": "test-source",
"network_type": "test-networkType",
"network_name": "test-networkName",
"publish_location_name": "test-publish-location",
"publish_image_name": "test-publish-image",
"watch_source_timeout_sec": 60,
Expand Down
4 changes: 2 additions & 2 deletions builder/vsphere/supervisor/step_connect_supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/hashicorp/packer-plugin-sdk/multistep"
"github.com/pkg/errors"
imgregv1alpha1 "github.com/vmware-tanzu/image-registry-operator-api/api/v1alpha1"
vmopv1alpha1 "github.com/vmware-tanzu/vm-operator/api/v1alpha1"
vmopv1 "github.com/vmware-tanzu/vm-operator/api/v1alpha3"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/clientcmd"
Expand Down Expand Up @@ -101,7 +101,7 @@ var InitKubeClientFunc = func(s *StepConnectSupervisor) (client.WithWatch, error
// The Supervisor builder will interact with both vmoperator, corev1, and image-registry-operator resources.
scheme := runtime.NewScheme()
_ = corev1.AddToScheme(scheme)
_ = vmopv1alpha1.AddToScheme(scheme)
_ = vmopv1.AddToScheme(scheme)
_ = imgregv1alpha1.AddToScheme(scheme)

// Initialize a WithWatch client as we need to watch the status of the source VM.
Expand Down
Loading
Loading