37 Star 403 Fork 75

GVPrancher/rancher

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
controller.go 913 Bytes
Copy Edit Raw Blame History
Darren Shepherd authored 2018-02-07 21:46 . API structure refactor
package usercontrollers
import (
"context"
"github.com/rancher/rancher/pkg/clustermanager"
"github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/rancher/types/config"
)
func Register(ctx context.Context, management *config.ManagementContext, manager *clustermanager.Manager) {
lifecycle := &ClusterLifecycle{
Manager: manager,
ctx: ctx,
}
clusterClient := management.Management.Clusters("")
clusterClient.AddLifecycle("cluster-agent-controller", lifecycle)
}
type ClusterLifecycle struct {
Manager *clustermanager.Manager
ctx context.Context
}
func (c *ClusterLifecycle) Create(obj *v3.Cluster) (*v3.Cluster, error) {
return nil, nil
}
func (c *ClusterLifecycle) Remove(obj *v3.Cluster) (*v3.Cluster, error) {
c.Manager.Stop(obj)
return nil, nil
}
func (c *ClusterLifecycle) Updated(obj *v3.Cluster) (*v3.Cluster, error) {
return nil, c.Manager.Start(c.ctx, obj)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/rancher/rancher.git
git@gitee.com:rancher/rancher.git
rancher
rancher
rancher
v2.0.1-rc2

Search