You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-17Lines changed: 38 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,32 +38,30 @@ All APIs are protected by an OIDC JWT Token with the following claims:
38
38
39
39
## 1. Register a new namespace
40
40
41
-
A `namespace` represents a collections of Kong Services and Routes that are managed independently.
41
+
A `namespace` represents a collection of Kong Services and Routes that are managed independently.
42
42
43
43
To create a new namespace, go to the <ahref="https://gwa-qwzrwc-test.pathfinder.gov.bc.ca/int"target="_blank">API Services Portal</a>.
44
44
45
-
After login and selection of an existing namespace, go to the `New Namespace` tab and click the `Create Namespace` button.
45
+
After login (and selection of an existing namespace if you have one already assigned), go to the `New Namespace` tab and click the `Create Namespace` button.
46
46
47
-
The namespace must be an alphanumeric string between 5 and 10 characters.
47
+
The namespace must be an alphanumeric string between 5 and 15 characters (RegExp reference: `^[a-z][a-z0-9]{4,14}$`).
48
48
49
49
Logout by clicking your username at the top right of the page. When you login again, you should be able to select the new namespace from the `API Programme Services` project selector.
50
50
51
51
## 2. Generate a Service Account
52
52
53
53
Go to the `Service Accounts` tab and click the `Create Service Account`. A new credential will be created - make a note of the `ID` and `Secret`.
54
54
55
-
With access:
55
+
The credential has the following access:
56
56
*`admin:gateway` : Permission to publish gateway configuration to Kong
57
57
*`admin:acl` : Permission to update the Access Control List for controlling access to viewing metrics, service configuration and service account management
58
58
*`admin:catalog` : Permission to update BC Data Catalog datasets for describing APIs available for consumption
59
59
60
60
## 3. Prepare configuration
61
61
62
-
The gateway configuration can be hand-crafted or you can use the `gwa``new` command to walk you through the creation of the config.
62
+
The gateway configuration can be hand-crafted or you can use a command line interface that we developed called `gwa` to convert your Openapi v3 spec to a Kong configuration.
63
63
64
-
To view a list of available plugins, you can run: `gwa plugins`.
65
-
66
-
To view examples go [here](/docs/samples/service-plugins).
64
+
### Hand-crafted (recommended if you don't have an Openapi spec)
67
65
68
66
**Simple Example**
69
67
@@ -91,9 +89,11 @@ services:
91
89
" > sample.yaml
92
90
```
93
91
92
+
To view optional plugin examples go [here](/docs/samples/service-plugins).
93
+
94
94
> NOTE: If you have separate pipelines for your environments (i.e./ dev, test and prod), you can split your configuration and update the `tags`. So for example, you can use a tag `ns.$NS.dev` to sync Kong configuration for `dev` Service and Routes only.
95
95
96
-
**gwa CLI Example**
96
+
### gwa Command Line
97
97
98
98
Run: `gwa new` and follow the prompts.
99
99
@@ -115,23 +115,27 @@ gwa new -o sample.yaml https://bcgov.github.io/gwa-api/openapi/simple.yaml
115
115
116
116
The Swagger console for the `gwa-api` can be used to publish Kong Gateway configuration, or the `gwa Command Line` can be used.
117
117
118
-
### Swagger Console
118
+
```
119
+
gwa new -o sample.yaml https://bcgov.github.io/gwa-api/openapi/simple.yaml
120
+
```
119
121
120
-
Go to <ahref="https://gwa-api-qwzrwc-test.pathfinder.gov.bc.ca/api/doc"target="_blank">gwa-api Swagger Console</a>.
122
+
> See below for the `gwa` CLI install instructions.
121
123
122
-
Select the `PUT``/namespaces/{namespace}/gateway` API.
124
+
> The current beta version of `gwa new` results in Kong configuration that needs to be edited before it is ready to be applied.
123
125
124
-
The Service Account uses the OAuth2 Client Credentials Grant Flow. Click the `lock` link on the right and enter in the Service Account credentials that were generated in step #2.
126
+
> Make the following edits:
127
+
> * Add a `hosts` list under each `route` with the external URL of your service on the gateway (i.e./ a value that is: `$NAME.api.gov.bc.ca`)
128
+
> * The `service``url` might need to be edited to equal your upstream URL
129
+
> * Optionally: Add a qualifier to the namespace tags if you are separating your configuration into different pipelines
125
130
126
-
For the `Parameter namespace`, enter the namespace that you created in step #1.
127
131
128
-
Select `dryRun` to `true`.
132
+
## 4. Apply gateway configuration
129
133
130
-
Select a `configFile` file.
134
+
The Swagger console for the `gwa-api` can be used to publish Kong Gateway configuration, or the `gwa Command Line` can be used.
131
135
136
+
### gwa Command Line (recommended)
132
137
Send the request.
133
138
134
-
### gwa Command Line
135
139
136
140
**Install**
137
141
@@ -173,6 +177,23 @@ If you want to see the expected changes but not actually apply them, you can run
173
177
gwa pg --dry-run sample.yaml
174
178
```
175
179
180
+
### Swagger Console
181
+
182
+
Go to <ahref="https://gwa-api-qwzrwc-test.pathfinder.gov.bc.ca/api/doc"target="_blank">gwa-api Swagger Console</a>.
183
+
184
+
Select the `PUT``/namespaces/{namespace}/gateway` API.
185
+
186
+
The Service Account uses the OAuth2 Client Credentials Grant Flow. Click the `lock` link on the right and enter in the Service Account credentials that were generated in step #2.
187
+
188
+
For the `Parameter namespace`, enter the namespace that you created in step #1.
189
+
190
+
Select `dryRun` to `true`.
191
+
192
+
Select a `configFile` file.
193
+
194
+
Send the request.
195
+
196
+
176
197
## 5. Verify routes
177
198
178
199
In our test environment, the hosts that you defined in the routes get altered; to see the actual hosts, log into the <ahref="https://gwa-qwzrwc-test.pathfinder.gov.bc.ca/int"target="_blank">API Services Portal</a> and view the hosts under `Services`.
0 commit comments