Blog

  • intellij settings shortcuts

    快速打开 project

    https://www.jetbrains.com/help/webstorm/opening-reopening-and-closing-projects.html#ws_reopen_project_with_run_anything

    格式化代码

    https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html

    显示空格

    Show whitespaces
    https://www.jetbrains.com/help/idea/settings-editor-appearance.html

    取消烦人的升级提示

    automatically check for plugin updates

    设置关闭 project, Keymap, Main menu, File, Close Project

    command + shift + w

    https://stackoverflow.com/questions/32765340/is-there-a-shortcut-to-close-a-project-in-intellij

  • helm

    helm 2

    版本

    helm version
    

    安装或升级

    helm upgrade gitlab-runner gitlab/gitlab-runner --namespace tools -f deploy/gitlab-runner-values.yaml --install --wait

    查看

    helm status gitlab-runner
    

    Init

    helm init --client-only

    Dry run, upgrade, deployment pods will rolling update

    helm upgrade --dry-run --debug -f values.yaml gitlab-runner .

    istio

    helm upgrade --dry-run --debug -f values.yaml istio .
    

    清理

    helm delete gitlab-runner --purge

    查看,更新 repo

    helm repo list
    helm repo update
    

    查看 repo 下的所有版本

    helm2 search -l gitlab/gitlab-runner
    helm2 search -l stable/nginx-ingress
    

    安装具体 chart 版本

    helm upgrade --debug gitlab-runner gitlab/gitlab-runner --version "1.8.1" --namespace infra gitlab-runner-values.yaml --install --wait
    
    helm --kube-context prod list
    

    切换 helm 版本

    brew unlink kubernetes-helm
    brew switch helm 3.4.0
    

    查看一个 helm 所有资源

    helm2 get service1
    helm3 get all service1 -n dev
    

    查看 values

    helm3.6.1 get values gitlab-runner  -n infra
    
  • shell 遍历 0-f

    for i in `seq 0 15`
    do
    letter=$(printf '%#x' $i | sed -e 's/0x//g')
    echo $letter
    done
    
  • git-crypt

    gpg --list-secret-keys
    gpg --list-keys
    
    

    导出 secret key

    gpg --export-secret-keys YOUR_ID_HERE > private.key
    

    导入 secret key

    gpg --import private.key
    

    查看加密文件

    git-crypt status

    解密整个 repo

    git-crypt unlock
  • istio-pilot pod

    istio-pilot 包含两个容器 discovery, istio-proxy

    容器 discovery 包含一个进程 pilot-discovery

    kubectl exec -it istio-pilot-8bdcc884d4-hj8k6 -c discovery /bin/bash -n istio-system
    

    容器 istio-proxy 包含两个进程 pilot-agent, envoy

    kubectl exec -it istio-pilot-8bdcc884d4-hj8k6 -c istio-proxy /bin/bash -n istio-system
    ps aux | grep ''
    /usr/local/bin/pilot-agent proxy --domain istio-system.svc.cluster.local --serviceCluster istio-pilot --templateFile /etc/istio/proxy/envoy_pilot.yaml.tmpl --controlPlaneAuthPolicy MUTUAL_TLS --log_output_level=default:info
    # pilot-agent 是以 sidecar 模式运行的
    
    
    
  • truncate 日志文件

    文件过大,大几十G

    ls -lhai newrelic_agent.log
    truncate -s 0 newrelic_agent.log
    ls -lhai newrelic_agent.log
    

    清理前后的 inode number, 文件权限都没有发生变化
    清理完之后 tail -f newrelic_agent.log 观察是否能正常写入

    How to empty (truncate) Log files in Linux