Overview

About this video

What You'll Learn

  1. Scaffold a Go Operator SDK project, define a custom resource API, and implement controller reconciliation math logic.
  2. Generate CRD and RBAC manifests, deploy the operator to a Kubernetes cluster, and observe reconciliation of sample resources.
  3. Use controller-runtime patterns and struct tags to validate required custom resource fields and optional behavior during reconcile.

Dennis Kelly walks through the Operator SDK by building a Go-based "add" operator: scaffolding a project, defining a custom resource, writing the reconciler with controller-runtime, generating CRDs and RBAC, and deploying it to a Kubernetes cluster.

Chapters

Jump to a chapter

  1. 0:00 Holding
  2. 0:30 Introductions
  3. 1:12 Introduction & Sponsor
  4. 1:47 Guest Introduction: Dennis Kelly
  5. 3:20 What is an operator / What is Operator SDK
  6. 3:29 What is a Kubernetes Operator?
  7. 4:33 What is the OperatorSDK?
  8. 5:08 Project Goal: Building an "Add" Operator
  9. 6:07 Prerequisites & Initializing the Project
  10. 6:15 Creating a new operator
  11. 8:00 Creating the API (Custom Resource Definition)
  12. 11:05 Defining the Custom Resource (CR) Schema (`_types.go`)
  13. 13:50 Adding fields to our custom resource definition
  14. 15:36 Implementing the Controller Logic (`_controller.go`)
  15. 15:40 Adding our business logic / Reconcile
  16. 21:55 Generating Kubernetes Manifests (CRD, RBAC)
  17. 24:00 Deploying / running our operator on a Kubernetes cluster
  18. 26:05 Creating a Custom Resource Instance
  19. 26:39 Verifying the Result (Viewing CR Status)
  20. 29:25 Demonstrating CR Update & Reconciliation
  21. 30:51 Further Discussion & Use Cases
  22. 37:46 Discussing CRD Schema and Validation
  23. 44:39 Future Plans for the Project & Community
  24. 46:59 Conclusion
Transcript

Full transcript

Generated from the English captions. Timestamps jump the player to that moment.

Read the full transcript

1:12 Introduction & Sponsor

1:12 Hello. And welcome to today's episode of Rawkode live. I'm your host, Rawkode. Now before we begin, I just wanna take a brief moment to say thank you to Equinix Medal. They are my employer and they provide the time resources for me to invest in the show, thank great hosts, and get find experts to come and share their knowledge with us so we can all learn together. If you wanna check out Equinix metal piece, feel free to use the code Rawkode dash live. This will get you $50 in credit. That's roughly around a hundred hours if you

1:42 spend it wisely. But go the fun route and spend it much quicker with larger machines. So today, we are gonna take a look at the OperatorSDK. And I'm very fortunate to be joined by a colleague of mine, Dennis Kelly. Hello, Dennis. How are you? I'm great. Thanks for having me today. No. My pleasure. Definitely. So you are a you work for Equinix Medal too, which is fantastic. So, know Yeah. And you are a staff Kubernetes engineer. So you spend a a great deal of your time working with Kubernetes. Do you wanna give a quick introduction of yourself, and then

1:47 Guest Introduction: Dennis Kelly

2:15 we'll talk about the OperatorSDK as well? Absolutely. Denovan diesel is my Twitter handle, and you can find me there and ask questions later if you want. My nickname is Deno, but I also go by Dennis. I work on our delivery engineering team here at Equinix Metal, and we stand up the Tinkerbell API that we use for provisioning on our Kubernetes clusters. Actually, only been here a few months, but already learning a ton and excited with the work I'm doing on the OperatorSDK and happy to share that today. Awesome. I think we actually joined roughly around

2:53 the same time, if I remember correctly. Yeah. We have our first comment already. So Hannah says, excited for this talk. And I think they possibly know you because they say, hey. So hi. Yes. And I I need to give a shout out to Hannah, and correct everyone on the proper way to say Kate's and that's CooperNoodles. So we'll be doing some CooperNoodling today. CooperNoodles. You know, I like it. I'm on board with that for sure. So can you tell us just in a summary, what is the OperatorSDK? Well, even to back up a little further, let's

3:29 What is a Kubernetes Operator?

