core/internal/kubernetes: refactor reconciler, move to subpackage
This makes the reconciler a bit more generic, and thus allows for
writing some basic tests (of the reconciler logic and of the declared
resources).
We also start the cleanup of //core/internal/kubernetes by moving the
reconciler into a separate subpackage. This creates two sketchy
cross-package references that we'll need to fix in the future once we
continue the cleanup and modularization of the Kubernetes package.
Test Plan: the reconciler is now tested with unit tests!
X-Origin-Diff: phab/D552
GitOrigin-RevId: b43643065c8174402922c62e80cd9c87fdce2f13
diff --git a/core/internal/kubernetes/kubelet.go b/core/internal/kubernetes/kubelet.go
index 502b14d..3b0d966 100644
--- a/core/internal/kubernetes/kubelet.go
+++ b/core/internal/kubernetes/kubelet.go
@@ -28,12 +28,13 @@
"os"
"os/exec"
+ "git.monogon.dev/source/nexantic.git/core/internal/common/supervisor"
+ "git.monogon.dev/source/nexantic.git/core/internal/kubernetes/reconciler"
+ "git.monogon.dev/source/nexantic.git/core/pkg/fileargs"
+
"go.etcd.io/etcd/clientv3"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubeletconfig "k8s.io/kubelet/config/v1beta1"
-
- "git.monogon.dev/source/nexantic.git/core/internal/common/supervisor"
- "git.monogon.dev/source/nexantic.git/core/pkg/fileargs"
)
type KubeletSpec struct {
@@ -103,11 +104,12 @@
ClientCAFile: "/data/kubernetes/ca.crt",
},
},
+ // TODO(q3k): move reconciler.False to a generic package, fix the following references.
ClusterDomain: "cluster.local", // cluster.local is hardcoded in the certificate too currently
- EnableControllerAttachDetach: False(),
+ EnableControllerAttachDetach: reconciler.False(),
HairpinMode: "none",
- MakeIPTablesUtilChains: False(), // We don't have iptables
- FailSwapOn: False(), // Our kernel doesn't have swap enabled which breaks Kubelet's detection
+ MakeIPTablesUtilChains: reconciler.False(), // We don't have iptables
+ FailSwapOn: reconciler.False(), // Our kernel doesn't have swap enabled which breaks Kubelet's detection
KubeReserved: map[string]string{
"cpu": "200m",
"memory": "300Mi",