Automatic merge from submit-queue add port validate when --port is set or --expose=true ```shell $ kubectl run nginx --image=nginx --port=88888 --expose=true The Deployment "nginx" is invalid. spec.template.spec.containers[0].ports[0].containerPort: Invalid value: 88888: must be between 1 and 65535, inclusive $ kubectl run nginx --image=nginx --port=0 --expose=true error: --port must be a positive integer when exposing a service ``` 1. when port is greater than 65535, port is required between 1 and 65535 and deployment 'nginx' can not be created. 2. when port is less than 1, port is not validated and deployment 'nginx' can be created. But service will be created failed. so i add this change: when --port is set or --expose=true, validate port range so that error reported can be the same when port is greater than 65535 or less than 1. And this can also find the port range error before creating the deployment other than during creating the deployment.
23 KiB
23 KiB