3:33 talk first What are Kubernetes? Yeah. Hopefully, people understand what Kubernetes is, but the Kubernetes operator is, just an extension of the Kubernetes API. When you think about interacting with Kubernetes cluster using kubectl or kubectl, however you wish to pronounce it, you you can then extend the Kubernetes API to do, like, custom automatic programmatic things and, define custom resources within your, Kubernetes cluster. And, you know, it's very popular in kind of like the DevOps y, area that I work in because, you know, there's things that you wanna do like backups or, you know, customized automated deployments. Say you wanna

4:24 create your own auto scaler, the Kubernetes operator provides a powerful platform to automate a lot of those tasks. And, the OperatorSDK, while it's also while it's available in Golang and what will feature today, you can also do this with Ansible and Helm, and other platforms, but, it's just a very powerful platform that kind of bootstraps your operator development environment and makes it easy for you to, develop operators for your environment. Okay. So what we're we're gonna write an operator today, if I'm not mistaken. Is that is that correct? Yes. We're gonna do a very simple case. We're gonna call this the

5:08 Project Goal: Building an "Add" Operator

5:11 add operator where we basically take two add ins and compute the sum. And while typically your operators are gonna interact more so with objects and resources within the Kubernetes ecosystem, This will at least demonstrate how to get up and running with some simple business logic, but then we'll also wire in some useful tools that you would actually use for interacting with those other resources. Okay. Will we be running today's operator and say that for Kubernetes cluster? We sure will. Alright. I've always like you know, I've I've dabbled in this in the past and never really been terribly successful.

5:55 And I think it's just always the that development environment and how you how you work with it, how you get it. And so I'm looking forward to just seeing you kinda break all that down for us and and Yeah. Absolutely. Learn a lot. So should we get your screen up when we get started? Yes. Yeah. Let's go there. So here you see I have a Mac with a terminal open. Really, the only prerequisites to building this is having make installed and having Golang. And I'm using I think it's 1.15 and then the OperatorSDK. The latest version is

6:15 Creating a new operator

6:37 1.2. That's what I have downloaded, and you can get that using brew. And so when building an operator with Golang and the operator SDK, you're gonna wanna start in a directory that's in your go path. And so that's why I have this go source GitHub demo van diesel. And I'm just gonna make a directory here for our new operator, and we'll close this guy down for a minute. We got some commands here. I'll copy and paste because I am not the best typer in the world. And so we're gonna knit this directory. We're gonna just gonna use the domain example.com,

7:25 and that's basically the domain name for the, schema that we're going to create. And I'll list me as the owner, d e kelly at equinix dot com. Here, it's gonna leverage the controller runtime and, basically set up our directory with all this, boilerplate, code. And you can see we have a make file, a Docker file, a bin where it's already built our first manager with basically nothing inside of it. And the next thing it's gonna want us to do is create our API. Okay. Do mind if I ask you a few questions as we go? No. Please.

8:00 Creating the API (Custom Resource Definition)

8:07 So, like, you know, I I've I've never done this before. So some of these questions will be hopefully just to clarify my own understanding. But the operator SDK has a a binary as a command that you have installed. It's just for it's just for this boilerplate stuff. Right? It's it doesn't really do anything else. Everything else is consumed, I'm guessing, by something in the go mod that points to the operator SDKs. Correct. So OperatorSDK is just creating the the directory structure for us and building our initial main .go, which is gonna kind of be the manager that gets built. And the manager

8:46 will then have controllers for the operator and, you know, and then when you want to say apply a custom resource that is of this type, it'll go to the reconciler for the operator to do the business logic, compute everything, and return the results. Okay. Sweet. And that domain flag that you have passed, is that gonna be like a prefix for API version? Like, is that what separates out from other controllers? This one I have highlighted. So, like, the initial operator in it that we just ran just sets up the directory structure, and then we're going to actually add the

9:34 schema to our API with this next tab. Okay. And I guess I just sorry. And you go. Go ahead. I I guess I just didn't understand the --domainexample.com in the previous command. So, like, when you create a resource in Kubernetes, you're telling it it's it it has this schema and it's typically domain.com/v1 or whatever. And so that's all it's that's using that in the Okay. The custom resource definition. And so it can be anything that you want it to be. Example.com is just kind of the the default. But typically, you're creating your own schema to extend Kubernetes,

