<?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: Omkar Halankar</title>
    <description>The latest articles on Forem by Omkar Halankar (@omkar_halankar).</description>
    <link>https://forem.com/omkar_halankar</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%2F1008186%2F6a8563e1-4c51-4fe9-8d38-ec0b5a9c9e80.jpeg</url>
      <title>Forem: Omkar Halankar</title>
      <link>https://forem.com/omkar_halankar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/omkar_halankar"/>
    <language>en</language>
    <item>
      <title>Atlantis : The DevOps Tool You Need for Cloud Automation</title>
      <dc:creator>Omkar Halankar</dc:creator>
      <pubDate>Sun, 26 Mar 2023 08:15:34 +0000</pubDate>
      <link>https://forem.com/omkar_halankar/atlantis-terraform-the-devops-tool-you-need-for-cloud-automation-l3e</link>
      <guid>https://forem.com/omkar_halankar/atlantis-terraform-the-devops-tool-you-need-for-cloud-automation-l3e</guid>
      <description>&lt;p&gt;&lt;strong&gt;Atlantis&lt;/strong&gt; is actually a DevOps tool that helps organizations to automate their infrastructure management and deployment processes. It is an open-source tool that streamlines the management of infrastructure as code (IaC) and helps teams collaborate more effectively on large-scale infrastructure projects.&lt;/p&gt;

&lt;p&gt;At its core, Atlantis is designed to work with Terraform, a popular infrastructure provisioning tool. It provides a centralized workflow for managing Terraform configuration files, allowing teams to review and approve changes before they are applied to production environments.&lt;/p&gt;

&lt;p&gt;One of the key benefits of Atlantis is that it helps to reduce the risk of errors and misconfigurations in infrastructure deployments. By providing a standardized workflow and approval process, it ensures that all changes are thoroughly tested and reviewed before they are applied.&lt;/p&gt;

&lt;p&gt;Additionally, Atlantis integrates with many popular DevOps tools, including GitHub, Bitbucket, and GitLab, making it easy to incorporate into existing workflows. It also provides detailed reporting and notifications, allowing teams to stay on top of infrastructure changes and quickly identify any issues that arise.&lt;/p&gt;

&lt;p&gt;Overall, Atlantis is a powerful tool for organizations looking to streamline their infrastructure management and deployment processes. By automating many of the tedious and error-prone tasks associated with infrastructure management, it allows teams to focus on delivering high-quality products and services to their customers.&lt;/p&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started with Atlantis...
&lt;/h2&gt;

&lt;p&gt;**&lt;br&gt;
To read more about Atlantis go to &lt;a href="https://www.runatlantis.io/"&gt;https://www.runatlantis.io/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;With Atlantis, developers are able to write and apply Terraform safely. They submit pull requests, can run &lt;code&gt;atlantis plan&lt;/code&gt; until their change looks good and then get approval from Ops to apply.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation Guide&lt;/strong&gt;&lt;br&gt;
There are multiple ways to install/deploy Atlantis ": &lt;a href="https://www.runatlantis.io/docs/installation-guide.html"&gt;Installation Guide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Helm-chart seems pretty straight forward to be defined in &lt;code&gt;values.yml&lt;/code&gt; &lt;a href="https://www.runatlantis.io/docs/deployment.html#kubernetes-helm-chart"&gt;https://www.runatlantis.io/docs/deployment.html#kubernetes-helm-chart&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Based on the Version Control System : Github / Enterprise , GitLab, .. setup the Webhook as described in &lt;a href="https://www.runatlantis.io/docs/configuring-webhooks.html"&gt;WebHook Configuration&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Atlantis Configuration&lt;/strong&gt;&lt;br&gt;
Three methods for configuring Atlantis:&lt;/p&gt;

&lt;p&gt;Passing flags to the atlantis server command&lt;br&gt;
Creating a server-side repo config file and using the --repo-config flag&lt;br&gt;
Placing an atlantis.yaml file at the root of your Terraform repositories&lt;/p&gt;

&lt;p&gt;Details on &lt;a href="https://www.runatlantis.io/docs/configuring-atlantis.html"&gt;Configuring Atlantis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Workflow Hooks&lt;/strong&gt;&lt;br&gt;
As part of Workflow setup:&lt;br&gt;
&lt;a href="https://www.runatlantis.io/docs/pre-workflow-hooks.html"&gt;Pre Workflow Hooks&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.runatlantis.io/docs/post-workflow-hooks.html"&gt;Post Workflow hooks&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For Atlantis also supports &lt;strong&gt;Terragrunt&lt;/strong&gt; apart from Terraform but not natively.&lt;br&gt;
Atlantis supports with help of &lt;a href="https://www.runatlantis.io/docs/custom-workflows.html"&gt;Custom Worksflows&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Using-Atlantis
&lt;/h2&gt;

&lt;p&gt;Once Atlantis is &lt;strong&gt;Installed, Configured and Workflows&lt;/strong&gt; are in-place Atlantis will be in action with supported commands &lt;a href="https://www.runatlantis.io/docs/using-atlantis.html"&gt;Atlantis in Action&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How Atlantis Works
&lt;/h2&gt;

&lt;p&gt;There are different aspects that need to be understood in detail while using Atlantis&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Locking&lt;/code&gt; the environment/workspace while provisioning infra in collaboration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Autoplan&lt;/code&gt; how the infrastructure changes should be configured with any change in repo.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Automerge&lt;/code&gt; how tge changes should be merged with successful PR plan.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More &lt;a href="https://www.runatlantis.io/docs/how-atlantis-works.html"&gt;Details&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  More robust setup
&lt;/h2&gt;

&lt;p&gt;with the above deployment and configuration, you are all set to use Atlantis but there are few more things that can be put in place for a better and a safer utilization of Atlantis.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;atlantis.yaml&lt;/code&gt; file actually requires Project setup which has to be modified manually in case any folders are added ex. in GitHub which has to be monitored by Atlantis. If there are few resources to be provisioned and monitored than this looks fine to be managed manually but in most of the cases provisioning is not limited and anything that involves manual intervention is prone to error.&lt;/p&gt;

&lt;p&gt;This can be automated by using another open-source tool by Transcend.io &lt;a href="https://transcend.io/blog/why-we-use-terragrunt/"&gt;terragrunt-atlantis-config&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This generates the project section automatically based on the changes done and raised during PR.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding Code Analysis Tool
&lt;/h2&gt;

&lt;p&gt;Can we ever imagine sitting back and manually reading each line of code to find flaws? To ease our work, several types of static analysis tools are available in the market which helps to analyze the code during the development and detect fatal defects early in the SDLC phase.&lt;/p&gt;

&lt;p&gt;Some tools that have been proven to be the best-fit in IAC for Terraform are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://aquasecurity.github.io/tfsec/v1.28.1/"&gt;Tfsec&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.checkov.io/"&gt;Checkov&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://runterrascan.io/"&gt;Terrascan&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The good thing about these Static Code Analysis tools are they can be used in conjunction with each other which increases the code coverage perimeter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-commit Hooks for Terraform
&lt;/h2&gt;

&lt;p&gt;Enforcing Terraform Linting and Security Standards Using Pre-Commit Hooks&lt;/p&gt;

&lt;p&gt;We can use &lt;a href="https://pre-commit.com/"&gt;Pre-Commit Hooks&lt;/a&gt; as an on-demand tool to integrate and use these tools before checking code into source control.&lt;/p&gt;

&lt;p&gt;Installation, Hooks, Usage all described in detail at &lt;a href="https://github.com/antonbabenko/pre-commit-terraform#readme"&gt;https://github.com/antonbabenko/pre-commit-terraform#readme&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>terraform</category>
      <category>gitops</category>
      <category>atlantis</category>
    </item>
    <item>
      <title>Datree - Automate quality checks for Kubernetes YAMLs</title>
      <dc:creator>Omkar Halankar</dc:creator>
      <pubDate>Mon, 16 Jan 2023 04:56:20 +0000</pubDate>
      <link>https://forem.com/omkar_halankar/datree-automate-quality-checks-for-kubernetes-yamls-14i7</link>
      <guid>https://forem.com/omkar_halankar/datree-automate-quality-checks-for-kubernetes-yamls-14i7</guid>
      <description>&lt;p&gt;So now-a-days we hear yet another fancy term ... &lt;strong&gt;Gitops&lt;/strong&gt;.&lt;br&gt;
