<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Hima</title>
    <description>The latest articles on Forem by Hima (@himaatluri).</description>
    <link>https://forem.com/himaatluri</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F394532%2F9d1535da-ee61-4983-8f9a-dc04f9d43059.png</url>
      <title>Forem: Hima</title>
      <link>https://forem.com/himaatluri</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/himaatluri"/>
    <language>en</language>
    <item>
      <title>Streamlining AWS CloudFormation Template Tag Management with Tagion</title>
      <dc:creator>Hima</dc:creator>
      <pubDate>Sun, 06 Apr 2025 03:33:30 +0000</pubDate>
      <link>https://forem.com/himaatluri/streamlining-aws-cloudformation-template-tag-management-with-tagion-1hk0</link>
      <guid>https://forem.com/himaatluri/streamlining-aws-cloudformation-template-tag-management-with-tagion-1hk0</guid>
      <description>&lt;p&gt;Managing tags across multiple AWS CloudFormation templates can be a tedious and error-prone process. Enter Tagion, a command-line tool that simplifies the process of adding and managing tags across your CloudFormation resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Challenge
&lt;/h2&gt;

&lt;p&gt;AWS tags are essential for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cost allocation&lt;/li&gt;
&lt;li&gt;Resource organization&lt;/li&gt;
&lt;li&gt;Access control&lt;/li&gt;
&lt;li&gt;Automation&lt;/li&gt;
&lt;li&gt;Compliance requirements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, manually adding tags to CloudFormation templates is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Time-consuming&lt;/li&gt;
&lt;li&gt;Error-prone&lt;/li&gt;
&lt;li&gt;Often overlooked during resource creation&lt;/li&gt;
&lt;li&gt;Inconsistent across templates&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introducing Tagion
&lt;/h2&gt;

&lt;p&gt;Tagion is a Go-based CLI tool that automatically analyzes and adds tags to AWS CloudFormation templates. It supports both YAML and JSON formats and can process single templates or entire directories.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Bulk Processing&lt;/strong&gt;: Process multiple templates in a directory with a single command&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart Analysis&lt;/strong&gt;: Only modifies resources that support tags&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preview Changes&lt;/strong&gt;: Shows which templates will be modified before making changes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preserve Existing Tags&lt;/strong&gt;: Merges new tags with existing ones without duplicates&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple Format Support&lt;/strong&gt;: Works with both YAML and JSON templates&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Usage Example
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Define your tags in a JSON configuration file
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"tags"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Environment"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Production"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Project"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"TagionCFN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Owner"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"DevOps"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"ManagedBy"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Tagion"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Run Tagion
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  tagion &lt;span class="nt"&gt;-tags&lt;/span&gt; tags.json &lt;span class="nt"&gt;-path&lt;/span&gt; templates/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Review the proposed changes
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;╭────────────────────────────────────────────┬───────────┬────────────────────╮
│ TEMPLATE                                   │ RESOURCES │ STATUS             │
├────────────────────────────────────────────┼───────────┼────────────────────┤
│ templates/ec2-no-tags.yaml                 │         1 │ Will be modified   │
│ templates/s3-with-tags.yaml                │         1 │ Has tags           │
│ templates/multi-resources.json             │         2 │ Will be modified   │
│ templates/unsupported.yaml                 │         2 │ No changes needed  │
├────────────────────────────────────────────┼───────────┼────────────────────┤
│ Total                                      │         6 │ To modify: 2       │
╰────────────────────────────────────────────┴───────────┴────────────────────╯
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Confirm and apply changes
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Do you want to proceed with these changes? [y/N]:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Supported AWS Resources
&lt;/h3&gt;

