Skip to content

Instantly share code, notes, and snippets.

@berinle
Last active February 16, 2021 19:46
Show Gist options
  • Select an option

  • Save berinle/6dffbba1d1589cc4fd945ccb5470ef33 to your computer and use it in GitHub Desktop.

Select an option

Save berinle/6dffbba1d1589cc4fd945ccb5470ef33 to your computer and use it in GitHub Desktop.
KF first time login

Check if namespace exists for the user

curl 'http://www.example.com/api/workgroup/exists' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'accept: application/json' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36' \
  -H 'Referer: http://www.example.com/' \
  -H 'Accept-Language: en-US,en;q=0.9' \
  -H 'Cookie: authservice_session=some-valid-token' \
  --compressed \
  --insecure
  {"hasAuth":true,"user":"forestgump","hasWorkgroup":false,"registrationFlowAllowed":true}

Create a namespace for the user (if it doesn't exist)

  curl 'http://www.example.com/api/workgroup/create' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'accept: application/json' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36' \
  -H 'content-type: application/json' \
  -H 'Origin: http://www.example.com' \
  -H 'Referer: http://www.example.com/' \
  -H 'Accept-Language: en-US,en;q=0.9' \
  -H 'Cookie: authservice_session=some-valid-token' \
  --data-raw '{"namespace":"forestgump"}' \
  --compressed \
  --insecure
  {"message":"Created namespace forestgump"}

Constantly poll to see if namespace was successfully created

curl 'http://www.example.com/api/workgroup/exists' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'accept: application/json' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36' \
  -H 'Referer: http://www.example.com/' \
  -H 'Accept-Language: en-US,en;q=0.9' \
  -H 'Cookie: authservice_session=some-valid-token' \
  --compressed \
  --insecure
{"hasAuth":true,"user":"forestgump","hasWorkgroup":true,"registrationFlowAllowed":true}

Get env info (can be used to determine user namespaces)

curl 'http://www.example.com/api/workgroup/env-info' \
-H 'Connection: keep-alive' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
-H 'accept: application/json' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36' \
-H 'Referer: http://www.example.com/' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Cookie: authservice_session=some-valid-token' \
--compressed \
--insecure
{"user":"[email protected]","platform":{"kubeflowVersion":"v1beta1","provider":"azure:///subscriptions/SUBSCRIPTION-ID/resourceGroups/RESOURCE-GROUP/providers/Microsoft.Compute/virtualMachineScaleSets/aks-agentpool-30636385-vmss/virtualMachines/0","providerName":"azure"},"namespaces":[{"user":"[email protected]","namespace":"forestgump","role":"owner"},{"user":"[email protected]","namespace":"testrus","role":"owner"}],"isClusterAdmin":false}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment