Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Shorten the dev loop with mirrord

Shorten the dev loop with mirrord

cncf-canada-meetups

October 19, 2023
Tweet

More Decks by cncf-canada-meetups

Other Decks in Technology

Transcript

  1. 03 POV: you are working on a new feature Days

    Work log Mood 1 Write some new code 😊 2 Local testing 😊 3 Open PR, nitpicks 🙂 4 Staging, NullPointerException, rollback 😐 5 Fix, open PR, redeploy 😐 Days Work log Mood 7 Back to day 1, new tasks, your feature is in backlog 😖 8 You are fixing the bug, and you are focusing on a new task 😠 6 Your mate Adam, just deployed a version to staging which crashed yours 😢
  2. 06 How to shorten this loop with mirrord? • mirrord

    lets you run local processes in the context of your cloud environment. • you can access microservices, databases, queues, and managed services, all without leaving the local setup you know.
  3. 07 Mirroring Traffic 🚦 mirrord’s default mode for traffic is

    set to mirroring - meaning a copy of TCP traffic on a port will be sent to you locally
  4. 09 It’s not a crime to steal sometimes You can

    steal traffic instead of mirroring it, which means that any response from your remote app is completely ignored and your local app will respond! { "accept_invalid_certificates": false, "feature": { "network": { "incoming": "steal", "outgoing": true }, "fs": "read", "env": true } }
  5. 11 Fine graining your incoming traffic in steal mode -

    HTTP filters You can filter traffic by HTTP headers and paths. For example, you want your local process to only respond to a particular end-point like /api/v1/test or just by headers: { "feature": { "network": { "incoming": { "mode": "steal", "http_filter": { "header_filter": "service-log: true" } } } } } { "feature": { "network": { "incoming": { "mode": "steal", "http_filter": { "path_filter": "api/v1" } } } } }
  6. 12 Accessing the file system To access a file that

    exists on the remote or a file that exists locally, you can fine tune your access through different modes on file operations and by setting read/write only access on various paths. mirrord exec -t pod/logger -- cat /app/output.txt
  7. 13 Remote environment variables? No problem when you run a

    local process in the context of remote environment it means that environment variables present in the remote pod will be loaded into the local process. For example, if you want your local process to access a remote database, the connection string configured in the remote pod’s environment variable can be used by your local process.
  8. 14 Resolving DNS 🔍 mirrord can resolve DNS through your

    remote pod, which means if your local process needs access to a service, the DNS request will be resolved in the context of your remote pod/cluster. K8S connectivity for local utils Resolving DNS locally
  9. 15 Making sense of everything With the ability to toggle

    on/off these features one can seamlessly debug their local process: - Without having to run your entire deployment locally - Without going through CI and deployment - Without deploying untested code to the cloud environment - the stable version of the code is still running in the cluster and handling requests When running with mirrord, you get access to TCP/UDP traffic, Unix streams, Environment Variables, DNS resolution and the Filesystem.