&lt;p&gt;Currently supports tags for common AWS resources including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EC2 instances&lt;/li&gt;
&lt;li&gt;S3 buckets&lt;/li&gt;
&lt;li&gt;RDS databases&lt;/li&gt;
&lt;li&gt;DynamoDB tables&lt;/li&gt;
&lt;li&gt;Lambda functions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Benefits
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Time Savings&lt;/strong&gt;: Automate tag addition across multiple templates&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consistency&lt;/strong&gt;: Ensure uniform tagging across your infrastructure&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compliance&lt;/strong&gt;: Easily implement tagging policies&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error Prevention&lt;/strong&gt;: Avoid manual tagging mistakes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Non-Destructive&lt;/strong&gt;: Preserves existing tags and only adds missing ones&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;Install Tagion using Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go &lt;span class="nb"&gt;install &lt;/span&gt;github.com/himaatluri/tagion@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Future Enhancements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Support for more AWS resource types&lt;/li&gt;
&lt;li&gt;Custom tag validation rules&lt;/li&gt;
&lt;li&gt;Integration with AWS Organizations tag policies&lt;/li&gt;
&lt;li&gt;Tag removal and modification features&lt;/li&gt;
&lt;li&gt;CI/CD pipeline integration&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Tagion simplifies CloudFormation template tag management, making it easier to maintain consistent tagging across your AWS infrastructure. It's an essential tool for DevOps teams managing multiple CloudFormation templates and needing to ensure proper resource tagging.&lt;/p&gt;

&lt;p&gt;The project is open source and available on GitHub under the Apache License 2.0. Contributions are welcome!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This blog post was written for the Tagion project. For more information, visit our &lt;a href="https://github.com/himaatluri/tagion" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>go</category>
      <category>devops</category>
    </item>
    <item>
      <title>GCP Workload Identity - Kubernetes Federation</title>
      <dc:creator>Hima</dc:creator>
      <pubDate>Wed, 29 Jan 2025 04:04:05 +0000</pubDate>
      <link>https://forem.com/himaatluri/gcp-workload-identity-kubernetes-federation-1gh5</link>
      <guid>https://forem.com/himaatluri/gcp-workload-identity-kubernetes-federation-1gh5</guid>
      <description>&lt;p&gt;&lt;strong&gt;How to Authorize Kubernetes Pods in Rancher Desktop to Google Cloud APIs Using Workload Identity Federation (WIF)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this post, I’ll show you how I used &lt;strong&gt;Workload Identity Federation (WIF)&lt;/strong&gt; to authorize a &lt;strong&gt;Kubernetes pod&lt;/strong&gt; running in &lt;strong&gt;Rancher Desktop&lt;/strong&gt; to access &lt;strong&gt;Google Cloud APIs&lt;/strong&gt;—without needing service account keys. This approach simplifies authentication by using federated identities for workload access, making it more secure and manageable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Use Workload Identity Federation?
&lt;/h3&gt;

&lt;p&gt;Workload Identity Federation (WIF) eliminates the need to handle service account keys. Instead of relying on long-lived keys, you use identity federation to authenticate workloads. This improves security, as there are no keys to rotate or expose, and is ideal for cloud-native environments like Kubernetes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Steps to Set Up Workload Identity Federation with Rancher Desktop
&lt;/h3&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;1. Ensure prerequisites are met&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Ensure that your Rancher Desktop cluster meets the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kubernetes version 1.20 or higher.&lt;/li&gt;
&lt;li&gt;ServiceAccount token volume projections enabled in kube-apiserver. In Rancher Desktop, this is typically already enabled since it's based on K3s, which supports projected volumes.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;2. Set up the Kubernetes cluster issuer&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;To get the cert and key:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kubectl config view -o=jsonpath="{.users[?(@.name == 'rancher-desktop')].user.client-certificate-data}" --flatten | base64 -d &amp;gt; rancher.crt

