Last active
April 5, 2024 15:26
-
-
Save kromanow94/3a40e45f4f5777734e67ac3da683354e to your computer and use it in GitHub Desktop.
Kubeflow curl m2m api tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Snippets for testing the KF API using 'curl' and M2M API Tokens. | |
# Assuming the istio-ingressgateway is deployed in istio-system namespace. | |
# Configure port forwarding | |
```bash | |
$ export ISTIO_INGRESSGATEWAY_NAMESPACE=istio-system | |
$ export ISTIO_INGRESSGATEWAY_ENDPOINT=localhost:8080 | |
$ nohup kubectl port-forward --namespace $ISTIO_INGRESSGATEWAY_NAMESPACE svc/istio-ingressgateway 8080:80 & | |
``` | |
# Select KF Profile and experiment name | |
```bash | |
$ export KF_PROFILE=kubeflow-user-example-com | |
$ export EXPERIMENT_NAME=m2m-experiment | |
``` | |
# Create Experiment | |
```bash | |
$ curl -XPOST "$ISTIO_INGRESSGATEWAY_ENDPOINT/pipeline/apis/v2beta1/experiments" \ | |
-H "Authorization: Bearer $(kubectl -n kubeflow-user-example-com create token default-editor)" \ | |
-d "{\"display_name\": \"$EXPERIMENT_NAME\", \"namespace\": \"$KF_PROFILE\"}" | |
``` | |
# Get Experiments | |
```bash | |
$ curl "$ISTIO_INGRESSGATEWAY_ENDPOINT/pipeline/apis/v2beta1/experiments?namespace=$KF_PROFILE" \ | |
-H "Authorization: Bearer $(kubectl -n kubeflow-user-example-com create token default-editor)" | |
``` | |
# List shared pipelines | |
```bash | |
$ curl "$ISTIO_INGRESSGATEWAY_ENDPOINT/pipeline/apis/v2beta1/pipelines" \ | |
-H "Authorization: Bearer $(kubectl -n kubeflow-user-example-com create token default-editor)" | |
``` | |
# Get experiment id for pipeline run | |
```bash | |
$ export EXPERIMENT_ID="$(curl -qs \ | |
"$ISTIO_INGRESSGATEWAY_ENDPOINT/pipeline/apis/v2beta1/experiments?namespace=$KF_PROFILE" \ | |
-H "Authorization: Bearer $(kubectl -n kubeflow-user-example-com create token default-editor)" \ | |
| jq --arg display_name $EXPERIMENT_NAME '.experiments[] | select(.display_name == $display_name)|.experiment_id' -r | |
)" | |
``` | |
# Get shared pipeline id for pipeline run | |
```bash | |
$ export PIPELINE_ID="$(curl -qs \ | |
"$ISTIO_INGRESSGATEWAY_ENDPOINT/pipeline/apis/v2beta1/pipelines" \ | |
-H "Authorization: Bearer $(kubectl -n kubeflow-user-example-com create token default-editor)" \ | |
| jq '.pipelines[0].pipeline_id' -r | |
)" | |
``` | |
# Create pipeline run | |
```bash | |
$ curl -XPOST \ | |
"$ISTIO_INGRESSGATEWAY_ENDPOINT/pipeline/apis/v2beta1/runs?namespace=$KF_PROFILE" \ | |
-H "Authorization: Bearer $(kubectl -n kubeflow-user-example-com create token default-editor)" \ | |
-d "{ | |
\"experiment_id\":\"$EXPERIMENT_ID\", | |
\"display_name\": \"Pipeline created with M2M Token\", | |
\"pipeline_version_reference\": {\"pipeline_id\": \"$PIPELINE_ID\"} | |
}" | |
``` | |
# List Pipeline Runs | |
```bash | |
$ curl "$ISTIO_INGRESSGATEWAY_ENDPOINT/pipeline/apis/v2beta1/runs?namespace=$KF_PROFILE" \ | |
-H "Authorization: Bearer $(kubectl -n kubeflow-user-example-com create token default-editor)" | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment