From 7ff208fd4db319e7e20b17786189644ee827836a Mon Sep 17 00:00:00 2001 From: Stephen Levine Date: Thu, 21 Dec 2023 15:47:17 -0500 Subject: [PATCH 1/3] Add HA component to SRE challenge --- challenges/sre/challenge.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/challenges/sre/challenge.md b/challenges/sre/challenge.md index 9806eb7..4413bd6 100644 --- a/challenges/sre/challenge.md +++ b/challenges/sre/challenge.md @@ -154,6 +154,7 @@ but, at a minimum, please include the following: ### Deployment * Create a helm chart for the service that includes at least: a Deployment, ServiceAccount and Service +* Upgrading the helm chart should not result in unavailability of the service. ## Level 4 @@ -177,6 +178,7 @@ but, at a minimum, please include the following: ### Deployment * Create a helm chart for the service that includes at least: a Deployment, ServiceAccount and Service +* Upgrading the helm chart should not result in unavailability of the service. ## Level 5 @@ -203,6 +205,7 @@ but, at a minimum, please include the following: * Create a helm chart for the service * Include production-level packaging for this service, including but not limited to: Deployment, Role, RoleBinding, ServiceAccount, Service +* Upgrading the helm chart should not result in unavailability of the HTTP API portion of the service. # Guidance @@ -293,12 +296,8 @@ provide a clear path to a solution. Consider making other reasonable trade-offs. Make sure you communicate them to the interview team. -Here are some other trade-offs that will help you to spend less time on the task: - -* Do not implement a system that scales or is highly performing. Describe which - performance improvements you would add in the future. -* It is OK if the system is not highly available. Write down how you would make - the system highly-available and why your system is not. +Do not implement a system that scales outside of the scope of this challenge. +For example, it is not necessary to deploy a shared cached or support deployment to multiple regions or AZs. ## Pitfalls and Gotchas From 0e8cf6e1f60f7a471e445dc7462a0c7e51834522 Mon Sep 17 00:00:00 2001 From: Stephen Levine Date: Thu, 21 Dec 2023 15:48:35 -0500 Subject: [PATCH 2/3] Delete challenges/sre/sre-server directory --- challenges/sre/sre-server/main.go | 64 ------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 challenges/sre/sre-server/main.go diff --git a/challenges/sre/sre-server/main.go b/challenges/sre/sre-server/main.go deleted file mode 100644 index 88ffdfb..0000000 --- a/challenges/sre/sre-server/main.go +++ /dev/null @@ -1,64 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "net/http" - "os" - "path/filepath" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" - "k8s.io/client-go/tools/clientcmd" -) - -func main() { - err := run(os.Args) - if err != nil { - fmt.Fprintf(os.Stderr, "Error: %v", err) - } -} - -func run(args []string) error { - homedir, err := os.UserHomeDir() - if err != nil { - return err - } - - var port, kubeconfig string - flag.StringVar(&port, "port", "8080", "server port") - flag.StringVar(&kubeconfig, "kubeconfig", filepath.Join(homedir, ".kube", "config"), "path to the kubeconfig file") - flag.Parse() - - // use the current context in kubeconfig - config, err := clientcmd.BuildConfigFromFlags("", kubeconfig) - if err != nil { - return err - } - - // create the clientset - clientset, err := kubernetes.NewForConfig(config) - if err != nil { - return err - } - - // add handlers - http.Handle("/healthz", &healthzHandler{clientset: clientset}) - - return http.ListenAndServe(":"+port, nil) -} - -// healthzHandler is an HTTP handler for the healthz API. -type healthzHandler struct { - clientset *kubernetes.Clientset -} - -// ServeHTTP implements http.Handler -func (h *healthzHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - pods, err := h.clientset.CoreV1().Pods("").List(r.Context(), metav1.ListOptions{}) - if err != nil { - http.Error(w, err.Error(), http.StatusServiceUnavailable) - return - } - fmt.Fprintf(w, "healthz: OK\nThere are %d pods in the cluster\n", len(pods.Items)) -} From 842d12419de356081bc492cbb5da188e01b07b42 Mon Sep 17 00:00:00 2001 From: Stephen Levine Date: Thu, 21 Dec 2023 15:49:01 -0500 Subject: [PATCH 3/3] Update challenge.md --- challenges/sre/challenge.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/challenges/sre/challenge.md b/challenges/sre/challenge.md index 4413bd6..6788b4b 100644 --- a/challenges/sre/challenge.md +++ b/challenges/sre/challenge.md @@ -32,9 +32,6 @@ The requirements vary depending on the level you are applying to. This challenge covers 5 engineering levels at Teleport. Level 6 is only for internal promotions. Check [Site Reliability Engineering (SRE) Levels](../../levels/sre.pdf) for more details. -An incomplete implementation of a Go server is located at -[sre-server/main.go](./sre-server/main.go). - Start by creating a new GitHub repository. Then let the interview panel know the repository's location by pasting a link in your interview Slack channel. Invite interview panel participants as contributors to the new repository if you prefer