Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new GetAllMaintainedLinuxSIGImageConfigTemplates API #5604

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
66 changes: 66 additions & 0 deletions pkg/agent/datamodel/sig_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,72 @@ var (
}
)

//nolint:gochecknoglobals
var allLinuxSIGImageConfigTemplates = []SigImageConfigTemplate{
SIGUbuntu1604ImageConfigTemplate,
SIGUbuntu1804ImageConfigTemplate,
SIGUbuntu1804Gen2ImageConfigTemplate,
SIGUbuntuGPU1804ImageConfigTemplate,
SIGUbuntuGPU1804Gen2ImageConfigTemplate,
SIGUbuntuContainerd1804ImageConfigTemplate,
SIGUbuntuContainerd1804Gen2ImageConfigTemplate,
SIGUbuntuGPUContainerd1804ImageConfigTemplate,
SIGUbuntuGPUContainerd1804Gen2ImageConfigTemplate,
SIGUbuntuFipsContainerd1804ImageConfigTemplate,
SIGUbuntuFipsContainerd1804Gen2ImageConfigTemplate,
SIGUbuntuFipsContainerd2004ImageConfigTemplate,
SIGUbuntuFipsContainerd2004Gen2ImageConfigTemplate,
SIGUbuntuFipsContainerd2204ImageConfigTemplate,
SIGUbuntuFipsContainerd2204Gen2ImageConfigTemplate,
SIGUbuntuArm64Containerd2204Gen2ImageConfigTemplate,
SIGUbuntuArm64Containerd2404Gen2ImageConfigTemplate,
SIGUbuntuContainerd2204ImageConfigTemplate,
SIGUbuntuContainerd2204Gen2ImageConfigTemplate,
SIGUbuntuContainerd2204TLGen2ImageConfigTemplate,
SIGUbuntuContainerd2004CVMGen2ImageConfigTemplate,
SIGUbuntuMinimalContainerd2204ImageConfigTemplate,
SIGUbuntuMinimalContainerd2204Gen2ImageConfigTemplate,
SIGUbuntuEgressContainerd2204Gen2ImageConfigTemplate,
SIGUbuntuContainerd2404ImageConfigTemplate,
SIGUbuntuContainerd2404Gen2ImageConfigTemplate,
SIGCBLMarinerV1ImageConfigTemplate,
SIGCBLMarinerV2Gen1ImageConfigTemplate,
SIGAzureLinuxV2Gen1ImageConfigTemplate,
SIGAzureLinuxV3Gen1ImageConfigTemplate,
SIGCBLMarinerV2Gen2ImageConfigTemplate,
SIGAzureLinuxV2Gen2ImageConfigTemplate,
SIGAzureLinuxV3Gen2ImageConfigTemplate,
SIGCBLMarinerV2Gen1FIPSImageConfigTemplate,
SIGAzureLinuxV2Gen1FIPSImageConfigTemplate,
SIGAzureLinuxV3Gen1FIPSImageConfigTemplate,
SIGCBLMarinerV2Gen2FIPSImageConfigTemplate,
SIGAzureLinuxV2Gen2FIPSImageConfigTemplate,
SIGAzureLinuxV3Gen2FIPSImageConfigTemplate,
SIGCBLMarinerV2KataImageConfigTemplate,
SIGAzureLinuxV2KataImageConfigTemplate,
SIGCBLMarinerV2Arm64ImageConfigTemplate,
SIGAzureLinuxV2Arm64ImageConfigTemplate,
SIGAzureLinuxV3Arm64ImageConfigTemplate,
SIGCBLMarinerV2TLImageConfigTemplate,
SIGAzureLinuxV2TLImageConfigTemplate,
SIGAzureLinuxV3TLImageConfigTemplate,
SIGCBLMarinerV2KataGen2TLImageConfigTemplate,
}

// GetAllMaintainedLinuxSIGImageConfigTemplates returns the SIG image config templates associated
// with all currently-maintained Linux images. In this case, "currently-maintained" denotes that the
// image is currently built and released during official SIG releases. This is used downstream to make sure
// that all expected images have been properly replicated before releasing new versions of agentbakersvc.
func GetAllMaintainedLinuxSIGImageConfigTemplates() []SigImageConfigTemplate {
var maintained []SigImageConfigTemplate
for _, template := range allLinuxSIGImageConfigTemplates {
if template.Version == LinuxSIGImageVersion {
maintained = append(maintained, template)
}
}
return maintained
}

func getSigUbuntuImageConfigMapWithOpts(opts ...SigImageConfigOpt) map[Distro]SigImageConfig {
return map[Distro]SigImageConfig{
AKSUbuntu1604: SIGUbuntu1604ImageConfigTemplate.WithOptions(opts...),
Expand Down
43 changes: 43 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,49 @@ import (
. "github.com/onsi/gomega"
)

var _ = Describe("GetAllMaintainedLinuxSIGImageConfigTemplates", func() {
It("should return the correct value", func() {
expected := []SigImageConfigTemplate{
SIGUbuntuContainerd1804ImageConfigTemplate,
SIGUbuntuContainerd1804Gen2ImageConfigTemplate,
SIGUbuntuFipsContainerd1804ImageConfigTemplate,
SIGUbuntuFipsContainerd1804Gen2ImageConfigTemplate,
SIGUbuntuFipsContainerd2004ImageConfigTemplate,
SIGUbuntuFipsContainerd2004Gen2ImageConfigTemplate,
SIGUbuntuArm64Containerd2204Gen2ImageConfigTemplate,
SIGUbuntuArm64Containerd2404Gen2ImageConfigTemplate,
SIGUbuntuContainerd2204ImageConfigTemplate,
SIGUbuntuContainerd2204Gen2ImageConfigTemplate,
SIGUbuntuContainerd2204TLGen2ImageConfigTemplate,
SIGUbuntuContainerd2004CVMGen2ImageConfigTemplate,
SIGUbuntuContainerd2404ImageConfigTemplate,
SIGUbuntuContainerd2404Gen2ImageConfigTemplate,
SIGCBLMarinerV2Gen1ImageConfigTemplate,
SIGAzureLinuxV2Gen1ImageConfigTemplate,
SIGAzureLinuxV3Gen1ImageConfigTemplate,
SIGCBLMarinerV2Gen2ImageConfigTemplate,
SIGAzureLinuxV2Gen2ImageConfigTemplate,
SIGAzureLinuxV3Gen2ImageConfigTemplate,
SIGCBLMarinerV2Gen1FIPSImageConfigTemplate,
SIGAzureLinuxV2Gen1FIPSImageConfigTemplate,
SIGAzureLinuxV3Gen1FIPSImageConfigTemplate,
SIGCBLMarinerV2Gen2FIPSImageConfigTemplate,
SIGAzureLinuxV2Gen2FIPSImageConfigTemplate,
SIGAzureLinuxV3Gen2FIPSImageConfigTemplate,
SIGCBLMarinerV2KataImageConfigTemplate,
SIGAzureLinuxV2KataImageConfigTemplate,
SIGCBLMarinerV2Arm64ImageConfigTemplate,
SIGAzureLinuxV2Arm64ImageConfigTemplate,
SIGAzureLinuxV3Arm64ImageConfigTemplate,
SIGCBLMarinerV2TLImageConfigTemplate,
SIGAzureLinuxV2TLImageConfigTemplate,
SIGAzureLinuxV3TLImageConfigTemplate,
}
actual := GetAllMaintainedLinuxSIGImageConfigTemplates()
Expect(actual).To(Equal(expected))
})
})

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