$ kubectl config view -o=jsonpath="{.users[?(@.name == 'rancher-desktop')].user.client-key-data}" --flatten | base64 -d &amp;gt; rancher.key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Retrieve the cluster's issuer URL:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;curl &lt;span class="nt"&gt;-k&lt;/span&gt; &lt;span class="nt"&gt;--cert&lt;/span&gt; rancher.crt &lt;span class="nt"&gt;--key&lt;/span&gt; rancher.key https://127.0.0.1:6443/.well-known/openid-configuration
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The expected format is something like &lt;code&gt;https://kubernetes.default.svc&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Download the JWKS for the cluster:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;curl &lt;span class="nt"&gt;-k&lt;/span&gt; &lt;span class="nt"&gt;--cert&lt;/span&gt; rancher.crt &lt;span class="nt"&gt;--key&lt;/span&gt; rancher.key https://127.0.0.1:6443/openid/v1/jwks &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; cluster-jwks.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rancher Desktop will expose this endpoint since it's based on standard Kubernetes configurations.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;3. Create the workload identity pool and provider in GCP&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a Workload Identity Pool:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   gcloud iam workload-identity-pools create rancher-cowboy &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;--location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"global"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;--description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Workload identity for Rancher Desktop"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;--display-name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Rancher Desktop Pool"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add the Rancher Desktop Kubernetes cluster as a provider:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   gcloud iam workload-identity-pools providers create-oidc rancher-desktop&lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;--location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"global"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;--workload-identity-pool&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"rancher-cowboy"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;--issuer-uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://kubernetes.default.svc"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;--attribute-mapping&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"google.subject=assertion.sub"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
     &lt;span class="nt"&gt;--jwk-json-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"cluster-jwks.json"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;4. Grant IAM access&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Grant access to the Kubernetes ServiceAccount:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud projects add-iam-policy-binding PROJECT_ID &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;roles/viewer &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--member&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/rancher-cowboy/subject/system:serviceaccount:default:default
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;5. Deploy the Kubernetes workload&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Sample workload with alpine image and gcloud installed to test the access&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pod&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;horse&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rhorse&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;google/cloud-sdk:alpine&lt;/span&gt;
    &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/bin/sh"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-c"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gcloud&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;auth&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;login&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;--cred-file&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$GOOGLE_APPLICATION_CREDENTIALS&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;gcloud&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;auth&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;list&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;sleep&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;600"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;volumeMounts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;token&lt;/span&gt;
      &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/var/run/service-account"&lt;/span&gt;
      &lt;span class="na"&gt;readOnly&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;workload-identity-credential-configuration&lt;/span&gt;
      &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/etc/workload-identity"&lt;/span&gt;
      &lt;span class="na"&gt;readOnly&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;GOOGLE_APPLICATION_CREDENTIALS&lt;/span&gt;
      &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/etc/workload-identity/credential-configuration.json"&lt;/span&gt;
  &lt;span class="na"&gt;serviceAccountName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
  &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;token&lt;/span&gt;
    &lt;span class="na"&gt;projected&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;sources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;serviceAccountToken&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;audience&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/rancher-cowboy/providers/rancher-desktop&lt;/span&gt;
          &lt;span class="na"&gt;expirationSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3600&lt;/span&gt;
          &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;token&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;workload-identity-credential-configuration&lt;/span&gt;
    &lt;span class="na"&gt;configMap&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;wif-cm&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;6. Authentication and verification&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Verify authentication:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;kubectl &lt;span class="nb"&gt;exec &lt;/span&gt;horse &lt;span class="nt"&gt;--namespace&lt;/span&gt; default &lt;span class="nt"&gt;--&lt;/span&gt; gcloud auth print-access-token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;kubectl &lt;span class="nb"&gt;exec &lt;/span&gt;horse &lt;span class="nt"&gt;--namespace&lt;/span&gt; default &lt;span class="nt"&gt;--&lt;/span&gt; gcloud iam service-accounts list &lt;span class="nt"&gt;--project&lt;/span&gt; PROJECT_ID
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This setup ensures that Rancher Desktop running locally on your laptop can securely authenticate workloads with GCP using Workload Identity Federation.&lt;/p&gt;




&lt;h4&gt;
  
  
  Wait what happened? How did this work?
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Workload Requests GCP Access, A K8s Pod in Rancher Desktop runs with a ServiceAccount, which is configured to receive a projected OIDC token.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Kubernetes Issues OIDC Token, The K8s API server generates an OIDC-compatible JWT for the Pod based on the ServiceAccount and its audience.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Token Details, The token contains claims like:&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Issuer&lt;/em&gt; &lt;code&gt;iss&lt;/code&gt;: The Kubernetes API server's OIDC URL.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Audience&lt;/em&gt; &lt;code&gt;aud&lt;/code&gt;: The target GCP Workload Identity Pool URL.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Subject&lt;/em&gt; &lt;code&gt;sub&lt;/code&gt;: The identity of the ServiceAccount &lt;code&gt;system:serviceaccount:&amp;lt;namespace&amp;gt;:&amp;lt;service-account-name&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The token is signed by the K8s cluster.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Pod Passes Token to GCP: The token is presented to GCP during API requests via the Google Cloud SDK or client libraries in the workload.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;GCP verifies the OIDC token by&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Checking the token signature against the trusted Kubernetes OIDC issuer's public keys (usually from a .well-known/openid-configuration endpoint).&lt;/li&gt;
&lt;li&gt;Ensuring that the token audience matches the configured audience for the GCP WIF provider.&lt;/li&gt;
&lt;li&gt;Validating claims (like expiration and ServiceAccount identity).&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;p&gt;In conclusion, I successfully authorized a Kubernetes pod running in Rancher Desktop to interact with Google Cloud APIs using Workload Identity Federation. This method eliminated the need for managing service account keys and simplified the authentication process using federated identities. It’s a more secure and scalable solution for accessing Google Cloud resources from Kubernetes workloads.&lt;/p&gt;

