Skip to content

Latest commit

 

History

History
 
 

delay

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Service to simulate delay in HTTP request

  1. Create project
> oc new-project link-example
  1. Create a new app, based on s2i strategy
> oc new-app --name service-delay -i java:8 https://github.com/rofrba/examples-openshift --context-dir delay -e DELAY=1
  1. Expose the service
> oc expose svc service-delay
  1. Check the API and check the delay
> curl $(oc get route -o jsonpath='{..spec.host}{"\n"}')
  1. Activate readiness and liveness probes for the application.
> oc set probe dc/service-delay --liveness --get-url=http://:8080/ --initial-delay-seconds=2 --timeout-seconds=2
oc set probe dc/service-delay --readiness --get-url=http://:8080/ --initial-delay-seconds=2 --timeout-seconds=2
  1. Change the delay value again and verify the pod status
> oc set env dc/service-delay DELAY=5
> oc get pods
  • service-delay-4-nsj2k 1/1 Running 0 107s
  • service-delay-5-6hs7d 0/1 Running 1 42s
  • service-delay-5-deploy 1/1 Running 0 46s

We see that the pod restarts multiple times and never gets ready because the readiness probe gets no response within the allotted timeout

  1. Change the delay to pass the readiness probe
> oc set env dc/service-delay DELAY=1
  1. Now we see that the new pod was created and is ready to receive traffic
  • service-delay-4-nsj2k 0/1 Terminating 0 5m37s
  • service-delay-6-deploy 0/1 Completed 0 22s
  • service-delay-6-xq9xs 1/1 Running 0 16s