diff --git a/pkg/apis/k0s/v1beta1/extensions.go b/pkg/apis/k0s/v1beta1/extensions.go index 0ef163466fe4..598afb1ac317 100644 --- a/pkg/apis/k0s/v1beta1/extensions.go +++ b/pkg/apis/k0s/v1beta1/extensions.go @@ -102,7 +102,7 @@ type Chart struct { // ManifestFileName returns filename to use for the crd manifest func (c Chart) ManifestFileName() string { - return fmt.Sprintf("%d_helm_extension_%s.yaml", c.Order, c.Name) + return fmt.Sprintf("%9d_helm_extension_%s.yaml", c.Order, c.Name) } // Validate performs validation diff --git a/pkg/apis/k0s/v1beta1/extenstions_test.go b/pkg/apis/k0s/v1beta1/extenstions_test.go index 752c773e22bc..90d46d9416ac 100644 --- a/pkg/apis/k0s/v1beta1/extenstions_test.go +++ b/pkg/apis/k0s/v1beta1/extenstions_test.go @@ -102,9 +102,17 @@ func TestValidation(t *testing.T) { TargetNS: "default", Order: 2, } - assert.Equal(t, chart.ManifestFileName(), "0_helm_extension_release.yaml") - assert.Equal(t, chart1.ManifestFileName(), "1_helm_extension_release.yaml") - assert.Equal(t, chart2.ManifestFileName(), "2_helm_extension_release.yaml") + + chart20 := Chart{ + Name: "release", + ChartName: "k0s/chart", + TargetNS: "default", + Order: 20, + } + assert.Equal(t, chart.ManifestFileName(), "000000000_helm_extension_release.yaml") + assert.Equal(t, chart1.ManifestFileName(), "000000001_helm_extension_release.yaml") + assert.Equal(t, chart2.ManifestFileName(), "000000002_helm_extension_release.yaml") + assert.Equal(t, chart20.ManifestFileName(), "000000020_helm_extension_release.yaml") }) }