core/proto: remove NodeDebugService.GetCondition

This stopped being used after D590 where we moved the debug service to
start late enough that we're sure we already have the prerequisite
conditions to continue testing. In the future, the debug service might
grow some introspection methods into the supervisor - if so, that will
somewhat replace this bespoke condition API.

Test Plan: no behavioural changes

X-Origin-Diff: phab/D604
GitOrigin-RevId: a7edf8a45467fb2be602323b612abe054acf2b11
diff --git a/core/cmd/dbg/main.go b/core/cmd/dbg/main.go
index bfa7871..e0bde55 100644
--- a/core/cmd/dbg/main.go
+++ b/core/cmd/dbg/main.go
@@ -78,15 +78,6 @@
 			fmt.Println(line)
 		}
 		return
-	case "condition":
-		conditionCmd.Parse(os.Args[2:])
-		condition := conditionCmd.Arg(0)
-		res, err := debugClient.GetCondition(ctx, &apb.GetConditionRequest{Name: condition})
-		if err != nil {
-			fmt.Fprintf(os.Stderr, "Failed to get condition: %v\n", err)
-			os.Exit(1)
-		}
-		fmt.Println(res.Ok)
 	case "kubectl":
 		// Always get a kubeconfig with cluster-admin (group system:masters), kubectl itself can impersonate
 		kubeconfigFile, err := ioutil.TempFile("", "dbg_kubeconfig")
diff --git a/core/cmd/init/debug_service.go b/core/cmd/init/debug_service.go
index e66b6d7..ef940d9 100644
--- a/core/cmd/init/debug_service.go
+++ b/core/cmd/init/debug_service.go
@@ -74,22 +74,3 @@
 	}
 	return &apb.GetComponentLogsResponse{Line: lines}, nil
 }
-
-// GetCondition checks for various conditions exposed by different services. Mostly intended for testing. If you need
-// to make sure something is available in an E2E test, consider adding a condition here.
-// TODO(q3k): since all conditions are now 'true' after the node lifecycle refactor, remove this call - or, start the
-// debug service earlier.
-func (s *debugService) GetCondition(ctx context.Context, req *apb.GetConditionRequest) (*apb.GetConditionResponse, error) {
-	var ok bool
-	switch req.Name {
-	case "IPAssigned":
-		ok = true
-	case "DataAvailable":
-		ok = true
-	default:
-		return nil, status.Errorf(codes.NotFound, "condition %v not found", req.Name)
-	}
-	return &apb.GetConditionResponse{
-		Ok: ok,
-	}, nil
-}
diff --git a/core/proto/api/debug.proto b/core/proto/api/debug.proto
index b036989..ec96591 100644
--- a/core/proto/api/debug.proto
+++ b/core/proto/api/debug.proto
@@ -28,8 +28,6 @@
     rpc GetDebugKubeconfig(GetDebugKubeconfigRequest) returns (GetDebugKubeconfigResponse);
     // GetComponentLogs dumps various log ringbuffers for binaries that we run.
     rpc GetComponentLogs(GetComponentLogsRequest) returns (GetComponentLogsResponse);
-    // GetCondition gives the current status of various conditions inside Smalltown. Mainly used for testing.
-    rpc GetCondition(GetConditionRequest) returns (GetConditionResponse);
 }
 
 
@@ -51,11 +49,3 @@
 message GetComponentLogsResponse {
     repeated string line = 1;
 }
-
-message GetConditionRequest {
-    string name = 1;
-}
-
-message GetConditionResponse {
-    bool ok = 1;
-}
diff --git a/core/tests/e2e/BUILD.bazel b/core/tests/e2e/BUILD.bazel
index a0cc433..974bcdd 100644
--- a/core/tests/e2e/BUILD.bazel
+++ b/core/tests/e2e/BUILD.bazel
@@ -3,7 +3,6 @@
 go_library(
     name = "go_default_library",
     srcs = [
-        "condition_helpers.go",
         "kubernetes_helpers.go",
         "utils.go",
     ],
diff --git a/core/tests/e2e/condition_helpers.go b/core/tests/e2e/condition_helpers.go
deleted file mode 100644
index 7f9bc63..0000000
--- a/core/tests/e2e/condition_helpers.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2020 The Monogon Project Authors.
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package e2e
-
-import (
-	"context"
-	"errors"
-	"time"
-
-	apb "git.monogon.dev/source/nexantic.git/core/proto/api"
-)
-
-func waitForCondition(ctx context.Context, client apb.NodeDebugServiceClient, condition string) error {
-	var lastErr = errors.New("No RPC for checking condition completed")
-	for {
-		reqT, cancel := context.WithTimeout(ctx, 5*time.Second)
-		defer cancel()
-		res, err := client.GetCondition(reqT, &apb.GetConditionRequest{Name: condition})
-		if err != nil {
-			if err == ctx.Err() {
-				return err
-			}
-			lastErr = err
-		}
-		if err == nil && res.Ok {
-			return nil
-		}
-		select {
-		case <-time.After(1 * time.Second):
-		case <-ctx.Done():
-			return lastErr
-		}
-	}
-}
diff --git a/core/tests/e2e/main_test.go b/core/tests/e2e/main_test.go
index 224aa15..faae520 100644
--- a/core/tests/e2e/main_test.go
+++ b/core/tests/e2e/main_test.go
@@ -95,22 +95,6 @@
 	// This exists to keep the parent around while all the children race
 	// It currently tests both a set of OS-level conditions and Kubernetes Deployments and StatefulSets
 	t.Run("RunGroup", func(t *testing.T) {
-		t.Run("IP available", func(t *testing.T) {
-			t.Parallel()
-			ctx, cancel := context.WithTimeout(ctx, smallTestTimeout)
-			defer cancel()
-			if err := waitForCondition(ctx, debugClient, "IPAssigned"); err != nil {
-				t.Errorf("Condition IPAvailable not met in %s: %v", smallTestTimeout, err)
-			}
-		})
-		t.Run("Data available", func(t *testing.T) {
-			t.Parallel()
-			ctx, cancel := context.WithTimeout(ctx, largeTestTimeout)
-			defer cancel()
-			if err := waitForCondition(ctx, debugClient, "DataAvailable"); err != nil {
-				t.Errorf("Condition DataAvailable not met in %vs: %v", largeTestTimeout, err)
-			}
-		})
 		t.Run("Get Kubernetes Debug Kubeconfig", func(t *testing.T) {
 			t.Parallel()
 			selfCtx, cancel := context.WithTimeout(ctx, largeTestTimeout)