Skip to content

Commit 4cbdf9d

Browse files
authored
Merge pull request #6326 from hedge-sparrow/optional-updateprobe
Allow update-prober to be disabled
2 parents ba3f66a + d946973 commit 4cbdf9d

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

cmd/controller/controller.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/k0sproject/k0s/internal/sync/value"
2828
"github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
2929
"github.com/k0sproject/k0s/pkg/applier"
30-
apclient "github.com/k0sproject/k0s/pkg/autopilot/client"
3130
"github.com/k0sproject/k0s/pkg/build"
3231
"github.com/k0sproject/k0s/pkg/certificate"
3332
"github.com/k0sproject/k0s/pkg/component/controller"
@@ -562,12 +561,12 @@ func (c *command) start(ctx context.Context, flags *config.ControllerOptions, de
562561
Workloads: controllerMode.WorkloadsEnabled(),
563562
})
564563

565-
clusterComponents.Add(ctx, controller.NewUpdateProber(
566-
&apclient.ClientFactory{
567-
ClientFactoryInterface: adminClientFactory,
568-
},
569-
leaderElector,
570-
))
564+
if !slices.Contains(flags.DisableComponents, constant.UpdateProberComponentName) {
565+
clusterComponents.Add(ctx, controller.NewUpdateProber(
566+
adminClientFactory,
567+
leaderElector,
568+
))
569+
}
571570

572571
// Add the config source as the last component, so that the reconciliation
573572
// starts after all other components have been started.

cmd/controller/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Flags:
5252
--data-dir string Data Directory for k0s. DO NOT CHANGE for an existing setup, things will break! (default `+defaultDataDir+`)
5353
-d, --debug Debug logging (implies verbose logging)
5454
--debugListenOn string Http listenOn for Debug pprof handler (default ":6060")
55-
--disable-components strings disable components (valid items: applier-manager,autopilot,control-api,coredns,csr-approver,endpoint-reconciler,helm,konnectivity-server,kube-controller-manager,kube-proxy,kube-scheduler,metrics-server,network-provider,node-role,system-rbac,windows-node,worker-config)
55+
--disable-components strings disable components (valid items: applier-manager,autopilot,control-api,coredns,csr-approver,endpoint-reconciler,helm,konnectivity-server,kube-controller-manager,kube-proxy,kube-scheduler,metrics-server,network-provider,node-role,system-rbac,update-prober,windows-node,worker-config)
5656
--enable-cloud-provider Whether or not to enable cloud provider support in kubelet
5757
--enable-dynamic-config enable cluster-wide dynamic config based on custom resource
5858
--enable-k0s-cloud-provider enables the k0s-cloud-provider (default false)

cmd/install/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Flags:
4646
-c, --config string config file, use '-' to read the config from stdin (default `+defaultConfigPath+`)
4747
--cri-socket string container runtime socket to use, default to internal containerd. Format: [remote|docker]:[path-to-socket]
4848
--data-dir string Data Directory for k0s. DO NOT CHANGE for an existing setup, things will break! (default `+defaultDataDir+`)
49-
--disable-components strings disable components (valid items: applier-manager,autopilot,control-api,coredns,csr-approver,endpoint-reconciler,helm,konnectivity-server,kube-controller-manager,kube-proxy,kube-scheduler,metrics-server,network-provider,node-role,system-rbac,windows-node,worker-config)
49+
--disable-components strings disable components (valid items: applier-manager,autopilot,control-api,coredns,csr-approver,endpoint-reconciler,helm,konnectivity-server,kube-controller-manager,kube-proxy,kube-scheduler,metrics-server,network-provider,node-role,system-rbac,update-prober,windows-node,worker-config)
5050
--enable-cloud-provider Whether or not to enable cloud provider support in kubelet
5151
--enable-dynamic-config enable cluster-wide dynamic config based on custom resource
5252
--enable-k0s-cloud-provider enables the k0s-cloud-provider (default false)

docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ they need to fulfill their need for the control plane. Disabling the system
583583
components happens through a command line flag for the controller process:
584584
585585
```text
586-
--disable-components strings disable components (valid items: applier-manager,autopilot,control-api,coredns,csr-approver,endpoint-reconciler,helm,konnectivity-server,kube-controller-manager,kube-proxy,kube-scheduler,metrics-server,network-provider,node-role,system-rbac,windows-node,worker-config)
586+
--disable-components strings disable components (valid items: applier-manager,autopilot,control-api,coredns,csr-approver,endpoint-reconciler,helm,konnectivity-server,kube-controller-manager,kube-proxy,kube-scheduler,metrics-server,network-provider,node-role,system-rbac,update-prober,windows-node,worker-config)
587587
```
588588
589589
If you use k0sctl, just add the flag when installing the cluster for the first

pkg/component/controller/updateprober.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import (
1313

1414
"github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
1515
"github.com/k0sproject/k0s/pkg/autopilot/channels"
16-
apcli "github.com/k0sproject/k0s/pkg/autopilot/client"
1716
"github.com/k0sproject/k0s/pkg/autopilot/controller/updates"
1817
"github.com/k0sproject/k0s/pkg/build"
1918
"github.com/k0sproject/k0s/pkg/component/controller/leaderelector"
2019
"github.com/k0sproject/k0s/pkg/component/manager"
20+
kubeutil "github.com/k0sproject/k0s/pkg/kubernetes"
2121
"github.com/sirupsen/logrus"
2222
corev1 "k8s.io/api/core/v1"
2323
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -27,13 +27,13 @@ import (
2727
var _ manager.Component = (*UpdateProber)(nil)
2828

2929
type UpdateProber struct {
30-
APClientFactory apcli.FactoryInterface
30+
APClientFactory kubeutil.ClientFactoryInterface
3131
ClusterConfig *v1beta1.ClusterConfig
3232
log logrus.FieldLogger
3333
leaderElector leaderelector.Interface
3434
}
3535

36-
func NewUpdateProber(apClientFactory apcli.FactoryInterface, leaderElector leaderelector.Interface) *UpdateProber {
36+
func NewUpdateProber(apClientFactory kubeutil.ClientFactoryInterface, leaderElector leaderelector.Interface) *UpdateProber {
3737
return &UpdateProber{
3838
APClientFactory: apClientFactory,
3939
log: logrus.WithFields(logrus.Fields{"component": "updateprober"}),

pkg/config/cli.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ var availableComponents = []string{
269269
constant.NetworkProviderComponentName,
270270
constant.NodeRoleComponentName,
271271
constant.SystemRBACComponentName,
272+
constant.UpdateProberComponentName,
272273
constant.WindowsNodeComponentName,
273274
constant.WorkerConfigComponentName,
274275
}

pkg/constant/constant.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ const (
107107
NodeRoleComponentName = "node-role"
108108
WindowsNodeComponentName = "windows-node"
109109
AutopilotComponentName = "autopilot"
110+
UpdateProberComponentName = "update-prober"
110111

111112
// ClusterConfigNamespace is the namespace where we expect to find the ClusterConfig CRs
112113
ClusterConfigNamespace = "kube-system"

0 commit comments

Comments
 (0)