Skip to main content
Glama
verify.sh1.02 kB
#!/bin/bash set -e NAMESPACE="e-commerce" SERVICE_NAME="checkout-service" EXPECTED_SELECTOR_VERSION="green" TIMEOUT="120s" echo "Waiting for the Service '$SERVICE_NAME' to point to version '$EXPECTED_SELECTOR_VERSION'..." # Use 'kubectl wait' to verify the service selector condition if ! kubectl wait --for=jsonpath='{.spec.selector.version}'="$EXPECTED_SELECTOR_VERSION" service/$SERVICE_NAME -n $NAMESPACE --timeout=$TIMEOUT; then echo "Failed to verify the service selector." exit 1 fi echo "Service selector updated correctly." echo "Verifying that service endpoints match the green deployment..." # Use a single command to check if at least one endpoint has the desired label kubectl get endpointslices -n $NAMESPACE -l kubernetes.io/service-name=$SERVICE_NAME \ -o jsonpath='{.items[0].endpoints[*].conditions.ready}' | grep -q "true" || { echo "Failed to verify service endpoints."; exit 1; } echo "Service endpoints correctly point to the green deployment." echo "Verification successful!" exit 0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/containers/kubernetes-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server