10:23 you would use your own domain name. Okay. Thanks. And it'll make more sense here in a minute too. Because now we're creating this add operator, and we're just gonna put it in a group called math. Because say we wanna do a subtract subtraction or a multiplication operator later, we can still add it to the same project or just have it part of that schema group. And so And so now we have kind of all the files that we need to start developing the operator, and we'll start here with the the main entry point. And so you can see it's,

11:05 Defining the Custom Resource (CR) Schema (`_types.go`)

11:18 you know, using the controller runtime to set up everything. And the nice thing about this is behind the scenes, it's creating the manager for the operator and adding in a lot of features that you'll want down the road, like, automatic, collection of metrics. You can do leader election if you want to say run multiple replicas. And and then it's just wiring in our controller into the manager and then starting it up. And so there is one addition to the controller that I'd like to add is oftentimes with custom or with resources, you're gonna want to

12:07 add a recorder so that you can publish events. So say your operator is, you know, building up a new application, it may take time for it to, you know, download the image, deploy the container, and you can then, since it's asynchronous, you can, publish these events so people can then check-in on the kind of status of their resources being built. And so the manager already includes a record or has a recorder, so we're just gonna add this to our reconciler right here. And so we were creating an event recorder for add. And, you know, other things you could do is,

12:57 you know, here we have a logger that's set to use dev mode. You could say add another flag to your, container startup that says, you know, whether or not you wanna use dev for production. Just have that be a boolean and then have that specified here when you set up your login. And so the nice thing about it is it really, you know, sets you up to, like, really focus on your own business logic and your own, APIs and controllers. And so since we created the API under, v one beta one, we then go into our ad types, and

13:41 this will be the schema for our operator. And I've, again, kind of prebuilt this before. And, again, I'll just copy and paste, and you'll see it bigger here on this screen. And so, again, this is kind of a template scaffolding file. Add spec is how we define the desired state of the operator. And so what we wanna be able to do is take two add ins and compute the sum. And so what we're going to submit to the API are those two add ins. We're gonna say they're integers, and then there's a next thing we do for the

13:50 Adding fields to our custom resource definition

14:29 status is the observed state. And so when it's all said and done, we wanna have that sum computed and available. And so, you know, this really defines the the API that we're building for this operator. We really don't have to do anything else with it because our ad spec and ad status then become part of the ad struck ad list. And then we the schema builder will register those two new schemas or custom resource definitions within the the cluster. Okay. So when we ran that last generate command, I noticed that it add I asked you two questions. Do you want to add

15:16 a resource and add a controller? So, like, that boilerplate is just an empty custom resource definition with a controller that's watching it, and then we have to then decide what gets in that spec, what gets in that status. And that's you're just adding that to the obstructs, like. Yeah. And it's it's easy as that. And so the last one it can created was our controller. And again, kind of boilerplate code, and and so it's setting up our reconciler and our logging for you. And so one thing that we did with our reconciler is we added in an event recorder.

15:40 Adding our business logic / Reconcile

16:00 And so we're gonna want to also add that to the definition of our controller here. And I'll and then demonstrate how to use that. And so the reconciler has within it your logging, the, schema, and then it also includes a Kubernetes client so that we can then, query to, like, either list, create, update, objects within Kubernetes. And so what we're gonna do here is I'm gonna kind of bring in some more boilerplate. Because what we're gonna wanna do is when we receive one of these custom resources for the ad, we're gonna pull in that as a as a what we call our

17:04 instance. And so it's of type math b one beta one and that ad struct that we created in our ad types over here. And so this ad struct is gonna have metadata, the ad spec, the ad status, and that is the object that we're working with in Kubernetes. We use our reconciler client to get that instance. And then we're just, you know, kind of checking errors and also recording events based on those errors. So, someone wouldn't have to necessarily go into log files to debug problems with their custom resource that they just created. They could just describe it and see, you

17:53 know, what error had occurred. And so if the error is that it's not found, we want to just return it and requeue. But if we have a problem reading it, then we're gonna retry reading that request. And so that's all we're doing here with the boilerplate. And then the next thing that we're gonna do is just up, compute our sum. And update the status. And so here, the instance dot status sum is coming from the spec of our two edits. And then once we calculate that sum, we want to update that object in Kubernetes. And so here, we're doing this using

