@@ -148,7 +148,6 @@ public class KubernetesCloud extends Cloud implements PodTemplateGroup {
148
148
public KubernetesCloud (String name ) {
149
149
super (name );
150
150
setMaxRequestsPerHost (DEFAULT_MAX_REQUESTS_PER_HOST );
151
- setPodLabels (null );
152
151
}
153
152
154
153
/**
@@ -457,7 +456,7 @@ public void setLabels(Map<String, String> labels) {
457
456
*/
458
457
@ NonNull
459
458
public List <PodLabel > getPodLabels () {
460
- return podLabels == null ? List . of ( ) : podLabels ;
459
+ return podLabels == null || podLabels . isEmpty () ? PodLabel . fromMap ( DEFAULT_POD_LABELS ) : podLabels ;
461
460
}
462
461
463
462
/**
@@ -466,7 +465,9 @@ public List<PodLabel> getPodLabels() {
466
465
@ DataBoundSetter
467
466
public void setPodLabels (@ CheckForNull List <PodLabel > labels ) {
468
467
this .podLabels = new ArrayList <>();
469
- this .podLabels .addAll (labels == null || labels .isEmpty () ? PodLabel .fromMap (DEFAULT_POD_LABELS ) : labels );
468
+ if (labels != null ) {
469
+ this .podLabels .addAll (labels );
470
+ }
470
471
}
471
472
472
473
/**
@@ -716,7 +717,7 @@ public boolean equals(Object o) {
716
717
Objects .equals (jenkinsUrl , that .jenkinsUrl ) &&
717
718
Objects .equals (jenkinsTunnel , that .jenkinsTunnel ) &&
718
719
Objects .equals (credentialsId , that .credentialsId ) &&
719
- Objects .equals (podLabels , that .podLabels ) &&
720
+ Objects .equals (getPodLabels () , that .getPodLabels () ) &&
720
721
Objects .equals (podRetention , that .podRetention ) &&
721
722
Objects .equals (waitForPodSec , that .waitForPodSec ) &&
722
723
useJenkinsProxy ==that .useJenkinsProxy ;
@@ -997,8 +998,8 @@ private Object readResolve() {
997
998
if (waitForPodSec == null ) {
998
999
waitForPodSec = DEFAULT_WAIT_FOR_POD_SEC ;
999
1000
}
1000
- if (podLabels == null ) {
1001
- setPodLabels (labels == null ? null : PodLabel .fromMap (labels ));
1001
+ if (podLabels == null && labels != null ) {
1002
+ setPodLabels (PodLabel .fromMap (labels ));
1002
1003
}
1003
1004
if (containerCap != null && containerCap == 0 ) {
1004
1005
containerCap = null ;
0 commit comments