This commit is contained in:
Jeff
2019-04-07 23:42:00 +08:00
committed by zryfish
parent f01b4bd4a4
commit 828de74cc5
12 changed files with 145 additions and 101 deletions

View File

@@ -8,17 +8,16 @@ import (
)
const (
AppLabel = "app"
VersionLabel = "version"
ApplicationNameLabel = "app.kubernetes.io/name"
ApplicationVersionLabel = "app.kubernetes.io/version"
ServiceMeshEnabledLabel = "servicemesh.kubesphere.io/enabled"
AppLabel = "app"
VersionLabel = "version"
ApplicationNameLabel = "app.kubernetes.io/name"
ApplicationVersionLabel = "app.kubernetes.io/version"
ServiceMeshEnabledAnnotation = "servicemesh.kubesphere.io/enabled"
)
// resource with these following labels considered as part of servicemesh
var ApplicationLabels = [...]string{
ApplicationNameLabel,
ServiceMeshEnabledLabel,
AppLabel,
}
@@ -40,6 +39,15 @@ func GetComponentName(meta *metav1.ObjectMeta) string {
return ""
}
func IsServicemeshEnabled(annotations map[string]string) bool {
if enabled, ok := annotations[ServiceMeshEnabledAnnotation]; ok {
if enabled == "true" {
return true
}
}
return false
}
func GetComponentVersion(meta *metav1.ObjectMeta) string {
if len(meta.Labels[VersionLabel]) > 0 {
return meta.Labels[VersionLabel]