-
Show me some code you've written that you're proud of. Tell me why it's cool, well written, and maintainable. Also share a link to your GitHub profile or similar if you haven't already.
The public code that I am most proud of would be the provisioner I wrote for the Kubernetes InstanceGroup project. The provisoner I developed incorporated Amazon's EKS Fargate. I am most proud of it because Intuit (my current employer) uses to run their TurboTax and QuickBooks applications. Here is the final merge to master.
Because it was open-source and to be used by so many people, the primary objectives throughout the development was functional clarity, adherence to K8s methods, strong encapsulation of AWS and incorporation of standard Golang idioms. I think the code is clean, well-factored and is easy to maintain. While it has been used in production for nearly 6 months, there have been no issues.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
"sync" | |
) | |
// Max request limit. Gives all customers the same limit. Set to 1 so it is easy to test | |
// When the request count exceeds the limit a 429 is returned. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
"sync" | |
) | |
// Max request limit. Gives all customers the same limit. Set to 1 so it is easy to test | |
// When the request count exceeds the limit a 429 is returned. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case "eks-cf": | |
err := r.ReconcileEKSCF(ig, finalizerName) | |
if err != nil { | |
log.Errorln(err) | |
} | |
currentState := ig.GetState() | |
if currentState == v1alpha.ReconcileErr { | |
log.Errorln("reconcile failed") | |
return ctrl.Result{}, nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: instancemgr.keikoproj.io/v1alpha1 | |
kind: InstanceGroup | |
metadata: | |
creationTimestamp: "2020-02-28T20:48:40Z" | |
generation: 1 | |
name: hello-world-fargate | |
namespace: instance-manager | |
resourceVersion: "268582" | |
selfLink: /apis/instancemgr.keikoproj.io/v1alpha1/namespaces/instance-manager/instancegroups/hello-world-fargate | |
uid: b339b681-5a6b-11ea-bd68-06a5020d85c4 |
I hereby claim:
- I am thomaswhitcomb on github.
- I am thomaswhitcomb (https://keybase.io/thomaswhitcomb) on keybase.
- I have a public key ASCoEGuDOsv90ZcKBTvk-vH0MQJdr7fo2X82SYGCY69PaQo
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func wrapper(x interface{}) func() interface{} { | |
var xx = x | |
return func() interface{}{ | |
return xx | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type obj_interface struct{ | |
set func(y int) | |
get func() int | |
} | |
func instantiate() *obj_interface { | |
var x int | |
var o = new(obj_interface) | |
o.set = func(y int){ | |
x = y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type II interface{} | |
func mapper (collection [] II,fn func(II) II) [] II { | |
mapped := make([] II,0) | |
for _,v := range(collection){ | |
mapped = append(mapped,fn(v)) |