From a56cbd485fe88e52af40fd41403cbe80cc944a5c Mon Sep 17 00:00:00 2001 From: dongming Date: Mon, 12 Dec 2022 20:03:52 +0800 Subject: [PATCH] l-10 --- .../controller-runtime/pkg/cluster/internal.go | 1 + .../pkg/config/v1alpha1/types.go | 4 ++-- .../controller-runtime/pkg/manager/internal.go | 16 ++++++++-------- .../controller-runtime/pkg/manager/manager.go | 1 + 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/cluster/internal.go b/vendor/sigs.k8s.io/controller-runtime/pkg/cluster/internal.go index 125e1d1..fc4be5c 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/cluster/internal.go +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/cluster/internal.go @@ -31,6 +31,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/runtime/inject" ) +// 和 k8s 通讯的客户端。也就是和 kube-apiserver 通讯的组件(包括但不仅仅包括 客户端,缓存,同步机制。。。) type cluster struct { // config is the rest.config used to talk to the apiserver. Required. config *rest.Config diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/config/v1alpha1/types.go b/vendor/sigs.k8s.io/controller-runtime/pkg/config/v1alpha1/types.go index e67b62e..a078086 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/config/v1alpha1/types.go +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/config/v1alpha1/types.go @@ -88,12 +88,12 @@ type ControllerConfigurationSpec struct { // e.g. ReplicaSet in apps group (regardless of version) would be `ReplicaSet.apps`. // // +optional - GroupKindConcurrency map[string]int `json:"groupKindConcurrency,omitempty"` + GroupKindConcurrency map[string]int `json:"groupKindConcurrency,omitempty"` // 控制并发的映射 // CacheSyncTimeout refers to the time limit set to wait for syncing caches. // Defaults to 2 minutes if not set. // +optional - CacheSyncTimeout *time.Duration `json:"cacheSyncTimeout,omitempty"` + CacheSyncTimeout *time.Duration `json:"cacheSyncTimeout,omitempty"` // 缓存同步超时时间 } // ControllerMetrics defines the metrics configs. diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/manager/internal.go b/vendor/sigs.k8s.io/controller-runtime/pkg/manager/internal.go index 5b22c62..6a6665b 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/manager/internal.go +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/manager/internal.go @@ -67,29 +67,29 @@ type controllerManager struct { sync.Mutex started bool - stopProcedureEngaged *int64 - errChan chan error - runnables *runnables + stopProcedureEngaged *int64 // 已停止程序的计数器 + errChan chan error // 错误通知的管道 + runnables *runnables // 一些 manager 维护的子进程 // cluster holds a variety of methods to interact with a cluster. Required. - cluster cluster.Cluster + cluster cluster.Cluster // 和 cluster进行通讯的一组方法 // recorderProvider is used to generate event recorders that will be injected into Controllers // (and EventHandlers, Sources and Predicates). - recorderProvider *intrec.Provider + recorderProvider *intrec.Provider // 事件记录器,负责将事件传播出去,包括 events 资源和 log // resourceLock forms the basis for leader election - resourceLock resourcelock.Interface + resourceLock resourcelock.Interface // leader 选举过程中的通用方法集,用来锁定任意资源 // leaderElectionReleaseOnCancel defines if the manager should step back from the leader lease // on shutdown leaderElectionReleaseOnCancel bool // metricsListener is used to serve prometheus metrics - metricsListener net.Listener + metricsListener net.Listener // 监控的网络访问方法集 // metricsExtraHandlers contains extra handlers to register on http server that serves metrics. - metricsExtraHandlers map[string]http.Handler + metricsExtraHandlers map[string]http.Handler // 监控的网络访问 handler 映射 // healthProbeListener is used to serve liveness probe healthProbeListener net.Listener diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/manager/manager.go b/vendor/sigs.k8s.io/controller-runtime/pkg/manager/manager.go index 9caad3b..3736063 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/manager/manager.go +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/manager/manager.go @@ -409,6 +409,7 @@ func New(config *rest.Config, options Options) (Manager, error) { } // 重点关注,runnables。 + // 是一些可以运行的对象,这些对象被 manager 所管理,来完成不同任务 errChan := make(chan error) runnables := newRunnables(options.BaseContext, errChan)