&lt;p&gt;If you're looking to improve the security of your Kubernetes workloads, I highly recommend exploring Workload Identity Federation. It’s a great way to manage cloud access without the overhead of key management.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>security</category>
      <category>googlecloud</category>
      <category>docker</category>
    </item>
    <item>
      <title>Introducing NetIrk: A Lightweight CLI Tool for High-Level Network Insights</title>
      <dc:creator>Hima</dc:creator>
      <pubDate>Thu, 28 Nov 2024 07:33:14 +0000</pubDate>
      <link>https://forem.com/himaatluri/introducing-netirk-a-lightweight-cli-tool-for-high-level-network-insights-5e4p</link>
      <guid>https://forem.com/himaatluri/introducing-netirk-a-lightweight-cli-tool-for-high-level-network-insights-5e4p</guid>
      <description>&lt;p&gt;Netirk is a lightweight and efficient CLI tool designed to perform high-level network analysis. Built with simplicity in mind, it offers essential features like connectivity checks, DNS tracing, and a lightweight server to test local networking setups. Whether you're troubleshooting or verifying connectivity, Netirk is here to streamline the process.&lt;/p&gt;




&lt;p&gt;Installation&lt;/p&gt;

&lt;p&gt;To get started with Netirk, install it via Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;go install github.com/himaatluri/netirk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Usage&lt;/p&gt;

&lt;p&gt;Basic Commands&lt;/p&gt;

&lt;p&gt;Netirk offers a clean and easy-to-use CLI interface. Use the following commands for different operations:&lt;/p&gt;

&lt;p&gt;Check Connectivity&lt;/p&gt;

&lt;p&gt;Verify the response from a host and inspect SSL details if required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;netirk check --target &amp;lt;hostname&amp;gt; --verify-ssl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;netirk check --target google.com --verify-ssl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Getting server certs...

➥ Cert: 0 
 ￫ CA: false
 ￫ Issuer: WR2
 ￫ Expiry: Monday, 13-Jan-25 08:36:56 UTC
 ￫ PublicKey: 
   -----BEGIN CERTIFICATE-----
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Trace&lt;/p&gt;

&lt;p&gt;Diagnose connection details, including DNS resolution time, connection latency, and TLS handshake information.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;netirk trace --host &amp;lt;hostname&amp;gt; --port &amp;lt;port&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 1&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;netirk trace --host https://amazon.com --port 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DNS Resolution done: 7.618718ms
Connect Done: 26.686553ms
Request failed: dial tcp 54.239.28.85:8080: connect: connection refused
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 2&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;netirk trace --host https://amazon.com --port 443
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DNS Resolution done: 7.553307ms
Connect Done: 27.578134ms
TLS Handshake Done: 83.745488ms
Time to first byte: 147.988115ms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Running a Lightweight Server&lt;/p&gt;

&lt;p&gt;Netirk also includes a basic HTTP server to test local networking setups.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;netirk server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;➜ netirk server                                   
Starting a simple HTTP server on port: 8080
2024/11/25 23:46:37 request: GET /host
2024/11/25 23:46:44 request: GET /health
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use curl to interact with the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl localhost:8080/host
curl localhost:8080/health
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hostname-prints/returned
healthy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Help Menu&lt;/p&gt;

&lt;p&gt;To explore additional options or flags, use the help command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;➜  netirk git:(main) ./netirk help

               _    _        _    
  _ __    ___ | |_ (_) _ __ | | __
 | '_ \  / _ \| __|| || '__|| |/ /
 | | | ||  __/| |_ | || |   |   &amp;lt; 
 |_| |_| \___| \__||_||_|   |_|\_\


