Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Update sources event CE types, sources, subjects #1340

Merged
merged 9 commits into from
Jun 26, 2020

Conversation

yolocs
Copy link
Member

@yolocs yolocs commented Jun 24, 2020

Fixes #1209

Proposed Changes

  • Used new values for CE type/source/subject
  • Scheduler event data schema is updated
  • Unbundled event schemas from API versions

Release Note

BREAKING CHANGES

- All event types are updated to match event types in googleapis/google-cloudevents
- CAL/Storage/Scheduler events now also have updated CE "source" and "subject"
- Scheduler events now also have a new data schema

ACTION REQUIRED

- Users who only depend on "source", "type" and "subject" values in the trigger filters can create new triggers with new filter values (see details below).
- Users who depend on "source", "type" and "subject" values in their receiver code will have to update their code.
- Users who depend on scheduler event data will have to update their code.

DETAILED CHANGES

1. All event types and data schemas were updated to be compliant with https://github.com/googleapis/google-cloudevents/tree/master/proto/google/events/cloud. There is no real change to the CAL/PubSub/Storage event schema. Scheduler event schema was updated to be https://github.com/googleapis/google-cloudevents/blob/master/proto/google/events/cloud/scheduler/v1/data.proto
2. Source changes:
  CAL: was "//[service_name]/projects/[project_id]" => now "//cloudaudit.googleapis.com/projects/[project_id]/logs/[activity/data_access]"
  Scheduler: was "//cloudscheduler.googleapis.com/projects/[project_id]/locations/[location]/schedulers/[k8s_scheduler_source_name]" => now "//cloudscheduler.googleapis.com/projects/[project_id]/locations/[location]/jobs/[job_name]"
  Storage: was "//storage.googleapis.com/buckets/[bucket_name]" => now "//storage.googleapis.com/projects/_/buckets/[bucket_name]"
3. Subject changes:
  CAL: was "[resource_name]" => now "[service_name]/[resource_name]"
  Scheduler: was "jobs/[job_name]" => now NONE
  Storage: was "[object_id]" => now "objects/[object_id]"
4. Type changes:
  CAL: was "com.google.cloud.auditlog.event" => now "google.cloud.audit.log.v1.written"
  PubSub: was "com.google.cloud.pubsub.topic.publish" => now "google.cloud.pubsub.topic.v1.messagePublished"
  Scheduler: was "com.google.cloud.scheduler.job.execute" => now "google.cloud.scheduler.job.v1.executed"
  Storage:
    was "com.google.cloud.storage.object.finalize" => now "google.cloud.storage.object.v1.finalized"
    was "com.google.cloud.storage.object.delete" => now "google.cloud.storage.object.v1.deleted"
    was "com.google.cloud.storage.object.archive" => now "google.cloud.storage.object.v1.archived"
    was "com.google.cloud.storage.object.metadataUpdate" => now "google.cloud.storage.object.v1.metadataUpdated"

Docs

@yolocs yolocs requested a review from nachocano June 24, 2020 21:48
@knative-prow-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yolocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yolocs
Copy link
Member Author

yolocs commented Jun 24, 2020

/test all

Comment on lines 73 to 74
CloudAuditLogsSourceLogWrittenEventType = "google.cloud.audit.log.v1.written"
CloudAuditLogsSourceEventDataSchema = "https://github.com/googleapis/google-cloudevents/blob/master/proto/google/events/cloud/audit/v1/events.proto"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put all of these constants in register.go maybe? outside v1beta1... When we do v1, we will be copy/pasting them otherwise. Similar thing happened with the current values... They are both in v1alpha1 and v1beta1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually moved this out of the apis folder. I feel it makes more sense as they eventually should be replaced by the code generated from the protos.

@googlebot googlebot added the cla: yes (override cla status due to multiple authors bug) label Jun 25, 2020
@yolocs
Copy link
Member Author

yolocs commented Jun 25, 2020

Still trying to make sure the e2e tests are not broken

@yolocs
Copy link
Member Author

yolocs commented Jun 25, 2020

/test all

@yolocs
Copy link
Member Author

yolocs commented Jun 25, 2020

/retest

@yolocs
Copy link
Member Author

yolocs commented Jun 25, 2020

/test all

@yolocs
Copy link
Member Author

yolocs commented Jun 25, 2020

/test all

@yolocs
Copy link
Member Author

yolocs commented Jun 25, 2020

/test all

@yolocs
Copy link
Member Author

yolocs commented Jun 25, 2020

