// Package fleet contains Edge Fleet enum constants that represent each // tier of K8s clusters in the Edge platform. package fleet import ( "fmt" "edge-infra.dev/pkg/edge/constants" ) // Label is the K8s resource label used to store fleet information. const Label = "fleet." + constants.Domain // LabelType is the type of the label in the edge database for the fleet type const LabelType = "edge-fleet" // Type is the enum type representing Edge Fleets type Type string // Fleet Types const ( TopLevel = "top-level" Enterprise = "enterprise" Store = "store" BasicStore = "basic-store" Banner = "banner-infra" Cluster = "cluster-infra" CouchDB = "couchdb-masters" ) func IsValid(ft string) error { return Type(ft).IsValid() } var Types = []Type{TopLevel, Enterprise, Store, BasicStore, Banner, Cluster, CouchDB} var ErrInvalidType = fmt.Errorf("invalid fleet type, expected %v", Types) // IsValid checks that a Fleet Type enum value is correct. func (ft Type) IsValid() error { found := false for _, fType := range Types { if ft == fType { found = true } } if found { return nil } return fmt.Errorf("%v: %w", ft, ErrInvalidType) } // String is a convenience function for casting a fleet.Type to a string func (ft Type) String() string { return string(ft) } type AnnotationsGetter interface { GetAnnotations() map[string]string } func IsClusterInfraCluster(val Type) bool { return val == Cluster } func IsStoreCluster(val Type) bool { if val == Store { return true } if val == BasicStore { return true } return false }