Skip to content

Commit 7e2da27

Browse files
committed
Add fallback for service space and application labels in deployment mutation
1 parent f3a735b commit 7e2da27

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/mutation/mutation_deploy.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ func injectionDeploy(request *admissionv1.AdmissionRequest) (*admissionv1.Admiss
8787
// Get the application environment variables
8888
labels := deploy.GetLabels()
8989
serviceSpace, application := labels[config.ServiceSpaceLabel], labels[config.ApplicationLabel]
90+
if len(serviceSpace) == 0 || len(application) == 0 {
91+
serviceSpace, application = labels["jmsf.jd.com/service-space"], labels["app.jdap.io/name"]
92+
}
9093
if len(serviceSpace) > 0 && len(application) > 0 {
9194
envs, err := resource.GetApplicationEnvironments(serviceSpace, application)
9295
if err != nil {

0 commit comments

Comments
 (0)