Skip to content

Commit cf35e14

Browse files
committed
Update application label to use shortened format and refactor environment retrieval logic
1 parent c23760b commit cf35e14

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pkg/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const (
2828
ServiceGroupLabel = "jmsf.jd.com/group"
2929
ServiceSpaceLabel = "jmsf.jd.com/space"
3030
JdapServiceSpaceLabel = "jmsf.jd.com/service-space"
31-
ApplicationLabel = "jmsf.jd.com/application"
31+
ApplicationLabel = "jmsf.jd.com/app"
3232
JdapApplicationLabel = "app.jdap.io/name"
3333
WebHookMatchKeyEnv = "JOYLIVE_MATCH_KEY"
3434
WebHookMatchValueEnv = "JOYLIVE_MATCH_VALUE"

pkg/resource/control.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ type ApplicationEnvResponse struct {
1919
}
2020

2121
func GetApplicationEnvironments(labels map[string]string) (map[string]string, error) {
22-
serviceSpace, application := labels[config.ServiceSpaceLabel], labels[config.ApplicationLabel]
23-
if len(serviceSpace) == 0 || len(application) == 0 {
24-
serviceSpace, application = labels[config.JdapServiceSpaceLabel], labels[config.JdapApplicationLabel]
22+
serviceSpace := labels[config.ServiceSpaceLabel]
23+
application := labels[config.ApplicationLabel]
24+
if len(serviceSpace) == 0 {
25+
serviceSpace = labels[config.JdapServiceSpaceLabel]
26+
}
27+
if len(application) == 0 {
28+
application = labels[config.JdapApplicationLabel]
2529
}
2630
envMaps := make(map[string]string)
2731
if len(serviceSpace) != 0 && len(application) != 0 {

0 commit comments

Comments
 (0)