github.com/juju/juju@v0.0.0-20240327075706-a90865de2538/core/charm/kubernetes.go (about) 1 // Copyright 2021 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package charm 5 6 import ( 7 "github.com/juju/charm/v12" 8 "github.com/juju/collections/set" 9 10 corebase "github.com/juju/juju/core/base" 11 ) 12 13 // IsKubernetes reports whether the given charm should be deployed to 14 // Kubernetes, that is, a v1 charm with series "kubernetes", or a v2 charm 15 // with containers specified. 16 func IsKubernetes(cm charm.CharmMeta) bool { 17 switch charm.MetaFormat(cm) { 18 case charm.FormatV2: 19 if len(cm.Meta().Containers) > 0 { 20 return true 21 } 22 // TODO (hml) 2021-04-19 23 // Enhance with logic around Assumes once that is finalized. 24 case charm.FormatV1: 25 if set.NewStrings(cm.Meta().Series...).Contains(corebase.Kubernetes.String()) { 26 return true 27 } 28 } 29 return false 30 }