Skip to content

Commit

Permalink
feat: add ISO support in supervisor builder
Browse files Browse the repository at this point in the history
  • Loading branch information
dilyar85 committed Dec 18, 2024
1 parent 05133be commit 5cec440
Show file tree
Hide file tree
Showing 20 changed files with 973 additions and 694 deletions.
14 changes: 8 additions & 6 deletions .web-docs/components/builder/vsphere-supervisor/README.md
Original file line number Diff line number Diff line change
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`.

- `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.
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.
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

0 comments on commit 5cec440

Please sign in to comment.