18:46 our Kubernetes client again, the status update on that instance because then it will publish the sum into that custom resource. And, again, using logging to and event recording here to post errors. And, yeah, I found the event recorder to be super helpful because that way operators can easily obtain information about the status of their custom resource without having to go to log files. Yeah. I think it's one of my biggest frustrations when I'm working with Kubernetes is, like, the event log is just sitting there empty, and I'm like, well, nothing's working, and I have to start Yeah. Hunting down every log

19:30 from everything I I can find. Like Yeah. Yeah. And so this function down here is set up with manager. That is what gets called in our main go routine to add this controller to the manager. And so we created the repository as, you know, the add operator, but we could say change the name to MASH dash operator and add additional controllers into this. So and, you know, having these as kind of your boilerplate files, we could copy it over and create say a subtraction spec and a subtraction controller. Okay. So and your experience then, do you think it's better to do

20:15 you separate out all these reconcilers to be their own different controllers? Or do you use one controller that kinda monitors multiple resources? Like, what is the best practice there? I think it really depends on, like, the business and, you know, as always, like, the business and the situation. Like, I I like I like to think of the operator as a manager of controllers. And so, sometimes there's different operations that you wanna do with from within, like, the same management organis so if you're thinking about people, you're gonna have a manager, and then you have multiple

20:55 operators working for that manager. And those operators, you know, are gonna have these reconcilers, like the procedures that it runs for to do specific tasks. And so, you know, based on the request, you know, that's gonna define, like, the API. That's the request coming in. And then there's a procedure to run on those specific, values. And so you can have multiple operators or controllers under one manager, and we're actually doing that with more extensive operators that we're using in production. And it and it just makes sense. You're deploying one pod and they and they kind

21:40 of share a lot of the same back end code in terms of other business logic that it's gonna perform. But if they really don't share any code, it's fine also separating them up. Okay. Cool. Thanks. And so, you know, now that we've built our the functionality to do everything, we're gonna we're gonna generate the configs for this because we went in and updated our schema here. And so when you update the schema of your controller, you then need to recompute the custom resource definitions, and it's doing it from this code. So that way, we don't have to

21:55 Generating Kubernetes Manifests (CRD, RBAC)

22:36 build all of that YAML ourselves. Is that with that weird comment syntaxes with the pluses at the start? Is that a I mean, is that a Golang thing or is that just something the operator SDKs is parsing out of the the code? Yeah. That's the upper like, the controller generator. It's taking a look at this ad types and then generating the spec based on this Golang file. Okay. See lines thirty seven thirty eight, they look special. And it's it's not something that I I've seen before in Go. I just wasn't sure if that's a Go thing. Is this just

23:12 an operator cube builder thing? Like It's a it's a operator. So it's using those as annotations. Alright. Okay. And so we can now see we'll use so we have our map.example.com ads. And based on the file that we created in Golang, it's created our custom resource definition that will get added to Kubernetes. Well, even that's all the open API stuff. And then one thing I won't do live here is pushing or building the the building the manager, our our operator, and pushing that to a repository. Then, you know, I'm I don't have the greatest Internet. It would

24:00 Deploying / running our operator on a Kubernetes cluster

24:16 take a really long time. So I've already pushed this to a cluster, but I can show you what you would need to do to make that happen here as well. So what you're gonna wanna do is, you know, add this custom resource to your cluster. So I'm just k apply the config CRD basis. And then you'll push the role in binding because, again, all of these are generated for you. So you'll apply that and then apply the role binding. And we're just going with the defaults right now, but you can go in, and, you know, change the namespaces

25:17 and the user that you wanna use for all of this. And the config manager manager is actually what deploys the operator. And that's done after you do because here in the make file, you can see, all your options. And so, like, manager will actually build the operator for you, and and then you can also do a docker build, and that will put it in an actual container and then push it. And in our case, we're pushing it to a COI back end. And so with this operator now deployed, we can create our custom resource. And so

26:05 Creating a Custom Resource Instance

26:10 this is where that example.com comes in because here our API version is math.example.comv 1 beta one. The type of, the kind is add. We're giving it a name of five plus seven. Hopefully, I didn't screw anything up in the cluster. And then we can k get. And we'll wanna do minus o YAML here. So you can see the spec had these two add ins, five and seven, and we define that in our add dot types. We computed the sum and pushed it back to this custom resource. Sweet. And so yeah. That's the, like, very basic

