<?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[DevStream - Medium]]></title>
        <description><![CDATA[DevStream blog. DevStream (CLI tool named dtm) is an open-source DevOps toolchain manager. - Medium]]></description>
        <link>https://medium.com/devstream?source=rss----a0072fac81ea---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>DevStream - Medium</title>
            <link>https://medium.com/devstream?source=rss----a0072fac81ea---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 02:02:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/devstream" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[App-Centric Configuration: Adding More Value to Your Life]]></title>
            <link>https://medium.com/devstream/app-centric-configuration-adding-more-value-to-your-life-8b53886086fd?source=rss----a0072fac81ea---4</link>
            <guid isPermaLink="false">https://medium.com/p/8b53886086fd</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devstream]]></category>
            <dc:creator><![CDATA[Tiexin Guo]]></dc:creator>
            <pubDate>Wed, 30 Nov 2022 01:53:14 GMT</pubDate>
            <atom:updated>2022-11-30T01:53:14.067Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vW33tRYfkMgvfBZc.png" /></figure><h3>DevStream’s Story</h3><p><a href="https://github.com/devstream-io/devstream/releases/tag/v0.1.0">About nine months ago, DevStream was first publicly released</a>. Since then, it has evolved a lot. If this is the first time you have come across DevStream, maybe read <a href="https://blog.devstream.io/posts/hello-world/">this blog</a> for a quick overview.</p><p>In the current incarnation (v0.9), every single DevOps tool (including integrations of tools and CI/CD pipeline setup for apps) is treated as a “Tool”, which is a DevStream concept. So, if you would like to define a DevOps platform that does the following:</p><ul><li>repository scaffolding</li><li>continuous integration w/ GitHub Actions</li><li>install Argo CD as the tool for continuous deployment</li><li>continuous deployment w/ Argo CD</li></ul><p>Your DevStream tools.yaml config file would look similar to this:</p><pre>tools:<br>- name: repo-scaffolding<br>  instanceID: myapp<br>  options:<br>    destinationRepo:<br>      owner: [[ githubUser ]]<br>      repo: [[ app ]]<br>      branch: main<br>      repoType: github<br>    sourceRepo:<br>      org: [[ githubUser ]]<br>      repo: dtm-scaffolding-python<br>      repoType: github<br>    vars:<br>      ImageRepo: [ dockerUser ]/[ app ]<br>      AppName: [[ app ]]<br>- name: githubactions-python<br>  instanceID: default<br>  dependsOn: [ repo-scaffolding.myapp ]<br>  options:<br>    owner: [[ githubUser ]]<br>    repo:  [[ app ]]<br>    language:<br>      name: python<br>    branch: main<br>    docker:<br>      registry:<br>        type: dockerhub<br>        username: [[ dockerUser ]]<br>        repository: [[ app ]]<br>- name: helm-installer<br>  instanceID: argocd<br>- name: argocdapp<br>  instanceID: default<br>  dependsOn: [ &quot;argocd.default&quot;, &quot;githubactions-python.default&quot; ]<br>  options:<br>    app:<br>      name: [[ app ]]<br>      namespace: argocd<br>    destination:<br>      server: https://kubernetes.default.svc<br>      namespace: default<br>    source:<br>      valuefile: values.yaml<br>      path: helm/[[ app ]]<br>      repoURL: ${{repo-scaffolding.myapp.outputs.repoURL}}</pre><p>A quick explanation — what DevStream does with this config is the following:</p><ul><li>install Argo CD;</li><li>repository scaffolding for myapp;</li><li>CI/CD for myapp.</li></ul><p>It looks nice and works like a charm.</p><p>However, suppose you have more than one app to worry about (more often than not, that would be the case in the microservice era). In that case, things start to get a bit complicated: you’d have to repeat the githubactions-golang and argocdapp sections as many times as the number of apps you manage.</p><p>That is to say, to manage ten apps/microservices, your DevStream YAML file may grow to well past 300 lines of config.</p><p>Today, we are happy to announce that it’s no longer the case. We’ve simplified it. By a big margin. With the release of v0.10.</p><p>Read on.</p><h3>Adding Value to Your Life</h3><p>A big config is definitely harder to read and maintain, and we don’t like that. That’s why we decided to solve this problem in the first place.</p><p>However, we waited to get right into it.</p><p>Instead, we started to think about our market positioning and value proposition. What is DevStream anyway? What problems does it solve? Why would other engineers want to use it instead of building stuff manually or purchasing one-stop DevOps platforms?</p><p>If we could precisely answer these questions, we would know how to improve it to the next level.</p><p>The discussion went on and on. The whole team, including our CEO, discussed multiple days. We’ve put tens of hours of thought and debate into it, until we figured out where exactly DevStream can add value to your life:</p><ul><li>installing DevOps tools (but that’s not the point at all)</li><li>integrating DevOps tools and building engineering platforms (now we’re talking)</li><li>application lifecycle/software development lifecycle management:</li><li>repository bootstrapping</li><li>continuous integration pipelines, integrating best practices, typical stages, and steps into it</li><li>continuous deployment pipelines, integrating helm chart/Dockerfile best practices</li><li>…</li></ul><p><em>Note: read more on </em><a href="https://www.redhat.com/en/topics/devops/what-is-application-lifecycle-management-alm"><em>Application Lifecycle Management (ALM) here</em></a><em> and </em><a href="https://medium.com/gitguardian/how-adding-security-into-devops-accelerates-the-sdlc-pt-1-459134252ee7"><em>Software Development Lifecycle (SDLC) here</em></a><em>.</em></p><h3>Lightbulb: Apps? Apps!</h3><p>Since many values DevStream could bring are around applications/microservices and their lifecycle management, why not simply build configurations based on that?</p><p>We call this new thought “app-centric” configuration, and let’s get right into it:</p><h3>Backward Compatibility</h3><p>First things first, the previous “tools” config still works. We wouldn’t want to break that. That is to say, if you copy-paste the first code snippet from the beginning of this article, it’s supposed to work without any problem, just like previous versions.</p><h3>(Much) Shorter, Simpler, Easier, While Achieving the Same</h3><p>You’d be surprised that the config below does exactly the same thing as the code snippet at the very beginning of this article.</p><pre>apps:<br>- name: myapp<br>  spec:<br>    language: python<br>    framework: django<br>  repo:<br>    url: github.com/devstream-io/myapp<br>  repoTemplate:<br>    url: github.com/devstream-io/dtm-scaffolding-python<br>  ci:<br>    - type: githubactions<br>  cd:<br>    - type: argocdapp</pre><p>Is this magic? How’d we do that?</p><p>First, we created a new abstraction that is called “apps”. Each app corresponds to a real-world application or microservice that you manage.</p><p>Secondly, we simplified the configurations as much as possible with five small sections:</p><ul><li>spec: language, framework related to the application, which is shared information with other sections</li><li>repo: where to create/bootstrap the repository for the app</li><li>repoTemplate: the template used to bootstrap the app’s repo</li><li>ci: setting up continuous integration for this app</li><li>cd: setting up continuous deployment for this app</li></ul><p>Last but not least, more “defaults” and “best practices” are integrated, by default, into DevStream, so that you don’t have to override most of the configs.</p><p>Neat, right? I know.</p><h3>One File to Rule Them All</h3><p>Putting It All Together:</p><pre>config:<br>  state:<br>  backend: local<br>  options:<br>    stateFile: devstream.state<br>tools:<br>- name: helm-installer<br>  instanceID: argocd<br>apps:<br>- name: myapp1<br>  spec:<br>    language: python<br>    framework: django<br>  repo:<br>    url: github.com/devstream-io/myapp1<br>  repoTemplate:<br>    url: github.com/devstream-io/dtm-scaffolding-python<br>  ci:<br>  - type: githubactions<br>  cd:<br>  - type: argocdapp<br>- name: myapp2<br>  spec:<br>    language: golang<br>    framework: gin<br>  repo:<br>    url: github.com/devstream-io/myapp2<br>  repoTemplate:<br>    url: github.com/devstream-io/dtm-scaffolding-golang<br>  ci:<br>  - type: githubactions<br>  cd:<br>  - type: argocdapp</pre><p>I hope you enjoy this new feature. Have fun experimenting tools together with apps!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b53886086fd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devstream/app-centric-configuration-adding-more-value-to-your-life-8b53886086fd">App-Centric Configuration: Adding More Value to Your Life</a> was originally published in <a href="https://medium.com/devstream">DevStream</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevStream 0.9.0 Release]]></title>
            <link>https://medium.com/devstream/devstream-0-9-0-release-6e905fd8b787?source=rss----a0072fac81ea---4</link>
            <guid isPermaLink="false">https://medium.com/p/6e905fd8b787</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[engineering-productivity]]></category>
            <dc:creator><![CDATA[Tiexin Guo]]></dc:creator>
            <pubDate>Fri, 16 Sep 2022 01:12:14 GMT</pubDate>
            <atom:updated>2022-09-16T01:12:14.149Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/819/0*BovBiejwobos99o5.png" /></figure><h3>Official Releases for Different Platforms</h3><ul><li><a href="https://devstream.gateway.scarf.sh/releases/v0.9.0/dtm-darwin-arm64">dtm-darwin-arm64</a></li><li><a href="https://devstream.gateway.scarf.sh/releases/v0.9.0/dtm-darwin-amd64">dtm-darwin-amd64</a></li><li><a href="https://devstream.gateway.scarf.sh/releases/v0.9.0/dtm-linux-amd64">dtm-linux-amd64</a></li></ul><h3>Major Changes since Last Release</h3><p>This version focuses on two things:</p><ul><li>refactoring</li><li>making the Jenkins/GitLab/Harbor/Java combination prod-ready</li></ul><p>Here we highlighted a few changes in this release:</p><h4>Core</h4><ul><li>helm-type plugins now support local charts</li><li>there is a new “force” flag to dtm destroy command, thanks to @csonezp</li><li>k8s backend is supported for storing state</li></ul><h4>Plugins</h4><ul><li>GitHub Actions for Python is enhanced</li><li>Jenkins/GitLab/Harbor plugins are greatly enhanced, including documentation, features, default values, etc.</li><li>ArgoCD plugin now treat namespace in an “upsert” manner</li><li>new plugin: harbor</li><li>added many default options for each plugin</li></ul><h4>Docs</h4><ul><li>Install dtm with asdf in quickstart, thanks to @zhenyuanlau</li><li>GitLab + Jenkins + Harbor On Premise Toolchain best practice (in Mandarin)</li><li>There is a new document (in both English and Chinese) detailing how to setup a local development Environment for Golang/K8s related projects (not specific to DevStream)</li></ul><h3>More</h3><p>See the <a href="https://github.com/devstream-io/devstream/compare/v0.8.0...v0.9.0">full changelog here</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e905fd8b787" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devstream/devstream-0-9-0-release-6e905fd8b787">DevStream 0.9.0 Release</a> was originally published in <a href="https://medium.com/devstream">DevStream</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevStream Certification Program Introduction]]></title>
            <link>https://medium.com/devstream/devstream-certification-program-introduction-263574f3e0a1?source=rss----a0072fac81ea---4</link>
            <guid isPermaLink="false">https://medium.com/p/263574f3e0a1</guid>
            <category><![CDATA[community]]></category>
            <category><![CDATA[devstream]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Tiexin Guo]]></dc:creator>
            <pubDate>Thu, 21 Jul 2022 08:18:14 GMT</pubDate>
            <atom:updated>2022-07-21T08:18:13.963Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*IQBK1NjoDMgQOfqU.jpg" /><figcaption>Genie, Sichuan, China.</figcaption></figure><p>Hello, and welcome to another DevStream blog post!</p><p>In today’s post, DevStream is happy to announce the new certification program for our contributors!</p><h3>0 Background</h3><p>For veteran contributors dating back to the beginning of this year, I’m sure you still remember our original certification, which is a well-designed digital image that certifies your efforts in the open-source community.</p><p>As beautiful as it is, there are some drawbacks with a certification in the form of digital images. To name a few:</p><ol><li>The image is pretty big, making it hard to share on social media platforms.</li><li>Since it’s an image, it’s not so easy to embed it in your profile page, for example, LinkedIn profile, GitHub profile, or even inside your CV.</li><li>It’s not easy for others to verify the authenticity of the certification.</li><li>Others don’t know much about what you did to get that achievement, what skills you already mastered.</li></ol><h3>1 Introducing the New Digital Certification Program</h3><p>With those pain points in mind, we sought out a new form of credential/certification system that would address those very drawbacks, and it wasn’t long before we got ourselves an answer: Credly.</p><p>TL;DR: Credly helps issue digital badges.</p><p>OK, that was brutally brief, isn’t it? So, let’s read the long version:</p><h3>2 <a href="https://info.credly.com/about-us">The Credly Story</a></h3><blockquote><em>Credly was founded to help people connect their verified abilities to opportunities. And, we strive to bring equity and access to every member of the current and future workforce. After leading the transformation in how people learn and connect online, our team turned its sights on bringing innovation to the outputs of meaningful learning experiences: the credential itself.</em></blockquote><blockquote><em>In 2018, Credly acquired the Acclaim credential business from Pearson and became the most comprehensive global solution for recognizing skills, capabilities, and achievements. Pearson invested in Credly’s growth and in 2022, acquired Credly to provide powerful solutions in the global workforce learning and talent market.</em></blockquote><blockquote><em>Credly is leading the digital credential movement, making talent more visible and opportunity more accessible.</em></blockquote><blockquote>Credly works with leading organizations that share our focus on unleashing the potential of the workforce with digital credentials.</blockquote><h3>3 Why Did DevStream Go with Credly</h3><p>No brainer: it seems <a href="https://learn.credly.com/blog/your-brand-doesn-t-need-to-white-label-digital-credentials">95% of the top IT certifications are issued through the Credly network</a>.</p><p>Plus, I got to know Credly because <a href="https://www.credly.com/organizations/amazon-web-services/badges">AWS uses Credly for its certifications</a>. Have a quick look at this beautiful wall of AWS certifications you can get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*8O6D-8yWOcJo0Y3N.png" /></figure><p>Checkout <a href="https://www.credly.com/users/tiexin-guo/badges">my profile</a> on Credly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*IRX2LcVcMiQxKLEV.png" /></figure><h3>4 Wait a Minute. So I Got My Certs. Where Can I Show Them Off?</h3><h4>GitHub Profile:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*aqviK0_WGFzxabiq.png" /></figure><h4>LinkedIn Profile:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*0DNcx3w5JEK3qywW.png" /></figure><p>Tweet all you want, and DevStream will try our best to retreat your tweets!</p><p><em>Spoil alert: DevStream is redesigning our </em><a href="https://www.devstream.io/community/"><em>community page on our official website</em></a>. I know, I know, it looks ugly; for now. It will be pretty, soon. You have my words. Contributors and their certifications will show up on the community page. Think of it as a “wall of fame” of DevStream. How cool is that!</p><h3>5 Where Do We Go From Here</h3><h4>Earn</h4><p>We will issue a digital badge (and we will try to automate the process) when you earn a DevStream certification. Digital badges are active as long as your certification is valid.</p><h4>Claim</h4><p>You’ll get an email from Credly’s platform with instructions for claiming your badge.</p><h4>Share</h4><p>Use Credly’s platform sharing features to post on your social media newsfeeds and add your digital badge to your professional profile, as mentioned above.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=263574f3e0a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devstream/devstream-certification-program-introduction-263574f3e0a1">DevStream Certification Program Introduction</a> was originally published in <a href="https://medium.com/devstream">DevStream</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevStream Joins CNCF Sandbox]]></title>
            <link>https://medium.com/devstream/devstream-joins-cncf-sandbox-f7a350b7df67?source=rss----a0072fac81ea---4</link>
            <guid isPermaLink="false">https://medium.com/p/f7a350b7df67</guid>
            <category><![CDATA[devstream]]></category>
            <category><![CDATA[cncf]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[community]]></category>
            <dc:creator><![CDATA[Tiexin Guo]]></dc:creator>
            <pubDate>Thu, 16 Jun 2022 03:57:06 GMT</pubDate>
            <atom:updated>2022-06-16T03:57:06.679Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NdoXYmLyTw-NK3_-dRn0-A.png" /></figure><p>On Jun 14, 2022, in the CNCF TOC Meeting, DevStream passed the technical oversight committee’s review, and joined CNCF sandbox!</p><h3>Background</h3><p>DevStream dated back in Oct 2021 and released the first minor version v0.1.0 in Feb 2022. Now, DevStream is a big family with 26 contributors and hundreds of users in our user group. We’ve attracted some attention, too. Now, we are on our way to 400 GitHub stars, which is all organic growth!</p><h3>Thank You</h3><p>Here, I, Tiexin Guo, PMC Chair of DevStream, representing our whole team, would like to say a heartfelt “thank you” to the community.</p><p>Joining the CNCF wouldn’t be remotely possible if it weren’t for you guys: all the users, contributors, and organization members.</p><p>Here in the DevStream community, we often ask ourselves this question: what is DevStream? What is DevStream’s core value? What defines DevStream? An open-source DevOps toolchain manager? Setting up your DevOps platform at the click of a button within 5 minutes?</p><p>While those are all true, they <em>don’t</em> define DevStream.</p><blockquote>You<em> define DevStream. You </em>are<em> DevStream. DevStream wouldn’t be a thing without our passionate community.</em></blockquote><h3>The CNCF TOC Review</h3><p>Oh, by the way, we didn’t just pass the TOC review, or meet the bare minimum requirements. It’s proud and fair to say that we passed with flying colors.</p><p>Normally, the CNCF TOC meeting is held every two months, and they review a bunch of projects in that one-hour meeting. Some projects are scrutinized; it’s not uncommon to see the TOC carefully review a project for about 10 minutes.</p><p>We passed within 2 minutes and 10 seconds. Yep, that’s not a typo :) See those glorious two minutes <a href="https://youtu.be/zcTZ2pYPM9I?t=2508">here on youtube</a>. Or, you can choose to watch the whole video if you would like to know more about how CNCF TOC meeting works:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ffd.xuwubk.eu.org%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FzcTZ2pYPM9I%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Ffd.xuwubk.eu.org%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DzcTZ2pYPM9I&amp;image=https%3A%2F%2Ffd.xuwubk.eu.org%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FzcTZ2pYPM9I%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a344d8a2fe52efae5d9add50b4c582f3/href">https://medium.com/media/a344d8a2fe52efae5d9add50b4c582f3/href</a></iframe><p>The review of DevStream starts from <a href="https://youtu.be/zcTZ2pYPM9I?t=2508">41:48</a>.</p><p>The result is officially documented <a href="https://lists.cncf.io/g/cncf-toc/topic/results_from_sandbox/91754161">here</a>; @amye has also <a href="https://github.com/cncf/toc/pull/860/files#diff-434180cbdead0d6d7a28f6e5961f360cd965ca1c75bd9b2cd736b9d318a59bb1R135">made a PR already to have DevStream listed</a>.</p><h3>What We Did Right</h3><p>This honor belongs to the community, and here I’d like to give back to the community a short list of actions that we think we did right from the beginning and accelerated everything:</p><ul><li>good documentation</li><li>good roadmap</li><li>some main contributors</li><li>consistent contributions from the community</li><li>community meetings</li><li>a slack channel (where the contributors communicate asynchronously)</li></ul><p>In the doc, it’s also critical to have some form of developer guide that lowers the bar and reduces the barriers for new contributors. After all, open-source is all about community.</p><h3>Summary</h3><p>In the next blog post, I will try to write a short FAQ which I summarized from CNCF TOC meetings. I will try my best to answer questions like:</p><ul><li>What exactly will the TOC meeting review?</li><li>What aspects are important?</li></ul><p>Stay tuned. See you in the next one!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7a350b7df67" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devstream/devstream-joins-cncf-sandbox-f7a350b7df67">DevStream Joins CNCF Sandbox</a> was originally published in <a href="https://medium.com/devstream">DevStream</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using AWS S3 to Store DevStream State]]></title>
            <link>https://medium.com/devstream/using-aws-s3-to-store-devstream-state-70a6a2e53f62?source=rss----a0072fac81ea---4</link>
            <guid isPermaLink="false">https://medium.com/p/70a6a2e53f62</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devstream]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Tiexin Guo]]></dc:creator>
            <pubDate>Mon, 30 May 2022 09:41:17 GMT</pubDate>
            <atom:updated>2022-05-30T09:41:17.813Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cZmRn7vcQgtynfwl_EfYxg.jpeg" /></figure><p>In our <a href="https://blog.devstream.io/posts/v060-release/">latest release v0.6.0</a>, using AWS S3 to store DevStream state is supported.</p><p>In this blog, we are going to demonstrate the usage of AWS S3 to store DevStream’s state files.</p><h3>Terminology</h3><p><em>State: if you don’t already know about DevStream state, please read </em><a href="https://docs.devstream.io/en/latest/core-concepts/core-concepts/"><em>this doc</em></a><em> and </em><a href="https://blog.devstream.io/posts/creating-a-dtm-plugin-for-anything/"><em>this blog</em></a><em> helps, too.</em></p><p>Backend: where to actually store the state file. It can be either local or s3 at the moment.</p><h3>Configuration</h3><p>In the main config file, we have a section to configure the state. Currently, local and S3 are supported.</p><p>Local example:</p><pre>varFile: variables-gitops.yaml</pre><pre>toolFile: tools-gitops.yaml</pre><pre>state:<br>  backend: local<br>  options:<br>    stateFile: devstream.state</pre><p>S3 example:</p><pre>varFile: variables-gitops.yaml</pre><pre>toolFile: tools-gitops.yaml</pre><pre>state:<br>  backend: s3<br>  options:<br>    bucket: devstream-remote-state<br>    region: ap-southeast-1<br>    key: devstream.state</pre><p>More on configuring state <a href="https://docs.devstream.io/en/latest/core-concepts/stateconfig/">here</a>.</p><p>In short, we can use the “backend” keyword to specify where to store the state: either locally or in an S3 bucket. If S3 is used, we need to specify the bucket, region, and the S3 key as well.</p><h3>Config File Examples</h3><p>In this demo, we use the following configs:</p><p>config.yaml:</p><pre>varFile: variables-gitops.yaml</pre><pre>toolFile: tools-gitops.yaml</pre><pre>state:<br>  backend: s3<br>  options:<br>    bucket: devstream-test-remote-state<br>    region: ap-southeast-1<br>    key: devstream.state</pre><p>variables-gitops.yaml:</p><pre>githubUsername: IronCore864<br>repoName: dtm-test-go<br>defaultBranch: main</pre><pre>dockerhubUsername: ironcore864</pre><pre>argocdNameSpace: argocd<br>argocdDeployTimeout: 5m</pre><p>tools-gitops.yaml:</p><pre>tools:<br>- name: github-repo-scaffolding-golang<br>  instanceID: default<br>  options:<br>    owner: [[ githubUsername ]]<br>    org: &quot;&quot;<br>    repo: [[ repoName ]]<br>    branch: [[ defaultBranch ]]<br>    image_repo: [[ dockerhubUsername ]]/[[ repoName ]]</pre><h3>Getting Started</h3><p>Before reading on, now is a good time to check if you have configured your AWS related environment variables correctly or not.</p><p>For macOS/Linux users, do:</p><pre>export AWS_ACCESS_KEY_ID=ID_HERE<br>export AWS_SECRET_ACCESS_KEY=SECRET_HERE<br>export AWS_DEFAULT_REGION=REGION_HERE</pre><p>For more information, see the <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html">official document here</a>.</p><h3>Apply</h3><p>Then let’s run dtm apply:</p><pre>tiexin@mbp ~/work/devstream-io/devstream $ ./dtm apply<br>2022-05-30 17:07:59 ℹ [INFO]  Apply started.<br>2022-05-30 17:07:59 ℹ [INFO]  Using dir &lt;.devstream&gt; to store plugins.<br>2022-05-30 17:07:59 ℹ [INFO]  Using s3 backend. Bucket: devstream-test-remote-state, region: ap-southeast-1, key: devstream.state.<br>2022-05-30 17:08:00 ℹ [INFO]  Tool (github-repo-scaffolding-golang/default) found in config but doesn&#39;t exist in the state, will be created.<br>Continue? [y/n]<br>Enter a value (Default is n): y</pre><pre>2022-05-30 17:08:08 ℹ [INFO]  Start executing the plan.<br>2022-05-30 17:08:08 ℹ [INFO]  Changes count: 1.<br>2022-05-30 17:08:08 ℹ [INFO]  -------------------- [  Processing progress: 1/1.  ] --------------------<br>2022-05-30 17:08:08 ℹ [INFO]  Processing: (github-repo-scaffolding-golang/default) -&gt; Create ...<br>2022-05-30 17:08:12 ℹ [INFO]  The repo dtm-test-go has been created.<br>2022-05-30 17:08:29 ✔ [SUCCESS]  Tool (github-repo-scaffolding-golang/default) Create done.<br>2022-05-30 17:08:29 ℹ [INFO]  -------------------- [  Processing done.  ] --------------------<br>2022-05-30 17:08:29 ✔ [SUCCESS]  All plugins applied successfully.<br>2022-05-30 17:08:29 ✔ [SUCCESS]  Apply finished.</pre><p>As we can see from the output, the S3 backend is used, and it also shows the bucket and key you are using, and in which region this bucket lives.</p><h3>Checking the State File</h3><p>After apply, let&#39;s download the state file from S3 and check it out:</p><pre>tiexin@mbp ~/work/devstream-io/devstream $ aws s3 cp s3://devstream-test-remote-state/devstream.state .</pre><p>And if we open the downloaded file, we will see something similar to the following:</p><pre>github-repo-scaffolding-golang_default:<br>  name: github-repo-scaffolding-golang<br>  instanceid: default<br>  dependson: []<br>  options:<br>    branch: main<br>    image_repo: ironcore864/dtm-test-go<br>    org: &quot;&quot;<br>    owner: IronCore864<br>    repo: dtm-test-go<br>  resource:<br>    org: &quot;&quot;<br>    outputs:<br>      org: &quot;&quot;<br>      owner: IronCore864<br>      repo: dtm-test-go<br>      repoURL: https://github.com/IronCore864/dtm-test-go.git<br>    owner: IronCore864<br>    repoName: dtm-test-go</pre><p>which is exactly the same as if we were using the local backend to store state.</p><p>Like this quick tutorial? Then I suggest to read more of our latest DevOps blogs:</p><ul><li><a href="https://blog.devstream.io/posts/9-terraform-best-practices/">9 Extraordinary Terraform Best Practices That Will Change Your Infra World</a></li><li><a href="https://blog.devstream.io/posts/dagger-in-depth/">Dagger (the CI/CD Tool, not the Knife) In-Depth — Everything You Need to Know (as of Apr 2022)</a></li><li><a href="https://blog.devstream.io/posts/dmca-takedowns/">A Brief History of the DMCA</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70a6a2e53f62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devstream/using-aws-s3-to-store-devstream-state-70a6a2e53f62">Using AWS S3 to Store DevStream State</a> was originally published in <a href="https://medium.com/devstream">DevStream</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevStream v0.6.0 Release]]></title>
            <link>https://medium.com/devstream/devstream-v0-6-0-release-7d519a9ba52a?source=rss----a0072fac81ea---4</link>
            <guid isPermaLink="false">https://medium.com/p/7d519a9ba52a</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[devstream]]></category>
            <category><![CDATA[devsecops]]></category>
            <dc:creator><![CDATA[Tiexin Guo]]></dc:creator>
            <pubDate>Wed, 25 May 2022 07:49:48 GMT</pubDate>
            <atom:updated>2022-05-25T07:49:48.235Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*q4eCB-WVHNTbMs41.jpg" /></figure><h3>Demo</h3><p>Talk is cheap. Show me the demo:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ffd.xuwubk.eu.org%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2Fq7TK3vFr1kg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Ffd.xuwubk.eu.org%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3Dq7TK3vFr1kg&amp;image=https%3A%2F%2Ffd.xuwubk.eu.org%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2Fq7TK3vFr1kg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/be52f5f8adfee87cb431ad960df5d680/href">https://medium.com/media/be52f5f8adfee87cb431ad960df5d680/href</a></iframe><h3>Official Releases for Different Platforms</h3><ul><li><a href="https://devstream.gateway.scarf.sh/releases/v0.6.0/dtm-darwin-arm64">dtm-darwin-arm64</a></li><li><a href="https://devstream.gateway.scarf.sh/releases/v0.6.0/dtm-darwin-amd64">dtm-darwin-amd64</a></li><li><a href="https://devstream.gateway.scarf.sh/releases/v0.6.0/dtm-linux-amd64">dtm-linux-amd64</a></li></ul><h3>Major Changes</h3><ul><li>Plugins now are released to an AWS S3 bucket. dtm init also downloads plugins from S3.</li><li>AWS S3 can be used to store DevStream state.</li></ul><h3>New Contributors</h3><ul><li><a href="https://dev.to/aeinrw">@aeinrw</a> made their first contribution in <a href="https://github.com/devstream-io/devstream/pull/456">https://github.com/devstream-io/devstream/pull/456</a></li><li>@lyleshaw made their first contribution in <a href="https://github.com/devstream-io/devstream/pull/463">https://github.com/devstream-io/devstream/pull/463</a></li><li>@aFlyBird0 made their first contribution in <a href="https://github.com/devstream-io/devstream/pull/479">https://github.com/devstream-io/devstream/pull/479</a></li><li>@wzymumon made their first contribution in <a href="https://github.com/devstream-io/devstream/pull/477">https://github.com/devstream-io/devstream/pull/477</a></li><li>@iyear made their first contribution in <a href="https://github.com/devstream-io/devstream/pull/498">https://github.com/devstream-io/devstream/pull/498</a></li><li>@SongDunYu made their first contribution in <a href="https://github.com/devstream-io/devstream/pull/540">https://github.com/devstream-io/devstream/pull/540</a></li><li>@shubham-cmyk made their first contribution in <a href="https://github.com/devstream-io/devstream/pull/536">https://github.com/devstream-io/devstream/pull/536</a></li><li>@yclchuxue made their first contribution in <a href="https://github.com/devstream-io/devstream/pull/553">https://github.com/devstream-io/devstream/pull/553</a></li><li>@24sama made their first contribution in <a href="https://github.com/devstream-io/devstream/pull/562">https://github.com/devstream-io/devstream/pull/562</a></li></ul><p>Congratulations, and keep up the good work!</p><h3>More</h3><p><strong>Full Changelog</strong>: <a href="https://github.com/devstream-io/devstream/compare/v0.5.0...v0.6.0">https://github.com/devstream-io/devstream/compare/v0.5.0...v0.6.0</a></p><p>For more details, see the <a href="https://github.com/devstream-io/devstream/releases/tag/v0.6.0">GitHub release page here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d519a9ba52a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devstream/devstream-v0-6-0-release-7d519a9ba52a">DevStream v0.6.0 Release</a> was originally published in <a href="https://medium.com/devstream">DevStream</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with minikube]]></title>
            <link>https://medium.com/devstream/get-started-with-minikube-7047168b57e5?source=rss----a0072fac81ea---4</link>
            <guid isPermaLink="false">https://medium.com/p/7047168b57e5</guid>
            <category><![CDATA[minikube]]></category>
            <category><![CDATA[cncf]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devstream]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Daniel Hu]]></dc:creator>
            <pubDate>Sat, 23 Apr 2022 14:45:37 GMT</pubDate>
            <atom:updated>2022-04-24T13:33:26.050Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1CbkaRle7REekUFbVgoINg.png" /><figcaption>Bar Mixato, Starbucks Reserve, Chengdu, China</figcaption></figure><p>What’s up guys, this is Daniel! Yeah, this English blog is WRITTEN by me, not TRANSLATED by me! It’s my first English blog in my whole life. If you are a Chinese reader, maybe you’ve ever seen my Chinese blogs before. Right, I wrote a lot of blogs, but only in Chinese. Believe it or not, English isn’t my strong suit. But I want to have a try today and I’ll do my best. Let’s get started.</p><h3>What We Will Talk about Today</h3><p>If you ask me how to create a local Kubernetes cluster, I’ll tell you <a href="https://kind.sigs.k8s.io/">Kind</a>, <a href="https://minikube.sigs.k8s.io/docs/">minikube</a>, and <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/">Kubeadm</a> are all good choices. If you ask me which tool is the most recommended for beginners, my answer must be minikube or Kind. minikube is more powerful than Kind, and Kind is easier than minikube.</p><p>In my previous article, I walked you guys through “How to Create a Local Kubernetes Cluster from the Ground Up” with Kind. If you are interested, here&#39;s a quick link for you:</p><ul><li><a href="https://www.devstream.io/blog/local-k8s-with-kind">Creating a Local Kubernetes Cluster from the Ground Up</a></li></ul><p>You might ask why that article is written by <a href="https://github.com/IronCore864">Tiexin Guo</a>, not me. Of course! As I said in the beginning, this blog you are reading now is my first English blog. So, technically, the one above isn’t “my” article, but I did write the Chinese version of it:</p><ul><li><a href="https://www.devstream.io/zh/blog/local-k8s-with-kind">从零开始快速搭建本地 Kubernetes 测试环节</a></li></ul><p>Both minikube and Kind are the most well-known and popular choices to run a Kubernetes environment on a local computer. Since I&#39;ve shown you how to use Kind, I might as well introduce minikube to youadorable today.</p><h3>Quick Start with minikube</h3><p>minikube is a command-line tool like Kind that you can use to create and configure Kubernetes clusters locally on your computer.</p><h3>How to Install minikube</h3><p>If your computer is the same as mine, Mac with m1 chip, you can install the latest minikube stable release in 2 steps:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c0bc6f9bace8692b4b3aa65b35184cf/href">https://medium.com/media/1c0bc6f9bace8692b4b3aa65b35184cf/href</a></iframe><p>If you are using Homebrew, just one command:</p><pre>brew install minikube</pre><p>If your computer is of other platforms or architectures, see the “Installation” section in <a href="https://minikube.sigs.k8s.io/docs/start/">minikube start</a> for more details.</p><h3>minikube start</h3><p>Like the section title we used here, to start using minikube, run minikube start:</p><pre>$ minikube start<br>😄  minikube v1.25.2 on Darwin 12.2.1 (arm64)<br>👎  Unable to pick a default driver. Here is what was considered, in preference order:<br>    ▪ docker: Not healthy: &quot;docker version --format {{.Server.Os}}-{{.Server.Version}}&quot; exit status 1: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?<br>    ▪ docker: Suggestion: Start the Docker service &lt;https://minikube.sigs.k8s.io/docs/drivers/docker/&gt;<br>💡  Alternatively you could install one of these drivers:<br>    ▪ hyperkit: Not installed: exec: &quot;hyperkit&quot;: executable file not found in $PATH<br>    ▪ parallels: Not installed: exec: &quot;prlctl&quot;: executable file not found in $PATH<br>    ▪ vmware: Not installed: exec: &quot;docker-machine-driver-vmware&quot;: executable file not found in $PATH<br>    ▪ virtualbox: Not installed: unable to find VBoxManage in $PATH<br>    ▪ podman: Not installed: exec: &quot;podman&quot;: executable file not found in $PATH</pre><pre>❌  Exiting due to DRV_DOCKER_NOT_RUNNING: Found docker, but the docker service isn&#39;t running. Try restarting the docker service.</pre><p>Ok, it doesn’t matter; we need to install Docker. In my previous article <a href="https://www.devstream.io/blog/local-k8s-with-kind">How to Create a Local Kubernetes Cluster from the Ground Up</a>, I introduced how to “Install Docker”.</p><p>After the Docker is installed, what we’ll need in total?</p><ul><li>A not too bad computer;</li><li>Internet connections;</li><li>Container or virtual machine hypervisor, such as: Docker, Hyper-V, KVM, VirtualBox, or VMware Workstation …</li></ul><p>Let’s try to run minikube start again. This command is time-consuming the first time you use it, especially if the network speed is low. Feel free to have a cup of coffee then come back to see the result.</p><p>2000 years later…</p><p>Well Done! 0 error, 0 warning! The logs are beautiful!</p><pre>$ minikube start<br>😄  minikube v1.25.2 on Darwin 12.2.1 (arm64)<br>✨  Automatically selected the docker driver<br>👍  Starting control plane node minikube in cluster minikube<br>🚜  Pulling base image ...<br>💾  Downloading Kubernetes v1.23.3 preload ...<br>    &gt; preloaded-images-k8s-v17-v1...: 419.07 MiB / 419.07 MiB  100.00% 8.54 MiB<br>    &gt; index.docker.io/kicbase/sta...: 28.23 MiB / 343.12 MiB  8.23% 1.34 MiB p/<br>    &gt; index.docker.io/kicbase/sta...: 343.12 MiB / 343.12 MiB  100.00% 3.77 MiB<br>❗  minikube was unable to download gcr.io/k8s-minikube/kicbase:v0.0.30, but successfully downloaded docker.io/kicbase/stable:v0.0.30 as a fallback image<br>🔥  Creating docker container (CPUs=2, Memory=3885MB) ...<br>🐳  Preparing Kubernetes v1.23.3 on Docker 20.10.12 ...<br>    ▪ kubelet.housekeeping-interval=5m<br>    ▪ Generating certificates and keys ...<br>    ▪ Booting up control plane ...<br>    ▪ Configuring RBAC rules ...<br>🔎  Verifying Kubernetes components...<br>    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5<br>🌟  Enabled addons: storage-provisioner, default-storageclass</pre><pre>❗  /usr/local/bin/kubectl is version 1.21.5, which may have incompatibilites with Kubernetes 1.23.3.<br>    ▪ Want kubectl v1.23.3? Try &#39;minikube kubectl -- get pods -A&#39;<br>🏄  Done! kubectl is now configured to use &quot;minikube&quot; cluster and &quot;default&quot; namespace by default</pre><h3>Access Your Shiny Kubernetes Cluster</h3><p>Do you have kubectl installed? If yes, you can now use it to access your shiny Kubernetes cluster:</p><pre>$ kubectl get pod -A<br>NAMESPACE     NAME                               READY   STATUS    RESTARTS        AGE<br>kube-system   coredns-64897985d-hdmqd            1/1     Running   0               3m10s<br>kube-system   etcd-minikube                      1/1     Running   0               3m24s<br>kube-system   kube-apiserver-minikube            1/1     Running   0               3m25s<br>kube-system   kube-controller-manager-minikube   1/1     Running   0               3m25s<br>kube-system   kube-proxy-nkzmn                   1/1     Running   0               3m10s<br>kube-system   kube-scheduler-minikube            1/1     Running   0               3m23s<br>kube-system   storage-provisioner                1/1     Running   1 (2m40s ago)   3m22s</pre><p>Alternatively, minikube can download the appropriate version of kubectl with the command minikube kubectl:</p><pre>$ minikube kubectl -- get pod -A<br>    &gt; kubectl.sha256: 64 B / 64 B [--------------------------] 100.00% ? p/s 0s<br>    &gt; kubectl: 52.82 MiB / 52.82 MiB [--------------] 100.00% 6.04 MiB p/s 8.9s<br>NAMESPACE     NAME                               READY   STATUS    RESTARTS       AGE<br>kube-system   coredns-64897985d-hdmqd            1/1     Running   0              4m32s<br>kube-system   etcd-minikube                      1/1     Running   0              4m46s<br>kube-system   kube-apiserver-minikube            1/1     Running   0              4m47s<br>kube-system   kube-controller-manager-minikube   1/1     Running   0              4m47s<br>kube-system   kube-proxy-nkzmn                   1/1     Running   0              4m32s<br>kube-system   kube-scheduler-minikube            1/1     Running   0              4m45s<br>kube-system   storage-provisioner                1/1     Running   1 (4m2s ago)   4m44s</pre><p>Cooooool!</p><p>Are you thinking this command is too complicated? Use the config below and you’ll be happy:</p><pre>alias kubectl=&quot;minikube kubectl --&quot;</pre><p>I’m used to command-line to access the Kubernetes cluster. Yes, I never use the Kubernetes Dashboard. But if you like to have some insight into your cluster state with a Dashboard, minikubebundles it for you:</p><pre>$ minikube dashboard<br>🔌  Enabling dashboard ...<br>    ▪ Using image kubernetesui/dashboard:v2.3.1<br>    ▪ Using image kubernetesui/metrics-scraper:v1.0.7<br>🤔  Verifying dashboard health ...<br>🚀  Launching proxy ...<br>🤔  Verifying proxy health ...<br>🎉  Opening http://127.0.0.1:51801/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...</pre><p>At this time, your browser will automatically open a new tab, and the Dashboard will soon show up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xOSSaujQ2mntFGhvMEkafA.png" /></figure><h3>Deploy an Application in Your Shiny Kubernetes Cluster</h3><p>Let’s create a sample deployment with the image preslavmihaylov/kubehelloworld:latest and expose it on port 3000.</p><p>The <a href="https://minikube.sigs.k8s.io/docs/start/">minikube start</a> told us to use the k8s.gcr.io/echoserver:1.4 to launch the hello-minikube application, but it&#39;ll fail on a Mac with m1 chip. See <a href="https://github.com/kubernetes/minikube/issues/11107">this issue</a> for more details.</p><pre>$ kubectl create deployment sample-deploy --image=preslavmihaylov/kubehelloworld:latest<br>deployment.apps/sample-deploy created<br>$ kubectl expose deployment sample-deploy --type=NodePort --port=3000<br>service/sample-deploy exposed<br>$ kubectl get pod<br>NAME                             READY   STATUS    RESTARTS   AGE<br>sample-deploy-795887588d-flkgb   1/1     Running   0          50s<br>$ kubectl get svc<br>NAME            TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE<br>kubernetes      ClusterIP   10.96.0.1      &lt;none&gt;        443/TCP          66m<br>sample-deploy   NodePort    10.107.59.38   &lt;none&gt;        3000:32631/TCP   43s</pre><p>Then we can use kubectl to forward the port:</p><pre>$ kubectl port-forward service/sample-deploy 3000:3000<br>Forwarding from 127.0.0.1:3000 -&gt; 3000<br>Forwarding from [::1]:3000 -&gt; 3000</pre><p>Open the browser, visit localhost:3000, and &quot;Hello World!&quot; will soon show up.</p><p>Another way to access this service is to use the minikube service sample-deploy command and minikube will launch a browser page for you with the right url:port address.</p><p>And we can use the command minikube tunnel to use the LoadBalancer type Service. Here is an example:</p><pre>$ kubectl delete service sample-deploy<br>service &quot;sample-deploy&quot; deleted<br>$ kubectl expose deployment sample-deploy --type=LoadBalancer --port=3000<br>service/sample-deploy exposed</pre><p>In another terminal window, start the tunnel to create a routable IP with the command minikube tunnel:</p><pre>$ minikube tunnel<br>✅  Tunnel successfully started</pre><pre>📌  NOTE: Please do not close this terminal as this process must stay alive for the tunnel to be accessible ...</pre><pre>🏃  Starting tunnel for service sample-deploy.</pre><p>Now you can use the EXTERNAL-IP to access the Service:</p><pre>$ kubectl get svc<br>NAME            TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE<br>kubernetes      ClusterIP      10.96.0.1       &lt;none&gt;        443/TCP          86m<br>sample-deploy   LoadBalancer   10.96.205.167   127.0.0.1     3000:31945/TCP   28s<br>$ curl 127.0.0.1:3000<br>Hello World!</pre><h3>How to Manage the Cluster</h3><p>I’ll show you some commands here:</p><ul><li>minikube pause # Pause Kubernetes cluster without impacting any deployed resources.</li><li>minikube unpause # Unpause the Paused Kubernetes cluster.</li><li>minikube stop # Remember the minikube start? Need I say more?</li><li>minikube config set memory 20480 # Change the default memory limit (requires a restart).</li><li>minikube addons list # Browse the easily installed Kubernetes addons catalog.</li><li>minikube start -p aged --kubernetes-version=v1.16.1 # Create a second cluster running an older Kubernetes version.</li><li>minikube delete --all # Yeah, delete all, delete anything, delete all clusters.</li></ul><p>That’s all?</p><p>No! But if you want to know them all, I’ll show you the <a href="https://minikube.sigs.k8s.io/docs/commands/">command docs here</a>.</p><h3>How to Push Images into a minikube Cluster</h3><p>There are about 8 ways you can use to push images into a minikube cluster. And I&#39;ll show you the most useful two ways today.</p><h3>Push Images with the cache Command</h3><ul><li>minikube cache add [flags] [options] # Add an image to local cache.</li></ul><p>Cache? Yes, the image will be cached by minikube and automatically pushed into all clusters, not like the Kind method: kind load docker-image &lt;IMAGE&gt; [IMAGE...] [flags].</p><p>Let’s see how many sub-commands cache has:</p><pre>$ minikube cache -h<br>Add, delete, or push a local image into minikube</pre><pre>Available Commands:<br>  add         Add an image to local cache.<br>  delete      Delete an image from the local cache.<br>  list        List all available images from the local cache.<br>  reload      reload cached images.</pre><p>Easy, isn’t it?</p><p>The only sub-command we need to talk about might be reload. If your image changed after you had cached it, you need to execute minikube cache reload [flags] [options]</p><p>E.g.:</p><ul><li>minikube cache add alpine:latest # Cache alpine:latest for all clusters.</li><li>minikube cache reload alpine:latest # Reload alpine:latest if it&#39;s changed.</li><li>minikube cache list # Display what images we have added to the cache.</li><li>minikube cache delete alpine:latest # Just delete alpine:latest</li></ul><h3>Pushing Directly to the In-Cluster Docker Daemon</h3><p>If the image we want to use inside the minikube cluster is built locally instead of pulled from a registry, we can reuse the Docker daemon inside the minikube cluster. Yeah, we don’t have to build the image on our host machine and cache it; we can just build inside the same docker daemon inside the minikube cluster.</p><pre>$ docker ps<br>CONTAINER ID   IMAGE                    COMMAND                  CREATED       STATUS       PORTS                                                                                                                                  NAMES<br>170fe8252660   kicbase/stable:v0.0.30   &quot;/usr/local/bin/entr…&quot;   6 hours ago   Up 6 hours   127.0.0.1:50981-&gt;22/tcp, 127.0.0.1:50982-&gt;2376/tcp, 127.0.0.1:50984-&gt;5000/tcp, 127.0.0.1:50985-&gt;8443/tcp, 127.0.0.1:50983-&gt;32443/tcp   minikube</pre><pre>$ eval $(minikube docker-env)<br>$ docker ps<br>CONTAINER ID   IMAGE                            COMMAND                  CREATED       STATUS       PORTS     NAMES<br>de4fedaf4ef0   preslavmihaylov/kubehelloworld   &quot;docker-entrypoint.s…&quot;   5 hours ago   Up 5 hours             k8s_kubehelloworld_sample-deploy-795887588d-flkgb_default_2e6b194a-bdc7-44cc-b455-91959a4206a9_0<br>d45474ce1888   k8s.gcr.io/pause:3.6             &quot;/pause&quot;                 5 hours ago   Up 5 hours             k8s_POD_sample-deploy-795887588d-flkgb_default_2e6b194a-bdc7-44cc-b455-91959a4206a9_0<br>...</pre><p>What happened?</p><p>After the command eval $(minikube docker-env) is executed, docker accesses the docker daemon inside the minikube cluster! What&#39;s the secret with minikube docker-env command? Let&#39;s dig into it:</p><pre>$ minikube docker-env<br>export DOCKER_TLS_VERIFY=&quot;1&quot;<br>export DOCKER_HOST=&quot;tcp://127.0.0.1:50982&quot;<br>export DOCKER_CERT_PATH=&quot;/Users/danielhu/.minikube/certs&quot;<br>export MINIKUBE_ACTIVE_DOCKERD=&quot;minikube&quot;</pre><pre># To point your shell to minikube&#39;s docker-daemon, run:<br># eval $(minikube -p minikube docker-env)</pre><p>I don’t think I need to explain more about what happened. And we can build against the Docker inside minikube now. Just execute a command like docker build -t my-image:latest ., my-image:latest is instantly accessible to the Kubernetes cluster.</p><h3>How to …</h3><p>Oops, there are many how-tos we could talk about, but I believe that you can start using minikube now. Maybe I&#39;ll talk about more how-tos next time. If you want to dive into minikube now, go ahead and study the <a href="https://minikube.sigs.k8s.io/docs/">official documentation</a>.</p><h3>Summary</h3><p>Cool, I finished writing this blog, It’s like opening Pandora’s box; I love this feeling. Of course, I know this blog is at the primary-school-student level, but I believe I can do better and better.</p><p>Don’t forget to give a Like, Comment, and Subscribe! I’ll see you in the next article!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7047168b57e5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devstream/get-started-with-minikube-7047168b57e5">Getting Started with minikube</a> was originally published in <a href="https://medium.com/devstream">DevStream</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Local Kubernetes Cluster from the Groud Up — a Tutorial of Kind]]></title>
            <link>https://medium.com/devstream/creating-a-local-kubernetes-cluster-from-the-groud-up-a-tutorial-of-kind-f5433ee1408a?source=rss----a0072fac81ea---4</link>
            <guid isPermaLink="false">https://medium.com/p/f5433ee1408a</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devstream]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Tiexin Guo]]></dc:creator>
            <pubDate>Mon, 18 Apr 2022 08:29:27 GMT</pubDate>
            <atom:updated>2022-04-25T08:16:56.994Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating a Local Kubernetes Cluster from the Groud Up — a Tutorial of Kind</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZvFUTyDnpqvir7a-8O33SA.jpeg" /><figcaption>Miyuan Cafe, Qinglong Lake Park, Chengdu, China. Photo by Daniel Hu</figcaption></figure><p>From the ground up? Yep, from the ground up!</p><h3><strong>Overview</strong></h3><p>Creating a Kubernetes cluster can be tricky.</p><p>There are multiple tools designed just for that job. There are even companies that provide “installing K8s” as a service. And, to create a production-ready Kubernetes cluster with all the best practices in mind requires detailed designing and planning.</p><p>So, the scope of this article isn’t to help you to create a “production-ready” cluster.</p><p>However, after reading this article, you should be able to create a local “testing” Kubernetes cluster, and for the developing and testing of <a href="https://www.devstream.io/">DevStream</a>, it should more than suffice.</p><p>Even for a local testing cluster, there are multiple tools you can choose from. For example, there is <a href="https://minikube.sigs.k8s.io/docs/start/">minikube</a>, and there is <a href="https://kind.sigs.k8s.io/">kind</a>. kind is a tool for running local Kubernetes clusters using Docker container “nodes”. kind was primarily designed for testing Kubernetes.</p><p>In this article, we are going with kind. We are not opinionated; we are not saying that kind is better than minikube or vice versa; we are merely choosing a tool to get the job done. If you are more familiar with other tools, it’s completely fine!</p><p>This article uses macOS as our local development environment. If you are using Windows or Linux, you can still read this post to get a general idea and achieve the same.</p><h3><strong>Install Docker</strong></h3><p>Docker works in a way using Linux’s Namespace and Cgroup. It’s quite easy to install Docker on Linux. On macOS and Windows, Docker runs with virtualization. However, we do not need to worry too much detail here, because it’s quite simple to download and run Docker Desktop.</p><p>Go to <a href="https://www.docker.com/products/docker-desktop,">https://www.docker.com/products/docker-desktop,</a> find the correct version of Docker Desktop (Intel/amd64, or M1/arm64):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*xC6_B_JDCJgB7Czf1UoH2Q.png" /></figure><p>Double click on the Docker.dmg file, and we see the installation interface like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*EXzcGOHIWlVAulTSweczLw.png" /></figure><p>Simply drag “Docker” to our “Applications,” and within a few seconds, it’s done! We can start it from the Launchpad:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*-NoBImOIJL_Y4e4n1gwVww.png" /></figure><p>Wait a few seconds and we can see the starting page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*BkOXHoEstmnm0bI2WSmJ5w.png" /></figure><p>Click the “gear” ⚙️ icon to change settings about Docker Desktop. For example, if we need to run a lot of containers, we might need to increase the memory. Here, we changed the memory to 4.00 GB:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*6Tf2GbkHGK6EJC-PQ90rJw.png" /></figure><p>Remember to “Apply &amp; Restart” to ensure the changes are effective.</p><h3><strong>Introduction to Kind</strong></h3><p>kind (Kubernetes-in-docker) uses a Docker container as a “node” to deploy Kubernetes. It’s mainly used for testing Kubernetes itself.</p><p>kind is simple, containing a command-line tool named kind and a Docker image which has Kubernetes and systemd. kind uses Docker on the host machine to create a container, which runs systemd, which in turn runs the container runtime, kubelet, and other Kubernetes components. So, we end up with a whole Kubernetes cluster in one container.</p><p>Note that although in the explanation above, the Cluster is only a single node cluster, it’s possible to create a multi-node Kubernetes cluster.</p><h3><strong>Creating a Kubernetes Cluster with Kind at the Click of a Button</strong></h3><p>1. clone DevStream’s repo: <a href="https://github.com/devstream-io/devstream">https://github.com/devstream-io/devstream</a></p><p>2. cd devstream; make e2e-up</p><p>That’s it.</p><p>If you check out the Makefile, you will see it actually runs a shell script that runs kind to create the cluster.</p><p>However, you wouldn’t be satisfied if we end this article right here, right now, would you.</p><p>So, let’s have a deep dive into kind. Fasten your seat belt, because we are gonna fly!</p><h3><strong>Creating a Kubernetes Cluster with Kind at Two Clicks of a Button</strong></h3><p>On GitHub, we can find the latest release of kind: <a href="https://github.com/kubernetes-sigs/kind/releases.">https://github.com/kubernetes-sigs/kind/releases.</a></p><p>Choose relatively new versions, and install:</p><pre># method 1: download pre-compiled binary<br>cd /tmp<br>curl -Lo ./kind <a href="https://github.com/kubernetes-sigs/kind/releases/download/v0.12.0/kind-darwin-arm64">https://github.com/kubernetes-sigs/kind/releases/download/v0.12.0/kind-darwin-arm64</a><br>chmod +x ./kind<br>sudo mv kind /usr/local/bin/</pre><pre># method 2: go get and compile locally<br>go get sigs.k8s.io/kind@v0.12.1</pre><p>We can also download the Docker image beforehand. Here we choose v1.22 of Kubernetes:</p><p>kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047</p><p>Create cluster:</p><p>kind create cluster --image=kindest/node:v1.22.0 --name=dev</p><p>Sample output:</p><pre>Creating cluster “dev” …<br>✓ Ensuring node image (kindest/node:v1.22.0) 🖼<br>✓ Preparing nodes 📦<br>✓ Writing configuration 📜<br>✓ Starting control-plane 🕹️<br>✓ Installing CNI 🔌<br>✓ Installing StorageClass 💾<br>Set kubectl context to “kind-dev”<br>You can now use your cluster with:<br>kubectl cluster-info --context kind-dev<br>Have a question, bug, or feature request? Let us know! <a href="https://kind.sigs.k8s.io/#community">https://kind.sigs.k8s.io/#community</a> 🙂</pre><p>Follow the hints above, next, let’s run kubectl cluster-info --context kind-dev to switch the context and make sure you are in the right Kubernetes context.</p><p>If we run kubectl get node and kubectl get pod -n kube-system , we can see that we have a local cluster for testing and developing Kubernetes.</p><h3><strong>Creating a Kubernetes Cluster with Kind at Three Clicks of a Button</strong></h3><p>A minimum highly-available Kubernetes cluster is composed of 3 nodes. In this section, let’s see how to create a multi-node, highly-available cluster locally using kind.</p><h4><strong>Kind Cluster Config</strong></h4><p>We can pass a config file to kind by using the--config parameter. Let’s have a look at a kind config file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/941a8d9e043ba9075e7291f67af15ab0/href">https://medium.com/media/941a8d9e043ba9075e7291f67af15ab0/href</a></iframe><p>We can see that the config has two sections: the upper part being kubeadm related stuff and the lower part being nodes related settings. Apparently, the “nodes” part is where we are going to edit to achieve a multi-node cluster.</p><h4><strong>1 Control Plane Node, 3 Worker Nodes Cluster</strong></h4><p>Let’s create a config named multi-node-config.yaml with the following content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a6ce789f9db839046a2234498b0c5f9/href">https://medium.com/media/8a6ce789f9db839046a2234498b0c5f9/href</a></iframe><p>Then run:</p><pre>$ kind create cluster --config multi-node-config.yaml --image=kindest/node:v1.22.0 --name=dev4</pre><p>We will get some output similar to the previous single-node cluster output, except for the “Joining worker nodes” part:</p><pre>Creating cluster “dev4” …<br>✓ Ensuring node image (kindest/node:v1.22.0) 🖼<br>✓ Preparing nodes 📦 📦 📦 📦<br>✓ Writing configuration 📜<br>✓ Starting control-plane 🕹️<br>✓ Installing CNI 🔌<br>✓ Installing StorageClass 💾<br>✓ Joining worker nodes 🚜<br>Set kubectl context to “kind-dev4”<br>You can now use your cluster with:<br>kubectl cluster-info --context kind-dev4<br>Thanks for using kind! 😊</pre><p>Let’s run the following command to check out our new cluster:</p><p>$ kubectl cluster-info --context kind-dev4</p><p>$ kubectl get node</p><p>From the result above, we can see that this cluster has 1 control plane node and 3 worker nodes.</p><h4><strong>3 Control Plane Nodes, 3 Worker Nodes, Highly Available Cluster</strong></h4><p><em>Note: “Highly available” here only means that we have three control plane nodes. It’s not strictly “highly available” because apparently, the three control plane nodes are actually on the same host, so when the host is down, everything is gone.</em></p><p>Prepare the ha-config.yaml with the following content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cbec8c72ee58d043689761e2767af8a6/href">https://medium.com/media/cbec8c72ee58d043689761e2767af8a6/href</a></iframe><p>Run:</p><p>$ kind create cluster --config ha-config.yaml --image=kindest/node:v1.22.0 --name=dev6</p><p>We can see familiar outputs, with the exception being “Configuring the external load balancer” and “Joining more control-plane nodes”:</p><pre>Creating cluster “dev6” …<br>✓ Ensuring node image (kindest/node:v1.22.0) 🖼<br>✓ Preparing nodes 📦 📦 📦 📦 📦 📦<br>✓ Configuring the external load balancer ⚖️<br>✓ Writing configuration 📜<br>✓ Starting control-plane 🕹️<br>✓ Installing CNI 🔌<br>✓ Installing StorageClass 💾<br>✓ Joining more control-plane nodes 🎮<br>✓ Joining worker nodes 🚜<br>Set kubectl context to “kind-dev6”<br>You can now use your cluster with:<br>kubectl cluster-info --context kind-dev6<br>Have a nice day! 👋</pre><p>Some fun facts:</p><ul><li>the number of boxes after “Preparing nodes” equals the number of nodes</li><li>the final greeting message is different: it was “Thanks for using kind! 😊” previously and now it’s “Have a nice day! 👋”</li></ul><p>Heck, those kind developers sure went some extra miles to enhance the user experience!</p><p>Check the cluster:</p><p>$ kubectl cluster-info --context kind-dev6</p><p>$ kubectl get node</p><p>We can see this cluster has 3 control plane nodes.</p><p>So far, we have mastered how to use kind to create a multi-node Kubernetes cluster locally.</p><h3><strong>Advanced Kind Features</strong></h3><p>Now that we know how to create clusters using kind, let’s have a look at some advanced operations which could help you better use the clusters.</p><h4><strong>Port Mapping</strong></h4><p>Imagine you are running an Nginx container listening on port 8080 in a kind cluster but you wish the outside world (outside of the cluster) to access the Nginx port. To achieve this, we can add the extraPortMappings configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a3c43f845a495e0c56fbb72ca4c5f0e2/href">https://medium.com/media/a3c43f845a495e0c56fbb72ca4c5f0e2/href</a></iframe><p>In this way, the port on the pod 8080 is mapped to the port on the host.</p><h4><strong>Expose kube-apiserver</strong></h4><p>Sometimes we want to install Kubernetes with kind on one host, but access the cluster from another host. By default, the kube-apiserver installed by kind listens on 127.0.0.1 (with a random port.) To make the kind cluster accessible from another host, we need to make kube-apiserver listen on a network interface (for example, eth0.)</p><p>In the config file, we add networking.apiServerAddress. The IP is your local nic’s IP:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4619e5dba6b517e838df6f71e9da1ad/href">https://medium.com/media/b4619e5dba6b517e838df6f71e9da1ad/href</a></iframe><h4><strong>Enable Feature Gates</strong></h4><p>Feature gates are a set of key=value pairs that describe Kubernetes features that are only available in Alpha, Beta or GA stage.</p><p>If we want to try some of those features, we can enable Feature Gates. In the config file, use:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d9bfff3022f72dfad83639c6402d877/href">https://medium.com/media/6d9bfff3022f72dfad83639c6402d877/href</a></iframe><h4><strong>Importing Images</strong></h4><p>Because the Kubernetes cluster is in fact running in a Docker container, by default, it can’t access Docker images that are on the host. However, we can import those images from hosts to the Kubernetes cluster created by kind:</p><pre># import my-image:v1<br>kind load docker-image my-image:v1 --name dev</pre><pre># import my-image.tar<br>kind load image-archive my-image.tar --name dev</pre><p>With this method, when we are building a new Docker image on the host which we want to run in a kind Kubernetes cluster, we can:</p><pre>docker build -t my-image:v1 ./my-image-dir<br>kind load docker-image my-image:v1<br>kubectl apply -f my-image.yaml</pre><p>How to see the images that are available in the kind Kubernetes cluster? Easy:</p><p>docker exec -it dev-control-plane crictl images</p><p>dev-control-plane is the name of the kind cluster.</p><p>You can also use crictl -h to see all the supported commands. For example, we can delete an image by using crictl rmi &lt;image_name&gt;.</p><h3><strong>Summary</strong></h3><p>Have fun playing with Kubernetes locally!</p><p>If you like this article, please like, comment, and subscribe. See you in the next article!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5433ee1408a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devstream/creating-a-local-kubernetes-cluster-from-the-groud-up-a-tutorial-of-kind-f5433ee1408a">Creating a Local Kubernetes Cluster from the Groud Up — a Tutorial of Kind</a> was originally published in <a href="https://medium.com/devstream">DevStream</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Honest Look at Dagger]]></title>
            <link>https://medium.com/devstream/an-honest-look-at-dagger-fae07986bfc1?source=rss----a0072fac81ea---4</link>
            <guid isPermaLink="false">https://medium.com/p/fae07986bfc1</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[dagger]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Tiexin Guo]]></dc:creator>
            <pubDate>Tue, 12 Apr 2022 03:14:22 GMT</pubDate>
            <atom:updated>2022-04-25T08:16:20.486Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O2myCrLX73fouFmD" /><figcaption>Photo by <a href="https://unsplash.com/@altumcode?utm_source=medium&amp;utm_medium=referral">AltumCode</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>1 What is Dagger?</strong></h3><p>TL;DR: Dagger runs your CI/CD pipelines locally in a Docker container, and can run the container in any CI environment (as long as that CI can run a container, of course.)</p><p>Do you want the long answer to this million-dollar question? It’s hard to answer, honestly. News is calling it a “DevOps platform”; the VC that funded Dagger even called it a “DevOps operating system.”</p><p>But, in fact, Dagger is neither of those things.</p><p>Before we can answer what Dagger is, let’s have a look at it in-depth:</p><h3><strong>2 Quirks and Features</strong></h3><h4><strong>2.1 BuildKit</strong></h4><p>In Dagger, the configuration is executed in BuildKit, which is the execution engine at the heart of Docker.</p><p>BuildKit was developed as part of the Moby project, the latter of which is an open framework to assemble specialized container systems without reinventing the wheel by Docker. Basically, it’s a toolkit for converting source code to build artifacts in an efficient, expressive, and repeatable manner. It was announced in 2017 and began shipping with Docker Engine in 2018’s version 18.09.</p><h4><strong>2.2 CUE</strong></h4><p>Unlike most popular CI systems out there, you don’t write YAML in Dagger; you write CUE.</p><p>I feel you because I didn’t know what’s CUE either. Turned out, CUE is an open-source data validation language and inference engine with its roots in logic programming.</p><p>It aims to simplify tasks involving defining and using data. It’s actually a superset of JSON, so users familiar with JSON should feel comfortable with it already and can get started quickly. It also has got built-in auto-formatting (yay.)</p><p>Although the language is not a general-purpose programming language, it has many applications, such as data validation, data templating, configuration (that’s probably why Dagger decided to use it in the first place), querying, code generation, and even scripting.</p><h4><strong>2.3 Wait a Minute</strong></h4><p>Since it’s already reusing Docker’s parts for configuration execution, why not reuse Docker’s other part, Dockerfile, for configuration?</p><p>What’s the purpose of using another language just for the configuration?</p><p>Solomon Hykes, the founder of Dagger, actually answered exact this question on their official Discord channel:</p><blockquote>We needed a modern declarative language with a type system, a package manager, native yaml and json interop, a formal spec, and a standalone community not locked to one tool.</blockquote><blockquote>Also Dockerfiles are specific to build, but Dagger is more general-purpose automation</blockquote><blockquote>There was no way at all Dockerfile could support our requirements (speaking as one of the original authors of the Dockerfile syntax)</blockquote><h3><strong>3 Enough Tech Spec. What Does Dagger Do?</strong></h3><h4><strong>3.1 What Dagger Isn’t</strong></h4><p>First, let me tell you what Dagger isn’t by quoting the official documentation:</p><blockquote>Dagger does not replace your CI: it improves it by adding a portable development layer on top of it.</blockquote><p>OK, so it’s not yet another CI (or CD, for that matter).</p><p>Dagger didn’t even try to <em>replace</em> your existing CI, at all. But rather, it <em>improves</em> your CI, by adding a wrapper layer.</p><p>I know the term “wrapper” doesn’t sound fancy, so let’s call it by its official reference, and that is “portable development layer”.</p><h4><strong>3.2 So, Just a Wrapper?</strong></h4><p>Disappointed? Don’t conclude too quick; follow me. First, let’s look at some other DevOps/cloud related examples:</p><ul><li>Think of Terraform. You’ve got multiple environments to manage. Even with reuseable modules and roles, you still have duplicated code across envs. Then comes Terragrunt, which is a (thin) wrapper that provides extra tools for keeping your configurations simple without repeating yourself.</li><li>Think of AWS CDK. It actually is a wrapper layer on top of CloudFormation, which lets you use your familiar programming languages to define and provision AWS cloud infrastructure, so that you don’t have to deal with CloudFormation’s non-human-readable configurations. Of course, your code still converts to a format that CloudFormation understands, and your infrastructure is still managed by CloudFormation; AWS CDK doesn’t really interact with AWS APIs directly. That’s why it’s only a wrapper layer on top of CloudFormation.</li><li>Think of CDKTF (CDK for Terraform); it’s no different than AWS CDK, perhaps because CDKTF is inspired by AWS CDK and also uses AWS’s jsii library to be polyglot. It’s a wrapper layer on top of Terraform that translates your code into Terraform HCL so that you don’t have to learn HCL. But in essence, your infrastructure is still managed by Terraform HCL, not your code directly. So, it’s yet another wrapper.</li></ul><p>You must have already figured out where I am going with this, and you are right: yes, Dagger is no different. It is a wrapper.</p><p>But, of course, the wrapper has to do something to be useful, right? Then what exactly does Dagger do? What exactly does Dagger wrap? Good Questions.</p><h4><strong>3.3 What Dagger Can Do</strong></h4><p>In any CI system, you define some steps and actions in a certain format (YAML, most likely) and run it in your CI system. For example, in Jenkins, maybe you will write some groovy file. In GitHub Actions, you write some YAML with multiple steps.</p><p>Basically, Dagger runs those “steps and actions” in a Docker container. Then where do you run the Dagger docker container itself? Great question: you can either run it locally (because you can install Docker desktop, right?) or in your existing CI (since most CIs can run a docker container.)</p><p>If you think about it: Dagger doesn’t wrap your CI pipelines or systems. It wraps those detailed steps and actions into a Docker container and still runs in your existing CI. It’s like writing a big Dockerfile, and when you run the container, it does git clone, source code static scan, test, build, artifact upload, and what have you.</p><h3><strong>4 What Dagger Really Is</strong></h3><p>Yes, Dagger is a wrapper, that part is true.</p><p>But, it doesn’t wrap CI systems; it wraps your pipeline steps and actions into a container (you have to rewrite those steps and actions in Dagger’s syntax, though), and the wrapped result can run in another CI (as long as that CI can run a container.)</p><p>In this sense, Dagger <em>is</em> yet another CI, except that CI runs in a container and most CI systems happen to be able to run containers.</p><h3><strong>5 Benefits</strong></h3><p>I think there are 3 major advantages of using Dagger</p><h4><strong>5.1 Local Development</strong></h4><p>Firstly, there is no need to install <em>any</em> dependencies specific to this application, because Dagger manages all the intermediate steps and transient dependencies inside the Docker container.</p><p>This might not be an advantage if we are talking about CI, but it is an advantage if we are talking about local development.</p><p>Think of Go where you have to install modules or think of Nodejs where you might even need to switch Node versions then do an NPM install. Now you can do all of those inside a container and only get the final result to your local laptop.</p><h4><strong>5.2 “On-Premise” CI</strong></h4><p>You can run your pipeline locally now since you can easily have the Docker desktop up and running locally.</p><p>I’m not sure if this is a solid requirement, though. Maybe it is? Because we all have powerful laptops now; why waste money on some CI systems when you can run them locally?</p><p>The idea of running it anywhere as long as Docker is available is intriguing, though. If you don’t want to buy CI as a service, you can run Dagger in your own infrastructure.</p><h4><strong>5.3 Migrate to Another CI</strong></h4><p>Since your “steps and actions” now are running in a container, you can run it elsewhere, in another CI system.</p><p>Should you need to migrate to another CI, you do not need to rewrite your CI steps anymore. For example, you don’t want to use your company’s old Jenkins instance anymore, but you are already using Dagger with Jenkins, and now you want to give GitHub Actions a try.</p><p>It’s worth noting that in this scenario, there are still two things to do:</p><ul><li>If you are using Jenkins now, and want to migrate those Jenkins pipelines into Dagger, you need to do it manually. The cost is the same (if not more) as rewriting your whole pipeline in GitHub Actions’ syntax.</li><li>You will still need to learn about your new CI system: how a job is triggered, the syntax, etc.</li></ul><p>Here you can see Dagger does provide a solution to avoid CI lock-in (to some extent.) But it is not a game changing solution that could resolve your flexibility concern.</p><p>For a DevOps engineer, a DevOps toolchain that could accommodate different needs and priorities from different teams is more than appealing. That being said, each component is modular and pluggable, and you could free yourself from tedious work like launching, integrating, and managing all these pieces.</p><p>Ideally, you could define your desired DevOps tools in a single human-readable YAML config file, and with one single command, you have your whole DevOps toolchain and SDLC workflow set up or changed.</p><p>If you are intrigued by the simplicity of “DevOps toolchain as code”, don’t hesitate to check out <a href="https://github.com/devstream-io/devstream">DevStream here</a>.</p><h3><strong>6 Should I use Dagger Now?</strong></h3><p>Is it promising? Maybe. Should I start using it now? My answer is No. Three reasons:</p><ul><li>The Dagger project itself still uses GitHub Actions. Why? Probably because it has limitations and can’t do everything you can achieve with GitHub Actions.</li><li>You probably won’t change your CI system every 6 months. If you only change it one time in 4 years, why bother adding that wrapper?</li><li>Dagger is only recently announced. It hasn’t supported a whole lot of CI systems yet. Maybe the CI you want to switch to doesn’t support it yet.</li></ul><p>Like, comment, subscribe. See you in the next article!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fae07986bfc1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devstream/an-honest-look-at-dagger-fae07986bfc1">An Honest Look at Dagger</a> was originally published in <a href="https://medium.com/devstream">DevStream</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a DevStream (dtm) Plugin for Anything]]></title>
            <link>https://medium.com/devstream/creating-a-devstream-dtm-plugin-for-anything-cab1ff122302?source=rss----a0072fac81ea---4</link>
            <guid isPermaLink="false">https://medium.com/p/cab1ff122302</guid>
            <category><![CDATA[devstream]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Tiexin Guo]]></dc:creator>
            <pubDate>Tue, 29 Mar 2022 09:47:02 GMT</pubDate>
            <atom:updated>2022-04-25T08:15:51.944Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ogviuSC1K4VYv81N0o7lgQ.jpeg" /></figure><p>Yes, the title of this post isn’t bluffing: you can actually create a plugin for just about anything that takes your fancy.</p><blockquote>In my previous article, I walked you guys through DevStream’s codebase.</blockquote><blockquote>If you haven’t read it yet, here’s a quick link for you:</blockquote><blockquote>[https://blog.dtm.dev/post/2022-03/01-hello-world/](https://blog.dtm.dev/post/2022-03/01-hello-world/).</blockquote><p>In this blog, we will walk you through the steps of creating a DevStream plugin from scratch with an example.</p><h3><strong>What is DevStream</strong></h3><p>DevStream is an amazing tool that lets you install, update, manage, and integrate your DevOps tools quickly and flexibly.</p><p>Not to brag, but with DevStream, you can have your own DevOps toolchain that is specifically tailored to your need up and running in 5 minutes.</p><p>Don’t believe it? Check out our <a href="https://docs.dtm.dev/en/latest/">docs</a> and follow the quickstart guide!</p><h3><strong>Existing Plugins</strong></h3><p>At the moment of publishing this article, we already support the following tools:</p><ul><li>Trello (including integration with GitHub)</li><li>Jira (integration with GitHub)</li><li>GitHub Repository bootstrapping (for Go)</li><li>GitHub Actions (for Go, Python, and Nodejs)</li><li>GitLab CI (for Go)</li><li>Jenkins (installation)</li><li>ArgoCD</li><li>ArgoCD Application (the deployment of your apps)</li><li>Prometheus + Grafana</li><li>DevLhttps://github.com/merico-dev/streamake</li><li>OpenLDAP</li></ul><p>We aim to have 50 plugins at the end of 2022!</p><p>Check out our <a href="https://github.com/merico-dev/stream">README</a> for the latest status.</p><h3><strong>Why Would I Want to Create a DevStream Plugin</strong></h3><p>Wait. YOU ALREADY HAVE TONS OF PLUGINS! Why on earth would I want to create yet another one?</p><p>I agree with you.</p><p>Can I get a show of hands, who here has made a DevStream plugin before?</p><p>Very few, if any, I guess.</p><p>However (I know it’s just a fancy “but”), there are, in fact, things that you want to build a plugin for:</p><ul><li>Maybe you are building a nice and shiny DevOps tool, and you want to be able to set it up quickly without any hassle. You would have to write some automation scripts for it anyway, right? DevStream got you covered.</li><li>Maybe you even need to integrate your tool with other tools to get the most out of it and you really don’t want to reinvent a lot of wheels just to manage those boring integrations. Again, DevStream got you covered.</li><li>Maybe you have both internal tools and open-source tools whose installation and integration need to be automated. The open-source tools are fine, but how to manage those internal ones and integrate them? DevStream got you covered.</li></ul><p>Or, maybe you just want to learn Go’s plugin, become a contributor, join our community and earn your certification (maybe a small present, too, who knows.) No problem.</p><p>No matter what your intention is and what thing you want to achieve, DevStream got you covered.</p><p>So hang tight, let’s get started.</p><h3><strong>Design: A “Local File” Plugin</strong></h3><p>In this example, let’s build something dum but simple, just to show you the process of creating a plugin.</p><p>We are creating a “local file” plugin. You specify the name and the content, and the plugin will create a local file for you. Let’s decide how we are going to use this plugin:</p><pre>tools:<br>- name: my-file<br>  plugin: localfile<br>  options:<br>    filename: foo.txt<br>    content: &quot;hello, world&quot;</pre><p>Basically:</p><ul><li>the name of the plugin: localfile</li><li>options of the plugin: filename, content</li></ul><p>The plugin will create a file with desired content according to this piece of config.</p><h3><strong>Scaffolding Automagically</strong></h3><p>First, let’s clone the DevStream repo and generate some scaffolding code:</p><pre>git clone git@github.com:merico-dev/stream.git<br>cd stream<br># builds dtm locally to make sure<br># it&#39;s using the same dependencies as your new plugin<br>make build-core<br>./dtm develop create-plugin --name=localfile</pre><p>There will be some useful output to guide you through the whole process.</p><p>Now, if we do a `git status`, we can see some new stuff are already created automagically:</p><pre>$ git status<br>On branch main<br>Your branch is up to date with &#39;origin/main&#39;.</pre><pre>Untracked files:<br>  (use &quot;git add &lt;file&gt;...&quot; to include in what will be committed)<br>    cmd/plugin/localfile/<br>    docs/plugins/localfile.md<br>    internal/pkg/plugin/localfile/</pre><p>Let’s have a quick recap of the directory structure:</p><h4><strong>cmd/</strong></h4><p>cmd/plugin/localfile/main.go is the main entrance of your plugin. But here you don’t need to do anything; nothing.</p><p>dtm has already generated the code for you, including the interfaces that you must implement.</p><h4><strong>docs/</strong></h4><p>docs/plugins/localfile.md is the automatically generated documentation.</p><p>Yep, I know dtm is automagic, but it can’t read your mind. I’m afraid that you will have to write your own doc.</p><p>But hey, at least here you get a reminder that you need to create a doc :)</p><h4><strong>internal/pkg/</strong></h4><p>internal/pkg/plugin/localfile has your plugin’s main logic.</p><p>Here, we need to:</p><ul><li>define your input parameters (options);</li><li>implement the validation of the input parameters;</li><li>implement four mandatory interfaces.</li></ul><h3><strong>Core Concepts</strong></h3><h4><strong>Config/State/Resource</strong></h4><p>Before explaining interfaces and implementing them, let’s have a look at how DevStream actually works:</p><ul><li><em>Config</em> is a list of tools, each of which has a name, plugin, options, etc.</li><li><em>State</em> is a map containing each tool’s name, plugin, options, etc. It’s used to store the result of dtm’s last action.</li><li><em>Resource</em> is the tool that the plugin created. The Read interface returns a description of that resource, which should be the same as the <em>State</em> if nothing has been changed after dtm’s last action.</li></ul><p>DevStream decides what to do based on your <em>Config</em>, the <em>State</em>, and the <em>Resource</em>’s status. See the flowchart below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*vETB_6BoSY83iehGrciAgw.png" /></figure><h4><strong>Interfaces</strong></h4><p>A quick recap: each DevStream plugin must satisfy the following four interfaces:</p><ul><li>Create</li><li>Read</li><li>Update</li><li>Delete</li></ul><p>Return values:</p><ul><li>Create and Update return two values (map[string]interface{}, error). The first return value is considered as the <em>State</em>, which will be stored in DevStream’s state file.</li><li>Read’s first return value is a description of the <em>Resource</em>, which should be the same as the <em>State</em> if nothing has changed.</li><li>Delete returns (true, nil)`if there is no error; otherwise it returns (false, error).</li></ul><h3><strong>Coding</strong></h3><h4><strong>Input Options/Validation</strong></h4><p>Now let’s open internal/pkg/plugin/localfile/options.go and add options according to our design in the previous section.</p><p>The internal/pkg/plugin/localfile/options.go should look like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/536c0133a94775175c7e04f3a2d6a8c4/href">https://medium.com/media/536c0133a94775175c7e04f3a2d6a8c4/href</a></iframe><p>Let’s also implement the validation function of the input options.</p><p>Open internal/pkg/plugin/localfile/validate.go and change the logic to verify the options. It should look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6cf3554a0cff5f339a4e258d89b77535/href">https://medium.com/media/6cf3554a0cff5f339a4e258d89b77535/href</a></iframe><h4><strong>Create()</strong></h4><p>We want to create the file based on the input options. So, let’s do just that in the file internal/pkg/plugin/localfile/create.go.</p><p>OK, talk is cheap, show me the code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f382eaa2b448bef604cfe8972a137ce3/href">https://medium.com/media/f382eaa2b448bef604cfe8972a137ce3/href</a></iframe><p>If you compare the code above to the code generated by dtm develop, you will see that we basically did nothing here. We only filled some blanks which are marked by dtm’s comment. The same is true for all the other interfaces.</p><p><em>A small tip: here, we can put the function </em><em>writefile in </em><em>internal/pkg/plugin/localfile/localfile.go, so that the code is better organized.</em></p><p>The localfile.go will look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d4688066dd714cd51692ef4225da5a4/href">https://medium.com/media/5d4688066dd714cd51692ef4225da5a4/href</a></iframe><h4><strong>Read()</strong></h4><p>Let’s also implement the Read interface.</p><p>The logic is simple: we want to try to see if the file exists or not, and if yes, what’s the filename and content.</p><p>internal/pkg/plugin/localfile/read.go:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b864217731c9ee3cf95668fd9735428d/href">https://medium.com/media/b864217731c9ee3cf95668fd9735428d/href</a></iframe><p>On the return value:</p><ul><li>If the file doesn’t exist, return nil, no error, because it means the resource hasn’t been created yet (or deleted by somebody)</li><li>If the file exists, return the “status” of it and no error.</li><li>Otherwise, return nil and the error.</li></ul><h4><strong>Update()</strong></h4><p>Update will be triggered if Read returns a different result than what’s recorded in the <em>State</em>.</p><p>For the implementation, since we are updating a file, it’s the same as Create, so we can actually reuse it here without duplicated code:</p><p>internal/pkg/plugin/localfile/update.go:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/323ba4faa9bc3cf9589544568a7de94b/href">https://medium.com/media/323ba4faa9bc3cf9589544568a7de94b/href</a></iframe><h4><strong>Delete()</strong></h4><p>Last but not least, let’s implement the Delete interface.</p><p>internal/pkg/plugin/localfile/delete.go:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6ed57aac7b6df7a25504a749874e6ba2/href">https://medium.com/media/6ed57aac7b6df7a25504a749874e6ba2/href</a></iframe><p>Just delete the file; nothing to look at here.</p><h3><strong>Build</strong></h3><p>Now that we finished coding, let’s build our new plugin. Our Makefile now supports building a specific plugin only:</p><p>make build-plugin.localfile</p><h3><strong>Test</strong></h3><p>First, let’s create a config file `config-localfile-test.yaml`:</p><pre>tools:<br>- name: my-file<br>  plugin: localfile<br>  options:<br>    filename: foo.txt<br>    content: &quot;hello, world&quot;</pre><p>Now, let’s apply:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/909f19c810f6ed1d81be74bee1f8f601/href">https://medium.com/media/909f19c810f6ed1d81be74bee1f8f601/href</a></iframe><p>As we can see, the plugin has created our file successfully. To verify, you can open the “foo.txt” file to have a look.</p><p>If we apply again, nothing should happen, since the file is already created with the desired content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d11ff814d1254b457d02c3d2b32c325/href">https://medium.com/media/4d11ff814d1254b457d02c3d2b32c325/href</a></iframe><p>But, what if somebody changed the content of “foo.txt”? Let’s experiment:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/52ededca12af46593485c732b5e08b21/href">https://medium.com/media/52ededca12af46593485c732b5e08b21/href</a></iframe><p>We can see that the file has drifted from the state, so it will be updated. After the operation, the file’s content is changed back to what we defined in our config.</p><p>Heck, let’s even try deleting this file and see what happens:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fd955b0d0af24b1eff698f839bddf96/href">https://medium.com/media/8fd955b0d0af24b1eff698f839bddf96/href</a></iframe><p>Apparently, DevStream thought the file should exist according to the state, but it doesn’t, so it is created again.</p><p>Last, let’s try to delete this file with dtm:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/282dc8d417e008363231c35cf7aede91/href">https://medium.com/media/282dc8d417e008363231c35cf7aede91/href</a></iframe><p>Hooray!</p><h3><strong>Summary</strong></h3><p>I’m sorry that I put the “TL;DR” at the end; it’s only because I want you to have a global feeling of DevStream. But for advanced developers, here’s a “TL;DR” (or use it as a checklist) for you:</p><ul><li>Run dtm develop create-plugin — name=your-plugin.</li><li>Do a git status, then:</li><li>find the generated files</li><li>edit/code at the places where there is already a comment mark</li><li>Pay special attention to the return value of the interfaces. Figure out the relationship between <em>State</em> and <em>Resource</em>. What the interfaces return decides how this plugin will behave.</li><li>Last but not least, update the documentation.</li></ul><p>If you enjoy reading this post, please like, comment, and subscribe! I will see you next time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cab1ff122302" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devstream/creating-a-devstream-dtm-plugin-for-anything-cab1ff122302">Creating a DevStream (dtm) Plugin for Anything</a> was originally published in <a href="https://medium.com/devstream">DevStream</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>