// Package workload defines the API constants + validation functions for workload.edge.ncr.com package workload import ( "fmt" "edge-infra.dev/pkg/edge/constants" ) // Label is the string key used to store workload information as labels // on K8s resources / KRMs const Label = "workload." + constants.Domain const SIEMLabel = "siem.edge.ncr.com" // Consts for Logging Related Namespace Labels const ( HelmEdgeIDLabel = SIEMLabel + "/helm-edge-id" HelmChartVersionLabel = SIEMLabel + "/helm-chart-version" HelmChartNameLabel = SIEMLabel + "/helm-chart-name" ) // WorkloadType a set of permissible string values for the Workload label type Type string // WorkloadType enum values const ( Platform = Type("platform") NCR = Type("ncr") Tenant = Type("tenant") Helm = Type("helm") ) var types = []Type{Platform, NCR, Tenant, Helm} var ErrInvalidType = fmt.Errorf("invalid workload type, expected %v", types) // IsValid checks that a workload Type is valid based on the workload Type enum func (wt Type) IsValid() error { found := false for _, wlType := range types { if wt == wlType { found = true } } if found { return nil } return fmt.Errorf("%v: %w", wt, ErrInvalidType) }