26:39 Verifying the Result (Viewing CR Status)

27:14 business logic. You know, oftentimes, you know, you'll be submitting values to, say, pull a list of pods in and then perform some action on those pods based on the output of what's currently running. And then your custom resource definition will keep that group of pods in that this consistent state all the time. Okay. Able yeah. So I just I I I wanna understand this. I'm gonna just throw some complete newbie questions at you here. Like, the boilerplate that you've built. Right? I mean, you only added, like, five lines of code to this to this project. Right?

27:59 And does this magic reconcile function which is being called? Now what triggers that reconcile to happen? So, basically, this reconciler is we're what basically, what we're doing is extending the Kubernetes API to support new schema. And so what triggers the the reconciler is when we add this custom resource here. So this is the API version and this is the kind. And because we uploaded that custom resource definition into the cluster, Kubernetes now recognize this as this as a resource within the cluster. And so and if you look, here's the self link, apismap.example.comv1beta1 namespace system ads, and then this is the

28:56 name of our, custom resource. And so, basically, we're just creating a new resource in Kubernetes because, like, you know, by default, it supports, you know, pods and secrets and, you know, all the various resources within Kubernetes environment ecosystem, and we're extending that API to support this mass operation. Okay. So if you modify that fail and change the five to 31 and apply it again, does that cause the reconciled to then rerun and update the status? Yeah. We can keep the same name. So it'd be it'd still be the same resource, but we'll change this to a seven.

29:25 Demonstrating CR Update & Reconciliation

29:50 And so here, it it didn't say that we created five plus seven. We configured five plus seven. We're changing the state of it. And so then even though the name of the resource is five plus seven, we have a new sum. Cool. And that's just all provided by the operator SDK hooking up everything that we need. So you really when you said you just need to write the business logic, like, that's that's that's a pretty cool way of doing it. No. Like, I I found this to be super powerful and cool because, like, you basically get to dive right into your own

30:29 business logic and, you know, say you wanna start scaling pods. You can, you know, get information about the pods, based on the metadata that you provided. And then, like, oh, we're at a certain we're at a certain low level. Let's, say add two more, pods and scale the app. Okay. Nice. I like it. Yeah. And and so, yeah, it has a lot of applications for software developers, DevOps, security, even testing because you can, you know, mock mock failure situations within an operator to, you know, test your environment. So but it's a really powerful platform for,

30:51 Further Discussion & Use Cases

31:11 you know, managing Kubernetes. K. Definitely. I can I can see what's I pretty much believe this is is so appealing? Just, like, I find the code and right away that things is running inside the cluster monitor and custom resources, subscribing to events in the Kubernetes API, and then call the record cell phone. I mean, there's a lot going on there under the hood and Yeah. Absolutely. And then, you know, the deeper you get into it, you know, you can go into this controller runtime and learn about all the other things a manager can provide or a controller can provide

31:44 to extend it. And I showed one example of, say, adding that event recorder because then when we like, we didn't have any errors, but, like, when you say describe your resource, if I can type, you know, we have no events posted. But say we ran into errors, all of those would be listed down here. Okay. Can we trigger one of those? Well, I wonder if I I I don't think I I think that would be hard given the errors that we're checking for right now. But because the other thing too is it sets up a a testing framework,

32:37 in the sweet tests. And so with this simple example, you know, we're not really checking for, say, integer overflows. And so maybe we pass two integers and that would then buffer over overflow the integer that we're putting it in into, we could check for that as say a, as a test case and then air on that so that we don't cause problems. Okay. So what is the sorry. If you is there something else you wanna go on to before I just keep throwing stuff at you? Keep throwing away. Yeah. So, like, you know, as a a developer. Right? I mean, I'm

33:21 sold now is that I I wanna use the operator SDK if I'm gonna build an operator. Like, you know, if I were to make a change to this code now, say we wanted add a new event recorder just every time it's updated and say, oh, we changed the value from the value change from this test or whatever. Like, what's my development experience like? How do I just do go run and it runs on the cluster? Do I have to build the image? Do need to use other tools, like, scaffold or tell? Like, what is the the kind of

