云原生临时记录
Crane
云原生
https://kubernetes.io/zh/docs/tasks/extend-kubectl/kubectl-plugins/
https://github.com/kubernetes/sample-cli-plugin
https://mp.weixin.qq.com/s/r7RzGUuem1GPuKnLc8XEuw
kubectl plugin
- https://krew.sigs.k8s.io/plugins/
- 首先得出一个设计的proposal看下,包括原理,设计,代码结构,功能等
- 用插件扩展 kubectl
- 使用 Go 从零开发并发布一个 Kubectl 插件
- https://github.com/kubernetes/sample-cli-plugin
question
kubectl get ns kubesphere-controls-system -o json | jq '.spec.finalizers=[]' > ns-without-finalizers.json
cat ns-without-finalizers.json
kubectl get ns kubesphere-monitoring-system -o json | jq '.metadata.finalizers=[]' > ns-without-finalizers.json
cat ns-without-finalizers.json
kubectl proxy &
PID=$!
curl -X PUT http://localhost:8001/api/v1/namespaces/kubesphere-monitoring-system/finalize -H "Content-Type: application/json" --data-binary @ns-without-finalizers.json
kill $ID
helm repo add gocrane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm repo add prometheus-community https://finops-helm.pkg.coding.net/gocrane/prometheus-community
helm repo add grafana https://finops-helm.pkg.coding.net/gocrane/grafana
helm repo update
helm install prometheus -n crane-system --set pushgateway.enabled=false --set alertmanager.enabled=false --set server.persistentVolume.enabled=false -f https://finops.coding.net/p/gocrane/d/helm-charts/git/raw/main/integration/prometheus/override_values.yaml?download=false --create-namespace prometheus-community/prometheus
helm install grafana -f https://finops.coding.net/p/gocrane/d/helm-charts/git/raw/main/integration/grafana/override_values.yaml?download=false -n crane-system --create-namespace grafana/grafana
helm install crane -n crane-system --create-namespace gocrane/crane
helm install fadvisor -n crane-system --create-namespace gocrane/fadvisor
- staticcheck – golangci-lint 中最令人困惑的一个 linter
- 单词缩写含义
- Crane Community Meetings Archives
- 如何在线下载Google Play里面的应用
caddy2
- 用 Caddy 2 配置通用代理,解决跨域(CORS)问题
- https://caddyserver.com/docs/caddyfile/directives/import
- https://caddy2.dengxiaolong.com/docs/quick-starts/reverse-proxy
https://www.json2yaml.com/convert-yaml-to-json
腾讯云 https://segmentfault.com/u/tcloudnative/articles
容器环境cpu读取
- Runtime.getRuntime().availableProcessors()方法在Docker容器中遇到的问题和解决方案
- 针对容器的nginx优化
- https://github.com/agile6v/container_cpu_detectio
- https://github.com/uber-go/automaxprocs
127.0.0.1 - - [15/Apr/2022:07:42:16 +0000] "GET /grafana/api/live/ws HTTP/1.1" 400 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36" "-"
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# 清理 Terminating namespace
namespace=crane-system
kubectl get ns $namespace -o json | jq '.spec.finalizers=[]' > ns-without-finalizers.json
cat ns-without-finalizers.json
kubectl proxy &
PID=$!
curl -X PUT http://localhost:8001/api/v1/namespaces/$namespace/finalize -H "Content-Type: application/json" --data-binary @ns-without-finalizers.json
kill $PID
LGTM : code review 行话
程序员这个行业,不管你是大佬还是小弟,代码code review是必不可少的。那么在git上,大家日常交流的缩写语,往往一下就能看出你道行的深浅,至少是入行时间,哈哈,不要露怯,勇敢的跟大佬过招拆招。
收集了一些实用的缩写,方便大家日常交流(装B)
LGTM — Looks good to me,表示认可这次PR,同意merge 合并代码到远程仓库
ASAP -— as soon as possible! 尽快
ACK — acknowledgement, i.e. agreed/accepted change
NACK/NAK — negative acknowledgement, i.e. disagree with change and/or concept
RFC — request for comments, i.e. I think this is a good idea, lets discuss
WIP:Work In Progress 「进展中」,常见词汇,这里做为 Best Practice 单独提出来,主要针对改动较多的 PR,可以先提交部分,标题或 Tag 加上 WIP,表示尚未完成,这样别人可以先 review 已提交的部分
AFAIK/AFAICT — as far as I know / can tell IIRC — if I recall correctly
IANAL — “ I am not a lawyer ”, but I smell licensing issues
IMO — (In my opinion),在我看来
TL;DR — Too Long; Didn’t Read 「太长懒得看」,README 文档常见。
PR — Pull request「合并请求」
CR — Code Review 「代码审查」
PTAL — Please Take A Look. 你来瞅瞅?用来提示别人来看一下
TBR — To Be Reviewed. 提示维护者进行 review
TBD — To Be Done(or Defined/Discussed/Decided/Determined). 根据语境不同意义有所区别,但一般都是还没搞定的意思。
TBH — To be honest 「老实说」
atm — at the moment 「现阶段」,
作者:前端大飞 链接:https://www.jianshu.com/p/238a1e1f4037