forked from rhd-gitops-example/odo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
labels.go
38 lines (29 loc) · 1.16 KB
/
labels.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package labels
import "github.com/openshift/odo/pkg/version"
// ApplicationLabel is label key that is used to group all object that belong to one application
// It should be save to use just this label to filter application
const ApplicationLabel = "app.kubernetes.io/part-of"
//////////////////////////////
// ADDITIONALLY USED LABELS
//////////////////////////////
// App is the default name used when labeling
const App = "app"
// OdoManagedBy notes that this is managed by odo
const OdoManagedBy = "app.kubernetes.io/managed-by"
// OdoVersion is a Kubernetes label that adds what version of odo is being ran.
const OdoVersion = "app.kubernetes.io/managed-by-version"
// GetLabels return labels that identifies given application
// additional labels are used only when creating object
// if you are creating something use additional=true
// if you need labels to filter component than use additional=false
func GetLabels(application string, additional bool) map[string]string {
labels := map[string]string{
ApplicationLabel: application,
}
if additional {
labels[App] = application
labels[OdoVersion] = version.VERSION
labels[OdoManagedBy] = "odo"
}
return labels
}