<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rahul Omar on Medium]]></title>
        <description><![CDATA[Stories by Rahul Omar on Medium]]></description>
        <link>https://medium.com/@rahul.omar?source=rss-4e4feacd7d0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5vf9olsak-FKeQG_YI1eHQ.jpeg</url>
            <title>Stories by Rahul Omar on Medium</title>
            <link>https://medium.com/@rahul.omar?source=rss-4e4feacd7d0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 12:09:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rahul.omar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[OAuth 2.0 Simplified — Disney Story : What & How]]></title>
            <link>https://medium.com/@rahul.omar/oauth-2-0-simplified-disney-story-what-how-785ac0abfa14?source=rss-4e4feacd7d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/785ac0abfa14</guid>
            <category><![CDATA[storytelling]]></category>
            <category><![CDATA[login]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[disneyland]]></category>
            <category><![CDATA[magic]]></category>
            <dc:creator><![CDATA[Rahul Omar]]></dc:creator>
            <pubDate>Fri, 21 Aug 2026 15:44:22 GMT</pubDate>
            <atom:updated>2026-08-21T15:44:22.905Z</atom:updated>
            <content:encoded><![CDATA[<p>Alright, let’s imagine your login journey and access like a trip to Disneyland</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxXweBHlqmvvGdnU1HpvOg.jpeg" /></figure><p>The Story of Disneyland Wristband</p><ul><li>Imagine arriving at the <strong>Disneyland Paris </strong>on the most exciting day of the year.</li><li>You want to ride the rollercoasters, visit the haunted mansion, and collect magical souvenir photos. But each ride operator has a strict rule : <em>they cannot let just anyone walk in, and they don’t want to handle your personal passport or private secret master key.</em></li><li>Instead of handing your master key to every single ride operator, you head straight to the <strong>Royal Castle Entrance aka Disneyland reception area</strong></li></ul><ol><li><strong>The Royal Identification:</strong> At the entry, you prove who you are with your identity once.</li><li><strong>The Magic Wristband:</strong> The Castle gives you a glowing <strong>Magic Wristband</strong>. It doesn’t reveal your password or secret identity; it simply carries an official Castle stamp saying: <em>“This guest is authorized to all rides roll until 6:00 PM, He can also have special grants like priority entry to rides”</em></li><li><strong>Enjoying the Rides:</strong> When you run over to Space Mountain, the ride attendant doesn’t ask for your personal identity. They simply scan your glowing wristband, verify the Castle’s official stamp, and open the gates.</li></ol><h3>Mapping the Magic to OAuth 2.0</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJkeC6SbrwYZc6p-Z_8a0A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wgYckj_9A87YGJba7J4azg.png" /></figure><h3>Why This Keeps the Disneyland Safe</h3><ul><li><strong>Your Secret Stays Secret:</strong> <br>1. The individual rides never see your master credentials. <br>2. If a ride’s system gets hacked, your master account at the Castle remains completely secure.</li><li><strong>Limited Magic (Scopes):</strong> <br>1. Your wristband can be restricted to only allow <em>taking photos<br>2. Other scopes/grants can be restricted based on your master credentials</em></li><li><strong>Automatic Expiration:</strong> <br>1. If a wristband falls off or its time runs out, it becomes harmless plastic. <br>2. The ride simply asks you to check back in with the Castle for a fresh wristband.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=785ac0abfa14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API Contract : Design/Development Trust — Spring Cloud Contracts]]></title>
            <link>https://medium.com/@rahul.omar/api-contract-design-development-trust-spring-cloud-contracts-6cff9943ad85?source=rss-4e4feacd7d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cff9943ad85</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[spring-boot-cloud]]></category>
            <category><![CDATA[spring-cloud-contract]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[api-design]]></category>
            <dc:creator><![CDATA[Rahul Omar]]></dc:creator>
            <pubDate>Fri, 31 Jul 2020 16:14:15 GMT</pubDate>
            <atom:updated>2020-07-31T16:14:15.765Z</atom:updated>
            <content:encoded><![CDATA[<h3>API Contract : Design/Development Trust — Spring Cloud Contracts</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*6vYhxj36mjJdnkXCGSZRGw.png" /></figure><blockquote>Introduction</blockquote><p>So we all have been through the struggle of the API design in initial phases of project development, where different <strong>partners/producers</strong> producing the services must adhere to be in contract with different <strong>consumers/clients </strong>(Best case scenario). There always have been issues especially with the private API’s updating the contracts and then either missing to update their clients resulting into broken client applications without knowing a reason around.(Due to backward compatibility or any other petty issues). Since the process is manual it is liable to fail many a times and each time we spend various resources and exchanges to get this fixed for each of our clients.</p><p>The solution to the problem could be either we automate the process of triggering a notification each time you update the contract (an old school way though) or define a <strong>contract/promise</strong> in between producers and consumers introducing Spring cloud contract verifier to take care of the contract modifications to fail the application build as soon as a contract breach occurs, which in turn alarms all your clients to stay on toes to raise alerts to the producers that the API contract is not compatible any more and needs to be changed on both sides to comply to the standards. The Spring cloud contract works simply as shown below at a high level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jL04R2qItSGAm5a_IEesQQ.png" /></figure><p>With planned evolutions the manual process can still be managed at some cost , but with multiple APIs and multiple producers/consumers in an application it really gets weird and is a reason for slow releases and aggravating issues in between various teams across organisation starting a blame game of contract violations and unnecessary noise. In fact with third parties the issues are still under control as the APIs are public or secured and the announcement mechanisms are kept well in process to adapt to the changes.</p><p>Having said all the above, No one could deny if there is a way to automate such processes (without hefty cost) one would want to get them in place as soon as possible as a result it provides us with peaceful running of the applications and we don’t need to worry around various petty failures and could concentrate more on important business and technical decisions.</p><blockquote>Implementation</blockquote><p>So to achieve this with spring cloud contract, we can follow these steps:</p><p>Initially start with adding a spring cloud contract maven plugin followed by enabling the spring cloud contract verifier dependency. Post this define a groovy contract of your features which is to be exposed to your clients. Once we build this producers application it auto generates the contract verifier tests and the stub archives using the spring cloud contract plugin and at the same time pushes the artifacts to the stub store.</p><p>Next steps are on the consumer side where we add stub runner spring cloud contract dependency and write a stub test based on the contract defined mutually in between the producer and the consumer. Now the last step is to build the client application, where the stub runner demands the stub store for producer stubs, Once fetched it runs the test on the stub server, Now when the request is sent to the stub runner from clients end, the runner confirms the validity of the contract. If there is a change captured the client build fails with the correct reason of the change in contract in the logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J8_pgu3TZZcSVw1dcXmmbA.png" /><figcaption>Sequence Diagram Flow</figcaption></figure><blockquote>Example</blockquote><p>I had defined the end point in my contract as a producer as “/person/{id}” , the contract is based on this specifications. After an evolution the producer feels to change the end point resources to “/person/name/{id}” and modifies the contract without informing the client. When the producer builds his application the same flow of stubs and verifier tests are generated, Now when the client builds the application consuming producer’s API , the verifier tests on the client side fails with a message “URL does not match” as shown below, This now could be well dealt accordingly as per the processes defined in the organisation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mJXOJLFjvb-1vuAWdZhb-g.png" /><figcaption>Received request after changes in contract</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4-TtMS_uGIyBH33zCeq03w.png" /><figcaption>Error for contract violation on client side</figcaption></figure><p>As we see how simple it is to define the Spring cloud contracts in microservices, There is an overhead of writing the contracts on producer’s end and the verifier test on the client side based on application features. Since this is one time process and keeps evolving, with my own experience believe me it is worth spending that time once rather than getting into conflicts with multiple clients.</p><p>Although this practise must start in initial stages on the project when the designer defines the initial draft contracts in an API first approach. When it is adapted early in the process it results in lot of pre-won battles at the stage of project industrialisation. This not only helps saving a lot of time and energy but also helps for hassles free exchanges in between the producers and consumers of the application and keeps the environment and motivation on the team on the higher side. The benefits are enormous for integration to API gateways and not violating contracts in silos, Therefore to conclude its a situation win-win in all cases.</p><p>I hope this benefits your processes and systems and you could have a peaceful project journey with Spring cloud contracts in place.</p><p>See you until my next article !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cff9943ad85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configuration Management Struggle: Dev, Ops or DevOps]]></title>
            <link>https://medium.com/@rahul.omar/configuration-management-struggle-dev-ops-or-devops-1a5536fa4fba?source=rss-4e4feacd7d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a5536fa4fba</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[spring-cloud]]></category>
            <category><![CDATA[configuration-management]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Rahul Omar]]></dc:creator>
            <pubDate>Mon, 06 Jul 2020 08:36:09 GMT</pubDate>
            <atom:updated>2020-07-06T08:36:09.379Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*j9dUFVuKogv7LkqaFdU7ew.jpeg" /></figure><p>Coming along the road to battle between Dev and Ops, earlier we used to face tussles in between Dev and QA, Many thanks to DDD which helped to mitigate that gap, These days the heat is more on the conversations in between Dev and Ops related to automation during CI/CD or provisioning the infrastructure and taking charge of configurations and deployment processes. Here I will discuss both approaches of configuration management.</p><p>“<strong><em>Is it the developers who must be responsible and keep the configuration management at their end or is it the Ops who must maintain and take care of it</em></strong>”</p><p>In this write up I must discuss both of these approaches bringing in the pros and cons of each approach. Lot of developer teams are quite confident on managing the configurations and bundling the configurations as part of their jars using Spring cloud config server(actually a good way to manage configs) and then activating the profile in bootstrap or passing profile in VM arguments while deploying the application.</p><p>On the contrary there are developers who wish to keep configuration management headaches away from them to be managed by the Ops(usually happens in a distributed team set up where separation of concerns, roles and responsibilities are a high priority) outside of their jars in a separate git repo and provision them via config maps while deploying the applications.</p><p>Let us discuss both these approaches in detail</p><h4><strong>Configurations Managed at Developers end</strong></h4><p><strong><em>Spring Cloud Config</em></strong> could also be used as Spring’s client/server approach for storing and serving distributed configurations across multiple applications and environments. We can set up a cloud config server including maven dependency “<strong>spring-cloud-config-server</strong>” and on all client services where we require to utilise these configs we include maven dependency “<strong>spring-cloud-starter-config</strong>”. All that needs to be done is to create a local git repository to be used as configuration storage and name the default properties file with name of the service “<strong>/{application}-{profile}.properties</strong>” (E.g for range-service prep use range-service-prep.properties), At the clients end we rename application.properties to bootstrap.properties and define which is the active profile “<strong>spring.profiles.active=prep</strong>” and cloud config server uri “<strong>spring.cloud.config.uri=http://localhost:8888</strong>” , based on active profile while bootstrapping the application picks up all the default properties defined in the range-service.properties and clubs all other preprod environment properties. The priority stays with the profile chosen, any attribute defined in the environment properties gets priority over the ones defined in default.</p><p>Pros and cons below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_VFmvhGGO3MAMuFmYoheFQ.png" /><figcaption>Config at Developer’s end</figcaption></figure><h4><strong>Configurations Managed at DevOps End</strong></h4><p>In this approach, the environment properties are separated from the packaging of image and are kept in a separate repository being controlled by DevOps, Each time there is a change in configuration the developers need to update the configs and request a deployment (Good part is there is no build required but just a deploy which saves a lot of release time), this increases a extra step of generating pull requests and following the git flow, but also makes sure that configurations are correct and there are no mistakes.</p><p>During the deployment of applications while using kubernetes, the path to provisioning is passed which helps to read those environment based files and generate a config map using the snippet (kubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties) the filename becomes a key stored in the data section of the ConfigMap. The file contents become the key&#39;s value.</p><p>Add the ConfigMap name under the volumes section of the Pod specification. This adds the ConfigMap data to the directory specified as volumeMounts.mountPath.The command section lists directory files with names that match the keys in ConfigMap</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xO33gInlOFHSMRY8LlKABQ.png" /><figcaption>Mount configMap in pod definition yaml</figcaption></figure><p>While writing the CD pipeline, Ops takes care of getting the configurations based on environment input in jenkins job.</p><p>Pros and cons below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kMFNZsd-Af5a60HfHZM0dQ.png" /><figcaption>Config at Ops’ end</figcaption></figure><p>Having explained in detail I think both approaches have their own pros and cons as I already added above. To my experience the choice is between better management and better process, As with the developers handling all the configurations it makes more sense in terms of less dependency, less resourcing, less processes, less hassles with config. On the contrary with Ops being specialised to take care of the configs it also has benefits in terms of more manageable, faster release cycles and augmented productive setup.</p><p>This decision also depends on the organisation structure and hierarchy based on an enterprise set up depending on how well are dev and ops gelled up. If there is not a lot of gap in between the teams and if communication channels and processes have been well established then it does not really makes a lot of difference as to who is handling the configurations( This is obviously in theory). This is why we call all of those processes combined as DevOps or further we also name it as SRE (Site Reliability Engineering).</p><p><em>Code prototype for first approach are present at: </em><a href="https://github.com/omarrahul/SpringCloudConfigServer"><strong><em>https://github.com/omarrahul/SpringCloudConfigServer</em></strong></a></p><p>For the second approach it is a matter of writing the syntax for generating a configMap from input provisioning file based on which environment we are going to deploy and then mapping the config map name to volumes under pod definitions(in kubernetes). I am not sure of the devops approach especially when using the virtual machine setup, so this yet needs to be drilled down to find out how it works.</p><p>Happy configuring !!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a5536fa4fba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API Design — Reality over Conventions]]></title>
            <link>https://medium.com/@rahul.omar/api-design-reality-over-conventions-875587f8f962?source=rss-4e4feacd7d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/875587f8f962</guid>
            <category><![CDATA[design-thinking]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[api-design]]></category>
            <dc:creator><![CDATA[Rahul Omar]]></dc:creator>
            <pubDate>Sat, 27 Jun 2020 14:22:12 GMT</pubDate>
            <atom:updated>2020-06-27T14:22:12.619Z</atom:updated>
            <content:encoded><![CDATA[<h3>API Design — Reality over Conventions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rwq74H81T8VjHJ6h1qnzPA.jpeg" /><figcaption>Design Thinking</figcaption></figure><p>Usually when we speak about design, We expect a dreamer who thinks various aspects to solve a problem with a thousand feet overview about the subject and connects the dots to define a probable solution.</p><p>Similarly in case of the technical designers the role requires to fill in the gap between a problem statement followed by a high and low level design of the document connecting the architecture with real models and giving shape to solutions to be future proof and backward compatible. It sounds to be easy but when it comes to complex businesses it could be a mesh of models creating nightmares if not managed very well.</p><p>As its rightly said “<strong><em>No technology is bad, there are only bad designs and implementations</em></strong>”</p><p>Quoting some real project experiences which I have experienced in my tenure with digital transformation opportunities revolving around retail. Digital transformation starts with breaking the legacy monolithic systems into silos one by one, where we need people having a mix of business domain knowledge and technical details to be able to define bounded contexts and separation of concerns, but this never happens over night and requires a well thought road map and step by step approach.</p><p>A good experienced designer could help big time defining the API first approaches to realise first of services which are to be fine grained from a big monolithic solution utilising strangler patterns (This pattern helps fine grain the system into smaller units one by one so that business continuity is maintained while we completely eliminate and get rid of the legacy systems in phases).</p><p>API first approach carves out the premier solutions to realise the prototype of an application. Defining the request/response structures, defining the models either by facading the legacy systems or creating the new systems all together.</p><p>With SAFe agile ways of delivery where fail fast approach with cheap costs is the need of the hour, it is immensely important to realise and define the design early in the game with mocks which requires to explore the domain and find out quick results and models to appease your consumer with draft versions so that parallel developments could be achieved and there is less ruckus/hassles in between front and backend developers during the integration. With this approach even when the solution has not been fully built all stakeholders be it Business, Frontend, Backend, Infrastructure are on the same page to realise the solution together with one common goal.</p><p>API design cycle usually looks something like as shown below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P4djJSTqOA6t3lI_tzWilQ.png" /><figcaption>Design and Review Cycle</figcaption></figure><p>- Exploration phase best practices include asking as many questions as possible to know the details of the business and its pain points, Since no question is a bad question you could get some unknown answers as well and could raise challenges and valid points in subsequent exchanges. Document everything, I literally mean everything, so as to not miss on any details and take meeting notes to define and delegate next actions. Leverage use case and sequence diagrams to define drafts and keep evolving the design as per changes or clarifications received (Always remember no first design is the perfect, it gets better with each iteration)</p><p>- With API first approach the next step is to define a contract/pact (<strong>OAS 3, Swagger 2.0, Spring cloud contract</strong> etc), which could only be changed with consent of both the producer and consumer of APIs. It is important to not change the scope of the solution realised in the first step. Since the use case does not seems real (In enterprise projects lot of attributes and models keep evolving) it is thus recommended to maintain versions of contracts based on phases of deliveries and defined roadmaps.</p><p>- Data mapping and error mapping are the next steps specifically while breaking a monolith to microservices architecture where in the service does not require all of the attributes available on the legacy system, It runs on the concepts of “<strong><em>Response what your consumer needs</em></strong>”. Api design is similar to extraction concept, hide all complexities from your consumer and help them only with what they request for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*4SOopobyHZHw_Ycff2Z4pQ.jpeg" /><figcaption>Design — Iteration Behaviour</figcaption></figure><p>- Maintain versions of the APIs using a version control, my favourite is git. I recommend to use gitflow for evolutions of the swagger contracts and easy sharing of the contracts among the teams. Although we could also use Swagger hub which is a licensed version providing capabilities to maintain API versions, editor for designing APIs, comparing tool kit for APIs and maintaining API portals all under one software. The choice of tools really depend on multiple constraints.</p><p>- Use interactive editors to write specifications and avoid to include technical API gateway configurations (If exposing your specifications to gateway) in your contracts, Since contracts are of interest to all stakeholders thus it makes more sense to not confuse your business and frontend consumers with technical details</p><p>- Make use of Spring fox plugin to generate specifications from the code implementations to match the ones you share via git or swagger hub to your consumers to verify if there is any deviation from the final implementation. This also confirms if your developers are respecting the contracts in the first place and are not breaking the flow by introducing a backward compatible change. Usually the developers would create all the skeleton services from the draft swagger which designers circulate after having the premier explorations and data modelling.</p><p>- Review cycles should not be missed so as to not generate confusions of having different understanding on the contract between the producers and consumers of APIs, This is where the draft version and spring fox plugin plays an important role to compare where the deviation occurred is it while designing or while implementing or even at consumption of these APIs</p><p>- Mocks are an important aspect of API design to be able to showcase the proposed solution end to end which is not real but may be 3 sprints down the project lane the application behavior would behave the same as could be based today on the mocks.</p><p>All the above are phases which are unfortunately never realised and never treated as part of the process. People are really focused on writing the specifications but they miss these very important points while gathering the facts which they require to write in those specifications. There are multiple links to best practices for Rest API design which could be followed to write the specifications (<a href="https://hackernoon.com/restful-api-designing-guidelines-the-best-practices-60e1d954e7c9">https://hackernoon.com/restful-api-designing-guidelines-the-best-practices-60e1d954e7c9</a>), but missing any of the phases of API design lifecycle creates tussles with your consumers and other stakeholders.</p><p>Some generic practices while involved in API design are :</p><ul><li>Be Proactive to ask questions and challenge the architecture.</li><li>Ask even the tiny details as it helps during all the phases.</li><li>Get in touch with the primary contacts (“<strong>hear </strong>something straight from the <strong>horse’s mouth</strong>”)</li><li>While designing always think <strong>Generic</strong>, <strong>Reusability</strong>, <strong>Multi Client purpose</strong> and <strong>Future Proof.</strong></li><li>Be ready to run the show as you are point of contact for multiple stakeholders.</li></ul><p>Hope this post helps you coordinate and delegate the API design tasks and shall facilitate you design better and faster APIs.</p><p>API first approaches are the driving fuel behind most successful digital business transformations as these allow the business to think quick and cheap to take risks and fail fast. They also act as prototypes with mocks giving the business a real view of the future applications and help convince people to thrive and think for business transformations not being a nightmare but helping hands for transforming needs of today’s customers.</p><p>Happy Designing !!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=875587f8f962" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deployment Tranquility : Service Mesh (SideCar Patterns)]]></title>
            <link>https://medium.com/@rahul.omar/deployment-tranquility-service-mesh-sidecar-patterns-12e97a5758f4?source=rss-4e4feacd7d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/12e97a5758f4</guid>
            <category><![CDATA[blue-green-deployment]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[service-mesh]]></category>
            <category><![CDATA[canary-deployments]]></category>
            <dc:creator><![CDATA[Rahul Omar]]></dc:creator>
            <pubDate>Fri, 26 Jun 2020 09:54:36 GMT</pubDate>
            <atom:updated>2020-06-26T09:54:36.198Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deployment Tranquility : Service Mesh (SideCar Patterns)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VRaojE5KyB65Vui5GD6aCg.jpeg" /></figure><p>With complex business models it is never too easy to devise simple solutions, but we still can utilise cutting edge technologies to simplify the way we handle those day to day problems.</p><p>After breaking the monoliths of legacy solutions, we started to fine grain solutions (creating independent small units called microservices) following principles of bounded contexts, separation of concerns and domain driven models to achieve more versatile (independence of technology to be chosen), more scalable and easily integratable, to be faster and cheaper etc etc</p><p>Until we have a defined number and scope of services and easy maintainability (which is hard as business keeps growing to demand new features each day) everything is under control, When we have large systems and complex interactions of services talking to each other, this is where it gets difficult to manage such systems. Well thanks to the containerization which really helps us set things up in no time and bigger thanks to technologies such as Kubernetes to keep orchestrating the show without much troubles.</p><p>With such enterprise architectures we need mechanisms such as <strong>Service Discovery</strong>, <strong>Distributed Tracing</strong>, <strong>Load Balancing</strong>, <strong>Resilient systems</strong>. The simple answer to all those jargons (aka cross cutting concerns) is to set up a Service Mesh. Here in the context of this post I will talk mainly about the most used service mesh implementation called <strong>ISTIO</strong>.</p><p><strong><em>“In simple words service mesh is a network of microservices which allows to interact with multiple services in an application ecosystem to keep it up and running without surprises</em>”</strong></p><p>Service meshes could also facilitate complex operational requirements such as throttling, observability, blue green and canary rollouts. It works best with containerised apps with a sidecar architecture pattern. To understand further below is the generic architecture of kubernetes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*FHasiAv_8rMlag1OLI8Dsg.png" /></figure><p>When istio is installed and enabled , the sidecar (another container in the same pod) just fits in with each pod to control the cross cutting concerns and other operational requirements which we listed above. See below the representation of a sidecar pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*44aQjickebk_XwOKA7lQ8g.png" /></figure><p>All this is achieved by setting up a kubernetes cluster and installing istio on top of it (Set up kubernetes cluster either ways AKS on azure, EKS on AWS and GKE on GCP) , installation is straight forward followed by setting up customer resource definition files.</p><p>Next we need to generate an istio yaml file instructing what all complex requirements you need to address using the sidecar (tracing, kiali dashboard, prometheus time series db etc). Once your yaml file is ready you can deploy it on your kubernetes cluster. The final step is to enable istio-injection to your namespace. After all those steps(if successfully done) we deploy a service you will start to see 2 instances (service and sidecar) on each pod created in that namespace.</p><p>To start seeing istio in action we must create the <strong>Gateway</strong> based on the ingress gateway (collection of routing rules governing services in kubernetes cluster), snapshot below is the simplest gateway allowing each http request received.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*jw3h4kPsgXDXxLa1XM7bVg.png" /><figcaption>Sample gateway yaml</figcaption></figure><p>Once the gateway is set up, we need a <strong>Virtual Service</strong> to be able to manage the routes, mirroring and rate limiting. A simple example of a service with multiple versions deployed could be used to see how easy it is to release and deploy services on production environments without disturbing or creating a lot of regressions and hassles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*32obl2ygXwS-IHAFd8k51w.png" /><figcaption>Example virtual service yaml</figcaption></figure><p>Virtual service yaml maps the gateway label as defined in the previous snapshot and matches the uri prefix, If the uri contains the endpoint then the request is routed to the defined host and port.</p><p>Post this we now check on basic deployment strategies defined in kubernetes deployments such as rolling updates (This strategy defines to deploy the new version of an application without having a downtime by auto scaling deployments based on max-surge and max-unavailable) and recreate (not a recommended approach, as this kills and recreates pods introducing some downtime).</p><p>- Next we talk about <strong>Blue-Green</strong> deployment technique, When we need to maintain multiple versions of our applications. Blue-Green as the name suggests is the deployment pattern where at one particular instance either Blue version is live or a green version is live. Blue green deployments are based on mirroring technique which mirrors one request coming from a user into two, Out of which one request goes to the live version of the application which responses to the user and the other is mirrored to a version you want to release in future to execute your tests. Once you test your newer version you can switch the traffic to latest version which you wish to make live.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*nQUQfygW4pzHjSvodyYpIQ.png" /></figure><p>This all is possible with a few tweaks by adding a <strong>Destination Rule</strong> with subsets and versions and an additional mirror node to the <strong>Virtual Service</strong> configuration with weight and subset (live version or future version) parameter to route as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*N-TpQ6zEDiegfOHIZoNbKg.png" /></figure><p>Once deployed we will start to see all traffic going to V1 as it holds the 100% weight and V2 starts receiving the mirrored traffic. Post tests we can switch the weight to hold 100% traffic and remove mirroring all together once the new version is stable to be made live. In case of issues a rollback script could set the system back with previous stable version.</p><p>- Last topic for this post are the <strong>Canary deployment</strong> technique, In this deployment both versions of an application could be made live based on the rate limiting settings defined for distributing traffic to each version. We make live only a handful of latest version to be deployed to test its stability (e.g 10:90 proportion for new:current version), if the new version does not have issues and is stable as per needs we slowly can distribute more traffic and decrease the traffic to current version.</p><p>The name for this technique originates from miners who would carry a canary (bird) in a cage down the coal mines. If toxic gases leaked into the mine, it would kill the canary before killing the miners.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*dMDLRzXFQDS873BmdiFo7g.png" /></figure><p>All of the above is possible with a few tweaks on <strong>Virtual Service</strong> configuration adding a second route with distributing weight and subset (live version or future version) parameter to route as shown below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*anEAHjLOCuHsj2X3P0ixlQ.png" /></figure><p>The weight could be tweaked through above file and then deploying them, the rollback strategy to previous versions of settings is quick and easy.</p><p>Enterprises who chose to move from monolithic to microservices architectures to achieve versatility, Independence, modularity etc at some points were scared about the cross cutting concerns and the growing complexity around microservices. Istio as we saw could solve some very complex problems with minimal configurations and quite efficiently. I hope this post helps you manage your releases and deployments with tranquility. I shall include posts in continuation to this topic to explore further on kiali dashboards, Jaeger, prometheus for application dashboarding using sidecars.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12e97a5758f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>