Skip to content

Instantly share code, notes, and snippets.

@matzew
Created March 5, 2020 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matzew/84076ef43a13011f2d8e9799ec9e3ca6 to your computer and use it in GitHub Desktop.
Save matzew/84076ef43a13011f2d8e9799ec9e3ca6 to your computer and use it in GitHub Desktop.

Migrating to the PingSource

With the release of 0.13 the CronJobsource is deprecated, and should be converted to the PingSource

Here is an example of a CronJobSource that delivers messages to a given sink:

apiVersion: sources.eventing.knative.dev/v1alpha1
kind: CronJobSource
metadata:
  name: cronjob-source
spec:
  schedule: "* * * * *"
  data: '{"message": "Hello world!"}'
  sink:
    apiVersion: eventing.knative.dev/v1alpha1
    kind: Broker
    name: default

Migration to the newer PingSource requires a few steps, and the sample now looks like:

apiVersion: sources.knative.dev/v1alpha2
kind: PingSource
metadata:
  name: ping-source
spec:
  schedule: "* * * * *"
  jsonData: '{"message": "Hello world!"}'
  sink:
    ref:
      apiVersion: eventing.knative.dev/v1beta1
      kind: Broker
      name: default

Biggest impact on changes were:

  • different GVK (see apiVersion/Kind diffs)
  • spec now uses jsonData on the PingSource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment