How to create custom KubeSpawner class to spawn notebook in a specific node in a K8S cluster

Hi all,

Currently, I am working on a custom kubeSpawner class that will be used in order to spawn notebooks in a specific node. The user could be able to check a check box, if this checkbox is checked then the notebook should be scheduled in a specific node that has gpu. To do something like that I have created a custom KubeFormSpawnerClass as presented below:

class KubeFormSpawner(KubeSpawner):
_user_option_keys = {‘image’, ‘gpu’, ‘cpu_guarantee’, ‘mem_guarantee’}

    def _options_form_default(self):
      return '''
      <label for="images">Choose an image:</label>
      <select name="image" id="images">
        <option value="jupyterhub/k8s-singleuser-sample:latest</option>

      <label for='gpu'>GPU</label>
      <input type="checkbox" name="gpu">
      <span title="If checked then notebook will be spawned on GPU node">&#9432;</span>
      <span class="checkmark"></span>

      <label for='cpu_guarantee'>CPU</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input  type="number" value="1" min="1" max="16" step="1" name='cpu_guarantee'></input>

      <label for='mem_guarantee'>Memory (GB)</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input pattern="^(?!0)[0-9]+$" name='mem_guarantee'></input>

    def options_from_form(self, formdata):
      return {'image': formdata.get('image', [''])[0].strip(),
              'cpu_guarantee': formdata.get('cpu_guarantee', [''])[0].strip(), 
              'mem_guarantee' : formdata.get('mem_guarantee', [''])[0].strip(), 
              'gpu': formdata.get('gpu', [''])[0].strip() }
    def image(self):
      image = 'jupyterhub/k8s-singleuser-sample:latest'
      if self.user_options.get('image'):
        image = self.user_options['image']
      return image

    def cpu_guarantee(self):
      cpu = '500m'
      if self.user_options.get('cpu_guarantee'):
        cpu = self.user_options['cpu_guarantee']
      return cpu

    def cpu_limit(self):
      cpulimit = '500m'
      if self.user_options.get('cpu_guarantee'):
        cpulimit = self.user_options['cpu_guarantee']
      return cpulimit
    def mem_guarantee(self):
      mem = '1073741824'
      if self.user_options.get('mem_guarantee'):
       mem = self.user_options['mem_guarantee']
       converted_mem = int(mem)
       converted_mem =converted_mem * 1073741824
       mem = str(converted_mem)
      return mem

    def mem_limit(self):
      meml= '1073741824'
      if self.user_options.get('mem_guarantee'):
        meml = self.user_options['mem_guarantee']
        converted_meml = int(meml)
        converted_meml =converted_meml * 1073741824
        meml = str(converted_meml)
      return meml
    def node_selector(self):
      node_selector = {"" : "nodeWithoutGpu"}
      if self.user_options.get('gpu'):
        node_selector = {"" : "nodeWithGpu"}
      return node_selector

It seems that the above solution works and when the checkbox is checked the notebook is spawned on the desired node. The problem is that looking at jupyterhub logs there is a warning:

so my questing is how can I resolve this warning?