1 00:00:00,810 --> 00:00:03,600 We've now fixed up posts and the react application. 2 00:00:03,600 --> 00:00:06,960 So let's go and write out our routing configuration inside of our ingress controller. 3 00:00:06,960 --> 00:00:09,330 Now that we have all these unique routes but together. 4 00:00:09,600 --> 00:00:15,990 So I'm going to find inside of my infra K AIDS directory the ingress service I can find where we have 5 00:00:15,990 --> 00:00:17,560 path's list out right here. 6 00:00:17,640 --> 00:00:22,350 We're going to start to update this pad and update or add in a couple of additional parts as well. 7 00:00:22,390 --> 00:00:26,850 So first off as we just discussed requests coming in to create a post so one that is trying to go to 8 00:00:26,850 --> 00:00:32,880 the post odd is now going to have a path of post slash create. 9 00:00:32,920 --> 00:00:35,390 Then after that I'm going to add in another path. 10 00:00:36,390 --> 00:00:40,200 So this one will be for let's skip on to just slash post right here. 11 00:00:40,200 --> 00:00:41,900 Request comes in slash posts. 12 00:00:41,910 --> 00:00:49,370 We want to send it to the query Khaled my path will be slash posts. 13 00:00:49,510 --> 00:00:56,780 In that case the back end is going to be the service that is named wary SRB. 14 00:00:56,790 --> 00:01:00,120 Now let's get a quick reminder on what port that query service is running on. 15 00:01:00,120 --> 00:01:04,440 We can either print out all of our services at the terminal or alternatively we can just open up our 16 00:01:04,440 --> 00:01:06,680 posts dash depot file right there. 17 00:01:06,690 --> 00:01:11,880 So here's the url not post but query Here's the query service. 18 00:01:11,880 --> 00:01:20,390 Looks like it's 44000 to so a service port 4000 to. 19 00:01:20,590 --> 00:01:25,890 Next up we have a path of post slash I.D. slash comments. 20 00:01:25,930 --> 00:01:30,070 Now we are writing out some running configuration that's going to be interpreted by engine X right now 21 00:01:30,520 --> 00:01:34,020 and engine X does not support the same kind of like wildcard thing right. 22 00:01:34,020 --> 00:01:35,350 They're using a colon. 23 00:01:35,500 --> 00:01:39,670 Instead we write up parts and if we ever expect to have some kind of wild card inside of it we have 24 00:01:39,670 --> 00:01:41,980 to use a regular expression. 25 00:01:41,980 --> 00:01:48,760 So we are going to write out a path of slash both slash and here's our regular expression part question 26 00:01:48,760 --> 00:01:53,070 mark parentheses dot star. 27 00:01:53,130 --> 00:01:59,450 Like so and then slash comments so this is going to be a wild card. 28 00:01:59,480 --> 00:02:04,990 We can have any value what we want to have inside there as long as it is followed by slash comments 29 00:02:05,000 --> 00:02:05,630 at the very end. 30 00:02:05,660 --> 00:02:11,350 It's going to match up to this Pat in order to use regular expressions in a path right here. 31 00:02:11,370 --> 00:02:16,080 We do have to add in one additional line of configuration at the top of this file so I can scroll back 32 00:02:16,080 --> 00:02:17,130 up towards the top. 33 00:02:17,240 --> 00:02:19,850 I'm gonna find that annotation section instead of here. 34 00:02:19,860 --> 00:02:26,310 I'll add in one more annotation of engine X thought cougar net is next to me. 35 00:02:26,310 --> 00:02:27,630 Engine X ingress. 36 00:02:27,630 --> 00:02:28,230 There we go. 37 00:02:28,230 --> 00:02:37,980 Dot Coober net is that I O slash use dash rig x output in true inside of a string. 38 00:02:37,980 --> 00:02:42,720 Notice that there are quotes around us so it is not just true by itself it is true with a set of single 39 00:02:42,720 --> 00:02:44,870 quotes around it. 40 00:02:44,940 --> 00:02:50,530 So again that's going to allow us to use regular expressions in all of our path expressions. 41 00:02:50,550 --> 00:02:57,400 Now we've got that but together we can specify our back end this will be a service name in this case 42 00:02:57,560 --> 00:02:58,210 or this path. 43 00:02:58,210 --> 00:03:03,710 We want to reach out to our comments pod so common spot right here. 44 00:03:03,710 --> 00:03:05,540 We'll make sure that we specify the comments. 45 00:03:05,540 --> 00:03:11,150 Service comments dash SRB the service port for that. 46 00:03:11,160 --> 00:03:13,170 I do not recall off the top of my head. 47 00:03:13,200 --> 00:03:16,260 I'm gonna go and double check my comments dash depot file. 48 00:03:16,260 --> 00:03:23,130 Here's the comment service it is watching for traffic on port four thousand one it's all put in my service 49 00:03:23,130 --> 00:03:30,030 port a four thousand one right there and then finally our very last path will be just slashed by itself. 50 00:03:30,100 --> 00:03:35,970 Now for our ReACT application just flashed by itself would work OK but for a typical react application 51 00:03:36,000 --> 00:03:40,320 where you are using something like react router to handle routing around inside of your application 52 00:03:40,320 --> 00:03:46,560 in a single page app sort of approach you would usually use a query or me a rig X right here of dot 53 00:03:47,190 --> 00:03:53,820 star like so that's can make sure it matches any path and always tried to show the react application. 54 00:03:53,820 --> 00:03:58,090 Now if you're going to write out a path like this it always has to be at the very end. 55 00:03:58,140 --> 00:04:04,340 These paths are ordered from greatest importance down to the least importance so if we put this at the 56 00:04:04,340 --> 00:04:08,390 end it will match only after trying to match all these other parts. 57 00:04:08,420 --> 00:04:11,870 If we put this at the top it will always go to the react app no matter what. 58 00:04:11,870 --> 00:04:21,900 Which is not what we want so then I'll put in my backend with the service name of client SRB and a service 59 00:04:21,900 --> 00:04:25,230 port of three thousand. 60 00:04:25,470 --> 00:04:25,730 All right. 61 00:04:25,770 --> 00:04:33,520 I'm gonna say this I'm going to go backwards my terminal I'm inside of my k aides directory we're going 62 00:04:33,520 --> 00:04:40,450 to make sure that we reapply the ingress SRB file so it keeps GTL apply dash f ingress Dash. 63 00:04:40,540 --> 00:04:44,450 S R v dot AML. 64 00:04:44,550 --> 00:04:47,100 Looks like we've updated our configuration successfully. 65 00:04:47,100 --> 00:04:53,220 So now we are ready to do a big final test and make sure our application is working before we do I can 66 00:04:53,220 --> 00:04:58,190 do a quick QCT l get pods I'm going to verify that everything is up and running. 67 00:04:58,440 --> 00:05:03,920 If you have any errors you'll need to make sure that those get result before we do this final test. 68 00:05:04,000 --> 00:05:06,200 I can go back over to my browser. 69 00:05:06,370 --> 00:05:10,900 I'm gonna go to post dot com and I should see might react application here. 70 00:05:10,900 --> 00:05:12,460 Yep here it is. 71 00:05:12,460 --> 00:05:15,150 You might see one or two posts already listed inside of here. 72 00:05:15,160 --> 00:05:19,900 If you do that is because we created some post a little bit ago using post man. 73 00:05:19,930 --> 00:05:23,380 I deleted those posts just so I'd have a fresh slate right here. 74 00:05:23,380 --> 00:05:28,920 I'm gonna create a brand new post so say new post number one. 75 00:05:29,100 --> 00:05:33,840 Remember we don't have any kind of library load or anything like that looking to refresh the page and 76 00:05:33,840 --> 00:05:34,770 there's my post. 77 00:05:34,770 --> 00:05:35,630 Very good. 78 00:05:35,730 --> 00:05:38,830 And then of course you have to test out our comments as well. 79 00:05:38,840 --> 00:05:44,070 I'll put a new comment submitted refresh and there's my comment. 80 00:05:44,290 --> 00:05:46,580 Hey that's it. 81 00:05:46,590 --> 00:05:52,620 Well that is a lot of work but after all this work we've now got our application posted inside of a 82 00:05:52,620 --> 00:05:54,280 Cuban 80s cluster. 83 00:05:54,540 --> 00:05:56,660 Of course we're not quite done yet. 84 00:05:56,670 --> 00:06:01,200 As I mentioned in the last video right now any time that we want to make a change to our code base we 85 00:06:01,200 --> 00:06:05,970 have to make the change we have to rebuild the image we have to push the image up to Docker Hub and 86 00:06:05,970 --> 00:06:10,430 then run that you'd see to yell the rollout restart deployment blah blah blah. 87 00:06:10,430 --> 00:06:16,170 Commands and obviously that is way too involved for doing any type of typical development approach. 88 00:06:16,170 --> 00:06:21,090 So we definitely need a better way of making changes to our cluster inside of a development environment 89 00:06:21,270 --> 00:06:23,070 than what we have right now. 90 00:06:23,130 --> 00:06:26,910 As I mentioned there is a tool that we're going to use to automate a ton of the stuff that we've been 91 00:06:26,910 --> 00:06:28,620 doing in these last videos. 92 00:06:28,670 --> 00:06:32,130 We'll take a pause right here and start to take a look at that tool in just a moment.