Author: Kris Nova

I feel like half of my blog ideas come from Jessie’s twitter page… but after another one of her great tweets I had an idea.

 

 

Which was to make a proper theme for my mountain pictures for tech presentations.

And of course if you know anything about me, it’s that if I do something manually once, I have to automate it for my future self. So I started working on a new presentation, except this time spent the extra hour or so to put together a proper theme.

So feel free to use it! I took all the pictures myself, and even went through the process of giving you happy/sad slides so you can introduce conflict in your presentation.

Download 0.0.1

Name Download
PowerPoint Slides  nova-clouds-theme-0.0.1.pptx
 Background Images (16:9)  nova-clouds-images.tar.gz

Using with Microsoft PowerPoint

  1. Create a new copy of the presentation
  2. Open the presentation
  3. Begin using the default slide layouts

Using with Google Slides

  1. Create a new Google slides presentation
  2. Click the Theme... button on the top bar
  3. Click import theme and import the theme
  4. Begin using the default slide layouts

 

 

So hanging out at GothamGo this year has been inspirational! I have been able to rub elbows with the best of the best Go engineers in the world.

Last night I was introduced to what I think is..

..finally the solution to generics in Go!

The G Package

The Generics Package

So there is an Apache 2 open source licensed package that can be found on GitHub here. ‘

The package is clean, and elegant. So let’s take the package for a spin!

First things first, we need to install the G package. Luckily it using the Go idiomatic installation method go get.


go get github.com/StabbyCutyou/generics

Now we can import the package into our Go program.


import . "github.com/StabbyCutyou/generics"

The Implementation

We can now take ugly and non idiomatic (but flexible) Go code such as the following and implement a much more elegant solution for Generics.


func UglyUnIdiomaticQuoteGenericApproachUnquote(poorexcuse ...interface{}) []interface{}

with the G package now becomes the following


func Excellence(things ...G) []G

Backwards Compatibility

From the G package repository we can read a glorious compatibility statement:

G meets the standard of golang by matching its stance on backwards compatibility. Until a 2.0 release of generics, which may never happen, G will always be 100% Backwards compatible with it’s initial 1.0 release.

Behind The Scenes

The source code for G is simple and elegant, and I encourage all users to take a peak at what is going on behind the scenes. In my eyes it is a clean solution to Generics in Go, and I couldn’t be more pleased with the project.

I hope this helps.

Cheers.

So I am working on a Go speech today, and I got to a slide where I wanted to mention the C# programming language. Or more importantly, I wanted to mention how some internal teams at Microsoft are switching over from C# to Go!

The only problem with this slide is that I am supposed to be somewhat credible in what I say..

and I have never written a line of C# in my life.

Furthermore I run linux as my primary operating system. So of course I decided it would be a good idea to try to get a C# development environment up and and running on Archlinux. After a total of 10 seconds of searching Google I couldn’t find the step-by-step tutorial I wanted so naturally I am creating one.

So here goes…

 

Install VS Code

C# isn’t scary at all!

Download page for Linux

Tarball for Linux

Okay so you don’t need VS code, but the C# plugin is really legit. It feels like any other programming language!

But feel free to use any text editor you like. We are just going to be banging out a quick and dirty hello world.

If you plan on writing copious amounts of C# I strongly suggest you get VS code. It’s free and works fantastically on Linux.

Install Mono

(Seriously this is all you do)


sudo pacman -S mono

Write your hello world program

Create a new file called HelloWorld.cs anywhere on your file system.

HelloWorld.cs

