-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary ======= `curl -v -H 'Accept: application/json' 192.168.49.2/todos` should work. Changes ======= `examples/mocking/gateway/**` --------------------- Example of Gateway mocking taken from [2] and added a deployment manifest. `skaffold.yaml`, `skaffold.sh`, `Makefile` and `.vscode/launch.json` -------------------------------------------------------------------- Tidy up `skaffold.yaml`, `skaffold.sh` and `Makefile`. Add `.vscode/launch.json` that contains debugger configuration for attaching to the manager from within VS Code. References ========== [1]: #298. [2]: https://pastebin.com/raw/avYFtZpX. --- Signed-off-by: Mohamed Bana <mohamed@bana.io>
- Loading branch information
Showing
8 changed files
with
194 additions
and
27 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Skaffold Debug", | ||
"type": "go", | ||
"request": "attach", | ||
"mode": "remote", | ||
"host": "localhost", | ||
"port": 56268, | ||
"substitutePath": [ | ||
{ | ||
"from": "${workspaceFolder}", | ||
"to": "/workspace", | ||
}, | ||
], | ||
} | ||
] | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
apiVersion: gateway.kusk.io/v1alpha1 | ||
kind: API | ||
metadata: | ||
name: mocking-gateway-api-1 | ||
spec: | ||
fleet: | ||
name: default | ||
namespace: default | ||
spec: | | ||
openapi: 3.0.0 | ||
info: | ||
title: mocking-gateway-api-1 | ||
version: 0.1.0 | ||
x-kusk: | ||
cors: | ||
origins: | ||
- "*" | ||
methods: | ||
- POST | ||
- GET | ||
headers: | ||
- Content-Type | ||
credentials: true | ||
max_age: 86200 | ||
upstream: | ||
service: | ||
namespace: default | ||
name: todo-backend | ||
port: 80 | ||
path: | ||
prefix: / | ||
paths: | ||
/todos: | ||
x-kusk: | ||
mocking: | ||
enabled: true | ||
get: | ||
responses: | ||
"200": | ||
description: "ToDos" | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
title: | ||
type: string | ||
description: Description of what to do | ||
completed: | ||
type: boolean | ||
order: | ||
type: integer | ||
format: int32 | ||
url: | ||
type: string | ||
required: | ||
- title | ||
- completed | ||
- order | ||
- url | ||
example: | ||
title: "Mocked JSON title" | ||
completed: true | ||
order: 13 | ||
url: "http://mockedURL.com" | ||
application/xml: | ||
example: | ||
title: "Mocked XML title" | ||
completed: true | ||
order: 13 | ||
url: "http://mockedURL.com" | ||
text/plain: | ||
example: | | ||
title: "Mocked Text title" | ||
completed: true | ||
order: 13 | ||
url: "http://mockedURL.com" |
35 changes: 35 additions & 0 deletions
35
examples/mocking/gateway/mocking-gateway-deployments-1.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: todo-backend | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: todo-backend | ||
template: | ||
metadata: | ||
labels: | ||
app: todo-backend | ||
spec: | ||
containers: | ||
- name: todo-backend | ||
image: docker.io/kubeshop/todobackend-backend | ||
env: | ||
- name: PORT | ||
value: "8080" | ||
ports: | ||
- containerPort: 8080 | ||
name: http | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: todo-backend | ||
spec: | ||
selector: | ||
app: todo-backend | ||
ports: | ||
- name: http | ||
port: 80 | ||
targetPort: 8080 |
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
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
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
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