A portable network utility to check system reachability,
this utility can also be used to run a small http server when figuring out how to deploy a small
http server in a dynamic network landscape such as cloud platforms.

Usage:
  netirk [command]

Available Commands:
  check       Verify if host is reachable
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  server      Run local server for quick testing
  trace       Run local server for quick testing
  version     Print the version number of Netirk CLI

Flags:
  -h, --help   help for netirk

Use "netirk [command] --help" for more information about a command.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Why Choose Netirk?&lt;/p&gt;

&lt;p&gt;Netirk is a versatile tool that focuses on providing network insights with minimal setup. Its intuitive commands and clean output make it a valuable addition to any SRE or platform engineer’s toolkit.&lt;/p&gt;




&lt;p&gt;Netirk combines sleek performance with practical functionality. From SSL validation to DNS resolution timing, it empowers you to quickly debug and analyze network connections.&lt;/p&gt;

&lt;p&gt;🛠️ &lt;strong&gt;How You Can Help&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Code Contributions:&lt;/strong&gt;&lt;br&gt;
Whether you're a seasoned developer or just starting, there’s always a place for your skills. From bug fixes and new features to optimizing performance, your code matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Documentation &amp;amp; Tutorials:&lt;/strong&gt;&lt;br&gt;
Help others get started by improving our documentation or creating tutorials for beginners.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing &amp;amp; Feedback:&lt;/strong&gt;&lt;br&gt;
Test new features and report issues to help us refine the tool.&lt;/p&gt;

&lt;p&gt;🌐 &lt;strong&gt;How to Get Started&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Check Out Our GitHub Repository:&lt;/strong&gt;&lt;br&gt;
Visit our &lt;a href="https://github.com/himaatluri/netirk" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt; to explore the project, review open issues, and find contribution guidelines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Join the Discussion:&lt;/strong&gt;&lt;br&gt;
Engage with us through GitHub Issues and Pull Requests&lt;/p&gt;

&lt;p&gt;💡 &lt;strong&gt;Submit a Pull Request:&lt;/strong&gt;&lt;br&gt;
Found a bug or have a new feature idea? Submit a PR and let’s collaborate!&lt;/p&gt;

&lt;p&gt;🙌 Thank You for Your Support!&lt;br&gt;
Every contribution, big or small, brings us closer to making this tool an essential resource for network engineers everywhere. Let’s build something amazing together!&lt;/p&gt;

</description>
      <category>networking</category>
      <category>go</category>
    </item>
    <item>
      <title>Kubernetes Deployment with Ansible: A Comprehensive Guide to Bootstraping Kubernetes Clusters</title>
      <dc:creator>Hima</dc:creator>
      <pubDate>Sun, 21 Apr 2024 02:33:16 +0000</pubDate>
      <link>https://forem.com/himaatluri/kubernetes-deployment-with-ansible-a-comprehensive-guide-to-bootstraping-kubernetes-clusters-2ebh</link>
      <guid>https://forem.com/himaatluri/kubernetes-deployment-with-ansible-a-comprehensive-guide-to-bootstraping-kubernetes-clusters-2ebh</guid>
      <description>&lt;p&gt;Kubernetes has emerged as the de facto standard for container orchestration, enabling organizations to manage and scale containerized applications seamlessly. However, setting up and managing Kubernetes clusters can be complex and time-consuming. Automation tools like Ansible can significantly streamline this process by providing a consistent and repeatable way to provision, configure, and manage Kubernetes clusters. In this blog post, we will explore how to use Ansible roles to bootstrap Kubernetes clusters, simplifying the deployment process and ensuring consistency across environments.&lt;/p&gt;

&lt;p&gt;Before diving into the specifics of bootstrapping Kubernetes clusters with Ansible, let's briefly review what Ansible is and how it works. Ansible is an open-source automation tool that simplifies IT orchestration, configuration management, and application deployment. It uses a declarative language called YAML to define the desired state of systems, which it then applies through SSH connections.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ansible Roles
&lt;/h3&gt;

