 Hello, and welcome to this video. My name is Ricardo, and today we're going to talk about the OpenShiftServer logic, which is the new feature that we have on the OpenShift serverless for Red Hat. So for this quick demo, I will introduce you for the project, what we have, the features of the upcoming component that we have and why you should care about workflows in general. So the first thing that you have to do is to download Visual Studio Code and this extension, the CodeG2 serverless workflow register that will enable you to create your workflows and deploy them as an application on Kubernetes cluster or OpenShift, of course. The first thing after downloading Visual Studio Code and the editor would be also to have to download and install in your machine Java, Maven, and also the KN CLI and Quarkus CLI command line interfaces. So in this machine, I already have Quarkus installed. Also we have KN command line installed, Cubicodo, and Maven as well. So I will let all the resources and links and how to install this on the description of this video. Okay, so the first thing after setting up your environment and have the editor set up, you should create your first project, your first workflow so you can, in order to create your workflow, deploy it on the cloud. So the first thing, using the KN workflow command, I can create my project, which I call my first OpenShift serverless logic. So this project will be created for me. Oh, all right, have it. So let me first remove it. All right, so let's create again. So yeah, like I was saying, you create your first project by using KN workflow create and a meaningful name for your project. After that, the only thing that you have to do is to use the Visual Studio Code and open this project. So my project here, I created under documents, my first OpenShift serverless logic. And if you're familiar with Quarkus, you see that it is just a regular plain Quarkus project, but there is no Java code nor anything like that. The only thing that you have to care, it is the workflow file that we created under source main and resources folder. So the bootstrap CLI would just create a blank workflow that can work in here, as you can see. But yeah, I have a more interesting one that we can use as an example, so you can start playing around with it. I'm going to copy and paste in here, and I will go walk you through this workflow. So first of all, this workflow language, it is an open source specification. And under the CNS CNCF umbrella, it calls CNCF serverless workflow specification. So it's meant to be used by serverless infrastructures to define workflow constructs. And with that, you can actually create your functions, define functions, define events, orchestrate services, orchestrate functions, everything under the Knative or OpenShift serverless platform. So everything that you have deployed on your cluster, you can, in a sense, orchestrate and play around with it using these constructs and using these workflows. So since you have the editor installed in your VS Codec IDE, you can easily play around with it. So as you see, on-site copy and paste, on-site pasted my workflow here. The workflow will generate this nice view here that you can follow around. And there is a few constructs in here. I will let the commentation in the description of the video, so you can take a look at the docs and see how that looks like. But it is pretty easy to understand. So let's take a look at the states. So we have the first one that we call a sweet state. That is basically, you have to choose your path, either if it is a language I selected was English or Spanish. Then depending on the condition or the result of this conditional, I go through a different node here. So I can go with the great in English state, if it is English language, or I can go into the great in Spanish state, if it is a Spanish state. At the end, I will concatenate this, the hello world and we will finish up and wrap up my workflow. So let me just change this to the Boolean value. So this language here, it is JQ. So it is a pretty popular language, expression language that you can use to manipulate the JSON data that you have within your workflow. So basically, serverless logic will work with JSON in its sense. So you have to push a JSON content to the workflow using HTTP or cloud event on the OpenShift serverless platform in the form of JSON data. So your JSON data is running within the workflow. So you can play around with it and select anything, do a few transformations in your data using JQ. It is pretty powerful language. So let's try to take a look into it and see how that works. In my terminal, I have here my project. So I'm in the root of my project and I'm going to use the Quark CLI to bootstrap the project and see how that would look like on my machine. So let's try to build that first. It can take a few seconds to wrap up since it is the first time that I'm doing this. We bootstrap the project. Yeah, there's a few tools that Quark will fire up when you are what we call DevBall. When you type Quark's Dev in the CLI, there's a few features and services that Quark will create in order to have more meaningful experience for your development cycle while you're in local. So yeah, let's try to access the application now. It should be available in the default, normally, usually the default port that we have, right? That is localhost88. So when every OpenSheepService logic project will have a swagger interface available. So once we create the project, you can see that my endpoint is named after my workflow, like JSON grid here and you can see in here the ID of my workflow with JSON grid. So I have this interface that I keep playing around and we can try it out this application. So what I have it is like the input of my workflow that is expecting the language as you can see and the name, right? So let's put my name here and I can easily just execute in here and I will create a new instance of the workflow and we should have a reply with my information and the grid in here. So as you can see, something is really weird, right? We have the greeting attribute here but no name, nothing like that. So what can be happened? Let's take a look. What we have is that once we finish the workflow, when we start the workflow, the workflow will just go here, choose the path since I chose English, go with English and then grid person and we'll execute this function here, what we call grid function and this grid function is just a sees out type of operation meaning that I'm just, you know, printing in the console the information that I have here, the expression that I have here, that is the greeting and the name attribute and as you can see here in the console, we have the message printed in the console. So it is not like the experience that I wanted to have, right? So let's try to play around a little bit with this and see what we can accomplish. So one of the things that we have in the workflow, it is the ability to do some sort of manipulation in the data that I have. So let's go to this grid person state, there is an operation state and I will add here the state data filter attribute. As you can see there is to provide me an intelligence that I can play around with it and also as I receive the information, my workflow goes here into this state. I can perform something here that I call an output for this state. So this state will output something here, you know, we will output as the expression that I'm going to add here without the runtime to do. So in this expression what I want to do is concatenate my greeting and my name. So I have right here, it is basically the same operation, the same expression that I have here. So I save this file and I try to call it again using the swagger UI. So you see, I don't need to be there again, I don't need to do anything. I just do the change that I need to do in my editor and I click on execute. So Quarkus will take every file that I've changed in my project and will do the change for me. And it will be with only the things that I've changed in my project. As you can see, the result of the workflow data, it is now the right greeting. So that's how we do. So let's say I want Spanish instead of English, so that's how that looks like. It will look like the message now it is. So look at this, the JSON workflow. So it is like a different message based on the language that I have here. So I stretch to something even better. What about adding a new condition in here? So instead of only English and Spanish, I'm going to do Portuguese as well. So, oh sorry, my mouth is a little bit crazy. So let me go and use Portuguese instead. So let me copy and paste would be way easier by Portuguese. Yeah, way better, instead of just clicking there. So I have English, Spanish and Portuguese now as options. And then instead of transitioning to greeting Spanish, I will transition to greeting in Portuguese. So as I have greeting Portuguese, I have to have a state that transitions to greeting Portuguese. So I have English in Spanish and I will also have greeting in Portuguese. That can be, I know how to type the same sentence in Portuguese as well. It is like this, hola, JSON workflow. Save my file and I will do the same thing again. Execute. Quarkus will just be with the new file that I've just changed it. And here's my reply with Spanish because I didn't change my language. Let's try now. Yeah, it works. So if I change to something that doesn't exist, what happens in this case is that I go for the default condition. As you can see here in green from chosen language, I go to grade in English because it is my default transition. Or if I wanted to go further and make it, I don't know, maybe a little more. You know, either for my users instead of typing the entire name, I just use the language code. So same thing, I change, I save. Of course I need to change the here as well. My request, I do the request again. And reply is over here. Nice. All right, so we have everything and we've finished our work in the local machine. And so I'm going to just stop the execution here for Quarkus Dev. I wrap up, finish my work. And now I wish to deploy this application on Kubernetes. Or on OpenShift, or any kind of Kubernetes flavor really. But for the OpenShift StriveLogic, we're going to use in my local environment, I'm going to use Minicube just to evaluate if I am doing everything correctly and it works. Okay, native. So I'm going to access my internal hash string here. And I'm going to use code to workflow instead of create. Now I'm going to use build instead. So, sorry. Okay. So what I'm going to do here, the first thing is that I'm going to build this image using, you know, this name as my image name. Dev.local means that I'm pushing the image to my local registry so I can, you know, I don't need to use any kind of external resource to push my image. That would just work. So let's build that. So the CLI will just take all the project information that I have here. The information about the image, the information about the project, and we'll create an image and push that to my internal registry of my Minicube. So, okay, we're waiting for a couple minutes. Okay, 35 seconds only. But I forgot to add one thing, actually. There is a, this file here, the application properties that you can do a lot of things with that and configure your application the way you want and do more advanced use case. In this case, I'm going to do it is just to add the option to add that nice interface of swagger also in production. That means that that interface is by default. It is only added in Quarkus Dev mode. But in this case, I'm going to add here just to have the option to play around with the interface also in the cluster. So let me build that in. Hopefully we now have the layers and we'll take less than 35 or not. Oh, yeah, this is the nice feature you can just spend here and the workflow will just rearrange together. If you're new visualization depending on the resolution of your monitor or anything like that. All right, we have the image and we can take a look into it. Yeah, it is here. Just create it. All right, the next thing now that we have to do is to see if we have a namespace, a proper namespace to deploy our application. So I'm going to create one. Create any ass. I'm going to call it demo. All right. So I'm going to set the namespace to demo. So it would be easier for me to deploy things and get my pods and everything. I don't have pods. As you can see, let's use KN to try to see if we have any service deployed. No, we don't have any service. So let's use KN to deploy our workflow. So the common is pretty simple, like KN workflow deploy. It will take your image, your project that you just built and push it and deploy it directly. Into the KN, into my namespace. So let's try to take a look to see if we have, yeah, we have, it is provisioning. Let's see. Well, it is already here. So if I click in here in this address, in this endpoint, I should be redirected to my swagger interface. But now in the cluster. So what I'm going to do now is try to access the application right now in the, in the cluster. And if you go to terminal when you try to see if you have any pods. Let's see there. It is running as a Knet service deployment. So if I do the same thing, like what we are trying to do now, let's try to do another, you know, request, but now using language Portuguese. Let's try name here. Name in Ricardo and execute it. Yeah, it's working. But now working on Kubernetes. So that's all for this video today. I want to show really how you can get you started with your first workflow, how you can deploy it on Knative. And I will leave in the description everything that you need to set up your environment and to understand this workflow DSO, but it's really, really simple. Really using intelligence of the editor and the visualization tooling that we have here. Everything would be much, much easier for you to understand and to create your own workflows. I intend to record more videos, more advanced videos and teach you how you can actually call an external service or an event or anything, you know, using for a use case, more complex use case as well. All right. I hope you enjoyed the video. Like and subscribe. See you. Bye-bye.