add affinity template