&lt;p&gt;Ansible roles are a way to organize and package automation content in a reusable and modular format. Roles encapsulate tasks, variables, handlers, and other Ansible components into a directory structure, making it easy to share and reuse automation logic across different projects. Leveraging roles promotes consistency, scalability, and maintainability in Ansible playbooks.&lt;/p&gt;

&lt;p&gt;Now, let's discuss how to leverage Ansible roles to bootstrap Kubernetes clusters. The process involves several key steps:&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before getting started, ensure that Ansible is installed on the control machine from which you will orchestrate the Kubernetes deployment. Additionally, you'll need SSH access to the target nodes where Kubernetes will be deployed.&lt;/p&gt;

&lt;p&gt;Ansible Inventory:&lt;br&gt;
Create an Ansible inventory file containing the details of the nodes in your Kubernetes cluster. This includes IP addresses, hostnames, and any necessary SSH configuration.&lt;/p&gt;

&lt;p&gt;Variables and Templates:&lt;br&gt;
Utilize Ansible variables and Jinja2 templates to parameterize the playbook and roles, allowing for flexibility and customization based on different environments or requirements. This includes specifying Kubernetes version, networking options, and other configuration parameters.&lt;/p&gt;

&lt;p&gt;Execute the Ansible playbook against the inventory of nodes using the &lt;code&gt;ansible-playbook&lt;/code&gt; command. Ansible will connect to each node via &lt;code&gt;SSH&lt;/code&gt; and apply the defined tasks and roles, orchestrating the entire Kubernetes deployment process automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits of Using Ansible for Kubernetes Bootstraping:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automation: Ansible automates the deployment process, reducing manual intervention and human error.&lt;/li&gt;
&lt;li&gt;Consistency: Ansible roles ensure consistency across deployments, eliminating configuration drift.&lt;/li&gt;
&lt;li&gt;Reusability: Roles can be reused and shared across projects, saving time and effort in development.&lt;/li&gt;
&lt;li&gt;Flexibility: Ansible's modular structure allows for customization and adaptation to different environments and requirements.&lt;/li&gt;
&lt;li&gt;Scalability: Ansible can scale to manage Kubernetes clusters of any size, from small development environments to large-scale production deployments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bootstraping Kubernetes clusters with Ansible offers a streamlined and efficient approach to infrastructure automation, enabling organizations to deploy and manage Kubernetes clusters with ease. By leveraging Ansible roles, teams can achieve consistency, reliability, and scalability in their Kubernetes deployments, ultimately accelerating time-to-market and improving operational efficiency.&lt;/p&gt;

&lt;p&gt;This &lt;a href="https://github.com/himasagaratluri/ansible-roles" rel="noopener noreferrer"&gt;repository&lt;/a&gt; contains reference roles for Kubeadm and k3s setup, PRs are welcome they are work-in-progress&lt;/p&gt;

</description>
    </item>
    <item>
      <title>CD pipeline in GO</title>
      <dc:creator>Hima</dc:creator>
      <pubDate>Sun, 28 Jan 2024 05:51:09 +0000</pubDate>
      <link>https://forem.com/himaatluri/cd-pipeline-in-go-294p</link>
      <guid>https://forem.com/himaatluri/cd-pipeline-in-go-294p</guid>
      <description>&lt;h2&gt;
  
  
  The IDEA
&lt;/h2&gt;

&lt;p&gt;I often pondered the necessity of acquiring proficiency in a new DSL (Domain-Specific Language) for orchestrating releases and executing CD (Continuous Delivery) steps such as simply building a container image and running shell commands etc.. It seemed counterintuitive to me, as I questioned why I couldn't achieve my objectives using the language(s) I'm already proficient in (Python/Go).&lt;/p&gt;

&lt;h2&gt;
  
  
  Analysis
&lt;/h2&gt;

&lt;p&gt;Analyzing the above idea a bit two key benefits stood out:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Time Efficiency:&lt;/u&gt;&lt;/strong&gt; The potential to save time and redirect it towards enhancing my proficiency in the core language, exploring concepts like Go routines, packaging, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Singular Focus:&lt;/u&gt;&lt;/strong&gt; The ability to concentrate solely on my primary project, minimizing the need to delve into and comprehend additional DSLs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The solution
&lt;/h2&gt;

