Skip to content

Instantly share code, notes, and snippets.

View alicek106's full-sized avatar

Chanho Yong alicek106

View GitHub Profile
@alicek106
alicek106 / python-k8s-scheduler.py
Created October 4, 2019 14:39
Simple python scheduler for kubernetes
import random
import json
from kubernetes import client, config, watch
# 이 스케줄러가 담당할 스케줄러 이름을 지정합니다.
scheduler_name = "my-custom-scheduler"
# 이 스케줄러가 스케줄링할 포드의 네임스페이스를 지정합니다. 필요에 따라 전역적으로 사용할 수도 있습니다.
namespace_name = "default"
@alicek106
alicek106 / sort-slice-example.go
Created August 30, 2019 04:50
Simple sort example for golang
package main
import (
"fmt"
"sort"
)
type person struct {
age int
number int
@alicek106
alicek106 / Dockerfile-golang-practice
Created August 16, 2019 05:29
Dockerfile for Golang Practice
FROM ubuntu:16.04
RUN apt update && apt install wget git build-essential vim -y
RUN wget https://dl.google.com/go/go1.12.linux-amd64.tar.gz && \
tar -xvf go1.12.linux-amd64.tar.gz && \
mv go /usr/local
ENV GOROOT=/usr/local/go
ENV GOPATH=/root/go
ENV PATH="$GOPATH/bin:$GOROOT/bin:${PATH}"
@alicek106
alicek106 / pod-crud-example.py
Created August 8, 2019 07:14
Pod CRUD example (쿠버네티스 페이스북 그룹 질문에서)
# Original link : https://github.com/roshanp30/Kubernetes-Api-using-python/blob/master/podcrud.py
import yaml
from os import path
from kubernetes import client, config, utils
from pprint import pprint
DEPLOYMENT_NAME = "alicek106"
IMAGE_NAME = "nginx"
PORT_NO = 80
APP_NAME = "alicek106"
@alicek106
alicek106 / pod-crud-example.py
Created August 8, 2019 07:14
Pod CRUD example (쿠버네티스 페이스북 그룹 질문에서)
# Original link : https://github.com/roshanp30/Kubernetes-Api-using-python/blob/master/podcrud.py
import yaml
from os import path
from kubernetes import client, config, utils
from pprint import pprint
DEPLOYMENT_NAME = "alicek106"
IMAGE_NAME = "nginx"
PORT_NO = 80
APP_NAME = "alicek106"
@alicek106
alicek106 / dex-app-dockerfile.yaml
Created July 28, 2019 12:05
Dockerfile for Dex App (k8s)
# build stage
FROM golang:1.12.7-alpine
RUN apk add build-base git
RUN go get github.com/dexidp/dex; exit 0
WORKDIR src/github.com/dexidp/dex
RUN make
# final stage
FROM alpine
COPY --from=0 /go/src/github.com/dexidp/dex/bin/example-app /
@alicek106
alicek106 / master-dex-config.yaml
Created July 28, 2019 07:41
Kubernetes Master Configuration for Dex (kubeadm)
kind: ClusterConfiguration
apiVersion: kubeadm.k8s.io/v1beta1
apiServer:
extraArgs:
authorization-mode: Node,RBAC
cloud-provider: aws
oidc-issuer-url: https://dex.alicek106.com
oidc-client-id: example-app
oidc-ca-file: /etc/ssl/oidc-certs/ca.pem
oidc-username-claim: email
data:
log4j2.properties: |-
status = error
appender.console.type = Console
args:
- "-c"
- |
echo ['date'] ping
sleep 10
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/server-snippet: |
set $flag 0;
if ($http_user_agent ~* "(Mobile)" ){
set $flag = 1;
}
if ( $flag = 1 ){
return 301 http://google.com;