[provide a description of the issue]
I am exposing my mongo by the command
oc port-forward mongodb-0 27017:27017 --request-timeout=30s
First the timeout of 30s is not closing the connection.
Also there is no command to close the port forward in another thread
oc v3.7.1+ab0f056
kubernetes v1.7.6+a08f5eeb62
features: Basic-Auth
Server https://ocp-admin.got.xxx.net
openshift v3.6.173.0.21
kubernetes v1.6.1+5115d708d7
[step 1]
run the command
oc port-forward mongodb-0 27017:27017 --request-timeout=30s
[step 2]
The timeout does not work
The timeout should work
[try to run $ oc adm diagnostics (or oadm diagnostics) command if possible]
[if you are reporting issue related to builds, provide build logs with BUILD_LOGLEVEL=5]
[consider attaching output of the $ oc get all -o json -n <namespace> command to the issue]
[visit https://docs.openshift.org/latest/welcome/index.html]
This is one of they way you can use it in your scripts.
$ oc port-forward nginx 8090:8080 > /dev/null 2>&1 &
$ ps -ef | grep nginx
root 87849 1 0 14:58 pts/0 00:00:00 oc port-forward nginx 8090:8080
root 88431 85086 0 15:02 pts/0 00:00:00 grep --color=auto nginx
$ kill -9 87849
@openshift/sig-master
I don't think --request-timeout applies to API calls like exec and port-forward
saving the PID of the running port-forward command and sending it a termination signal is what I would expect
$ oc port-forward nginx 8090:8080 > /dev/null 2>&1 &
$ PORT_FORWARD_PID=$!
...
$ kill -9 $PORT_FORWARD_PID
Hello on the bash i could have this working, but on the jenkins pipeline build i got an error.
The line from the pipeline
sh "oc login ${openshiftUrl} --token=${openshiftToken}"
sh "oc port-forward mongodb-0 27017:27017 > /dev/null 2>&1 &"
sh "PORT_FORWARD_PID=\$!"
sh 'kill -9 $PORT_FORWARD_PID'
From the console with the error
[Pipeline] sh
[pdm] Running shell script
Could you try and pass the variable in curly bracket.
${PORT_FORWARD_PID}
Seems that the problem is here
sh "PORT_FORWARD_PID=$!"
Running shell script
[mongodb] + PORT_FORWARD_PID=
Because the PORT_FORWARD_PID is not getting any value.
See
mongodb] + kill -9 '{}'
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.
If this issue is safe to close now please do so with /close.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.
If this issue is safe to close now please do so with /close.
/lifecycle rotten
/remove-lifecycle stale
Rotten issues close after 30d of inactivity.
Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.
/close
@openshift-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue by commenting
/reopen.
Mark the issue as fresh by commenting/remove-lifecycle rotten.
Exclude this issue from closing again by commenting/lifecycle frozen./close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Most helpful comment
I don't think
--request-timeoutapplies to API calls like exec and port-forwardsaving the PID of the running port-forward command and sending it a termination signal is what I would expect