Skip to content

Commit

Permalink
good first issue for knative readme (#4886)
Browse files Browse the repository at this point in the history
* good first issue for knative readme

* good first issue for knative_eventing.md

---------

Co-authored-by: Abhinav Singh <abhinav.singh@Abhinavs-MacBook-Pro.local>
  • Loading branch information
asingh9530 and Abhinav Singh authored Jun 7, 2023
1 parent 29028e8 commit dfc6cd8
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 88 deletions.
6 changes: 3 additions & 3 deletions doc/source/streaming/knative_eventing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Seldon Core implements the Knative Eventing Duck Typing requirements which allow
An example of a trigger for a SeldonDeployment named "iris-deployment" can be created with the following format:

```yaml
apiVersion: eventing.knative.dev/v1beta1
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:

Expand Down Expand Up @@ -43,7 +43,7 @@ In the case of every Seldon Deployment, the `status.addressable.url` is always t
In the case of multiple predictors, or in the case that you want to send the Cloudevent through your ingress, you can actually create a trigger that overrides the URI. An example of this would be the following:

```yaml
apiVersion: eventing.knative.dev/v1beta1
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
Expand Down Expand Up @@ -96,7 +96,7 @@ This means that you could create a trigger for a seldon deployment of name `iris
```yaml
---
# Trigger to send events to service above
apiVersion: eventing.knative.dev/v1alpha1
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
name: event-display
Expand Down
170 changes: 85 additions & 85 deletions examples/streaming/knative-eventing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Now we run the Seldon Deployment configuration file we just created.
!kubectl apply -f assets/simple-iris-deployment.yaml
```

seldondeployment.machinelearning.seldon.io/iris-deployment created
seldondeployment.machinelearning.seldon.io/iris-deployment created


### Check that the model has been deployed
Expand All @@ -61,7 +61,7 @@ Now we run the Seldon Deployment configuration file we just created.
!kubectl get pods | grep iris
```

iris-deployment-default-0-simple-iris-model-65697469fb-b4dhs 2/2 Running 0 25s
iris-deployment-default-0-simple-iris-model-65697469fb-b4dhs 2/2 Running 0 25s


## Create a Trigger to reach our model
Expand All @@ -75,7 +75,7 @@ We will be using the following seldon deployment:
!kubectl get sdep | grep iris
```

iris-deployment 21s
iris-deployment 21s


### Create trigger configuration
Expand All @@ -84,7 +84,7 @@ We will be using the following seldon deployment:
```python
%%writefile ./assets/seldon-knative-trigger.yaml

apiVersion: eventing.knative.dev/v1beta1
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
name: seldon-eventing-sklearn-trigger
Expand All @@ -111,7 +111,7 @@ Create this trigger file which will send all cloudevents of type `"seldon.<deplo
!kubectl apply -f assets/seldon-knative-trigger.yaml
```

trigger.eventing.knative.dev/seldon-eventing-sklearn-trigger created
trigger.eventing.knative.dev/seldon-eventing-sklearn-trigger created


CHeck that the trigger is working correctly (you should see "Ready: True"), together with the URL that will be reached.
Expand All @@ -121,9 +121,9 @@ CHeck that the trigger is working correctly (you should see "Ready: True"), toge
!kubectl get trigger
```

NAME READY REASON BROKER SUBSCRIBER_URI AGE
event-display True default http://event-display.default.svc.cluster.local/ 9d
seldon-eventing-sklearn-trigger True default http://iris-deployment-default.default.svc.cluster.local:8000/api/v1.0/predictions 18m
NAME READY REASON BROKER SUBSCRIBER_URI AGE
event-display True default http://event-display.default.svc.cluster.local/ 9d
seldon-eventing-sklearn-trigger True default http://iris-deployment-default.default.svc.cluster.local:8000/api/v1.0/predictions 18m


### Send a request to the KNative Eventing default broker
Expand All @@ -142,21 +142,21 @@ To send requests we can do so by sending a curl command from a pod inside of the
-d '{"data": { "ndarray": [[1,2,3,4]]}}'
```

































### Check our model has received it
Expand All @@ -168,12 +168,12 @@ We can do this by checking the logs (we can query the logs through the service n
!kubectl logs svc/iris-deployment-default simple-iris-model | tail -6
```

WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
2020-03-27 17:16:36,681 - werkzeug:_log:122 - INFO: * Running on http://0.0.0.0:9000/ (Press CTRL+C to quit)
2020-03-27 17:17:14,228 - SKLearnServer:predict:37 - INFO: Calling predict_proba
2020-03-27 17:17:14,231 - werkzeug:_log:122 - INFO: 127.0.0.1 - - [27/Mar/2020 17:17:14] "POST /predict HTTP/1.1" 200 -
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
2020-03-27 17:16:36,681 - werkzeug:_log:122 - INFO: * Running on http://0.0.0.0:9000/ (Press CTRL+C to quit)
2020-03-27 17:17:14,228 - SKLearnServer:predict:37 - INFO: Calling predict_proba
2020-03-27 17:17:14,231 - werkzeug:_log:122 - INFO: 127.0.0.1 - - [27/Mar/2020 17:17:14] "POST /predict HTTP/1.1" 200 -


## Connect a source to listen to the results of the seldon model
Expand Down Expand Up @@ -234,8 +234,8 @@ spec:
!kubectl apply -f assets/event-display-deployment.yaml
```

deployment.apps/event-display unchanged
service/event-display unchanged
deployment.apps/event-display unchanged
service/event-display unchanged


### Check that the event display has been deployed
Expand All @@ -245,7 +245,7 @@ spec:
!kubectl get pods | grep event
```

event-display-7c69959598-txxdg 1/1 Running 0 6d14h
event-display-7c69959598-txxdg 1/1 Running 0 6d14h


### Create trigger for event display
Expand All @@ -257,7 +257,7 @@ We now can create a trigger that sends all the requests of the type and source c
%%writefile ./assets/event-display-trigger.yaml

# Trigger to send events to service above
apiVersion: eventing.knative.dev/v1alpha1
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
name: event-display
Expand Down Expand Up @@ -285,7 +285,7 @@ spec:
!kubectl apply -f assets/event-display-trigger.yaml
```

trigger.eventing.knative.dev/event-display configured
trigger.eventing.knative.dev/event-display configured


### Check our triggers are correctly set up
Expand All @@ -297,9 +297,9 @@ We now should see the event trigger available.
!kubectl get trigger
```

NAME READY REASON BROKER SUBSCRIBER_URI AGE
event-display True default http://event-display.default.svc.cluster.local/ 9d
seldon-eventing-sklearn-trigger True default http://iris-deployment-default.default.svc.cluster.local:8000/api/v1.0/predictions 18m
NAME READY REASON BROKER SUBSCRIBER_URI AGE
event-display True default http://event-display.default.svc.cluster.local/ 9d
seldon-eventing-sklearn-trigger True default http://iris-deployment-default.default.svc.cluster.local:8000/api/v1.0/predictions 18m


## Send a couple of requests more
Expand All @@ -319,21 +319,21 @@ We can use the same process we outlined above to send a couple more events.
-d '{"data": { "ndarray": [[1,2,3,4]]}}'
```

































### Visualise the requests that come from the service
Expand All @@ -343,39 +343,39 @@ We can use the same process we outlined above to send a couple more events.
!kubectl logs svc/event-display | tail -40
```

☁️ cloudevents.Event
Validation: valid
Context Attributes,
specversion: 0.3
type: seldon.iris-deployment.default.response
source: seldon.iris-deployment
id: bee392e0-77cc-44fc-915b-5a08660a1071
time: 2020-03-27T17:20:42.040931317Z
datacontenttype: application/json
Extensions,
knativearrivaltime: 2020-03-27T17:20:42.045829175Z
knativehistory: default-kne-trigger-kn-channel.default.svc.cluster.local
path: /api/v1.0/predictions
traceparent: 00-e01a320040c3f368a14bd3b54c294107-6299f694fefb34b5-00
Data,
{
"data": {
"names": [
"t:0",
"t:1",
"t:2"
],
"ndarray": [
[
0.0006985194531162841,
0.003668039039435755,
0.9956334415074478
]
]
},
"meta": {}
}

☁️ cloudevents.Event
Validation: valid
Context Attributes,
specversion: 0.3
type: seldon.iris-deployment.default.response
source: seldon.iris-deployment
id: bee392e0-77cc-44fc-915b-5a08660a1071
time: 2020-03-27T17:20:42.040931317Z
datacontenttype: application/json
Extensions,
knativearrivaltime: 2020-03-27T17:20:42.045829175Z
knativehistory: default-kne-trigger-kn-channel.default.svc.cluster.local
path: /api/v1.0/predictions
traceparent: 00-e01a320040c3f368a14bd3b54c294107-6299f694fefb34b5-00
Data,
{
"data": {
"names": [
"t:0",
"t:1",
"t:2"
],
"ndarray": [
[
0.0006985194531162841,
0.003668039039435755,
0.9956334415074478
]
]
},
"meta": {}
}




Expand Down

0 comments on commit dfc6cd8

Please sign in to comment.