Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

=====================================================================Create label to run the buildon pod in a particular slave node using node affinity.

...

===========================================================================

As-Is:

subprocess.Popen(['kubectl run '+ self.uid +' -i --tty --rm --restart=Never --image='+imagename+ ' --env="commitID='+self.uid+'" --env="branchName='+self.tuid+'" --env="gitURL='+self.httpurl+'" --env="KUBEMASTER='+self.host_ip+'" --env="UPLOADPORT='+self.upload_port+'" --env="scmServiceAccount='+self.scmServiceAccount+'"'], shell=True)

To Be:

subprocess.Popen(['kubectl run '+ self.uid +' -i --tty --rm --restart=Never --image='+imagename+ ' --overrides='{ "apiVersion": "v1","kind":"Pod", "metadata": {"name": "buildonslave"},"spec": {"affinity": {"nodeAffinity": {"requiredDuringSchedulingIgnoredDuringExecution":{"nodeSelectorTerms": [ { "matchExpressions": [ { "key": "thisnode", "operator": "In", "values": [ "slavelabel"]}]}]}}}}}' --env="commitID='+self.uid+'" --env="branchName='+self.tuid+'" --env="gitURL='+self.httpurl+'" --env="KUBEMASTER='+self.host_ip+'" --env="UPLOADPORT='+self.upload_port+'" --env="scmServiceAccount='+self.scmServiceAccount+'"'], shell=True)