Skip to content

Commit

Permalink
Initial support for Ubuntu 24.04 (Noble Numbat)
Browse files Browse the repository at this point in the history
  • Loading branch information
hakman committed May 8, 2024
1 parent dd390bf commit 065ca37
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
8 changes: 2 additions & 6 deletions util/pkg/distributions/distributions.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ var (
DistributionDebian11 = Distribution{packageFormat: "deb", project: "debian", id: "bullseye", version: 11}
DistributionDebian12 = Distribution{packageFormat: "deb", project: "debian", id: "bookworm", version: 12}
DistributionUbuntu2004 = Distribution{packageFormat: "deb", project: "ubuntu", id: "focal", version: 20.04}
DistributionUbuntu2010 = Distribution{packageFormat: "deb", project: "ubuntu", id: "groovy", version: 20.10}
DistributionUbuntu2104 = Distribution{packageFormat: "deb", project: "ubuntu", id: "hirsute", version: 21.04}
DistributionUbuntu2110 = Distribution{packageFormat: "deb", project: "ubuntu", id: "impish", version: 21.10}
DistributionUbuntu2204 = Distribution{packageFormat: "deb", project: "ubuntu", id: "jammy", version: 22.04}
DistributionUbuntu2404 = Distribution{packageFormat: "deb", project: "ubuntu", id: "noble", version: 24.04}
DistributionAmazonLinux2 = Distribution{packageFormat: "rpm", project: "amazonlinux2", id: "amazonlinux2", version: 0}
DistributionAmazonLinux2023 = Distribution{packageFormat: "rpm", project: "amazonlinux2023", id: "amzn", version: 2023}
DistributionRhel8 = Distribution{packageFormat: "rpm", project: "rhel", id: "rhel8", version: 8}
Expand Down Expand Up @@ -99,9 +97,7 @@ func (d *Distribution) DefaultUsers() ([]string, error) {
// See https://github.com/coredns/coredns/blob/master/plugin/loop/README.md#troubleshooting-loops-in-kubernetes-clusters
func (d *Distribution) HasLoopbackEtcResolvConf() bool {
switch d.project {
case "ubuntu":
return d.version >= 18.04
case "flatcar":
case "ubuntu", "flatcar":
return true
default:
if _, err := os.Stat("/run/systemd/resolve/resolv.conf"); err == nil {
Expand Down
8 changes: 2 additions & 6 deletions util/pkg/distributions/identify.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,10 @@ func FindDistribution(rootfs string) (Distribution, error) {
return DistributionDebian12, nil
case "ubuntu-20.04":
return DistributionUbuntu2004, nil
case "ubuntu-20.10":
return DistributionUbuntu2010, nil
case "ubuntu-21.04":
return DistributionUbuntu2104, nil
case "ubuntu-21.10":
return DistributionUbuntu2110, nil
case "ubuntu-22.04":
return DistributionUbuntu2204, nil
case "ubuntu-24.04":
return DistributionUbuntu2404, nil
}

// Some distros have a more verbose VERSION_ID
Expand Down
18 changes: 4 additions & 14 deletions util/pkg/distributions/identify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,14 @@ func TestFindDistribution(t *testing.T) {
expected: DistributionUbuntu2004,
},
{
rootfs: "ubuntu2010",
err: nil,
expected: DistributionUbuntu2010,
},
{
rootfs: "ubuntu2104",
err: nil,
expected: DistributionUbuntu2104,
},
{
rootfs: "ubuntu2110",
rootfs: "ubuntu2204",
err: nil,
expected: DistributionUbuntu2110,
expected: DistributionUbuntu2204,
},
{
rootfs: "ubuntu2204",
rootfs: "ubuntu2404",
err: nil,
expected: DistributionUbuntu2204,
expected: DistributionUbuntu2404,
},
{
rootfs: "notfound",
Expand Down
13 changes: 13 additions & 0 deletions util/pkg/distributions/tests/ubuntu2404/etc/os-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

0 comments on commit 065ca37

Please sign in to comment.