Run prettier on apps/example/README.md
CodeQL checks / Detect whether code changed (push) Waiting to run Details
CodeQL checks / Analyze (actions) (push) Blocked by required conditions Details
CodeQL checks / Analyze (go) (push) Blocked by required conditions Details
CodeQL checks / Analyze (javascript) (push) Blocked by required conditions Details

This commit is contained in:
Austin Pond 2025-10-06 11:53:23 -04:00
parent 51cb0931a2
commit 1ad75a4335
No known key found for this signature in database
GPG Key ID: E96F015B40A49C32
1 changed files with 25 additions and 18 deletions

View File

@ -5,6 +5,7 @@ This App is an example of general app capabilities when developing on the grafan
## Enabling the App ## Enabling the App
By default, the example app is disabled. To enable this App, add the following to your `conf/custom.ini`: By default, the example app is disabled. To enable this App, add the following to your `conf/custom.ini`:
``` ```
[grafana-apiserver] [grafana-apiserver]
runtime_config = example.grafana.app/v0alpha1=true,example.grafana.app/v1alpha1=true runtime_config = example.grafana.app/v0alpha1=true,example.grafana.app/v1alpha1=true
@ -39,6 +40,7 @@ Navigate to [localhost:3000/swagger?api=example.grafana.app-v1alpha1](http://loc
(this version has the most capabilities/endpoints). You can use the `Execute` button to make requests via the swagger UI. (this version has the most capabilities/endpoints). You can use the `Execute` button to make requests via the swagger UI.
Create a new `Example` resource with via swagger with: Create a new `Example` resource with via swagger with:
```json ```json
{ {
"apiVersion": "example.grafana.app/v1alpha1", "apiVersion": "example.grafana.app/v1alpha1",
@ -61,6 +63,7 @@ Create a new `Example` resource with via swagger with:
``` ```
Create an invalid object which will be rejected by validation: Create an invalid object which will be rejected by validation:
```json ```json
{ {
"apiVersion": "example.grafana.app/v1alpha1", "apiVersion": "example.grafana.app/v1alpha1",
@ -83,6 +86,7 @@ Create an invalid object which will be rejected by validation:
``` ```
Update `custom` subresource: Update `custom` subresource:
```json ```json
{ {
"apiVersion": "example.grafana.app/v1alpha1", "apiVersion": "example.grafana.app/v1alpha1",
@ -98,15 +102,18 @@ Update `custom` subresource:
} }
} }
``` ```
(`metadata.resourceVersion` is required for an update, use the value you get from a GET request) (`metadata.resourceVersion` is required for an update, use the value you get from a GET request)
## cURL ## cURL
You can also interact with the grafana API server via a kubeconfig set up for it, or via `curl` using the `-u <username>:<password>` flag. You can also interact with the grafana API server via a kubeconfig set up for it, or via `curl` using the `-u <username>:<password>` flag.
Currently, cluster-scoped custom routes are erased from the swagger as part of grafana's APIServer code, but can still be called via `curl`, like so: Currently, cluster-scoped custom routes are erased from the swagger as part of grafana's APIServer code, but can still be called via `curl`, like so:
```bash ```bash
curl -u admin:admin http://localhost:3000/apis/example.grafana.app/v1alpha1/other curl -u admin:admin http://localhost:3000/apis/example.grafana.app/v1alpha1/other
``` ```
``` ```
% curl -u admin:admin http://localhost:3000/apis/example.grafana.app/v1alpha1/other % curl -u admin:admin http://localhost:3000/apis/example.grafana.app/v1alpha1/other
{"message":"This is a cluster route"} {"message":"This is a cluster route"}