►
From YouTube: Knative demo: Image processing pipeline
Description
In this video, Mete Atamel, developer advocate at Google, builds an image processing pipeline to connect Google Cloud Storage events to various services with Knative Eventing on GKE.
A
Okay,
cool
now,
first
shameless
plug
I.
Have
this
K
NATO
tutorial
on
github,
where
I
basically
tried
to
keep
it
up
to
date,
I
think
the
latest
version
of
K
native
that
I
updated
this
tutorial
form
was
0.14
I'm.
Well
aware
that
there's
a
new
version
15
and
I'm
going
to
do
it
a
bit
back,
probably
tomorrow
or
next
week
to
that
I'm.
Basically,
in
this
tutorial,
I
show
some
basic
use
cases
for
k,
disturbing
Canadian,
ting
Canada.
A
We
went
in
with
Google
Cloud
and
detect
on
pipelines
which
used
to
contain
it
around
so
feel
free
to
check
it
out.
But
today
I
want
to
talk
about
couple
of
these.
The
first
one
is
image
processing
pipeline
and
the
second
one
is
a
big
query
processing
pipeline.
So
let's
just
look
at
the
image
processing
pipeline
first,
so
here
I
mean
with
both
of
these
pipelines.
A
What
I
wanted
to
do
is
I
wanted
to
build
some
kind
of
a
processing
pipeline
using
some
kind
of
a
balancing,
Google
cloud
and
I
wanted
these
services
to
be
kind
of
chained
but
chained
in
a
way
that
they're
kind
of
you
know
independent
of
each
other,
so
I
can
add
them
and
remove
them
as
I
as
I
wanted
them.
So
the
first,
so
first
of
these
pipelines
is
image
processing
pipeline,
and
the
idea
here
is
that
the
user
end-users
will
save
some
images
into
a
cloud
storage
bucket,
which
is
cloud
storage.
A
A
First
of
all,
when
the
user
saves
the
image
I
wanted
it
to
be
filtered
I
didn't
want
any
kind
of
images
falling
in
the
pipeline,
so
this
filter
service
it
uses
vision,
API
to
determine
whether
the
image
is
safe
or
not,
and
I
will
I
will
talk
about
what
safe
means
as
we
go
through
the
code.
So
once
the
image
goes
to
the
filter,
then
the
filter
sends
and
and
message
out,
but
I
guess.
First
I
should
describe
in
detail
like
what
happened.
A
So
the
user
stays
image
in
the
bucket,
then
I
set
up
clad,
Google
Cloud
storage
stores.
So
this
is
a
an
event
source.
That's
part
of
the
key
native
GCP
project
that
enables
you
to
listen:
Google,
Cloud,
storage
events.
So
when
the
user
says
'hey
the
the
file
that
generates
an
event
and
that
event
gets
pulled
into
the
decay
net
cluster
with
big
cloud
storage
stores,
and
then
I
just
make
that
to
pass
the
message
to
broker
and
I
have
a
default
broker
in
the
namespace.
A
A
A
filter
will
determine
that
it's
safe
and
it
will
generate
a
clad
event,
a
custom
card
event.
That's
I
can
go
type.
His
type
I
made
it
to
be
like
file
uploaded,
yeah
I
just
mention
it
here.
It's
like
file
uploaded
and
they
will
pass
it
back
to
broker
that's
one
of
the
things
that
I
like
about
K
native,
is
this
whole
model
of
like
broker
ease
and
the
triggers.
So
the
broker
is
kind
of
like
the
backbone
of
the
whole
event
in
pipeline,
and
then
you
can
receive
messages
from
it.
A
You
can
receive
certain
messages
by
applying
filters
on
your
trigger,
but
then
you
can
also
reply
to
messages
which
makes
it
really
easy,
because
you
know
when
the
filter
is
easy,
the
cloud
event
from
cut
source
source.
It
can
reply
with
a
custom
message
to
broker
and
then
worker
figures
out
where
to
route
it,
which
nice
it
makes
it
really
easy
to
to
write
the
code.
A
So
then,
this
K
native
samples,
final
event
is
being
listened
by
to
other
services
precisely
and
labeler,
so
the
resizer
will
receive
the
image,
usually
it's
big
and
it
will
resize
it
using
an
image
sharp.
My
services
are
in
c-sharp,
so
I
use
image
share,
which
is
kind
of
like
image
magic
both
for
c-sharp.
So
this
will
resize
it
to
400
400,
and
then
it
will
emit
another
kind
of
message.
A
A
custom
message
called
pile
resize
and
then
the
water
market
service
will
receive
that
image
and
it
will
add
a
watermark
to
it
and
then
it
will
save
to
the
output
bucket.
Similarly,
the
weight
layer
will
listen
for
the
final
uploaded
message
and
then
it
will
use
vision,
API
to
extract
the
labels
out
of
the
image,
and
so
what
this
image
is
about,
and
then
it
will
save
those
labels
as
a
text
file
to
the
output,
so
give
it
a
single
image.
A
We
will
basically
end
up
with
three
different
files
and
these
files
are
the
resize
image,
the
resize
image
with
the
watermark
and
then
the
labels
of
the
image
in
the
text
file.
So
this
is
a
pipeline
and
I
go
through
like
what
you
need
to
do
is
set
it
up
here.
So
just
to
show
it
quickly.
You
need
to
create
the
buckets
input
and
output
and
then
you
need
to
set
up
the
Google
Cloud
storage
source
and
if
you
actually
look
at
the
source,
I
have
the
idol
source
here.
A
A
Let's
see
what
else
we
need
to
do
so
we
inject
a
broker
in
the
namespace
by
like
labeling
the
default
namespace.
Then
I
go
through
each
services,
a
filter
service,
so
the
service
and
the
trigger
resizer
and
and
then
the
water
marker,
and
then
the
white
blur
I
guess
I
can
show
you
one
of
the
codes.
So
let's
look
at,
let's
say
filter.
A
So
if
we
look
at
the
filter
code,
so
the
program
the
this
is
a
c-sharp,
it
just
listens
on
port
8080,
but
everything
basically
happens
here.
So
when
we
receive
a
post
request.
I
have
this
event
reader,
which
is
which
basically
reads
just
a
cloud
event.
So
I
read
the
clad
event.
Then
I
have
this.
I
could
even
pick
a
reader,
so
we
have
classes
for
everything
in
C
sharp.
A
So
so
this
bucket
even
later
either
just
looks
at
the
data
of
the
Claddagh
band
and
then
extracts
the
bucket
name
and
the
object
name
from
from
there.
Basically,
we
can
ignore
this
code
because
I'm
running
this
in
cloud
run
as
well
and
in
color
when
there's
a
strange
bug
where
I
had
to
check
whether
the
bucket
name
is
what
I
expect,
but
for
King
it
is
not
relevant
and
then
from
from
the
bucket
name
and
object
name,
I
created
sorry,
G
or
L.
A
Then
I
pass
this
to
a
method
called
picture
safe
and
this
picture
said
is
basically
using
vision
in
clients.
So
this
is
the
client
to
top
division
API
and
then
it
will
call
the
text
safe,
search,
async
and
it
will
pass
in
the
image
URL
and
then
this
will
return
some
likelihood.
So
as
long
as
my
image
is
not
possibly
adult
medical,
racist,
poop
or
violent,
then
I
say:
okay,
this
picture
is
safe
and
then,
if
it's
not
safe,
I
just
don't
return
anything,
but
if
it
is
safe,
then
I
create
an
object.
A
So
this
object
is
the
bucket
and
the
name
so
I'm.
Basically
so
this
is
gonna,
be
the
big
body
of
the
cloud
event
and
in
the
body
I'm
just
saying
this
is
the
bucket.
This
is
the
name
of
the
object,
but
that
you
should
care
about
and
then
I
write
this
as
a
custom
event.
So
this
is
what
the
goal
does
here.
A
A
But
then,
if
you
look
at
the
labor,
for
example,
it's
pretty
poor
the
way
blur
it
will
filter
on
file
upload
it,
because
this
is
the
event
that
gets
generated
by
a
filter,
and
it
will
only
look
for
those.
So
that's
how
you
can
kind
of
make
different
services
get
different
kinds
of
events,
and
this
one
is
also
getting
get
file,
uploaded
event
and
so
on
and
so
forth.
So
let
me
just
show
you
how
this
works.
I
mean
my
Papa.
This
is
big
enough.
A
Yes,
I
was
worried
for
a
second
something's,
not
working
but
yeah
its
source
is
created
and
then
let
me
make
sure
that
there's
a
broker
in
the
appropriate
as
a
default
broker
and
if
I
do
get
cloud
storage
source.
Hopefully
that
should
be
up
and
running
yes.
So
now
we
are
getting
the
events
from
Google,
Cloud
storage
and
to
the
broker.
Now
we
need
to
actually
create
our
services.
So
let
me
apply
the
create
the
service
in
the
create
the
trigger
this
is
for
filtered
and
then
let's
do
the
same
for
labeler.
A
Let's
do
the
same
for
resides
there.
Let's
do
the
same
for
watch
your
marker
yeah
and
then,
if
you
look
at
services,
well,
there's
a
few
other
services,
but
the
ones
that
we
care
about
is
the
filter
label
or
besides
the
remoter
maker,
they
seem
to
be
running
and
then,
if
you
do
trigger,
you
can
see
that
all
the
triggers
are
ready.
So
I
think
it's
gonna
work.
A
Look
at
the
pods
yeah.
We
have
some
pods
running
as
well.
So
now
let
me
go
to
Google
Cloud
console
and
I
mean
I'm
in
Google,
Cloud
storage
area
and
then
I
have
my
bucket
here.
Tentative
images,
input
and
I
already
have
an
image
here.
So
let's
just
upload.
Let's
talk
about
the
same
image,
so
this
is
a
picture
that
I
look
at
out
of
nowadays,
because
I
cannot
be
at
places
like
this
I'm
stuck
in
my
apartment,
but
basically
you
can
see,
hopefully
can
see
it's
mountains
and
sunshine
and
in
the
beach.
A
A
A
Yeah,
you
can
see
the
little
of
the
filter
that
it
received
a
cloud
event
and
the
source
is
storage,
and
this
is
a
type,
and
this
is
the
actual
data
that
we
kind
of
care
about,
and
then
it's
fun
to
store.
Url
tell
me
that
this
picture
is
safe.
Then
you
replied
back
with
another
cloud
event
and
the
data
is
what
I
described
like
the
bucket
and
may
be.
So
we
pass
this
on
and
then,
if
we
look
at
other
pods,
let's
say:
wait:
yeah,
let's
get
labeling,
for
example,.
A
Yeah
so
the
labeler
received
the
custom
clad
event
and
then
it
made
a
call
to
vision,
API
and
then
it
says:
okay,
this
picture
is
labeled
Scottie,
but
I
ordered
see,
nature
cost
so
on
and
so
forth,
and
then
it
uploaded
this
to
the
output
folder
right
and
yeah.
We
don't
have
to
look
at
all
the
pods,
but
the
other
ones.
They
already
did
their
work
resizing
em,
others
there
terminating.
But
if
everything
worked,
let
me
go
back
to
clear
now:
let's
go
to
our
output,
folder.