33:47 process? So, you know, we could say do a R recorder. We're gonna post it to our sync. Because we could also add events to other resources within but we'll add it to our instance here, event type info. Well You're gonna have to get Kubernetes in there somewhere too. Yeah. And so if we let me see if I can build this quick enough to have it, add that functionality in. But, basically, you would see in the like, if you look at just a standard event from another resource, it would just say, you know, for for your instance,

34:55 we called it five plus seven info type sum and then computing sum on Kubernetes. And, you know, these are useful when you have business logic that's going to take a long time. Yeah. And so we just add that simple line and then Oh, I forgot to do my imports. But, I can go back and add that real quick. So I'll just share a link on the screen as well to that repository. So, you know, feel free to I can yeah. I can make that public. Right now, think it's internal to school people at Uh-huh. Equinix Medal, but,

35:49 I will, I'll I'll talk to my boss. We can open that up. I don't see that as a problem. But, yeah, then you would just make your image. So you would make your new image. You, would then push it to your repository. And in our config, manager manager, you know, this is where it gets deployed. And so, if, say, you with your Docker push, you don't use latest, you could then update this file here to specify the specific PIN that you wanted to use, and then it's just k apply config manager. I mean, I take it you're just using

36:39 Docker for Mac here. Right? Yes. Oh, yeah. So, I mean, if you don't actually need to push that to a remote repository. Like, if we add image pool policy, if not present to that, then it should just work with the and build Docker for Mac one. Yeah. I'm actually I'm actually, using one of our Kubernetes clusters that are Oh, nice. Metal. So not not on my Mac. That's why some of the, results take a while to come back. Right. Okay. So But, yeah, here, I do a Docker login to Quay, and then I push the image

37:19 to this packet add operator. And then I've updated the config to use that Quay image. Okay. And so, yeah, this is this is running on a fully functional Kubernetes cluster. Right. Okay. That that's why we we're not building and pushing. Got it. That makes sense. So can we take a, like, take a look at that struct as well that we defined for our CRD? Yeah. Because I'm thinking, you know, in my head, what if we've got slightly more complex custom resources? Like, is there a way for us oh, yeah. If I I can see some

37:46 Discussing CRD Schema and Validation

37:58 sort of annotation stuff here. So maybe we can go over that. Like, what if I've got mandatory fields versus optional fields? Is is there a way for me to kinda specify that? I don't think I've gotten into that in with my experience yet. But, basically, everything is required. So right now. And so if I modified our our add YAML and I removed add in one, it's gonna error on us. Oh. I cannot type. Yeah. That's the that's the curse of people watching you. Your typing spells always go out the window. Oh, it's not gonna be required.

39:07 But say I added something that wasn't here, like That's so weird. I've never seen that yet. Of course, during demos demonstration. Yeah. I think Kubernetes is just like I mean, let's describe it. Let's see what five plus seven actually looks like in the cluster. Let's get or do a dash or YAML, whichever one's gonna show us more details. Yeah. But I guess Kubernetes. So I I actually expected it to work when you removed one because I've seen an annotation in your structure that says on the empty, and that kinda seems to me like Yeah. Maybe an optional

39:50 annotation. I'm not really sure. I'm I'm guessing more than anything. But So it looks like it initialized add in one to zero even though it's it wasn't there because it we still have a sum of seven, and it didn't air out. And I think that has to do with you can specify annotations whether to be strict or not on your Yeah. Schema. And so, I think it would be from what I've worked with on operators thus far in, like, the two months I've been working with them, I actually air out if we don't have the information we need. And then

40:30 if it's not if it's optional, then you can default that value or just continue on without it depending on what the situation is. That's sweet. Cool. Alright. If anyone's watching and has any questions, feel free to drop them in the chat and we'll tackle them before we we finish up. I guess I can throw a few more at you just know where we where we went. So let's say let's pop up on a reconcile function again. Have a look in there. Oh, sure. I think I'm just I'm still kind of amazed at how little effort is actually required

41:07 to to kinda get something to get something There's a lot of lots of magic going on. Yeah. So So, yeah, the only things we added was where put your logic here, and we return the result at the end. So Yeah. That's pretty cool. I like it. Yeah. So is there any sorry, Nico. Like, another example would be to go can grab stuff from, say, core b one, like secret, and then specify the, you know, name and namespace of that secret and that you could then pull that in and manipulate it. Again, you can, you know, do,

