Skip to content

Instantly share code, notes, and snippets.

View reaperes's full-sized avatar

Kim Namhoon reaperes

  • Seoul, Korea
View GitHub Profile
# It locates on /etc/systemd/system/
[Unit]
Description=Cleaning unnecessary cadvisor system resources. See issue https://github.com/kubernetes/kubernetes/issues/64137.
[Service]
Slice=cadvisor-gc.slice
ExecStart=/opt/cadvisor-gc/cadvisor-gc.sh
[Install]
// It's test code. Not working yet.
@Component
class CORSFilter : Filter {
@Value("${cmdb.cors.allowedDomainPattern}")
lateinit var allowedDomainPattern: String
override fun doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain) {
val res = response as HttpServletResponse
if (!request.serverName.matches(allowedDomainPattern.toRegex())) {
res.addHeader(HttpHeaders.VARY, "Origin")
@reaperes
reaperes / set-docker-auth.sh
Last active April 1, 2021 12:06
Set docker auth without prompt
AUTH=$(echo -n 'username:password' | base64)
echo $(cat /root/.docker/config.json | jq '. += {
"auths": {
"my.registry.com/v1/": {
"auth": "'"$AUTH"'",
"email": "my@email.com"
}
}
}') > /root/.docker/config.json
apiVersion: v1
kind: Pod
metadata:
name: hello-world
spec:
containers:
- name: hello
image: "alpine:3"
command: ["/bin/echo", "hello, world"]
kind create cluster --name cluster --image kindest/node:v1.18.4
# k8s cluster does not located on 127.0.0.1
sed -i s/127.0.0.1/host.docker.internal/g ~/.kube/config
# certificated does not work for host.docker.internal
sed -i 's/certificate-authority-data:.*$/insecure-skip-tls-verify: true/g' ~/.kube/config
kubectl get pod
# https://hub.docker.com/r/kindest/node/tags?page=1&ordering=last_updated
# TAG=v1.16.4
kind create cluster --image --image kindest/node:$TAG
# ref: https://github.com/newrelic/k8s-webhook-cert-manager
openssl req -new -x509 -subj "/CN=${service}.${namespace}.svc" -nodes -newkey rsa:4096 -keyout tls.key -out tls.crt -days 9999
#!/usr/bin/env bash
CONFIG=~/.knd.yaml
NAME=$(sed -rn 's/name:[[:space:]]*(.*)/\1/gp' $CONFIG)
KUBECONFIG=~/.kube/kind
up() {
local ver=$1
local image=""
buildscript {
repositories {
mavenCentral()
}
dependencies {
"classpath"(group = "org.yaml", name = "snakeyaml", version = "1.28")
}
}
flyway {
@reaperes
reaperes / s3-policy.json
Created December 29, 2021 03:36
s3 ip allow policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "IPAllow",
"Principal": {
"AWS": "*"
},
"Effect": "Allow",
"Action": [