code: public static boolean isValidName(String name) {
      return Utils.isNotNullOrEmpty(name) &&
        name.length() < KUBERNETES_DNS1123_LABEL_MAX_LENGTH &&
        KUBERNETES_DNS1123_LABEL_REGEX.matcher(name).matches();
    }
docs: Validates name of Kubernetes Resource name, label or annotation based on Kubernetes regex
  
  @param name Name of resource/label/annotation
  @return returns a boolean value indicating whether it's valid or not