Skip to content

Instantly share code, notes, and snippets.

View sang-w0o's full-sized avatar
🎯
Focusing

나상우(Roy) sang-w0o

🎯
Focusing
View GitHub Profile
@sang-w0o
sang-w0o / service.yaml
Created August 26, 2022 10:38
Simple kubernetes service yaml file.
apiVersion: v1
kind: Service
metadata:
name: demo-dev-svc
namespace: demo-dev
spec:
selector:
app: demo
ports:
- protocol: TCP
@sang-w0o
sang-w0o / deployment.yaml
Created August 26, 2022 10:37
Simple kubernetes deployment file.
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-dp
labels:
app: demo
namespace: demo-dev
spec:
replicas: 2
selector:
@sang-w0o
sang-w0o / secret.yaml
Created August 23, 2022 15:27
Secret example for eks.
apiVersion: v1
kind: Secret
metadata:
name: planit-dev-secret
namespace: planit-dev
data:
DATASOURCE_PRIMARY_URL: amRiYzptYXJpYWRi
DATASOURCE_USERNAME: cGx
DATASOURCE_SECRET: Ubl0MCE=
# 등등..
@sang-w0o
sang-w0o / eks-cluster-3az.yaml
Created August 23, 2022 15:01
Yaml file used by eksctl to create eks cluster.
# A simple example of ClusterConfig object:
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: ${ekscluster_name}
region: ${AWS_REGION}
version: "${eks_version}"
@sang-w0o
sang-w0o / eks-vpc-3az.yaml
Created August 23, 2022 14:51
VPC for EKS using 3 AZs.
---
AWSTemplateFormatVersion: "2010-09-09"
Description: "Amazon EKS Sample VPC - 3 AZ, Private 3 subnets, Public 3 subnets, 1 IGW, 3 NATGateways, Public RT, 3 Private RT, Security Group for ControlPlane "
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: "Worker Network Configuration"
Parameters:
@sang-w0o
sang-w0o / mini_memcached.go
Last active March 14, 2022 05:21
mini_memcached.go
package benchmarks
import (
"net"
"sync"
)
type Server struct {
l net.Listener
}
@sang-w0o
sang-w0o / grpc_gateway_9.go
Created March 2, 2022 06:32
grpc_gateway_9.go
func New() {
router = chi.NewRoter()
//..
router.Mount("/api", http.HandlerFunc(mux.ServeHTTP))
}
@sang-w0o
sang-w0o / grpc_gateway_8.go
Created March 2, 2022 05:57
grpc_gateway_8.go
func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) {
s.handlers[meth] = append([]handler{{pat: pat, h: h}}, s.handlers[meth]...)
}
@sang-w0o
sang-w0o / grpc_gateway_7.go
Created March 2, 2022 05:54
grpc_gateway_7.go
func RegisterAdminHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AdminClient) error {
mux.Handle("POST", pattern_Admin_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
// http request (body, path parameter, query parameter 등)를 Proto Message로 변환해
// 매핑된 gRPC Service 함수를 호출해요.
})
}
@sang-w0o
sang-w0o / grpc_gateway_6.go
Created March 2, 2022 05:20
grpc_gateway_6.go
func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
//..
// ServeMux의 handler를 하나씩 순회해요.
for _, h := range s.handlers[r.Method] {
// http.Request를 통해 알맞은 endpoint에 등록된
// handler를 찾아 아래 request를 handle하게 해요.
h.h(w, r, pathParams)
}
}