chenyulin0719 commented on code in PR #900:
URL: https://github.com/apache/yunikorn-k8shim/pull/900#discussion_r1732379097
##########
pkg/common/utils/utils.go:
##########
@@ -213,6 +213,66 @@ func GetApplicationIDFromPod(pod *v1.Pod) string {
return GenerateApplicationID(pod.Namespace,
conf.GetSchedulerConf().GenerateUniqueAppIds, string(pod.UID))
}
+func CheckAppIdInPod(pod *v1.Pod) error {
+ appIdLabelKeys := []string{
+ constants.CanonicalLabelApplicationID,
+ constants.SparkLabelAppID,
+ constants.LabelApplicationID,
+ }
+ appIdAnnotationKeys := []string{
+ constants.AnnotationApplicationID,
+ }
Review Comment:
Thanks for the review. Moved appIdLabelKeys/appIdAnnotationKeys to
constants.go in the new commits.
##########
pkg/common/utils/utils.go:
##########
@@ -213,6 +213,66 @@ func GetApplicationIDFromPod(pod *v1.Pod) string {
return GenerateApplicationID(pod.Namespace,
conf.GetSchedulerConf().GenerateUniqueAppIds, string(pod.UID))
}
+func CheckAppIdInPod(pod *v1.Pod) error {
+ appIdLabelKeys := []string{
+ constants.CanonicalLabelApplicationID,
+ constants.SparkLabelAppID,
+ constants.LabelApplicationID,
+ }
+ appIdAnnotationKeys := []string{
+ constants.AnnotationApplicationID,
+ }
+ if err := ValidatePodLabelAnnotation(pod, appIdLabelKeys,
appIdAnnotationKeys); err != nil {
+ return fmt.Errorf("pod has inconsistent application ID in
labels and annotations. %w", err)
+ }
+ return nil
+}
+
+func CheckQueueNameInPod(pod *v1.Pod) error {
+ queueLabelKeys := []string{
+ constants.CanonicalLabelQueueName,
+ constants.LabelQueueName,
+ }
+ queueAnnotationKeys := []string{
+ constants.AnnotationQueueName,
+ }
Review Comment:
Done
--
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]