►
From YouTube: Write a Kubernetes Operator in Go with Ellen Körbes
Description
Kubernetes monitors and maintains state for many aspects of your cluster, but what about those out-of-the-box ideas no one’s thought of yet that are essential to the success of your program? Enter Kubernetes Operators: state-management machines for self-defined resources. See Kubernetes Operators in action as Ellen Körbes live-codes one in Go—showing you their practical application and everything you need to write your own.
A
So
we're
going
to
talk
about
kubernetes
operators.
I
assume,
since
this
is
the
cncf
meetup
thingy.
That's
entirely.
I
assume
you
all
know
what
kubernetes
is
so
water
operators,
it's
basically
kubernetes
handles
by
default.
Very
well
lots
of
things
like
pogs
deployments,
whatever
all
the
kubernetes
stuff
you
you're
you're,
probably
already
familiar
with
that.
But
then
the
thing
is,
if
you
want
to
pod,
if
you
want
a
deployment,
that's
fine,
but
let's
say
you
want
something
new.
Let's
say
you
want.
A
I
don't
know
that
whenever
some
pod
goes
online,
you
start
at
the
database
or
you
do
something
something
or
when
something
crashes
you
you
know,
get
a
backup
or
basically,
whenever
you
want
something
that
is
not
the
default
kubernetes
things
and
you
want
it
to.
Let's
say
work
on
the
same
control
loop
as
kubernetes.
Then
you
need
an
operator.
A
So
the
control
loop
is
that
cycle.
When
you
don't,
basically
you
declare
the
state.
Things
should
be
and
there's
this
cycle,
where
kubernetes
checks,
if
things
are
the
way
they
should
be
and
if
they
are
not
the
way
they
should
be.
Kubernetes
calls
a
controller
that
that
makes
things
be.
The
way
they
should
be
so
a
pod
crashes,
the
pod
controller
is
going
to
you
know,
put
another
pod
there,
so
that
the
desired
state
and
the
actual
state
match.
A
So
if
you
want
some
custom
functionality
to
work
within
that
control
loop,
you
need
an
operator.
An
operator
is
basically
operator
is
not
a
thing
that
exists.
It's
an
encapsulating
term
for
a
custom
resource
and
a
controller
for
that
resource,
so
link
what
link
this
thing
that
I'm
looking
at.
Let
me
see
how
do
I
open
the
chat
now
here.
A
Okay,
where
was
I
right
so
yeah
when
you
want
to
do
custom
things
within
the
kubernetes
loop?
You
use
an
operator.
An
operator
is
a
custom
resource
and
a
controller.
So
there's
gonna
be
two
parts:
I'm
gonna
create
a
resource
and
then
we're
gonna
create
the
controller
and
then
we're
gonna
write
a
whole
bunch
of
code
from
the
for
the
controller.
So
you
can
see
what
the
controller
does
now,
I'm
not
an
expert
in
operators.
I
just
happen
to
know
how
to
write
one.
A
So
I
can't
tell
you
whether,
like
you
know
the
best
way
to
architect
the
controller
and
saturn
all
that,
but
I
can
show
you
how
to
do
the
basic
operations.
So
that's
what
we're
gonna
do
if
you
wanna,
of
course,
if
you
wanna
do
something
like
this
for
real
in
production,
then
you
should
read
something
like
what's
on
the
screen
and
you
know,
and
then
you
get
a
better
sense
of
how
things
work.
A
So
if
you
look
at
here,
the
first
thing
it's
going
to
smell
the
second
thing
it's
going
to
say
is:
you
should
use
an
sdk
like
cube
builder
and
that's
exactly
what
we're
going
to
do.
So
this
is
cube
builder
and
before
I
start,
I
want
to
say
big
thanks
to
sally
ross
is
one
of
the
maintainers
of
this
project
for
giving
me
a
hand
with
all
this
stuff.
So
this
is
cube
builder
I'll
share
the
link
there
as.
A
Well,
and
we,
since
we
are
gonna,
build
an
example,
an
operator,
we
need
an
example
project
right.
So
what
we're
gonna
do
is
a
useless
machine.
I,
if
you
don't
know
what
a
useless
machine
is.
A
So
there
are
ones
like
this
where
you
you
turn
it
on
and
it
turns
itself
off
and
then
there
are
fancier
machines
like
this
one
where
it
wakes
a
little
bit
and
it
makes
fun
of
you
and
sometimes
it's
really
quickly.
Sometimes
it
you
know
plays
a
little
bit
and
so
yeah,
so
we're
gonna
do
the
simple
thing
and
then
we'll
see
what
we
can
do
on
the
other
side.
A
Now
for
the
for
the
development
workflow
we're
going
to
use
tilt,
that's
the
company
at
work
and
tilt's
a
tool
that
it
basically
watches
your
file
system.
Whenever
you
change
your
code,
all
you
need
to
do
is
basically
save
the
file
and
everything
is
up
and
running
and
kubernetes
instantly,
and
you
don't
have
to
you-
don't
have
to
like
build
images
and
push
stuff
on
docker
and
keep
cuddle.
I
don't
have
to
do
any
of
that.
A
So
we're
going
to
use
this,
so
we
can
have
a
better,
so
we
can
have
more
fun
instead
of
doing
paperwork
the
whole
time
if
things
are
tiny
on
the
screen.
Please
leave
your
comments
on
the
chat,
so
I
can
make
them
bigger.
So,
let's
get
started,
we're
gonna
use
q
builder.
Let
me
see,
I
hope
this
is
big
enough,
which
link
carol.
You
have
to
tell
me
which
link
you
want.
A
Okay,
there
you
go
if
you
decide
to
start
using
tails
at
work.
My
employers
are
going
to
be
very
happy
okay,
so
I'm
gonna
start
here
with
cube
builder
init
and
if
I
can
type
it
right,
it's
probably
gonna
work
cube
builder
in
it,
and
this
is
gonna.
No.
This
is
a
bad
place.
Okay,
I
need
to
create
a
directory,
it's
july,
14th,
okay
and
then
I'll
do
that
again,
but
I'm
very
type
of
wrong
command.
A
It's
because
of
the
alcohol
okay,
so
I
hope
you
can
establish
that
so
it's
creating
a
bunch
of
yellow
for
me
so
that
I
don't
have
to
do
it
by
hand
because
writing
an
operator
requires
both
of
the
ammo.
As
you
can
see.
This
is
what
cube
builder
already
did
so
a
whole
lot
of
stuff,
and
now
we
can
create
something
that
actually
does
something,
because
all
of
this
yellow
does
nothing
for
now,
so
cube
builder
create
okay
and
first
we're
just
gonna,
create
the
resource
and
we're
not
going
to
create
the
controller.
A
Okay,
so
what
did
it
just
do
when
I
created
the
resource?
It
did
this
so
now
I
have
a
type
called
machine,
because
that's
the
name
that
I
put
here
so
if
you
use
kubernetes,
you
know
how
there's
always
group
version
kind,
and
I
decided
that
the
kind's
going
to
be
machine
because
we're
going
to
be
playing
with
use,
useful
machines,
useless
machines,
etc.
A
Okay,
so,
let's,
let's
look
at
what
that
was
so
machine
types:
here's
where
you
define
the
resource
and
defining
the
resources.
Basically,
whenever
you
look
at
yaml,
there's
a
bunch
of
fields
that
you
fill
in,
that
definition
of
the
fields
that
that's
what
the
resource
is.
So
if
you
look
at
the
main
struct,
we
have
type
meta
which
we're
not
gonna
talk
about
today,
object
meta!
A
This
is
where
the
name
and
the
namespace
are
spec
on
a
pod
stack
is
where
you
put
the
image
that
you're
going
to
use,
for
example,
and
status
and
status,
is
you
know
transient
information
about
how
things
are
doing
so?
Let's
add
some
fields
here.
I
want
to
have
a
machines
pack
with
a
field.
That's
going
to
be
machine
type,
and
this
is
where
I'm
going
to
specify.
A
A
So,
let's
see
if
this
works,
let
me
save
this
and
now
we
can
go
here
and
I
need
to
stop
a
bunch
of
made
commands.
I
never
know
which
one
so
I
just
use
them
all.
Every
time
may
generate
make
manifests
styles.
Some
kind
of
masks
like
this.
A
So
now
let's
say
I
do
cubecut
or
get
this
doesn't
exist.
It's
going
to
tell
me
the
server
does
not
have
a
restart
with
that
name,
but
if
I
do
cube
cuddle
get
machine
now
it's
going
to
tell
no
resource
is
found,
so
the
type
exists
we
just
don't
have
an
instance
there.
Now.
Let
me
back
out
here
and
go
to
another
screen.
A
Now
I'm
going
to
go
to
config
samples,
so
q
builder
creates
some
sample
yaml
for
me
that
I
can
use
as
a
starting
point.
So
let's
call
this
useful
machine
because
we're
not
going
to
start
with
the
useless
machine
and
I'm
going
to
come
here
and
then
let
me
refresh
my
list
useful
okay.
So
here
I'm
gonna
do
machine
useful
and
the
specs
gonna
say
machine
type,
useful!
A
Okay!
Now,
if
I
come
here-
and
I
do
cube
cuddle
get
machines-
oh
of
course
I
need
to
apply
that
so
apply
file
useful
all
right
now.
If
I
keep
cuddle
get
machine,
I
have
a
machine
there,
so
I
have
a
resource.
It
doesn't
do
anything
because
I
don't
have
a
controller,
but
kubernetes
has
a
definition
of
that
resource
and
I
can
create
objects
using
that
definition.
A
So
this
is
half
the
job
done.
Basically,
actually
it's
not
good,
something
you
can
notice
here,
there's
a
mouse,
something
you
can
notice
here
is
that
the
cubes
are
name
and
age,
and
I
don't
want
that.
I
want
name
machine
type
and
status.
Those
are
the
fields
that
I
care
about,
so
I
can
come
here
in
the
documentation
for
cube
builder
and
let
me
put
a
link
there
before
corral
asks
for
it
again.
A
A
And
for
the
status
one,
that's
considered
a
sub-resource,
I'm
not
sure
why.
But
I
need
to
add
this
one
line
here
as
well.
So
here,
okay,
so
my
fields
are
going
to
be
machine
type
and
that's
going
to
come
from
my
spec
and
from
the
machine
type
field.
The
other
is
going
to
be
called
status
and
that's
gonna
come
from
status.
A
Dot
status:
okay!
Now,
if
I
come
back
here
again-
and
I
do
where
was
that-
maybe
somewhere
else,
okay,
so
make
manifests,
make
generate,
make
install
again
no
wrong
place.
A
Okay,
now
it's
gonna
put
all
this
stuff
in
my
cluster
again
and
now.
If
I
do
keep
cuddle
get
machine,
you
can
see
that
the
fields
here
are
the
fields
I
want
machine
type
and
status
and
we
can
see
the
machine
type
is
useful,
because
that's
what
I
have
here
so
okay,
so
I
think
we
know
a
little
bit
about
the
how
to
create
a
resource.
So
now,
let's
go
to
the
controller,
because
the
controllers,
where
well,
where
the
proverbial
experiment
hits
the
proverbial
time
so
what
we
need
to
do
now.
A
A
Again
and
if
we
look
at
the
files
now
I
have
a
controllers
folder
with
controller.go
in
there
and
that's
where
my
controller
lives.
So
let's
look
at
that
controller
refresh
okay.
A
A
So
I
have
a
reconciliation
method
for
my
machine
controller
type
that
I
basically
it
it
basically
comes
from
the
resource,
and
the
setup
here
is
where
I
say:
hey
whatever
stuff
is
going
on
here
is
four
objects
off
the
type
machine.
A
So,
let's,
let's
play
around
with
this
a
little
bit,
so
I
can
do
here.
A
I
can
have
a
log
and
then
I
can
do
log
info.
What
am
I
going
to
need
here,
hello
from
machine
controller
and
then
I'm
just
going
to
add
some
metadata,
so
we
can
know
what's
what
and
rack.
A
no.
This
is
not
what
I
want.
Oh
yeah,
namespace
name,
okay,
cool
and
the
namespace
name
is
coming
from
right
and
rack
is
here
so
basically,
when
I
receive
a
restart,
it
comes
with
a
name.
When
I
receive
a
request
to
the
reconciliation
loop,
I
get
the
name
of
the
resource
in
the
name
space
that
it's
in.
So
that's
what
I'm
using
here.
A
So
now
it
is
building
all
that
stuff,
compiling,
etc,
and
this
this
stuff
that
you
see
here
this
is
basically
what
the
output
of
the
operator
looks
like
on
my
logs
and
we're
going
to
spend
a
lot
of
time.
Looking
at
stuff
like
this-
and
here
I
have
hello
from
machine
controller,
because
I
do
have
a
machine
that
works
that
exists
on
my
cluster.
So
if
I
come
here
and
I
go
to
config,
is
it
no?
It's
not
complete,
or
am
I
typing
wrong,
or
am
I
drunk?
A
I
don't
know
okay
config
samples
here
I
have
my
useful
machine
and
I
can
do
cube
pedal
delete
my
useful
machine.
A
Okay,
now
it's
deleted
and
if
I
go
back
to
the
logs,
I
get
another
call
from
the
machine
controller.
So
whenever
a
machine
object
is
created,
deleted
or
updated
whenever
any
of
those
happen,
this
is
going
to
run.
So
that
is,
that
is
how
we
connect
the
bits
here.
A
Okay,
so
we
know
how
the
mechanics
work,
what
cool
stuff
can
we
do
here?
We
can
do,
for
example,
now
we're
gonna
need
a
context.
If
you
don't
know
what
a
context
is,
I'm
not
gonna
explain
it's
goal.
You
can
just
ignore
it
for
now
so
here
I
can
have
let's
say.
A
I'm
gonna
have
a
guess,
because
I
have
the
name
of
the
resource
and
the
namespace.
I
don't
have
the
data
of
the
restart
just
yet.
So
we
need
to
get
that.
So
I'm
gonna
get
here's
a
contacts.
What
else
do
I
need
my
next
base?
Name
and
I
need
a
machine
object,
a
pointer
to
a
machine
object
and
we
don't
have
one.
So,
let's
create
one
var
machine
and
it's
going
to
be
type
the
thing
that
I
created
before
cool.
A
A
Call
okay,
I
blame
the
alcohol
for
now
there
you
go
right
so
here
I'm
gonna,
say
error,
get
an
object,
and
here
instead
of
returning
no
error,
I'm
gonna
say
client
ignore
not
found
and
I'll
explain
in
a
minute.
Why
I'm
doing
this,
but
okay,
so
assuming
I'm
not
gonna,
compile
just
now
so
assuming
I
did
this
correctly
and
now
I
have
a
machine
object
with
all
the
information
from
my
actual
object.
What
can
I
do
with
it?
A
I
can
do,
for
example,
if
machine
status
status
is
empty,
I'm
gonna
say
that
if
it's
empty,
I'm
gonna
set
it
to
howdy,
and
now
I
need
to
apply
the
new
status,
so
I
can
do
once
again
restart
status
update.
I
think
this
is
right,
and
then
I
give
you
the
context
and
the
pointer
to
the
machine.
A
Okay,
error:
updating
status;
okay:
this
should
run
let's
see
if
it
runs,
but
this
brings
us
to
something
else.
Updating
this
by
hand
requires
me
to
so
every
time
I
make
a
change
I
need
to
come
here.
I
need
to
access
the
process.
I
need
to
make
run
again.
I
need
to
wait.
It
takes
some
time.
I
need
to
do
it
by
hand.
I
don't
like
to
do
those
things
as
you
can
see,
I'm
drawing.
A
I
just
want
my
code
to
work,
so
we're
going
to
do
something
different,
we're
going
to
use
stills,
and
that
is
what
I
mentioned
here.
So
it's
a
handy
tool.
That's
going
to
make
our
lives
much
easier.
So,
let's
use
tilt
yourself.
I
need
a
tilt
file
and
that's
kind
of
like
a
docker
file,
but
for
tilt,
and
I
actually
do
need
a
docker
file,
because
this
is
gonna
run
inside
kubernetes
and
that's
worth
pointing
out.
This
stuff
is
running
locally,
not
inside
the
cluster.
A
For
simple
things
like
this,
it
makes
no
difference,
but
depending
on
what
you're
doing
that
doesn't
work,
you
need
to
run
it
inside
the
cluster.
So
with
software
you
can
actually
run
it
inside
the
cluster.
So
let's
do
that.
I'm
going
to
copy
my
tool
file
from
another
project
that
I
set
up
before
and
I'm
gonna
also
copy
the
dockerfire.
A
A
So
if
you
have,
if
you
have
an
app
full
of
services,
they're
all
gonna
be
listed
here
and
in
the
case
of
this
app
I
have
a
few
custom
services,
for
example
recompile
one.
It
watches
my
source
code.
Whenever
my
source
code
changes
it
recompiles
it
and
then
what
my
actual
service
is
doing-
and
this
is
going
to
be
our
controller,
it's
basically
taking
the
binary
that
was
recompiled
here
it
hot
swaps,
the
binary
inside
the
container
restarts
the
process.
A
So
basically
I
can
hot
reload
into
kubernetes
without
having
to
think
about
it
and
it
just
happens
like
magic
and
gotta
make
it
a
little
bit
bigger,
and
these
are
the
same
logs.
We
were
looking
at
before
so
same
thing,
but
now
I
don't
need
to
compile
anything
by
name
all
right
now.
Where
were
we?
Yes,
we
wanted
to
run
this
stuff,
so
I
don't
have
any
calls
here,
probably
because
I
don't
have
any
machines
running.
A
So,
let's
run
the
machine
again,
I'm
gonna
do
cube
pedal
get
machine
watch,
so
I
can
see
my
machines
as
they
get
updated
and
I'm
gonna
come
back
here
to
my
yama
folder
and
I'm
gonna,
I'm
gonna,
maybe
try
to
type
correctly
cube,
cuddle
or
fine
useful
okay.
So
now
you
can
see
that
at
first
our
status
was
empty
and
then
it
was
updated
to
howdy.
A
So
that's,
basically
what
we
wrote
here
and
if
we
look
at
the
logs
on
the
operator,
you
can
see
hello
from
machine
controller
when
it
just
received
the
machine
object
with
the
empty
status
and
once
again
hello
from
machine
controller
when
we
updated
the
status.
So
every
call
we
get
something
here.
We
could
make
these
logs
better,
but
I
don't
feel
like
it.
So
we
won't
okay.
Now,
let's
do
some
more
fun
things,
because
this
works,
but
it's
boring.
Okay.
A
A
And
then
I'm
going
to
do
a
switch
on
machine
type,
so
if
the
machine
is
useful,
we're
going
to
do
one
thing
if
the
machine
is
useless,
we're
going
to
do
something
else,
so
here's
what
we're
going
to
do
if
the
machine
is
useful,
I'm
just
going
to
say
that
the
status
is
going
to
be
okay,
because
this
is
not
a
talk
about
useful
machine,
so
we're
just
not
gonna
mess
with
them.
A
Now,
if
a
machine
is
useless,
then
you're
in
trouble,
because
then
I
wanna
delete
this
machine,
so
I'm
gonna
set
the
status
to
delete
and
up
here
I'm
gonna
check
for
these.
So
if
machine
doc
nope,
I
can't
type,
I
had
one
sip
of
alcohol:
that's
why?
If
machine
dot
status,
dot
status
equals
okay.
A
A
Okay,
it
did
compile
so
we're
happy,
probably
nothing's,
going
to
happen,
because
we
only
have
a
useful
machine.
It
should
change
to
the
leads
at
some
point.
It
should
change
to
okay,
it
didn't
so.
I
probably
screwed
this
up.
A
A
A
A
So
in
these
intervals
and
we're
waiting,
I
always
like
to
tell
stupid
computer
jokes
on
the
next
one,
I'm
going
to
tell
you
okay.
So
now
it's
okay!
So
thanks
for
your
contribution,
I
would
not
have
figured
this
out
without
you.
A
A
Okay,
and
now
I
can
open
that
useless,
refresh
okay,
so
this
is
going
to
be
machine
useless
and
my
machine
type
is
also
going
to
be
useless
all
right
now
we
can
run
that
cube,
apply
file,
useless
and,
as
you
can
see,
the
status
down
here
went
to
delete
for
the
useless
machine.
Okay.
So
now,
let's
figure
out
how
to
delete
the
same
because
we're
not
fans
of
useless
machines
and
we
want
them
all
to
be
deleted.
A
A
A
A
So
the
joke
is
that
I
will
tell
you
a
udp
joke,
but
you
might
not
get
it
get
it
did
this
run?
Yes,
it
ran,
and
now
I
have
two
deletes
here
and
if
I
look
back
at
my
logs
again
so
here's
what
happened,
useless,
machine
deleted
error
getting
object.
A
So
what
is
error?
Getting
object,
that's
from
resource
get,
and
why
am
I
getting
an
error
because
I'm
trying
to
get
a
resource
that
doesn't
exist
anymore?
So,
if
you
remember
what
I
said
in
the
beginning,
the
reconciler
is
going
to
be
called
anytime.
A
resource
is
modified,
created
or
deleted.
So
that's
why
we
need
to
pay
attention
to
the
fact
that
sometimes
we're
going
to
get
requests
that
refer
to
resources
that
don't
exist
anymore.
A
So
that's
why
I
put
ignore
not
found
here,
because
if
I
hadn't
then
we
would
have
like
a
huge,
like
panic,
looking
kind
of
an
error
message
and
it's
pretty
ugly.
So
here
we're
just
getting
a
message:
hey
the
thing
doesn't
exist.
We
have,
we
can
getting
object
and
that's
all.
A
Okay.
Now
we
have
a
bit
of
a
problem
here,
so
let
me
clean
this
up,
and
the
problem
is
that
when
we
turn
the
useless
machine
on
kubernetes
turns
it
off,
I
turn
it
on
kubernetes
turns
it
off,
and
that
is
kind
of
what
we
wanted
to
do
right.
A
If
you
remember
this
there
you
go,
we
have
it,
but
we're
still
halfway
through
the
top.
So
we
need
to
do
something.
Fancy
and
now
we're
gonna.
Do
the
playful
machine
and
that's
gonna
be
more
fun,
so
here
we're
gonna,
have
useful
useless
and
case
playful,
and
I'm
not
going
to
write
off
this
by
hand,
because
it's
mostly
just
go.
There's
no
kubernetes
stuff
here,
so
you're
not
missing
out
on
anything.
A
This
so
a
bunch
of
shenanigans
here
and
a
couple
helper
functions
at
the
bottom,
and
we
don't
need
to
go
through
this
because
it's
just
silly
ghost
stuff
all
right
did.
I
do
something
wrong,
or
does
it.
A
A
Okay,
so
this
compiled?
So
now
we
need
a
playful
machine,
so
I'm
going
to
copy
useless
into
playful.yaml
I'm
going
to
come
here.
I'm
going
to
play
refresh
this
list.
There
you
go
machine,
playful
machine
type,
playful,
okay,.
A
Yeah,
so
t-box
is
doing
some
it's
acting
crazy,
a
little
bit.
I
don't
know
why.
A
A
So
what
you
can
see
down
here
is
the
little
finger
of
the
machine
trying
to
go
towards
the
little
button
and
then
it
goes
and
it
comes
back
and
it
goes
and
it
comes
back
blah,
blah
blah
and
when
it
finally
reaches
the
button,
then
you're
going
to
see
what
happens,
but
let's
hope
it
does
there
you
go
so
it
switched
itself
up,
see
how
silly
that
is,
I'm
so
proud.
A
Okay,
so
now
we
have
also,
in
addition
to
the
simple
useless
machine
that
we
have
here,
we
also
have
the
oh.
We
also
have
the
machine
that
messes
with
you
a
little
bit
right,
cool
right.
A
Okay,
now
I'm
one
of
those
crazy
people
who
just
live
inside
the
terminal,
and
I
don't
like
buttons-
and
I
don't
like
using
the
mouse-
and
you
know
typical
linux
nerd,
but
some
people
do
so.
Let's
assume
you
have
a
sense
of
style
and
you
want
to
put
things
in
a
browser
and
show
your
status
in
the
browser.
So
all
your
friends
can
like
type
buttons
on
their
phones
and
look
at
the
styles
of
your
playful
machine,
so
you're
going
to
need
a
way
for
them
to
do
that
on
the
web.
A
Now
I'm
not
going
to
write
a
web
server
here,
I'm
just
going
to
pretend
that
I'm
writing
a
web
server
and
I'm
going
to
tell
you
how
you
would
look
things
up
so
we're
gonna
need
we're.
Gonna
need
it
so
that
whenever
you
create
a
playful
machine,
you
create
a
web
controller.
That's
basically
gonna
monitor.
A
What's
going
on
on
the
machine
and
put
that
in
the
wire,
I'm
not
going
to
write
the
logic
to
put
it
on
the
web,
I'm
just
going
to
do
the
controller,
so
we
need
something
that
creates
a
web
controller
for
each
playful
machine
and
once
the
web
controller
is
exists,
it
needs
to
not
only
be
able
to
monitor
web
objects.
It
needs
to
be
able
to
monitor
machine
objects.
So
the
machine
controller
only
looks
like
machine
stuff.
A
The
wac
controller
is
gonna
need
to
monitor
the
machine
stuff
in
order
to
update
the
web
stuff.
I
hope
this
makes
sense.
If
it
doesn't
ask
me
a
question
okay,
so
let's
do
that
now,
when
you're
using
cube
builder,
there
are
two
ways
to
have
basically
an
operator
with
multiple
controllers,
there's
the
right
way,
which
would
require
rewriting
a
lot
of
stuff
here
and
doing
it
differently
and
then
there's
the
way
I'm
gonna
do
so.
A
A
So
here's
what
I'm
going
to
do,
I'm
going
to
come
back
here,
I'm
going
to
go
into
my
controllers
folder
and
I'm
just
going
to
copy
my
machine
controller
into
a
web
controller
and
I'll
fix
it
later,
but
that's
the
spirit
and
then
I'm
going
to
go
to
the
resource
definition,
and
I'm
also
going
to
do
the
same
thing.
So
I'm
going
to
copy
my
machine
type
into
web
types,
go!
A
A
No,
I
don't
want
the
machine.
I
want
oh
you're,
seeing
my
irc
messages
in
the
corner.
Okay,
so
this
is
my
web
controller,
but
this
is
all
machine
stuff
because
I
just
copied
over.
So
I'm
just
gonna
come
here
and
replace
machine
with
web
and
then
I'm
going
to
come
here
and
replace
machine
lowercase
with
web.
A
Now,
if
you're
really
paying
attention
you're
going
to
notice
that
we
don't
have
api
library
in
kubernetes,
we
have
api
machinery
and
it
took
me
maybe
an
hour
to
figure
this
out
when
I
was
first
doing
this.
So
don't
do
that.
So
I'm
gonna
delete
all
of
this
machine
controller
logic,
because
I
don't
need
it.
A
So
we
can
just
replace
machine
with
web.
Go
up
again,
connect
this
okay
and
then
I
replace
machine
lowercase
with
my
lowercase.
Once
again
we
don't
have
api
library.
We
have
api
machinery,
okay
and
I
think
I'll
diffuse,
your
web
type
or
whatever.
It's
fine
we're
not
going
to
play
with
this
anyway,
so
we
can
just
leave
it
there.
It
doesn't
matter,
okay.
A
What
else
we
need
to
do?
Let
me
think:
let's
come
back
here,
I'm
gonna
need
to
apply
all
that
stuff
so
make
manifest.
Make
generate
it's
probably
in
the
wrong
order.
Make
install.
A
Okay,
so
the
types
now
going
to
be
web,
the
name
is
going
to
be
fun,
I
don't
know,
and
web
type
is
gonna
be
hello.
I
don't
know
this,
doesn't
matter
we're
just
testing
now
I
can
do
keep
cuddle
wait
not
here.
Let's
do
this
here,
we'll
get
and
watch.
A
No,
you
don't
have
a
resource
called
web
yeah.
Of
course
you
don't.
They
forgot
one
step.
The
step
I
forgot
was
that,
because
I'm
doing
this,
the
hacky
way
and
not
the
way
that
the
manual
says
I
need
to
come
here
and
what
was
it
config
crg
basis?
A
And
then
I
need
to
apply
the
last
one
by
hand,
so
cube
photo
apply
yeah.
So
this
is
this.
Is
why
it's
hacky?
So
if
you,
if
you're
doing
this
right,
you
wouldn't
need
to
do
this
by
hand
because
we're
doing
it
wrong,
then
we
do.
A
So
get
web
okay.
Basically,
what
I
want
to
show
is
cube
pedal
get
web.
It
tells
you
no
resources
found
which
is
different
from
trash,
which
says
it
doesn't
exist.
So
now
we
do
have
a
website
already
same
as
when
you
created
the
machine
type.
Okay,
so
let's
apply
cube
cuddle
apply
the
white
file.
A
A
Now
I
have
a
wet
fun
object,
type,
hello,
but
there's
something
here
that
we're
not
going
to
be
happy
with,
and
this
is
squad
controller
we're
supposed
to
get
hello
from
our
controller.
And
if
we
look
here,
we
are
not.
So
if
I
do
web
controller,
nothing
found
it's
not
here,
because
I
forgot
once
again
an
important
step
and
that's
happens.
A
A
A
A
Machine
controller
and
I'm
gonna
copy
this
once
again
because,
like
we're
40
minutes
in-
and
this
is
just
bar
and
type-
you
already
know
how
this
works.
A
And
I'm
going
to
put
some
stuff
here
at
the
bottom
nope,
not
this
no
get
out.
You
know
this
here,
okay,
okay-
and
this
goes
here-
and
I
think
this
shouldn't
be
a
message.
I
always
do
this
wrong.
I
always
have
to
fix
it
and
then
we
fix
it
in
the
middle
of
the
talk.
So,
okay,
now,
let's
look
at
what
we're
doing
here.
So
this
this
is
basically
the
same
as
the
ammo
we
did
before
so
grab
the
cmo.
A
So
this-
and
this
are
the
same-
but
here
I'm
doing
go
and
here
I'm
doing
it
in
yemo,
but
it's
basically
the
same
thing.
The
only
difference
is
that
here
I'm
saying
that
the
name
of
the
object
is
going
to
be
the
name
of
the
machine.
A
Meanwhile,
here
I'm
just
saying
the
name
is
that's
the
only
difference
and
I'm
gonna-
I'm
gonna
use
this,
so
I
can
get
basically
an
empty
web
object
that
I'm
gonna
create,
and
here
I'm
gonna
use,
create
or
update
the
way
creator
update
works.
Is
I
make
this
big,
so
I'm
going
to
create
an
object.
A
It's
going
to
be
based
on
the
properties
that
are
on
these
on
this
object,
which
I'm
creating
on
the
function
that
you
just
saw
and
if
the
object
is
already
there,
I'm
gonna
update
the
object
and
I'm
gonna
update
the
object.
Oh
I'm
gonna
update
the
object
with
this
function.
A
Now,
as
you
can
see,
this
function
doesn't
do
anything,
and
the
point
is
we're
not
doing
any
update
we're
just
using
this
function
to
create
a
thing
if
it's
not
there
yet
so
we're
gonna
see
a
bunch
of
object,
not
updated,
because
no
change
or
something
something
in
the
so
yeah.
This
is
pretty
common.
We
have
a
log
line
here
and,
if
you're
wondering
by
the
way,
where's
my
cursor.
A
So
usually,
when
I'm
writing
the
code
here
below,
it
tells
me
like
the
types
of
things
and
stuff
and
right
now,
it's
not
doing
that
and
it's
annoying.
I
don't
know
why.
But
what
I
wanted
to
say
is
that
the
joke
that
I
usually
say
when
sam
decides
to
work
is
that
oppressed
here
is
not
a
comment
on
the
systemic
oppression
of
capitalism.
It's
just
because
the
return
of
this
function
is
called
operation
result
so
oppressed
yeah.
A
The
joke
would
work
if
them
were
helping
you,
okay,
okay,
so
now
this
is
probably
already
running,
because
coach
is
very
smart
and
already
picked
it
up.
A
Okay,
it's
running
so
in
theory.
If
I
create
a
playful
machine
now,
the
machine
controller
is
gonna,
create
a
lab
object
for
me.
So,
let's
see
if
that
works,
so
cube,
cuddle
get
web
and
watch-
and
here
I
can
do
cube,
cuddle
apply
playful
and
there
you
go
so
now
we
have
machine
play
for
wife.
So
we
know
that
when
I
create
a
platform,
this
feels
like
a
joke,
directly
assisted
by
goal
line.
A
Yes
right,
yeah,
I
agree:
where
was
it
right?
Okay,
so
now
we
know
that
the
machine
controller
can
create
web
objects
that
are
then
going
to
be
handled
by
the
web
controller,
and
we
know
that
the
web
controller
is
working,
because
here
we
can
see
the
lab
controller-
and
I
don't
see
my
message
here
so
I'm
going
to
hide
it
by
hand.
A
Why
is
the
search
not
finding
it,
though,
what
an
ass?
Okay?
There
is
a
hello
from
web
controller
here
somewhere
in
the
middle
of
this
mess,
so
because
every
time
the
little
the
little
finger
thingy
on
the
status
updates.
I
get
a
new
message
here,
so
we
have
a
lot
of
transit.
A
A
The
thing,
though,
is
how
many
hello
from
web
controller.
We
can
find
here
just
a
couple
right.
A
A
I
set
it
up
and
I
say
the
lab
reconciler
is
only
for
web
objects.
So
of
course
it's
not
gonna
updates
to
machine
objects
are
not
gonna
run
through
this,
because
I'm
not
telling
it
too.
So
let's
do
that
and
once
again,
I'm
going
to
cheat
I'm
just
going
to
copy
some
code
here,
because
it
is
too
long
and
boring
and
once
again
I'm
going
to
put
some
trash
here
and
then
I'm
going
to.
A
Explain:
okay,
so
I
can
save
this
already
far.
This
far
function
here
is
actually
kind
of
like
an.
It
is
a
wrapper
for
a
watch
function
that
looks
sort
of
like
this,
but
slightly
different.
Now.
What
is
this
watch
doing?
It's
saying
that
whenever
there
is
a
thing
from
a
machine
object,
I'm
gonna
do
you
know
magic
so
that
I
can
map
those
things
into
controller.request
objects
and
these
objects
are
gonna,
consist
of
name
and
namespace.
A
Now,
if
this
sounds
familiar
to
you,
it's
because
reconcilers
they
receive
control
that
request
bits
of
data
and
those
control
that
requires
bits
of
data.
They
do
contain
a
name
and
a
namespace.
A
So
basically,
I'm
saying
hey,
there's
a
bunch
of
crazy
kubernetes
stuff
going
on.
I
want
to
turn
that
bunch
crazy
into
something
that
my
reconcilers
read
and
understand,
and
that's
what
we're
doing
here
and
now,
because
I'm
basically
saying
watch
the
web
objects
and
watch
the
machine
objects
every
time
there
is
a
creation
deletion
or
update
to
either
machines,
machine
objects
or
web
objects,
either
of
the
two
I'm
going
to
get
a
call
on
this
reconciler.
A
A
A
Trying
to
you
know,
go
to
the
little
button,
but
something
you
can
see
is
that
now
I
have
a
ton
of
hello
from
my
controller
and
that's
because
not
only
is
my
web
controller
being
called
when
a
web
object
gets
changed
or
updated
or
created,
I
also
get
the
web
controller
is
also
getting
called
whenever
anything
changes
on
my
machine
and
so
yeah.
A
That's
why
you're
seeing
all
the
stuff
here
and
there's
a
bunch
of
web
controllers
that
it's
not
highlighting
yeah,
so
there's
like
40
minutes,
and
that
is
basically
what
I
had
to
show
you
so
now
you
know
how
to
create
a
custom
resource.
You
know
how
to
create
a
controller.
You
know
how
to
use
a
controller
to
create
resources,
update
resources,
delete
resources,
you
know
how
to
make
a
controller,
create
an
object
of
another
type,
and
you
know
how
to
make
a
controller
watch
different
types
of
objects.
A
So,
for
example,
maybe
you
have
a
database
controller
and
it's
watching
for
specific
pods,
and
if
your
database
pods
dies
and
gets
brought
back
to
life
with
kubernetes,
then
maybe
your
database
controller
is
going
to
do
like
database
migration
to
build
that
database
with
random
data
that
your
application
cannot
use.
I
don't
know
something
like
that.
My
point
is
you
can
get
paid
and
do
a
bunch
of
stuff.
So
that's
what
I
had
to
show
you
and
if
you
have
questions,
feel
free
to
do
the.