In simple terms &lt;strong&gt;Git&lt;/strong&gt; is used as a single source of truth for applications and infrastructure. So the team can focus on Application development rather than Operational Tasks (&lt;strong&gt;Ops&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitOps&lt;/strong&gt; provides features like&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CI/CD Automation pipelines&lt;/li&gt;
&lt;li&gt;Entire Audit History - Version Control, History, Peer Review and Rollback.&lt;/li&gt;
&lt;li&gt;Git serves as Single Source of Truth&lt;/li&gt;
&lt;li&gt;Webhooks to trigger pipelines&lt;/li&gt;
&lt;li&gt;PR driven approach&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So now as part of GitOps where the entire Industry is moving towards, we'll have to update the YAML manifests for Kubernetes and then go ahead with the deployment to specific environment - Dev , Stage , Preprod , Production as the situation demands.&lt;/p&gt;

&lt;p&gt;Any changes to the Manifest files will raise questions about its success/failure. With human intervention, the process cannot be error-free. And the important question here would be "&lt;em&gt;&lt;strong&gt;Can a process be put in place to avoid pushing the changes to next level ?&lt;/strong&gt;&lt;/em&gt;"&lt;/p&gt;

&lt;p&gt;And the answer to the above question would be "&lt;strong&gt;Yes!&lt;/strong&gt;". &lt;br&gt;
There is a way to validate the YAML manifest files before applying them in any region post modification.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's special about Datree tool&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Datree&lt;/strong&gt; provides possibilities to avoid passing any Kubernetes Misconfigurations from reaching Production with its automated policy checks in the CI pipeline.&lt;/li&gt;
&lt;li&gt;Its Open-Source CLI tool that enables us to write Manifest files that meet project standards or follow best practices.&lt;/li&gt;
&lt;li&gt;CLI runs the policy check on your system, your files and their contents are not transferred to their backend. To their backend, which is used to show your policy check history on your dashboard, the tool only sends metadata.&lt;/li&gt;
&lt;li&gt;It has an offline mode as well. That means Datree also does not need to be connected to the cluster.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Installation and general usage
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://hub.datree.io/cli/getting-started#1-install-the-datree-cli"&gt;https://hub.datree.io/cli/getting-started#1-install-the-datree-cli&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Just run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl https://get.datree.io | /bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Verification post installation
To verify the installation process has been successful, run the below command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;datree test ~/.datree/k8s-demo.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When Datree usually starts its check , it goes through 3 main stages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;    YAML validation;&lt;/li&gt;
&lt;li&gt;    checking Kubernetes charts;&lt;/li&gt;
&lt;li&gt;    checking Kubernetes policies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The output will be similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ datree test ~/.datree/k8s-demo.yaml
&amp;gt;&amp;gt;  File: .datree/k8s-demo.yaml

[V] YAML validation
[V] Kubernetes schema validation

[X] Policy check

❌  Ensure each container image has a pinned (tag) version  [1 occurrence]
    - metadata.name: rss-site (kind: Deployment)
💡  Incorrect value for key `image` - specify an image version to avoid unpleasant "version surprises" in the future

❌  Ensure each container has a configured liveness probe  [1 occurrence]
    - metadata.name: rss-site (kind: Deployment)
💡  Missing property object `livenessProbe` - add a properly configured livenessProbe to catch possible deadlocks

❌  Ensure each container has a configured memory limit  [1 occurrence]
    - metadata.name: rss-site (kind: Deployment)
💡  Missing property object `limits.memory` - value should be within the accepted boundaries recommended by the organization

❌  Ensure workload has valid label values  [1 occurrence]
    - metadata.name: rss-site (kind: Deployment)
💡  Incorrect value for key(s) under `labels` - the vales syntax is not valid so the Kubernetes engine will not accept it


(Summary)

- Passing YAML validation: 1/1

- Passing Kubernetes (1.20.0) schema validation: 1/1

- Passing policy check: 0/1

+-----------------------------------+-----------------------+
| Enabled rules in policy "Default" | 21                    |
| Configs tested against policy     | 1                     |
| Total rules evaluated             | 21                    |
| Total rules skipped               | 0                     |
| Total rules failed                | 4                     |
| Total rules passed                | 17                    |
| See all rules in policy           | https://app.datree.io |
+-----------------------------------+-----------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The detailed information that is made available helps know about the violations in the manifest. This also proves to be helpful while fixing the violations.&lt;/p&gt;

&lt;p&gt;Each Datree policy check is performed using the default policy, which includes 50+ built-in rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  CI Intgration
&lt;/h2&gt;

&lt;p&gt;Datree helps in the Left Shift movement. The sooner the errors are identified in the CICD cycle its better for the application life cycle.&lt;/p&gt;

&lt;p&gt;To integrate Datree into CI/CD, you can follow the example below. You need to follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;    Get your account token (you can find it in the dashboard's Settings).&lt;/li&gt;
&lt;li&gt;    Set DATREE_TOKEN as secret/environment variable&lt;/li&gt;
&lt;li&gt;    Add Datree to your CI flow via token as shown (i.e., for GitHub).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://github.com/Omqarrr/argocd"&gt;GitHub Repo with Sample Application&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Below is an example of Datree Integration with GitHub Actions&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;# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  push:
    branches: [ feature* ]
#   pull_request:
#     branches: [ main ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

env:
  DATREE_TOKEN: ${{ secrets.DATREE_TOKEN }} 

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      - name: Install Datree
        run: curl https://get.datree.io | /bin/bash

      - name: Test k8s file
        run: datree test deployment/deployment.yaml --no-record --ignore-missing-schemas
        continue-on-error: false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=SuyashSonawane.vscode-datree"&gt;You can install VSCode Extension locally&lt;/a&gt;&lt;/p&gt;

</description>
      <category>datree</category>
      <category>kubernetes</category>
      <category>devops</category>
      <category>gitops</category>
    </item>
  </channel>
</rss>
