Skip to content

Demo assets and scripts for live demos

Jorge Padilla edited this page Sep 29, 2022 · 2 revisions

Here we collect assets to help demo the search feature.

Sample deployment (airline-app)

# Create deployment.
oc create deployment airline-app --image=[registry.redhat.io/rhscl/postgresql-13-rhel7:1-89](http://registry.redhat.io/rhscl/postgresql-13-rhel7:1-89) 
# Add labels
oc patch deployment airline-app -p '{"spec":{"template":{"metadata":{"labels":{"department":"reservations"}}}}}'
# Create secret with postgres config
oc create secret generic airline-app-config --from-literal=POSTGRESQL_DATABASE=mydb --from-literal=POSTGRESQL_USER=myuser --from-literal=POSTGRESQL_PASSWORD=mysecretpassword
# Update deployment to set environment variables.
oc set env --from=secret/airline-app-config deployment/airline-app

Query the API

Setup

oc create route passthrough search-api --service=search-search-api -n open-cluster-management
export URL="https://$(oc get route search-api -n open-cluster-management | awk 'NR==2' |awk '{print $2;}')/searchapi/graphql"
export TOKEN=$(oc whoami -t)

curl query

curl --insecure --location \
--request POST $URL \
--header "Authorization: Bearer $TOKEN" --header 'Content-Type: application/json' \
--data-raw '{"query":"query q($input: [SearchInput]) { search(input: $input) { items } }","variables":{"input":[{"keywords":[],"filters":[{"property":"label","values":["department=reservations"]}], "limit":10}]}}' | jq