Fix Version/s: None
Yesterday's fix hard-coded a limit of 8 processes.
Kubernetes may expose the number of available cores via an environment variable. If it is available, use it.
Also, the limit of 8 processes does not take into account the coordinator, which doesn't need a core and thus should be added on. Move the calculation to the shell function to fix this.