From 6ed4bcb12b20b4a9fe1c12195caf323cd74aea7c Mon Sep 17 00:00:00 2001 From: Yanhua Li Date: Tue, 5 Nov 2024 00:18:22 -0500 Subject: [PATCH] OCPSTRAT-367: Support Nutanix in agent-based installer --- pkg/asset/agent/common.go | 4 +++- pkg/asset/agent/installconfig.go | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/pkg/asset/agent/common.go b/pkg/asset/agent/common.go index 80315e2a9f6..0b33102d2ee 100644 --- a/pkg/asset/agent/common.go +++ b/pkg/asset/agent/common.go @@ -9,6 +9,7 @@ import ( "github.com/openshift/installer/pkg/types/baremetal" "github.com/openshift/installer/pkg/types/external" "github.com/openshift/installer/pkg/types/none" + "github.com/openshift/installer/pkg/types/nutanix" "github.com/openshift/installer/pkg/types/vsphere" ) @@ -19,12 +20,13 @@ const ( // SupportedInstallerPlatforms lists the supported platforms for agent installer. func SupportedInstallerPlatforms() []string { - return []string{baremetal.Name, vsphere.Name, none.Name, external.Name} + return []string{baremetal.Name, vsphere.Name, nutanix.Name, none.Name, external.Name} } var supportedHivePlatforms = []hiveext.PlatformType{ hiveext.BareMetalPlatformType, hiveext.VSpherePlatformType, + hiveext.NutanixPlatformType, hiveext.NonePlatformType, hiveext.ExternalPlatformType, } diff --git a/pkg/asset/agent/installconfig.go b/pkg/asset/agent/installconfig.go index daef6b824af..d126ad91337 100644 --- a/pkg/asset/agent/installconfig.go +++ b/pkg/asset/agent/installconfig.go @@ -19,6 +19,8 @@ import ( baremetalvalidation "github.com/openshift/installer/pkg/types/baremetal/validation" "github.com/openshift/installer/pkg/types/external" "github.com/openshift/installer/pkg/types/none" + "github.com/openshift/installer/pkg/types/nutanix" + nutanixvalidation "github.com/openshift/installer/pkg/types/nutanix/validation" "github.com/openshift/installer/pkg/types/validation" "github.com/openshift/installer/pkg/types/vsphere" ) @@ -149,6 +151,11 @@ func (a *OptionalInstallConfig) validatePlatformsByName(installConfig *types.Ins allErrs = append(allErrs, a.validateBMCConfig(installConfig)...) } + if installConfig.Platform.Name() == nutanix.Name { + errList := nutanixvalidation.ValidatePlatform(installConfig.Platform.Nutanix, field.NewPath("platform", "nutanix"), installConfig) + allErrs = append(allErrs, errList...) + } + return allErrs } @@ -462,7 +469,23 @@ func warnUnusedConfig(installConfig *types.InstallConfig) { fieldPath := field.NewPath("Platform", "VSphere", "Hosts") logrus.Warnf(fmt.Sprintf("%s: %v is ignored", fieldPath, vspherePlatform.Hosts)) } + case nutanix.Name: + nutanixPlatform := installConfig.Platform.Nutanix + + if nutanixPlatform.ClusterOSImage != "" { + fieldPath := field.NewPath("Platform", "Nutanix", "ClusterOSImage") + logrus.Warnf(fmt.Sprintf("%s: %s is ignored", fieldPath, nutanixPlatform.ClusterOSImage)) + } + if nutanixPlatform.DefaultMachinePlatform != nil && !reflect.DeepEqual(*nutanixPlatform.DefaultMachinePlatform, nutanix.MachinePool{}) { + fieldPath := field.NewPath("Platform", "Nutanix", "DefaultMachinePlatform") + logrus.Warnf(fmt.Sprintf("%s: %v is ignored", fieldPath, nutanixPlatform.DefaultMachinePlatform)) + } + if nutanixPlatform.LoadBalancer != nil && !reflect.DeepEqual(*nutanixPlatform.LoadBalancer, configv1.NutanixPlatformLoadBalancer{}) { + fieldPath := field.NewPath("Platform", "Nutanix", "LoadBalancer") + logrus.Warnf(fmt.Sprintf("%s: %v is ignored", fieldPath, nutanixPlatform.LoadBalancer)) + } } + // "External" is the default set from generic install config code if installConfig.Publish != "External" { fieldPath := field.NewPath("Publish")