There are tens, probably hundreds of thousands of switch designs out there. Prices from pennies to hundreds of dollars or more. You can probably find any spec switch you can possibly imagine.
Standard microswitches are quite robust and have very repetable trip points although it may differ from one switch to the next. Be sure to put an adjustment in the mount. Also probably a good idea to put some spring action in the system to allow for over run so the switch does not get broken. Some microswitches have spring/levers built in on them but this design decreases the accuracy of the set point.
Plunger types are also good and can be purchased in an oil tight case. They also can have a generous overtravel to prevent breakage.
Push come to shove, you could easily improvise a simple switch mechanism. Most logic switches work by connecting to ground. An adjustable screw on the movable part (electrically connected to it) and an insulated contact on the fixed one with a single wire and you are done. You do need a ground connection from the electronics to the machine. All in the open and no complicated mechanism to get clogged up with fluids or swarf.
Make it fit.
You can't win and there is a penalty for trying!