diff --git a/e2e/node_config.go b/e2e/node_config.go index 2f6f38b150b..38874a389f6 100644 --- a/e2e/node_config.go +++ b/e2e/node_config.go @@ -603,7 +603,6 @@ func baseTemplateLinux(t testing.TB, location string, k8sVersion string, arch st EndpointConfig: datamodel.AzureEndpointConfig{ ResourceManagerVMDNSSuffix: "cloudapp.azure.com", }, - OSImageConfig: map[datamodel.Distro]datamodel.AzureOSImageConfig(nil), }, K8sComponents: &datamodel.K8sComponents{ PodInfraContainerImageURL: "mcr.microsoft.com/oss/v2/kubernetes/pause:3.6", @@ -922,7 +921,6 @@ DXRqvV7TWO2hndliQq3BW385ZkiephlrmpUVM= r2k1@arturs-mbp.lan`, EndpointConfig: datamodel.AzureEndpointConfig{ ResourceManagerVMDNSSuffix: "cloudapp.azure.com", }, - OSImageConfig: map[datamodel.Distro]datamodel.AzureOSImageConfig(nil), }, K8sComponents: &datamodel.K8sComponents{ WindowsPackageURL: fmt.Sprintf("https://packages.aks.azure.com/kubernetes/v%s/windowszip/v%s-1int.zip", kubernetesVersion, kubernetesVersion), diff --git a/pkg/agent/bakerapi.go b/pkg/agent/bakerapi.go index ec8bbd5cc70..51e94f6d988 100644 --- a/pkg/agent/bakerapi.go +++ b/pkg/agent/bakerapi.go @@ -58,22 +58,13 @@ func (agentBaker *agentBakerImpl) GetNodeBootstrapping(ctx context.Context, conf return nodeBootstrapping, nil } - osImageConfigMap, hasCloud := datamodel.AzureCloudToOSImageMap[config.CloudSpecConfig.CloudName] - if !hasCloud { - return nil, fmt.Errorf("don't have settings for cloud %s", config.CloudSpecConfig.CloudName) - } - - if osImageConfig, hasImage := osImageConfigMap[distro]; hasImage { - nodeBootstrapping.OSImageConfig = &osImageConfig - } - sigAzureEnvironmentSpecConfig, err := datamodel.GetSIGAzureCloudSpecConfig(config.SIGConfig, config.ContainerService.Location) if err != nil { return nil, err } nodeBootstrapping.SigImageConfig = findSIGImageConfig(sigAzureEnvironmentSpecConfig, distro) - if nodeBootstrapping.SigImageConfig == nil && nodeBootstrapping.OSImageConfig == nil { + if nodeBootstrapping.SigImageConfig == nil { return nil, fmt.Errorf("can't find image for distro %s", distro) } diff --git a/pkg/agent/bakerapi_test.go b/pkg/agent/bakerapi_test.go index b7a13cc306a..a0ff9598e8b 100644 --- a/pkg/agent/bakerapi_test.go +++ b/pkg/agent/bakerapi_test.go @@ -5,7 +5,6 @@ import ( "github.com/Azure/agentbaker/pkg/agent/datamodel" agenttoggles "github.com/Azure/agentbaker/pkg/agent/toggles" - "github.com/barkimedes/go-deepcopy" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -169,11 +168,6 @@ var _ = Describe("AgentBaker API implementation tests", func() { Expect(nodeBootStrapping.CustomData).NotTo(Equal("")) Expect(nodeBootStrapping.CSE).NotTo(Equal("")) - Expect(nodeBootStrapping.OSImageConfig.ImageOffer).To(Equal("aks")) - Expect(nodeBootStrapping.OSImageConfig.ImageSku).To(Equal("aks-ubuntu-containerd-22.04-gen2")) - Expect(nodeBootStrapping.OSImageConfig.ImagePublisher).To(Equal("microsoft-aks")) - Expect(nodeBootStrapping.OSImageConfig.ImageVersion).To(Equal("2025.06.02")) - Expect(nodeBootStrapping.SigImageConfig.ResourceGroup).To(Equal("resourcegroup")) Expect(nodeBootStrapping.SigImageConfig.Gallery).To(Equal("aksubuntu")) Expect(nodeBootStrapping.SigImageConfig.Definition).To(Equal("2204gen2containerd")) @@ -202,22 +196,6 @@ var _ = Describe("AgentBaker API implementation tests", func() { Expect(nodeBootStrapping.SigImageConfig.Version).To(Equal(nodeImageVersionOverride)) }) - It("should return an error if cloud is not found", func() { - // this CloudSpecConfig is shared across all AgentBaker UTs, - // thus we need to make and use a copy when performing mutations for mocking - cloudSpecConfigCopy, err := deepcopy.Anything(config.CloudSpecConfig) - Expect(err).To(BeNil()) - cloudSpecConfig, ok := cloudSpecConfigCopy.(*datamodel.AzureEnvironmentSpecConfig) - Expect(ok).To(BeTrue()) - config.CloudSpecConfig = cloudSpecConfig - - config.CloudSpecConfig.CloudName = "UnknownCloud" - agentBaker, err := NewAgentBaker() - Expect(err).NotTo(HaveOccurred()) - _, err = agentBaker.GetNodeBootstrapping(context.Background(), config) - Expect(err).To(HaveOccurred()) - }) - It("should return an error if distro is neither found in PIR nor found in SIG", func() { config.AgentPoolProfile.Distro = "unknown" agentBaker, err := NewAgentBaker() diff --git a/pkg/agent/datamodel/azenvtypes.go b/pkg/agent/datamodel/azenvtypes.go index 597071a336f..8fb02142136 100644 --- a/pkg/agent/datamodel/azenvtypes.go +++ b/pkg/agent/datamodel/azenvtypes.go @@ -5,10 +5,9 @@ package datamodel // AzureEnvironmentSpecConfig is the overall configuration differences in different cloud environments. type AzureEnvironmentSpecConfig struct { - CloudName string `json:"cloudName,omitempty"` - KubernetesSpecConfig KubernetesSpecConfig `json:"kubernetesSpecConfig,omitempty"` - EndpointConfig AzureEndpointConfig `json:"endpointConfig,omitempty"` - OSImageConfig map[Distro]AzureOSImageConfig `json:"osImageConfig,omitempty"` + CloudName string `json:"cloudName,omitempty"` + KubernetesSpecConfig KubernetesSpecConfig `json:"kubernetesSpecConfig,omitempty"` + EndpointConfig AzureEndpointConfig `json:"endpointConfig,omitempty"` } // KubernetesSpecConfig is the kubernetes container images used. @@ -42,11 +41,3 @@ type KubernetesSpecConfig struct { type AzureEndpointConfig struct { ResourceManagerVMDNSSuffix string `json:"resourceManagerVMDNSSuffix,omitempty"` } - -// AzureOSImageConfig describes an Azure OS image. -type AzureOSImageConfig struct { - ImageOffer string `json:"imageOffer,omitempty"` - ImageSku string `json:"imageSku,omitempty"` - ImagePublisher string `json:"imagePublisher,omitempty"` - ImageVersion string `json:"imageVersion,omitempty"` -} diff --git a/pkg/agent/datamodel/types.go b/pkg/agent/datamodel/types.go index 7baac10552a..ccbbe5438a5 100644 --- a/pkg/agent/datamodel/types.go +++ b/pkg/agent/datamodel/types.go @@ -1835,7 +1835,6 @@ const ( type NodeBootstrapping struct { CustomData string CSE string - OSImageConfig *AzureOSImageConfig SigImageConfig *SigImageConfig }