Tags: kcp


TABLE OF CONTENTS


Overview


Sometimes it is necessary to interrupt a cluster update or another long-running operation manually.


This article describes how it can be done via Kublr API. This is especially important for older versions of Kublr because operation interruption was only introduced in Kublr UI starting with Kublr 1.18.


Interrupt operation


# Login/get TOKEN

export KCP_URL=https://my-kcp-endpoint-url
export KCP_USERNAME=admin
 export KCP_PASSWORD=kublrbox

eval "$(curl -s -k \
    -d "grant_type=password" \
    -d "scope=openid" \
    -d "client_id=kublr-ui" \
    -d "username=${KCP_USERNAME}" \
    -d "password=${KCP_PASSWORD}" \
    "${KCP_URL}/auth/realms/kublr-ui/protocol/openid-connect/token" | \
    jq -r '"REFRESH_TOKEN="+.refresh_token,"TOKEN="+.access_token,"ID_TOKEN="+.id_token')"

# Interrupt cluster operation

# which cluster operation to interrupt
SPACE=default
CLUSTER=cluster-cr

curl -ksSf -H "Authorization: Bearer ${TOKEN}" \
    -XGET "${KCP_URL}/api/spaces/${SPACE}/cluster/${CLUSTER}" |
  jq '.status.state="Error"' |
  curl -ksSf -H "Authorization: Bearer ${TOKEN}" \
    -H 'content-type: application/json' --data-binary '@-' \
    -XPUT "${KCP_URL}/api/spaces/${SPACE}/cluster/${CLUSTER}"