/test pull-google-knative-gcp-integration-tests

@yolocs
Copy link
Member Author

yolocs commented Jun 25, 2020

/test all

@nachocano
Copy link
Member

Is this still in draft? Can we get this in and maybe do follow ups if needed? @zargarpur would benefit from some of this constants in a change he is doing for metrics...
I made a pass and I liked things moved to pkg/schemas

@yolocs yolocs marked this pull request as ready for review June 26, 2020 16:41
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-google-knative-gcp-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/events/v1alpha1/cloudauditlogssource_types.go 75.0% 66.7% -8.3
pkg/apis/events/v1alpha1/cloudpubsubsource_types.go 86.7% 85.7% -1.0
pkg/apis/events/v1alpha1/cloudschedulersource_types.go 71.4% 66.7% -4.8
pkg/apis/events/v1alpha1/cloudstoragesource_types.go 71.4% 66.7% -4.8
pkg/apis/events/v1beta1/cloudauditlogssource_types.go 80.0% 75.0% -5.0
pkg/apis/events/v1beta1/cloudpubsubsource_types.go 88.2% 87.5% -0.7
pkg/apis/events/v1beta1/cloudschedulersource_types.go 77.8% 75.0% -2.8
pkg/apis/events/v1beta1/cloudstoragesource_types.go 77.8% 75.0% -2.8
pkg/pubsub/adapter/converters/auditlogs.go 75.6% 76.1% 0.5
pkg/pubsub/adapter/converters/scheduler.go 93.8% 91.7% -2.1
pkg/schemas/v1/auditlogs.go Do not exist 100.0%
pkg/schemas/v1/pubsub.go Do not exist 100.0%
pkg/schemas/v1/scheduler.go Do not exist 100.0%
pkg/schemas/v1/storage.go Do not exist 100.0%

@nachocano
Copy link
Member

/lgtm

I reviewed yesterday. Just looked at the updates, looks great! Thanks a lot @yolocs for doing this.

Can we create a new issue to update the examples in this repo? and we can probably ask some new member to help with that?

Similarly, I think we need to discuss what are we going to do with current OSS users... Whether we are planning on updating their Triggers (if any is filtering based on old info), or we just have a huge Action Required in the notes...
I think for now I'd add an Action Required, breaking change in the release notes, and we can discuss with the group.

@yolocs
Copy link
Member Author

yolocs commented Jun 26, 2020

#1355 for doc updates.

@grantr
Copy link
Contributor

grantr commented Jun 26, 2020

Thanks @yolocs!The summary of the string changes in the release notes is great. I wrote this summary of the type strings changes to add as well:

Type changes:
CAL: was "com.google.cloud.auditlog.event" => now "google.cloud.audit.log.v1.written"
PubSub: was "com.google.cloud.pubsub.topic.publish" => now "google.cloud.pubsub.topic.v1.messagePublished"
Scheduler: was "com.google.cloud.scheduler.job.execute" => now "google.cloud.scheduler.job.v1.executed"
Storage:
  was "com.google.cloud.storage.object.finalize" => now "google.cloud.storage.object.v1.finalized"
  was "com.google.cloud.storage.object.delete" => now "google.cloud.storage.object.v1.deleted"
  was "com.google.cloud.storage.object.archive" => now "google.cloud.storage.object.v1.archived"
  was "com.google.cloud.storage.object.metadataUpdate" => now "google.cloud.storage.object.v1.metadataUpdated"

@yolocs
Copy link
Member Author

yolocs commented Jun 26, 2020

/retest

2 similar comments
@yolocs
Copy link
Member Author

yolocs commented Jun 26, 2020

/retest

@yolocs
Copy link
Member Author

yolocs commented Jun 26, 2020

/retest

@knative-test-reporter-robot

The following jobs failed:

Test name Triggers Retries
pull-google-knative-gcp-integration-tests pull-google-knative-gcp-integration-tests
pull-google-knative-gcp-integration-tests
pull-google-knative-gcp-integration-tests
pull-google-knative-gcp-integration-tests
pull-google-knative-gcp-integration-tests
3/3
pull-google-knative-gcp-wi-tests pull-google-knative-gcp-wi-tests
pull-google-knative-gcp-wi-tests
pull-google-knative-gcp-wi-tests
pull-google-knative-gcp-wi-tests
3/3

Job pull-google-knative-gcp-wi-tests expended all 3 retries without success.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved cla: yes (override cla status due to multiple authors bug) lgtm size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename CE types and change other attributes such as dataschema
7 participants