Skip to content

Instantly share code, notes, and snippets.

View toddams's full-sized avatar
💭
I may be slow to respond.

Ivan Balan toddams

💭
I may be slow to respond.
View GitHub Profile
@toddams
toddams / nginx-lb-aws.yaml
Created January 10, 2018 09:00 — forked from camilb/nginx-lb-aws.yaml
Kubernetes Nginx Ingress Controller for AWS
kind: Service
apiVersion: v1
metadata:
name: nginx-default-backend
namespace: kube-system
labels:
k8s-addon: ingress-nginx.addons.k8s.io
spec:
ports:
- port: 80
@toddams
toddams / HAProxy_and_K8s.md
Last active January 17, 2020 02:15 — forked from theundefined/HAProxy_and_K8s.md
Kubernetes + HAProxy sticky session affinity

Kubernetes + HAProxy sticky session affinity

  1. Make sure you have balance source in haproxy.
  2. Backend server section in haproxy config should have all your k8s nodes.
  3. sessionAffinity in k8s is irrelevant.
  4. Exposed k8s service need to have nodePort set and this annotation:

kubectl annotate service myService service.beta.kubernetes.io/external-traffic=OnlyLocal

This will cause internal k8s loadbalancer on nodeⁿ to route traffic only to pod on nodeⁿ. From Haproxy point of view it will look like nodeⁿ:nodePort === pod on nodeⁿ:port thus disabling k8s LB completly.

@toddams
toddams / multiline-values.yaml
Created November 16, 2017 10:34 — forked from rjattrill/multiline-values.yaml
Break YAML over multiple lines
# Join multiple lines without new line
value: >
part 1
part 2
# Join with newline
value2: |
line 1
line 2

Creating Neat .NET Core Command Line Apps

Every reason to get more HackerPoints™ is a good one, so today we're going to write a neat command line app in .NET Core! The Common library has a really cool package Microsoft.Extensions.CommandlineUtils to help us parse command line arguments and structure our app, but sadly it's undocumented.

No more! In this guide, we'll explore the package and write a really neat console app. We'll get good practices, a help system and argument parsing for free. Oh, it also involves ninjas. Insta-win.

@toddams
toddams / install.sh
Created September 22, 2017 09:01 — forked from maciekkolodziej/install.sh
Install ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Remove existing downloads and binaries so we can start from scratch.
rm ~/google-chrome-stable_current_amd64.deb
public class StringContentRazorProject : RazorLightProject
{
public StringContentRazorProject(Func<string, Stream> getContentFunc, Func<string, bool> existsCheckFunc)
{
this.GetContentFunc = getContentFunc;
this.ExistsCheckFunc = existsCheckFunc;
}
public Func<string, Stream> GetContentFunc { get; }
public Func<string, bool> ExistsCheckFunc { get; }