Skip to content

Commit d249208

Browse files
committed
fix(reflection): allow scheduling pods with name > 63
1 parent 708f51c commit d249208

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/virtualKubelet/forge/secrets.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func init() {
5757

5858
// IsServiceAccountSecret returns whether the current object contains remotely reflected service account tokens.
5959
func IsServiceAccountSecret(obj metav1.Object) bool {
60-
return serviceAccountSecretSelector.Matches(labels.Set(obj.GetLabels()))
60+
return serviceAccountSecretSelector.Matches(labels.Merge(obj.GetLabels(), obj.GetAnnotations()))
6161
}
6262

6363
// RemoteSecret forges the apply patch for the reflected secret, given the local one.
@@ -97,14 +97,14 @@ func RemoteServiceAccountSecret(tokens *ServiceAccountPodTokens, targetName, tar
9797
// RemoteServiceAccountSecretLabels returns the labels assigned to the secret holding service account tokens.
9898
func RemoteServiceAccountSecretLabels(tokens *ServiceAccountPodTokens) labels.Set {
9999
return map[string]string{
100-
LiqoSASecretForPodNameKey: tokens.PodName,
101100
LiqoSASecretForServiceAccountKey: tokens.ServiceAccountName,
102101
}
103102
}
104103

105104
// RemoteServiceAccountSecretAnnotations returns the annotations assigned to the secret holding service account tokens.
106105
func RemoteServiceAccountSecretAnnotations(tokens *ServiceAccountPodTokens) labels.Set {
107106
return map[string]string{
107+
LiqoSASecretForPodNameKey: tokens.PodName,
108108
LiqoSASecretForPodUIDKey: string(tokens.PodUID),
109109
LiqoSASecretExpirationKey: tokens.EarliestExpiration().Format(time.RFC3339),
110110
}

pkg/virtualKubelet/reflection/configuration/serviceaccount.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ func RemoteSASecretNamespacedKeyer(namespace, nodename string) func(metadata met
101101
return []types.NamespacedName{}
102102
}
103103

104-
// The label is certainly present, since it matched the selector.
105-
po := metadata.GetLabels()[forge.LiqoSASecretForPodNameKey]
104+
// The annotation is certainly present, since it matched the selector.
105+
po := metadata.GetAnnotations()[forge.LiqoSASecretForPodNameKey]
106106
return []types.NamespacedName{{Namespace: namespace, Name: po}}
107107
}
108108
}

0 commit comments

Comments
 (0)