42:02 our client get on pretty much any resource within the communities cluster. And, you know, typically, that's what you're going to be doing, grabbing pods, grabbing secrets, defining deployments. Yeah. Definitely. I I I can I mean, I guess we're kind of reaching a stage of I don't know if it's Kubernetes life cycle or or whatever, but there's a bit of a proliferation of controllers? Like like, everybody seems to have a controller for almost anything now. And, you know, when you see something like this and you're walking through and showing us how to take advantage of the operator SDK, you can kind

42:42 of understand why. Like, Yeah. Yeah. Because you you you get a lot from it, like, know, by defining a couple of structs angle, then you get all these custom resources that are available to your Kubernetes cluster. We can add the business logic to the reconcile function and just deploy it. And then we have our own ability to tweak the way that Kubernetes works to a certain degree. It should Yeah. And I'd also mentioned too that operator Pre one point o is kind of different, and I think a little harder to use where that's why I focused on the one dot

43:20 o, or one dot x series because, you know, it already wires up all the metrics for you, generates even more of the or, like, hides more of the boilerplate that you would have to have in your own files anyways. And there are a ton of examples, especially with Golang out there right now. And so and again, with, you know, hopefully, improve documentation and, you know, help the community with that to to make this even more viable because it's yeah. Super easy to use and really nice to get up and running with once you understand the concepts.

43:59 Yeah. Definitely. Cool. Thank you. Is there anything else you wanna cover? I think that's it. People can hit us up on Twitter after this or on YouTube and happy to talk about more operator stuff. Yeah. Definitely. Feel free to to grab either of us on Twitter. I think we're we're both I think it's safe to say that we both like talking about Kubernetes. So or Kubernetes. Sorry. Yeah. Yeah. Definitely. So like the ad operator, let's talk about the the why behind. I'm assuming you build this as a demonstration and a training materials so that other people can see how to

44:36 get started with assess this. You know, it's it's internal right now. Like, is it something that you're gonna continue to add on with more examples? Like, what what's your plan for the ad operator? I think the first thing is to go back and put some open source slide system on this and make it a public repository, and then, you know, work with the community to provide more examples. I might just call it, like, the math operator. That way we can add, other, controllers in there to show how you would wire up multiple controllers under one manager,

44:39 Future Plans for the Project & Community

45:13 demonstrate how you use Ginkgo, which is the testing framework Mhmm. And and check more of those edge cases, like, say, we're gonna overflow an integer, you know, how do we wanna handle some of those edge cases so that we it's kind of a secure example. And then, you know, maybe some more examples of how you would interact with the Kubernetes ecosystem, like, listing, retrieving objects, updating them based on it. And that so that might be just become another operator if we say move outside of the math concepts. Yeah. I I I think based on what

45:55 you're showing me, I think with my limited programming skills, even I could probably add like a subtract controller to this. I I mean, I think I can maybe handle those five lines of code. I'm not sure. But at least I've got you No. I think I think you should actually that should be your next task. Exactly. Right? I should just be like, hey. Let's add this subtract one. Because I could just add the types and then the reconciler and then like, boop boop. And that's just the way it goes. Yeah. Maybe I will do that

46:19 for a bit of fun. Yeah. It's it's super easy. Send me the PR. Alright. Okay. So we just got a couple of comments there. So great ad pun and good values. Because the emoji showed up, it doesn't Yeah. Alright. That was really useful. Really nice introduction to OperatorSDK. I'm looking I'm hoping we can open source this as a bit of a fun experiment and encourage people to, you know, come along and and add new types and just I think it's a really it could be a really cool and fun educational resource for anyone that wants to put down this path. Yeah.

46:55 It's a great playground. Yeah. For sure. Alright. Well, thank you very much, Dennis, for taking time out of your day to join me today and to putting that together and walking us through it. Really useful. So My pleasure. Thanks for having me again. And then we'll try and maybe organize a part two then once we get us open source and see what we can do. Absolutely. Sounds good. Sweet. Thank you. Have a great day and Thanks. Bye.

Technologies featured

Meet the Cast

Weekly Cloud Native insights

Stay ahead in cloud native

Tutorials, deep dives, and curated events. No fluff.

Comments, transcript, and resources

More from Rawkode Live

View all 173 episodes
Kubernetes

More about Kubernetes

View all 172 videos