diff --git a/charmorigin.go b/charmorigin.go index aff6164..bafdb88 100644 --- a/charmorigin.go +++ b/charmorigin.go @@ -48,11 +48,20 @@ type charmOrigin struct { Platform_ string `yaml:"platform"` } +const ( + defaultKubernetesPlatform = "unknown/kubernetes/kubernetes" + kubernetesSeries = "kubernetes" +) + func platformFromSeries(s string) (string, error) { if s == "" { return "", errors.New("cannot convert empty series to a platform") } + if s == kubernetesSeries { + return defaultKubernetesPlatform, nil + } + os, err := series.GetOSFromSeries(s) if err != nil { return "", fmt.Errorf("extracting os from series %q: %w", s, err) diff --git a/charmorigin_test.go b/charmorigin_test.go index d175fc9..698b947 100644 --- a/charmorigin_test.go +++ b/charmorigin_test.go @@ -167,6 +167,10 @@ func (s *CharmOriginSerializationSuite) TestPlatformFromSeries(c *gc.C) { expectedVal: "unknown/windows/win2008r2", series: "win2008r2", }, + { + expectedVal: "unknown/kubernetes/kubernetes", + series: "kubernetes", + }, } for _, test := range tests {