Rasa 3 NLU

Submitted by Lizhe on Sat, 06/27/2020 - 02:22

The first piece of a Rasa assistant is an NLU model. NLU stands for Natural Language Understanding, which means turning user messages into structured data. To do this with Rasa, you provide training examples that show how Rasa should understand user messages, and then train a model by showing it those examples.

Run the code cell below to see the NLU training data created by the rasa init command:

1

cat data/nlu.md

 

 

lizhe@ubuntu:~/rasa_workspace$ cat data/nlu.md

## intent:greet

- hey

- hello

- hi

Rasa 2 New project

Submitted by Lizhe on Fri, 06/26/2020 - 07:23

The first step is to create a new Rasa project. To do this, run:

1 rasa init --no-prompt

The rasa init command creates all the files that a Rasa project needs and trains a simple bot on some sample data. If you leave out the --no-prompt flag you will be asked some questions about how you want your project to be set up.

 

This creates the following files:

Rasa 1 install

Submitted by Lizhe on Fri, 06/26/2020 - 07:18

Quick Installation

pip3 install rasa

 

1. Create a New Project

rasa init --no-prompt

 

2. View Your NLU Training Data

cat data/nlu.md

 

3. Define Your Model Configuration

cat config.yml

 

4. Write Your First Stories

## story1

Istio 16 熔断

Submitted by Lizhe on Thu, 06/25/2020 - 10:54

熔断的概念这里就不提了,主要是为了how而不是why

apiVersion: networking.istio.io/v1alpha3

kind: DestinationRule

metadata:

  name: flaskapp-desrule 

  namespace: lizhe 

spec: 

  host: flaskapp-service

  trafficPolicy:

    connectionPool:

      tcp:

        maxConnections: 1

      http:

        http1MaxPendingRequests: 1

        maxRequestsPerConnection: 1

Istio 15 Gateway Https

Submitted by Lizhe on Thu, 06/25/2020 - 06:34

 

kubectl create -n istio-system secret tls istio-ingressgateway-certs --key private.key --cert certificate.crt

 

apiVersion: networking.istio.io/v1alpha3

kind: Gateway

metadata:

  name: example-gateway

  namespace: lizhe

spec:

  selector: 

    istio: ingressgateway

  servers:

    - port:

        number: 80

        name: http

Istio 13 Gateway LoadBalancer

Submitted by Lizhe on Wed, 06/24/2020 - 01:42

 

Kubernetes 提供了 Ingress 规范,用来入站流量管理

Istio的早期版本也实现了自己的 Ingress,后又因为 Ingress 在后来无法满足不断增加的需求,所以又推出了 Gateway,用于在网络边缘进行入站和出站的流量管理

Ingress Gateway 在逻辑上相当于一个负载均衡器

实际上之前做过的 VirtualService 对象, 都默认包含 gateways 字段,如果没有指定,那么默认值是

 

gateways:

- mesh

 

这里的 mesh 是 Istio 内部的虚拟 Gateway , 代表网络内部的所有 Sidecar, 换句话说,所有网络内部服务之间的相互通信,都是通过这个网关进行的。

 

如果要对外部提供服务,就需要定义 Gateway 对象, 并在 gateways 字段中进行赋值。
一旦在gateways中填写了mesh之外的对象名称,就要继续对内部通信进行流量控制,并必须显示地将内置的mesh对象名称也加入列表中

 


 

Istio 12 url rewrite

Submitted by Lizhe on Tue, 06/23/2020 - 09:40

个人认为 rewrite 比 redirect 好用,因为rewrite可以和route一起工作

 

apiVersion: networking.istio.io/v1alpha3

kind: VirtualService

metadata:

  name: flaskapp-canary

  namespace: lizhe

spec:

  hosts:

  - flaskapp-service.lizhe.svc.cluster.local

  http:

    - match:

      - uri:

          prefix: /env/rewriteme1

      rewrite:

        uri: /env/version

Istio 11 根据来源进行路由

Submitted by Lizhe on Tue, 06/23/2020 - 06:33

金丝雀的用例里,是基于 HTTP Header 进行路由的,这里尝试基于 源Pod ( sleep ) 的 label 对请求进行路由

首先我们去修改 sleep 应用,把它拆分成两个部署,分别label成 v1 和 v2

apiVersion: v1

kind: Service

metadata:

  name: sleep

  namespace: lizhe 

  labels: 

    app: sleep

spec: 

  selector: 

    app: sleep

  ports: 

    - name: ssh

      port: 80

 

---

 

Istio 10 金丝雀部署

Submitted by Lizhe on Tue, 06/23/2020 - 05:55

 

这里使用v2 当做新版本,在header中加入一个 lab:canary 用以区分用户

有 header 的用户导向 v2,没有的默认指向 v1

20200623020716

修改一下VirtualService

apiVersion: networking.istio.io/v1alpha3

kind: VirtualService

metadata:

  name: flaskapp-canary