Skip to content

Commit

Permalink
add auto pod upgrade controller for daemoset (#970)
Browse files Browse the repository at this point in the history
* add auto pod upgrade controller for daemoset

Signed-off-by: hxcGit <[email protected]>
  • Loading branch information
xavier-hou authored Sep 27, 2022
1 parent 7351cff commit 98a21c7
Show file tree
Hide file tree
Showing 11 changed files with 2,487 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/yurt-controller-manager/app/controllermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func NewControllerInitializers() map[string]InitFunc {
controllers := map[string]InitFunc{}
controllers["nodelifecycle"] = startNodeLifecycleController
controllers["yurtcsrapprover"] = startYurtCSRApproverController

controllers["daemonpodupdater"] = startDaemonPodUpdaterController
return controllers
}

Expand Down
14 changes: 14 additions & 0 deletions cmd/yurt-controller-manager/app/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"time"

"github.com/openyurtio/openyurt/pkg/controller/certificates"
daemonpodupdater "github.com/openyurtio/openyurt/pkg/controller/daemonpodupdater"
lifecyclecontroller "github.com/openyurtio/openyurt/pkg/controller/nodelifecycle"
)

Expand Down Expand Up @@ -65,3 +66,16 @@ func startYurtCSRApproverController(ctx ControllerContext) (http.Handler, bool,

return nil, true, nil
}

func startDaemonPodUpdaterController(ctx ControllerContext) (http.Handler, bool, error) {
daemonPodUpdaterCtrl := daemonpodupdater.NewController(
ctx.ClientBuilder.ClientOrDie("daemonPodUpdater-controller"),
ctx.InformerFactory.Apps().V1().DaemonSets(),
ctx.InformerFactory.Core().V1().Nodes(),
ctx.InformerFactory.Core().V1().Pods(),
)

go daemonPodUpdaterCtrl.Run(2, ctx.Stop)

return nil, true, nil
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/Masterminds/semver/v3 v3.1.1
github.com/Microsoft/go-winio v0.4.15
github.com/aliyun/alibaba-cloud-sdk-go v1.61.579
github.com/davecgh/go-spew v1.1.1
github.com/daviddengcn/go-colortext v1.0.0
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/emicklei/go-restful v2.12.0+incompatible // indirect
Expand Down
Loading

0 comments on commit 98a21c7

Please sign in to comment.