// A Hello World! program in C#.
using System;
namespace HelloWorld
{
    class Hello 
    {
        static void Main() 
        {
            Console.WriteLine("Hello World!");

            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
    }
}

Thanks to the official Microsoft docs for the code snippet!

Compile

The mono mcs compiler works very similar to gcc and accepts an -out flag to specify the name of the executable.


mcs -out:helloexe HelloWorld.cs

Run

Then you can run your program!


mono hello.exe

What’s next?

I am going to do some benchmarking with C# and Go and explore some concurrency patterns between the two. Stay tuned for my findings!

Hey everyone!

So a huge thanks to Hashiconf for letting me come out and talk about this stuff in person! But for those of you who missed it, or want more information there is also this blog on the matter as well.

So this is just a quick technical follow up of the tool terraformctl that I used in my session to get Terraform up and running inside of Kubernetes as a controller!

What is terraformctl?

A command line tool and gRPC server that is pronounced Terraform Cuddle.

 

The GitHub repo can be found here!

 

It’s a philosophical example of how infrastructure engineers might start looking at running cloud native applications to manage infrastructure. The idea behind the tool is to introduce this new way of thinking, and not necessarily to be the concrete implementation you are working for. This idea is new, and therefore a lot of tooling is till being crafted. This is just a quick and dirty example of what it might look like.

Terraformctl follows a simple client/server pattern.

We use gRPC to define the protocol in which the client will communicate with the server.

The server is a program written in Golang that will handle incoming gRPC requests concurrently while running a control loop.

The incoming requests are cached to a mutex controlled shared point in memory.

The control loop reads from the shared memory.

Voila. Concurrent microservices in Go!

What is cloud native infrastructure?

Well it’s this crazy idea that we should start looking at managing cloud native infrastructure in the same way we manage traditional cloud native applications.

If we treat infrastructure as software then we have no reason to run the software in legacy or traditional ways when we can truly concur our software by running it in a cloud native way. I love this idea so much that I helped author a book on the subject! Feel free to check it out here!

The bottom line is that the new way of looking at the stack is to start thinking of the layers that were traditionally managed in other ways as layers that are now managed by discreet and happy applications. These applications can be ran in containers, and orchestrated in the same ways that all other applications can. So why not do that? YOLO.

What Terraformctl is not..

Terraformctl is not (and will never be) production ready.

It’s a demo tool, and it’s hacky. If you really want to expand on my work feel free to ping me, or just out right fork it. I don’t have time to maintain yet another open source project unfortunately.

Terraformctl is not designed to replace any enterprise solutions, it’s just a thought experiment. Solving these problems is extremely hard, so I just want more people to understand what is really going into these tools.

Furthermore there are a number of features not yet implemented in the code base, that the code base was structure for. Who knows, maybe one day I will get around to coding them. We will see.

If you really, really, really want to talk more about this project. Please email me at kris@nivenly.com.

 

 

So as I continue to find workarounds and fixes for running Archlinux on my Microsoft Surface Book I will post them..

Here is a great quick and dirty fix for the wifi issue.

Problem

After closing your Surface Pro, or sending your computer into a state of hibernation or suspension the WiFi agent quits working.

Solution

Found a handy dandy script that totally fixes the problem.


sudo wget -P /usr/lib/systemd/system-sleep nivenly.com/surface-hib.sh

 

 

So I joined a new team at Microsoft and we run Microsoft Teams for our primary form of communication.

So here is a quick walk through of getting it up and running on Archlinux.

Archlinux

Download the pacman package from Github

cd ~

wget https://github.com/ivelkov/teams-for-linux/releases/download/v0.0.4/teams-for-linux-0.0.4.pacman

Install with Pacman


sudo pacman -U teams-for-linux-0.0.4.pacman

Alias teams to run in the background


echo "alias teams='teams &>/dev/null &'" >> ~/.bashrc

source ~/.bashrc

 

Then you can run teams from the command line to launch the program. Happy Microsofting. J

 

Follow @kris-nova

What are we creating?

  • Kubernetes v1.7.3
  • Private Networking in Digital Ocean
  • Encrypted VPN mesh for droplets
  • Ubuntu Droplets

So at Gophercon I released my latest project kubicorn.

As I go along I want to publish a set of use cases as examples. This helps me exercise kubicorn and understand my assumptions. It would be really cool if others could step in and use these cases to improve the system.

7 Node Cluster in Digital Ocean

Creating your cluster

So the deployment process is pretty straight forward. The first thing you need to do is grab a copy of `kubicorn v0.0.003`.


$ go get github.com/kris-nova/kubicorn

Verify kubicorn is working, and you are running the right version.

$ kubicorn --fab

Also you will need a Digital Ocean access key. You can use this guide to help you create one. Then just export the key as an environmental variable.

 
$ export DIGITALOCEAN_ACCESS_TOKEN=***************************************** 

The project offers a starting point for a digital ocean cluster called a profile. Go ahead and create one on your local filesystem.

$ kubicorn create dofuckyeah --profile do

Feel free to take a look at the newly created representation of the cluster and tweak it to your liking. Here is what mine looks like

For my cluster all I did was change the maxCount from 3 to 7 for my node serverPool.

When you are happy with your config, go ahead and apply the changes!

$ kubicorn apply dofuckyeah -v 4

Then check out your new cluster and wait for your nodes to come to life!

$ kubectl get no
kubectl get nodes

What we created

We created 8 droplets, all running Ubuntu 16.04

The master droplet uses a fantastic tool called meshbird to create an encrypted private VPN service mesh on Digital Ocean private networking.

Each of the droplets get a new virtual NIC called tun0 that allows each of the droplets to route on a private VPN.

The nodes register against the master via the newly created virtual NIC.

The master API is advertised on the public IP of the master droplet.

You can checkout the bootstrap script for the master here, and for the nodes here.

And thanks to kubeadm

Poof. Kubernetes.

Want to learn more?

Check out the kubicorn project on GitHub!

Follow @kubicornk8s on Twitter to get up to the second updates!

Join us in #kubicorn in the official Gopher’s slack!

 

Follow @kris-nova

Follow @kris-nova

Just keep reading.. I promise this is worth it..

Okay so I made a new Kubernetes infrastructure tool (sorry not sorry). Introducing my latest pile of rubbish… kubicorn!

Check it out on github here.

Why I made the tool

I made the tool for a lot of reasons. The main one is so that I could have some architectural freedom. Here are some other reasons:

