chia7712 commented on code in PR #808:
URL: https://github.com/apache/yunikorn-k8shim/pull/808#discussion_r1595171919
##########
pkg/common/utils/utils.go:
##########
@@ -373,10 +373,27 @@ func GetPlaceholderFlagFromPodSpec(pod *v1.Pod) bool {
}
}
- if value := GetPodLabelValue(pod, constants.LabelPlaceholderFlag);
value != "" {
+ // Deprecated: Support for old placeholder flags should be removed in
version 1.7.0.
+ if value := GetPodAnnotationValue(pod,
constants.OldAnnotationPlaceholderFlag); value != "" { // nolint:staticcheck
if v, err := strconv.ParseBool(value); err == nil {
+ log.Log(log.ShimUtils).Warn("Using deprecated
placeholder annotation. The support for old placeholder flag will be removed in
version 1.7.0",
Review Comment:
Maybe we should log the warning regardless of boolean value.
##########
test/e2e/framework/helpers/k8s/k8s_utils.go:
##########
@@ -1241,12 +1242,12 @@ func (k *KubeCtl) WaitForPlaceholders(namespace string,
podPrefix string, numPod
func (k *KubeCtl) ListPlaceholders(namespace string, podPrefix string)
([]v1.Pod, error) {
pods := make([]v1.Pod, 0)
- podList, lstErr := k.ListPods(namespace, "placeholder=true")
+ podList, lstErr := k.ListPods(namespace, "")
if lstErr != nil {
return pods, lstErr
}
for _, pod := range podList.Items {
- if strings.HasPrefix(pod.Name, podPrefix) {
+ if strings.HasPrefix(pod.Name, podPrefix) &&
pod.Annotations[constants.AnnotationPlaceholderFlag] == constants.True {
Review Comment:
What will happen if users rolling-update yunikorn with existent running
pods? Those pods having deprecated label don't have the new annotation.
##########
pkg/common/utils/utils.go:
##########
@@ -373,10 +373,27 @@ func GetPlaceholderFlagFromPodSpec(pod *v1.Pod) bool {
}
}
- if value := GetPodLabelValue(pod, constants.LabelPlaceholderFlag);
value != "" {
+ // Deprecated: Support for old placeholder flags should be removed in
version 1.7.0.
+ if value := GetPodAnnotationValue(pod,
constants.OldAnnotationPlaceholderFlag); value != "" { // nolint:staticcheck
if v, err := strconv.ParseBool(value); err == nil {
+ log.Log(log.ShimUtils).Warn("Using deprecated
placeholder annotation. The support for old placeholder flag will be removed in
version 1.7.0",
+ zap.String("podName", pod.Name),
+ zap.String("annotation",
constants.OldAnnotationPlaceholderFlag), // nolint:staticcheck
+ zap.String("value", value))
return v
}
}
+
+ // Deprecated: Support for old placeholder flags should be removed in
version 1.7.0.
+ if value := GetPodLabelValue(pod, constants.OldLabelPlaceholderFlag);
value != "" { // nolint:staticcheck
+ if v, err := strconv.ParseBool(value); err == nil {
+ log.Log(log.ShimUtils).Warn("Using deprecated
placeholder label. The support for old placeholder flag will be removed in
version 1.7.0",
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]