Knative v0.16.0更新
I finally got around to updating my Knative Tutorial from Knative
v0.14.0to the latest Knative
v0.16.0release. Since I skipped
v0.15.0, I'm not sure which changes are due to
v0.15.0vs.
v0.16.0. Regardless, there have been some notable changes that I want to outline in this blog post. This is not meant to be an exhaustive list. Feel free to let me know in the comments if there are other notable changes that I should be aware of.
我终于将Knative教程从Knative
v0.14.0更新到了最新的Knative
v0.16.0版本 。 由于我跳过了
v0.15.0,所以我不确定哪些更改是由于
v0.15.0与
v0.16.0。 无论如何,在本博客中,我想概述一些显着的变化。 这并不是详尽的清单。 如果还有其他值得注意的变化,请随时在评论中让我知道。
糖控制器 (Sugar Controller)
Once I updated to
v0.16.0, I realized the
Brokerinjection into the default namespace did not work. Turns out, there's a new
Sugar Controlleryou need to install to have
Brokerinjection. Installing Knative page has more details and my setup scripts have been updated to install this controller. This is how you install it:
更新到
v0.16.0,我意识到将
Broker注入默认名称空间不起作用。 原来,您需要安装一个新的
Sugar Controller才能进行
Broker注入。 “安装Knative”页面具有更多详细信息,并且我的安装脚本已更新以安装此控制器。 这是您的安装方式:
kubectl apply -f \ https://github.com/knative/eventing/releases/download/v0.16.0/eventing-sugar-controller.yaml
This allows you to:
这使您可以:
When a Namespace is labeled with
eventing.knative.dev/injection=enabled
, the controller will create a defaultBroker
in that namespace.当命名空间带有
eventing.knative.dev/injection=enabled
标记时,控制器将在该命名空间中创建一个默认Broker
。When a Trigger is annotated with
eventing.knative.dev/injection=enabled
, the controller will create aBroker
named by thatTrigger
in theTrigger
's namespace.当使用
eventing.knative.dev/injection=enabled
注释触发器时,控制器将在Trigger
的命名空间中创建由该Trigger
命名的Broker
。
代理注入的命名空间标签 (Namespace label for Broker injection)
If you were careful, you already realized that the namespace label for
Brokerinjection used to be:
如果您小心点,您已经意识到用于
Broker注入的名称空间标签曾经是:
knative-eventing-injection
Now, it changed to:
现在,它更改为:
eventing.knative.dev/injection
You have to label your namespace as follows now for
Brokerinjection into that namespace (
defaultin this case):
您现在必须按照以下方式标记名称空间,以便将
Broker注入该名称空间(在这种情况下为
default):
kubectl label ns default eventing.knative.dev/injection=enabled
默认经纪人网址 (Default Broker URL)
Once the
Brokeris up and running, you'll also realize that the default
BrokerURL also changed. If the
Brokeris injected into the
defaultnamespace, the URL used to be this:
Broker启动并运行后,您还将意识到默认的
BrokerURL也已更改。 如果将
Broker注入
default名称空间,则URL以前是这样的:
http://default-broker.default.svc.cluster.local
Now, the new URL is:
现在,新的URL为:
http://broker-ingress.knative-eventing.svc.cluster.local/default/default
It’s good to remember if you need to send messages to the
Broker.
记住如果您需要将消息发送给
Broker那是一件好事。
Knative-GCP API版本 (Knative-GCP API version)
As you might know, Knative-GCP project is useful to read Google Cloud events into Knative cluster. It also has a
v0.16.0release. With that, you can now move from
v1alpha1to
v1beta1API. This affects when you define a source, for example
CloudStorageSource. You can use the newer API:
如您所知, Knative-GCP项目对于将Google Cloud事件读入Knative集群很有用。 它还具有
v0.16.0版本 。 这样,您现在可以从
v1alpha1到
v1beta1API。 这会影响您定义源(例如
CloudStorageSource。 您可以使用较新的API:
apiVersion: events.cloud.google.com/v1beta1
kind: CloudStorageSource
...
Google CloudEvents (Google CloudEvents)
Another notable change in
v0.16.0is that Knative-GCP now uses new CloudEvent attributes and data schemas and all sources now emit these CloudEvents. You can see the list of CloudEvents in google-cloudevents repository.
v0.16.0另一个显着变化是Knative-GCP现在使用新的CloudEvent属性和数据模式,并且所有源现在都发出这些CloudEvent。 您可以在google-cloudevents存储库中查看CloudEvents列表。
As an example, if you wanted to listen for file updates in a storage bucket in Cloud Storage, you’d create a trigger with
com.google.cloud.storage.object.finalizefilter:
例如,如果您想在Cloud Storage的存储桶中监听文件更新,则可以使用
com.google.cloud.storage.object.finalize过滤器创建触发器:
apiVersion: eventing.knative.dev/v1beta1
kind: Trigger
metadata:
name: trigger
spec:
filter:
attributes:
type: com.google.cloud.storage.object.finalize
Now, you need to use the new CloudEvents listed in google-cloudevents. The same trigger needs to filter on
google.cloud.storage.object.v1.finalizedinstead:
现在,您需要使用google-cloudevents中列出的新CloudEvents 。 相同的触发器需要在
google.cloud.storage.object.v1.finalized上进行过滤:
apiVersion: eventing.knative.dev/v1beta1
kind: Trigger
metadata:
name: trigger
spec:
filter:
attributes:
type: google.cloud.storage.object.v1.finalized
CloudSchedulerSource更改 (CloudSchedulerSource changes)
Last but not least, I’ve realized that the
CloudSchedulerSourceevents changed slightly. For example, take a look at the following
CloudSchedulerSource:
最后但并非最不重要的一点是,我已经意识到
CloudSchedulerSource事件发生了轻微的变化。 例如,看看下面的
CloudSchedulerSource:
apiVersion: events.cloud.google.com/v1beta1
kind: CloudSchedulerSource
metadata:
name: schedulersource-cy
spec:
location: "europe-west1"
data: "Cyprus"
schedule: "0 17 * * *"
sink:
ref:
apiVersion: eventing.knative.dev/v1beta1
kind: Broker
name: default
In the past, you’d get a CloudEvents with
Cyprusin its
Datafield. In
v0.16.0, you'd get a
Datafield with the value
{"custom_data":"Q3lwcnVz"}. This is basically
CyprusBase64 encoded and saved under
custom_data. You need to take this into account as you're parsing the CloudEvent in your code.
过去,您会在“
Data字段中获得
Cyprus的CloudEvents。 在
v0.16.0,您将获得一个值为
{"custom_data":"Q3lwcnVz"}的
Data字段。 这基本上是
CyprusBase64编码并保存在
custom_data下。 在代码中解析CloudEvent时,需要考虑到这一点。
These are the changes to look out for in
v0.16.0. Did I miss anything? If so, let me know in the comments or reach out to me on Twitter (@meteatamel).
这些是
v0.16.0需要注意的更改。 我想念什么吗? 如果是这样,请在评论中让我知道,或在Twitter( @meteatamel )上与我联系 。
Originally published at https://atamel.dev.
最初发布于 https://atamel.dev 。
翻译自: https://medium.com/google-cloud/knative-v0-16-0-update-5a5690e5354c
- 个人收集的经典摘录(更新)
- java正则式的应用,持续更新。。。
- Ubuntu常用软件安装,持续更新中。。。
- 软件白盒测试基础(更新程度:完毕)
- SharePoint 更新word 等文档的内容,包括替换哦。功能强大
- 项目中用到的架构模式(持续更新)
- MyEclipse中Android程序的R文件不能自动更新的解决办法
- Android线程模型解析(包括UI的更新)
- 赛门铁克软件(北京)有限公司:有关更新赛门铁克防病毒软件病毒定义代码的问题
- 更新游戏后还是那个storage的数据
- 1000+节点:kubernetes 1.2性能和可扩展性更新介绍
- solr 增量更新
- solr的原子更新/局部更新
- 变态的静态资源缓存与更新
- Android SDK下载和更新失败的解决方法
- ubuntu 手动更新源 以及使用sudo update与upgrade的作用及区别
- 钱包农场 API 开发手记 六 更新用户信息
- 微信排版时,你们注意到135编辑器更新了吗?
- 极简教程1:在Unity中使用XLua实现脚本热更新