Service to store and retrieve Identity Provider configurations.
- Install Golang 1.17
- Run
make run-migrate
- Run
make run
- Access the API at http://localhost:3000/api/idp-configs-api/v0/openapi.json (All other routes are authenticated and require the X-RH-Identity request header to be set) NOTE: You may want to have a JSON formatter extension loaded in your web browser to make reading the output easier.
- See instructions here for onboarding an ephemeral cluster.
- Using the instructions in the step above, reserve a namespace on the ephemeral cluster.
- If you're running this from within the cloned
idp-configs-api
directory, runmake bonfire-config-github
to generate the bonfire config.yml. But if you're in a separate directory, edit the bonfire config (~/.config/bonfire/config.yaml
) with the contents ofdefault_config.yaml.github.example
. - After successfully reserving a namespace (eg. ephemeral-10), use this namespace to deploy the app:
- If you're within the
idp-configs-api
directory:Otherwise run:make deploy-app NAMESPACE=<reserved_ephemeral_namespace>
bonfire deploy idp-configs -n <reserved_ephemeral_namespace>
- Now the application should be running. You can check the pod with
oc get pods -n <reserved_ephemeral_namespace>
You can test by port-forwarding the app in one terminal and running a curl command in anotherIn a separate terminal:oc port-forward service/idp-configs-api-service 8000:8000 -n <reserved_ephemeral_namespace>
Note: To test authenticated endpoints, an X-RH-Identity header needs to be set on the requestcurl -v http://localhost:8000/api/idp-configs-api/v0/openapi.json
- When you're done testing, release your ephemeral namespace:
bonfire namespace release <reserved_ephemeral_namespace>
- If you're within the
Note: Testing on minikube can be a bit flaky and less reliable than testing on ephemeral clusters due to resource constraints.
This setup utilizes the following tools. Follow the steps in the links for installation:
- minikube
- Clowder
- Bonfire (see installation instructions for setting up the virtual environment for bonfire)
Following the information above you should have Docker, a minikube cluster running with Clowder installed, and a Python environment with bonfire
installed. Now move on to running the idp-configs-api
application.
- Clone the project.
git clone git@github.com:identitatem/idp-configs-api.git
- Change directories to the project.
cd idp-configs-api
- Setup access to the Docker enviroment within minikube, so you can build images directly to the cluster's registry.
eval $(minikube -p minikube docker-env)
- Build the container image.
make docker-build
- Create Bonfire configuration. To deploy from your local repository run the following:
make bonfire-config-local
The above command will create a file named config.yaml
pointing to your local repository. At times you may need to update the branch which is referred to with the ref
parameter (defaults to main
).
Bonfire can also deploy from GitHub. Running the following command will setup the GitHub based configuration:
make bonfire-config-github
- Setup a test namespace for deployment.
make create-ns NAMESPACE=test
- Deploy a Clowder environment (ClowdEnviroment) to the namespace with bonfire.
make deploy-env NAMESPACE=test
- Deploy the application to the namespace.
make deploy-app NAMESPACE=test
Now the application should be running. You can test this by port-forwarding the app in one terminal and running a curl command in another as follows:
Terminal 1
kubectl -n test port-forward service/idp-configs-api-service 8000:8000
Terminal 2
curl -v http://localhost:8000/
You should get a 200 response.
Unit tests:
make test
Lint:
go get -u honnef.co/go/tools/cmd/staticcheck@latest
make lint
- Run
make generate-docs
The API will serve the docs under a /docs
endpoint.