Add minimal functionality test for k8s control plane
Basic functionality test that sends the bootstrap RPC call,
waits for the k8s control plane to come up and runs a simple
kubectl command (that is expected to fail).
Adds reflection to the server to make grpc_cli easier to use.
Test Plan:
Ran `:launch` (because we modified its config) and `:test_boot`,
saw a nicely booted k8s cluster:
{P90}
X-Origin-Diff: phab/D275
GitOrigin-RevId: fe01e3f3ed09877aa76c15946664c9d9bdc4751b
diff --git a/core/internal/api/BUILD.bazel b/core/internal/api/BUILD.bazel
index b7aa48d..3daa397 100644
--- a/core/internal/api/BUILD.bazel
+++ b/core/internal/api/BUILD.bazel
@@ -16,6 +16,7 @@
"//core/internal/common/service:go_default_library",
"//core/internal/consensus:go_default_library",
"@org_golang_google_grpc//:go_default_library",
+ "@org_golang_google_grpc//reflection:go_default_library",
"@org_uber_go_zap//:go_default_library",
],
)
diff --git a/core/internal/api/server.go b/core/internal/api/server.go
index 715e99e..efd0be5 100644
--- a/core/internal/api/server.go
+++ b/core/internal/api/server.go
@@ -24,6 +24,7 @@
"git.monogon.dev/source/nexantic.git/core/internal/consensus"
"go.uber.org/zap"
"google.golang.org/grpc"
+ "google.golang.org/grpc/reflection"
"net"
)
@@ -57,6 +58,8 @@
schema.RegisterClusterManagementServer(grpcServer, s)
schema.RegisterSetupServiceServer(grpcServer, s)
+ reflection.Register(grpcServer)
+
s.grpcServer = grpcServer
return s, nil
diff --git a/core/internal/kubernetes/auth.go b/core/internal/kubernetes/auth.go
index afc51c1..89ae6dc 100644
--- a/core/internal/kubernetes/auth.go
+++ b/core/internal/kubernetes/auth.go
@@ -351,7 +351,7 @@
func makeLocalKubeconfig(ca, cert, key []byte) ([]byte, error) {
kubeconfig := configapi.NewConfig()
cluster := configapi.NewCluster()
- cluster.Server = "https://localhost:6443"
+ cluster.Server = "https://127.0.0.1:6443"
cluster.CertificateAuthorityData = pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: ca})
kubeconfig.Clusters["default"] = cluster
authInfo := configapi.NewAuthInfo()