Skip to content

使用kubebuilder实现的定时滚动重启deployment和statefulset资源对象的operator

Notifications You must be signed in to change notification settings

shuhanghang/kube-leisure

Repository files navigation

kube-leisure

定时滚动重启deployment或statefulset资源对象,等效于kubectl rollout restart

开始

  1. 安装
    kubectl apply -f https://raw.githubusercontent.com/shuhanghang/kube-leisure/master/deployment/leisure-crd-rbac.yaml
  1. 部署自定义重启负载文件
apiVersion: leisure.shuhanghang.com/v1beta1
kind: Leisure
metadata:
  name: leisure-sample
spec:
  restart:                     #重启资源
    resourceType: deployment   #资源类型
    name: nginx                #资源名称
    nameSpace: default         #资源所在的空间
    restartAt: '0 1 * * *'     #crontab格式
    timeZone: Asia/Shanghai    #所在时区
--- 
apiVersion: leisure.shuhanghang.com/v1beta1
kind: Leisure
metadata:
  name: leisure-sample2
spec:
  restart:
    resourceType: statefulset
    name: postgresql
    nameSpace: database
    restartAt: '0 2 1 * *'
    timeZone: Asia/Shanghai

About

使用kubebuilder实现的定时滚动重启deployment和statefulset资源对象的operator

Resources

Stars

Watchers

Forks

Packages

No packages published