Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions e2e/node_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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),
Expand Down
11 changes: 1 addition & 10 deletions pkg/agent/bakerapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
22 changes: 0 additions & 22 deletions pkg/agent/bakerapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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()
Expand Down
15 changes: 3 additions & 12 deletions pkg/agent/datamodel/azenvtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Comment on lines 6 to 11

// KubernetesSpecConfig is the kubernetes container images used.
Expand Down Expand Up @@ -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"`
}
1 change: 0 additions & 1 deletion pkg/agent/datamodel/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,6 @@ const (
type NodeBootstrapping struct {
CustomData string
CSE string
OSImageConfig *AzureOSImageConfig
SigImageConfig *SigImageConfig
}

Expand Down
Loading