Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 1.46 KB

README.MD

File metadata and controls

67 lines (48 loc) · 1.46 KB

Working 项目管理工具

说明

此服务为快速构建部署提供支持

实现功能

github webhook 触发k8s服务滚动更新

原理:获取git push事件,通过k8s api更新服务

  1. github webhook 填写接口地址 例如:https://xxx.abc.com/github-event

  2. commit格式:deploy:v{版本号}

    版本号请参考版本管理( SemVer )

    Example:

git commit --allow-empty -am "deploy:v0.0.1"
  1. deployment.yaml 添加labels: githubRepoName={github仓库名}

    Example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: working
  namespace: default
  labels:
    app: working
    githubRepoName: working
    ...

Apollo webhook 主动触发配置热更新

原理:通过Apollo webhook接收配置更新事件,从k8s api读取apollo关联服务podIP集合,最后广播到每个服务

  1. 注册ReloadConfigServer(注册了ReloadConfigServer的服务才能主动触发热更新)
import "github.com/comeonjy/go-kit/grpc/reloadconfig"
    
reloadconfig.RegisterReloadConfigServer(server, reloadconfig.NewServer(conf))
  1. deployment.yaml 添加labels: apolloAppId={Apollo配置中心的AppId}

    Example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: working
  namespace: default
  labels:
    app: working
    apolloAppId: working
    ...

TODO LIST

  • 区分不同环境部署