  • I want to start using (or abusing) kubeadm
  • I believe in standardizing a Kubernetes cluster API for the community
  • I believe in pulling configuration out of the engine, so users can define their own
  • I believe in creating the tool as a consumable library, so others can start to use it to build infrastructure operators
  • I wanted to enforce the concept of reconciliation, and pull it all the way up to the top of the library
  • I want to support multiple clouds (really)
  • I want it to be EASY to build a cloud implementation
  • I want it to be EASY to understand the code base
  • I want it to be EASY contribute to the project
  • I want it to be as idiomatic Go as possible

I am sure there are more, but you get the idea.

What it does

It empowers the user (that’s you) to manage infrastructure.

It lets the user (still you) define things like what the infrastructure should look like, and how the cluster should bootstrap.

It offers really great starting points (called profiles) that are designed to work out of the box. Tweak away!

It (eventually) will take snapshots of clusters to create an image. The image is both the infrastructure layer as well as the application layer bundled up into a lovely tarball. The tarball can be moved around, replicated, saved, and backed up. The tarball is a record of your entire cluster state (including infrastructure!).

What is next?

Please help me.

I need contributors and volunteers for the project. I want to share as much knowledge as possible with the user (you!) so that everyone can begin contributing.

What clouds do we support?

Today? AWS

Tomorrow? Digital Ocean (literally tomorrow.. checkout out the PR)

Next? You tell me. The whole point here is that the implementation is easy, so anyone can do it.

 

Kubicorn vs Kops

 

Feature Kops Kubicorn
HA Clusters
Easy to use library
Kubeadm
Bring your own bootstrap
Awesome as shit
API in Go
Digital Ocean Support
Kubernetes Official
Multiple Operating Systems (Ubuntu, CentOS, etc)
Requires DNS

 

Setting up Kubernetes 1.7.0 in AWS with Kubicorn

This is not ready for production! I started coding this a few weeks ago in my free time, and it’s very new!

Also check out the official walkthrough here!

Install kubicorn

go get github.com/kris-nova/kubicorn

Create a cluster API

kubicorn create knova --profile aws

Authenticate

You should probably create a new IAM user for this, with the following permission

  • AmazonEC2FullAccess
  • AutoScalingFullAccess
  • AmazonVPCFullAccess

Then export your auth information

export AWS_ACCESS_KEY_ID="omgsecret"
export AWS_SECRET_ACCESS_KEY="evenmoresecret"

Apply

Then you can apply your changes!

kubicorn apply knova

 

Example Output

 

Access

Then you can access your cluster

kubectl get nodes

Delete

Delete your cluster

kubicorn delete knova

Follow @kris-nova

So was sitting and having a cup of coffee this morning with Kelsey Hightower and he shared a beautiful piece of advice that I just had to share!

So let’s keep it sweet and simple:

If you are struggling getting a WiFi authentication page to open on your Mac..

You can go to captive.apple.com to hit the default auth page in your browser.

This just changed my life. I hope it helps you.

So a good friend of mine recently posted something on Twitter…screen-shot-2017-06-06-at-18-42-15

So I decided to crank out a quick write up on the matter. It’s something that also bothered me for the longest time, and a few years ago when I was hired into a job that enforced using Outlook clients I finally got to the bottom of it!

Also I work at Microsoft, so I had the best testing ground in the world. I just set an email to a non-outlook email address from my work account. Let’s take a look and see what happened.

From office 365
screen-shot-2017-06-06-at-18-30-50

So that actually worked out as expected!

It looks like the new Office 365 web client is on point and doing great.  Good job everyone!

Heck, even the smiley face is the proper emoticon code 😊 (😁)

For clarity I went ahead and pulled to raw message, and ran a quick base64 decode on it to get the following outputs.

raw

<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css" style="display:none;">
        <!-- P {
            margin-top: 0;
            margin-bottom: 0;
        }
        
