mirror of
https://github.com/lucky-sideburn/kubeinvaders.git
synced 2026-08-21 20:46:42 +00:00
22 lines
462 B
Python
22 lines
462 B
Python
import time
|
|
import consul
|
|
|
|
# Connect to the Consul cluster
|
|
client = consul.Consul()
|
|
|
|
# Continuously register and deregister a service
|
|
while True:
|
|
# Register the service
|
|
client.agent.service.register(
|
|
"stress-test-service",
|
|
port=8080,
|
|
tags=["stress-test"],
|
|
check=consul.Check().tcp("localhost", 8080, "10s")
|
|
)
|
|
|
|
# Deregister the service
|
|
client.agent.service.deregister("stress-test-service")
|
|
|
|
time.sleep(1)
|
|
|