Skip to content

Commit

Permalink
feat: add new GetMaintainedLinuxSIGImageConfigMap API (#5604)
Browse files Browse the repository at this point in the history
Co-authored-by: Cameron Meissner <[email protected]>
  • Loading branch information
cameronmeissner and Cameron Meissner authored Feb 7, 2025
1 parent ce97a62 commit da10daa
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pkg/agent/datamodel/sig_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,30 @@ var (
}
)

// GetMaintainedLinuxSIGImageConfigMap returns a set of Distro -> SigImageConfig mappings
// for ALL Linux distros that are currently built and maintained by AKS Node SIG (Version == LinuxSIGImageVersion).
// Note that each distro's SigImageConfig SubscriptionID field will be empty.
// This can be used downstream to make sure that all expected images have been properly replicated.
func GetMaintainedLinuxSIGImageConfigMap() map[Distro]SigImageConfig {
// no opts means subscriptionID will be empty in the corresponding image configs
imageConfigMaps := []map[Distro]SigImageConfig{
getSigUbuntuImageConfigMapWithOpts(),
getSigCBLMarinerImageConfigMapWithOpts(),
getSigAzureLinuxImageConfigMapWithOpts(),
}

maintained := map[Distro]SigImageConfig{}
for _, m := range imageConfigMaps {
for distro, config := range m {
if config.Version == LinuxSIGImageVersion {
maintained[distro] = config
}
}
}

return maintained
}

func getSigUbuntuImageConfigMapWithOpts(opts ...SigImageConfigOpt) map[Distro]SigImageConfig {
return map[Distro]SigImageConfig{
AKSUbuntu1604: SIGUbuntu1604ImageConfigTemplate.WithOptions(opts...),
Expand Down
42 changes: 42 additions & 0 deletions pkg/agent/datamodel/sig_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,48 @@ import (
. "github.com/onsi/gomega"
)

var _ = Describe("GetMaintainedLinuxSIGImageConfigMap", func() {
It("should return the correct value", func() {
expected := map[Distro]SigImageConfig{
AKSUbuntuContainerd1804: SIGUbuntuContainerd1804ImageConfigTemplate.WithOptions(),
AKSUbuntuContainerd1804Gen2: SIGUbuntuContainerd1804Gen2ImageConfigTemplate.WithOptions(),
AKSUbuntuFipsContainerd1804: SIGUbuntuFipsContainerd1804ImageConfigTemplate.WithOptions(),
AKSUbuntuFipsContainerd1804Gen2: SIGUbuntuFipsContainerd1804Gen2ImageConfigTemplate.WithOptions(),
AKSUbuntuFipsContainerd2004: SIGUbuntuFipsContainerd2004ImageConfigTemplate.WithOptions(),
AKSUbuntuFipsContainerd2004Gen2: SIGUbuntuFipsContainerd2004Gen2ImageConfigTemplate.WithOptions(),
AKSUbuntuArm64Containerd2204Gen2: SIGUbuntuArm64Containerd2204Gen2ImageConfigTemplate.WithOptions(),
AKSUbuntuArm64Containerd2404Gen2: SIGUbuntuArm64Containerd2404Gen2ImageConfigTemplate.WithOptions(),
AKSUbuntuContainerd2204: SIGUbuntuContainerd2204ImageConfigTemplate.WithOptions(),
AKSUbuntuContainerd2204Gen2: SIGUbuntuContainerd2204Gen2ImageConfigTemplate.WithOptions(),
AKSUbuntuContainerd2204TLGen2: SIGUbuntuContainerd2204TLGen2ImageConfigTemplate.WithOptions(),
AKSUbuntuContainerd2004CVMGen2: SIGUbuntuContainerd2004CVMGen2ImageConfigTemplate.WithOptions(),
AKSUbuntuContainerd2404: SIGUbuntuContainerd2404ImageConfigTemplate.WithOptions(),
AKSUbuntuContainerd2404Gen2: SIGUbuntuContainerd2404Gen2ImageConfigTemplate.WithOptions(),
AKSCBLMarinerV2: SIGCBLMarinerV2Gen1ImageConfigTemplate.WithOptions(),
AKSAzureLinuxV2: SIGAzureLinuxV2Gen1ImageConfigTemplate.WithOptions(),
AKSAzureLinuxV3: SIGAzureLinuxV3Gen1ImageConfigTemplate.WithOptions(),
AKSCBLMarinerV2Gen2: SIGCBLMarinerV2Gen2ImageConfigTemplate.WithOptions(),
AKSAzureLinuxV2Gen2: SIGAzureLinuxV2Gen2ImageConfigTemplate.WithOptions(),
AKSAzureLinuxV3Gen2: SIGAzureLinuxV3Gen2ImageConfigTemplate.WithOptions(),
AKSCBLMarinerV2FIPS: SIGCBLMarinerV2Gen1FIPSImageConfigTemplate.WithOptions(),
AKSAzureLinuxV2FIPS: SIGAzureLinuxV2Gen1FIPSImageConfigTemplate.WithOptions(),
AKSAzureLinuxV3FIPS: SIGAzureLinuxV3Gen1FIPSImageConfigTemplate.WithOptions(),
AKSCBLMarinerV2Gen2FIPS: SIGCBLMarinerV2Gen2FIPSImageConfigTemplate.WithOptions(),
AKSAzureLinuxV2Gen2FIPS: SIGAzureLinuxV2Gen2FIPSImageConfigTemplate.WithOptions(),
AKSAzureLinuxV3Gen2FIPS: SIGAzureLinuxV3Gen2FIPSImageConfigTemplate.WithOptions(),
AKSCBLMarinerV2Gen2Kata: SIGCBLMarinerV2KataImageConfigTemplate.WithOptions(),
AKSAzureLinuxV2Gen2Kata: SIGAzureLinuxV2KataImageConfigTemplate.WithOptions(),
AKSCBLMarinerV2Arm64Gen2: SIGCBLMarinerV2Arm64ImageConfigTemplate.WithOptions(),
AKSAzureLinuxV2Arm64Gen2: SIGAzureLinuxV2Arm64ImageConfigTemplate.WithOptions(),
AKSAzureLinuxV3Arm64Gen2: SIGAzureLinuxV3Arm64ImageConfigTemplate.WithOptions(),
AKSCBLMarinerV2Gen2TL: SIGCBLMarinerV2TLImageConfigTemplate.WithOptions(),
AKSAzureLinuxV2Gen2TL: SIGAzureLinuxV2TLImageConfigTemplate.WithOptions(),
AKSAzureLinuxV3Gen2TL: SIGAzureLinuxV3TLImageConfigTemplate.WithOptions(),
}
Expect(GetMaintainedLinuxSIGImageConfigMap()).To(Equal(expected))
})
})

var _ = Describe("GetSIGAzureCloudSpecConfig", func() {
var (
config SIGConfig
Expand Down

0 comments on commit da10daa

Please sign in to comment.