        -->
    </style>
</head>

<body dir="ltr">
    <div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
        <p>Hi everyone!</p>
        <p>
            <br>
        </p>
        <p>Just sending a quick testing email <span>😊</span></p>
        <p><span><br>
</span></p>
        <p>
            <br>
        </p>
    </div>
</body>

</html>

But I know there are sinister email’s still lurking around the internet somewhere. Let’s dive deeper..

From Outlook

screenshot2017-06-06at18-56-35I found an email in my archives when I tested this theory years ago. My only computer that runs the Outlook client is actually at the office, and I am lazy.

Regardless, this sample is really what we are looking for!

Here we can see that the HTML in the email does something fairly concerning. We didn’t get valid HTML. The email used a pseudo HTML markdown that was designed for word-processing style sheets, and does not adhere to the ISO/IEC 15445 standard for HTML!

The markdown actually references some font logic that is defined as an HTML comment, as well as referencing a proprietary font!

Hence why the font definitions aren’t being interpreted, and the user is left with an unfriendly looking email to read. Below is the decoded base64 content.

raw

<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="Title" content="">
    <meta name="Keywords" content="">
    <meta name="Generator" content="Microsoft Word 15 (filtered medium)">
    <style>
        <!--
        /* Font Definitions */
        
        @font-face {
            font-family: Wingdings;
            panose-1: 5 0 0 0 0 0 0 0 0 0;
        }
        
        @font-face {
            font-family: "Cambria Math";
            panose-1: 2 4 5 3 5 4 6 3 2 4;
        }
        
        @font-face {
            font-family: Calibri;
            panose-1: 2 15 5 2 2 2 4 3 2 4;
        }
        /* Style Definitions */
        
        p.MsoNormal,
        li.MsoNormal,
        div.MsoNormal {
            margin: 0in;
            margin-bottom: .0001pt;
            font-size: 12.0pt;
            font-family: Calibri;
        }
        
        a:link,
        span.MsoHyperlink {
            mso-style-priority: 99;
            color: #0563C1;
            text-decoration: underline;
        }
        
        a:visited,
        span.MsoHyperlinkFollowed {
            mso-style-priority: 99;
            color: #954F72;
            text-decoration: underline;
        }
        
        span.EmailStyle17 {
            mso-style-type: personal-compose;
            font-family: Calibri;
            color: windowtext;
        }
        
        span.msoIns {
            mso-style-type: export-only;
            mso-style-name: "";
            text-decoration: underline;
            color: teal;
        }
        
        .MsoChpDefault {
            mso-style-type: export-only;
            font-family: Calibri;
        }
        
        @page WordSection1 {
            size: 8.5in 11.0in;
            margin: 1.0in 1.0in 1.0in 1.0in;
        }
        
        div.WordSection1 {
            page: WordSection1;
        }
        
        -->
    </style>
</head>

<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
    <div class="WordSection1">
        <p class="MsoNormal"><span style="font-size:11.0pt">Hey this is a test! </span><span style="font-size:11.0pt;font-family:Wingdings">J</span><span style="font-size:11.0pt">
<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt"><o:p>&nbsp;</o:p></span></p>
    </div>
</body>

</html>

The infamous capital j

If you have ever wondered why you see erroneous j‘s floating around in emails, the unencoded sample from above can answer that as well.

When a user (in the older Outlook tools) types :) the program will actually replace the smiley face with J instead of 😊.

The source clearly shows that the smiley face being sent is encoded in the Wingdings font!

<span style="font-size:11.0pt;font-family:Wingdings">J</span>

Wingdings is available for purchase here at microsoft.com/typography/fonts if you want to run it on your server to decode the J‘s properly.

tldr;

Older outlook clients used to do some wonky things with mime encoding and pseudo HTML formatting that conflicted with ISO/IEC 15445

Most clients probably don’t support the non-standard encoding (well).  So it’s another case of not adhering to standard to do things a proprietary way.

So in theory, Outlook has been using emoticons since before emoticons were cool. NO BIG DEAL!

Glad to know it’s working as expected now, and that we should see the problem disappear over time. So much ❤ for the engineers who helped fix this! jjj