&lt;p&gt;While looking at this ideal scenario, I recently came across &lt;code&gt;dagger.io&lt;/code&gt;, a brilliant tool crafted by the minds behind Docker. Intrigued, I decided to put it to the test by implementing CICD as code in a small project, specifically focusing on "Building a container image from a Dockerfile."&lt;/p&gt;

&lt;h2&gt;
  
  
  Project
&lt;/h2&gt;

&lt;p&gt;To kickstart the process, I began by installing the &lt;code&gt;dagger.io/dagger&lt;/code&gt; Go package and most importantly &lt;code&gt;dagger&lt;/code&gt; CLI.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For testing this you need to have the Container Runtime Environment (CRE) which is Docker in my case(you can try with &lt;code&gt;containerd&lt;/code&gt; which is the current CRE for K8s)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Just a recap, I have one basic test in my mind, build my image and ship it in my choice of code and I have no interest in learning a new configuration other than what I already knew.&lt;/p&gt;

&lt;p&gt;Breaking that goal into steps, the following are the tasks we need to code.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Creation of a Dockerfile.&lt;/li&gt;
&lt;li&gt;Building Image.&lt;/li&gt;
&lt;li&gt;Ship it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This experience with dagger.io marked a noteworthy exploration into simplifying CICD workflows, aligning seamlessly with my aspiration to articulate deployment tasks using the language integral to my primary project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Action
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Dagger Definition&lt;/u&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (
    "context"

    "dagger.io/dagger"
)

var DockerTag string = "123123123213.dkr.ecr.us-east-1.amazonaws.com"

func main() {
    ctx := context.Background()
    client, err := dagger.Connect(ctx)
    if err != nil {
        panic(err)
    }

    defer client.Close()

    thisImage := client.Container().Build(
        client.Host().Directory("./"),
        dagger.ContainerBuildOpts{
            Dockerfile: "../Dockerfile",
        })

    thisImage.Publish(ctx, DockerTag)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What just happened?
&lt;/h2&gt;

&lt;p&gt;In the above snippet, you are importing the dagger package and defining the steps that the pipeline should do, basically converting our tasks from the goal to instructions.&lt;/p&gt;

&lt;p&gt;When you submit this to the dagger command line,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqj5npufg93w2vu7abbqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqj5npufg93w2vu7abbqj.png" alt=" " width="426" height="137"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It opens a new session to the dagger engine and submits the above API requests.&lt;/li&gt;
&lt;li&gt;The dagger engine calculates the DAG(Directed Acyclic Graph) on how to achieve those tasks, simply computing the steps to produce the result.&lt;/li&gt;
&lt;li&gt;when the steps are executed the responses are sent back to our program.&lt;/li&gt;
&lt;li&gt;This is where we can trigger other APIs or may even trigger a different pipeline.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;This is just a basic project, I just wanted to see how easy it is to create a pipeline in Go and additionally test the pipeline locally without needing a CICD instance.&lt;/p&gt;

&lt;p&gt;what I like is that you can test your pipeline locally without needing to spin a local Jenkins or any other tool as a container and configure it and add build agents or install plugins etc.. with dagger I can eliminate all that extra stuff.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dagger.io/" rel="noopener noreferrer"&gt;Dagger&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Gitlab CLI</title>
      <dc:creator>Hima</dc:creator>
      <pubDate>Mon, 03 Apr 2023 21:34:01 +0000</pubDate>
      <link>https://forem.com/himaatluri/gitlab-cli-1j9p</link>
      <guid>https://forem.com/himaatluri/gitlab-cli-1j9p</guid>
      <description>&lt;p&gt;Use Gitlab CLI for watching pipeline status remotely&lt;/p&gt;

&lt;p&gt;$ glab ci view&lt;/p&gt;

&lt;p&gt;This will show the gitlab CI view in your terminal, you don't have to switch tabs and your focus. very helpful for focusing and avoiding distractions.&lt;/p&gt;

&lt;p&gt;Verify Merge Request details, without hopping into a web browser&lt;br&gt;
$ glab mr view&lt;/p&gt;

&lt;p&gt;Download and configure today!&lt;br&gt;
&lt;a href="https://docs.gitlab.com/ee/integration/glab/" rel="noopener noreferrer"&gt;https://docs.gitlab.com/ee/integration/glab/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>gitlab</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
