mirror of https://github.com/linkerd/linkerd2.git
Move healthcheck proto to separate file, use throughout (#150)
* Move healthcheck proto to separate file, use throughout Signed-off-by: Kevin Lingerfelt <kl@buoyant.io> * Remove Check message from healthcheck.proto Signed-off-by: Kevin Lingerfelt <kl@buoyant.io> * Standardize healthcheck protobuf import name Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
This commit is contained in:
parent
9d552bccb1
commit
fd3cfcb5d9
|
|
@ -8,6 +8,7 @@ rm -rf controller/gen
|
|||
mkdir controller/gen
|
||||
bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/public/api.proto
|
||||
bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/common/common.proto
|
||||
bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/common/healthcheck/healthcheck.proto
|
||||
bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/proxy/telemetry/telemetry.proto
|
||||
bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/proxy/destination/destination.proto
|
||||
bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/proxy/tap/tap.proto
|
||||
|
|
@ -16,6 +17,7 @@ bin/protoc -I proto --go_out=plugins=grpc:controller/gen proto/controller/tap/ta
|
|||
|
||||
# Manually fix imports
|
||||
find controller/gen -type f -exec sed -i.bak 's:"common":"github.com\/runconduit\/conduit\/controller\/gen\/common":g' {} +
|
||||
find controller/gen -type f -exec sed -i.bak 's:"common/healthcheck":"github.com\/runconduit\/conduit\/controller\/gen\/common\/healthcheck":g' {} +
|
||||
find controller/gen -type f -exec sed -i.bak 's:"proxy/tap":"github.com\/runconduit\/conduit\/controller\/gen\/proxy\/tap":g' {} +
|
||||
find controller/gen -type f -exec sed -i.bak 's:"controller/tap":"github.com\/runconduit\/conduit\/controller\/gen\/controller\/tap":g' {} +
|
||||
find controller/gen -type f -exec sed -i.bak 's:"public":"github.com\/runconduit\/conduit\/controller\/gen\/public":g' {} +
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/runconduit/conduit/controller/api/public"
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
"github.com/runconduit/conduit/pkg/healthcheck"
|
||||
"github.com/runconduit/conduit/pkg/k8s"
|
||||
"github.com/runconduit/conduit/pkg/shell"
|
||||
|
|
@ -47,7 +48,7 @@ problems were found.`,
|
|||
}
|
||||
|
||||
func checkStatus(w io.Writer, checkers ...healthcheck.StatusChecker) error {
|
||||
prettyPrintResults := func(result healthcheck.CheckResult) {
|
||||
prettyPrintResults := func(result *healthcheckPb.CheckResult) {
|
||||
checkLabel := fmt.Sprintf("%s: %s", result.SubsystemName, result.CheckDescription)
|
||||
|
||||
filler := ""
|
||||
|
|
@ -56,11 +57,11 @@ func checkStatus(w io.Writer, checkers ...healthcheck.StatusChecker) error {
|
|||
}
|
||||
|
||||
switch result.Status {
|
||||
case healthcheck.CheckOk:
|
||||
case healthcheckPb.CheckStatus_OK:
|
||||
fmt.Fprintf(w, "%s%s[ok]\n", checkLabel, filler)
|
||||
case healthcheck.CheckFailed:
|
||||
case healthcheckPb.CheckStatus_FAIL:
|
||||
fmt.Fprintf(w, "%s%s[FAIL] -- %s\n", checkLabel, filler, result.FriendlyMessageToUser)
|
||||
case healthcheck.CheckError:
|
||||
case healthcheckPb.CheckStatus_ERROR:
|
||||
fmt.Fprintf(w, "%s%s[ERROR] -- %s\n", checkLabel, filler, result.FriendlyMessageToUser)
|
||||
}
|
||||
}
|
||||
|
|
@ -70,21 +71,21 @@ func checkStatus(w io.Writer, checkers ...healthcheck.StatusChecker) error {
|
|||
checker.Add(c)
|
||||
}
|
||||
|
||||
check := checker.PerformCheck(prettyPrintResults)
|
||||
checkStatus := checker.PerformCheck(prettyPrintResults)
|
||||
|
||||
fmt.Fprintln(w, "")
|
||||
|
||||
var errBasedOnOverallStatus error
|
||||
switch check.OverallStatus {
|
||||
case healthcheck.CheckOk:
|
||||
errBasedOnOverallStatus = statusCheckResultWasOk(w)
|
||||
case healthcheck.CheckFailed:
|
||||
errBasedOnOverallStatus = statusCheckResultWasFail(w)
|
||||
case healthcheck.CheckError:
|
||||
errBasedOnOverallStatus = statusCheckResultWasError(w)
|
||||
var err error
|
||||
switch checkStatus {
|
||||
case healthcheckPb.CheckStatus_OK:
|
||||
err = statusCheckResultWasOk(w)
|
||||
case healthcheckPb.CheckStatus_FAIL:
|
||||
err = statusCheckResultWasFail(w)
|
||||
case healthcheckPb.CheckStatus_ERROR:
|
||||
err = statusCheckResultWasError(w)
|
||||
}
|
||||
|
||||
return errBasedOnOverallStatus
|
||||
return err
|
||||
}
|
||||
|
||||
func statusCheckResultWasOk(w io.Writer) error {
|
||||
|
|
|
|||
|
|
@ -5,46 +5,46 @@ import (
|
|||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/runconduit/conduit/pkg/healthcheck"
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
"github.com/runconduit/conduit/pkg/k8s"
|
||||
)
|
||||
|
||||
func TestCheckStatus(t *testing.T) {
|
||||
t.Run("Prints expected output", func(t *testing.T) {
|
||||
kubectl := &k8s.MockKubectl{}
|
||||
kubectl.SelfCheckResultsToReturn = []healthcheck.CheckResult{
|
||||
kubectl.SelfCheckResultsToReturn = []*healthcheckPb.CheckResult{
|
||||
{
|
||||
SubsystemName: k8s.KubectlSubsystemName,
|
||||
CheckDescription: k8s.KubectlConnectivityCheckDescription,
|
||||
Status: healthcheck.CheckOk,
|
||||
Status: healthcheckPb.CheckStatus_OK,
|
||||
FriendlyMessageToUser: "This shouldnt be printed",
|
||||
},
|
||||
{
|
||||
SubsystemName: k8s.KubectlSubsystemName,
|
||||
CheckDescription: k8s.KubectlIsInstalledCheckDescription,
|
||||
Status: healthcheck.CheckFailed,
|
||||
Status: healthcheckPb.CheckStatus_FAIL,
|
||||
FriendlyMessageToUser: "This should contain instructions for fail",
|
||||
},
|
||||
{
|
||||
SubsystemName: k8s.KubectlSubsystemName,
|
||||
CheckDescription: k8s.KubectlVersionCheckDescription,
|
||||
Status: healthcheck.CheckError,
|
||||
Status: healthcheckPb.CheckStatus_ERROR,
|
||||
FriendlyMessageToUser: "This should contain instructions for err",
|
||||
},
|
||||
}
|
||||
|
||||
kubeApi := &k8s.MockKubeApi{}
|
||||
kubeApi.SelfCheckResultsToReturn = []healthcheck.CheckResult{
|
||||
kubeApi.SelfCheckResultsToReturn = []*healthcheckPb.CheckResult{
|
||||
{
|
||||
SubsystemName: k8s.KubeapiSubsystemName,
|
||||
CheckDescription: k8s.KubeapiClientCheckDescription,
|
||||
Status: healthcheck.CheckFailed,
|
||||
Status: healthcheckPb.CheckStatus_FAIL,
|
||||
FriendlyMessageToUser: "This should contain instructions for fail",
|
||||
},
|
||||
{
|
||||
SubsystemName: k8s.KubeapiSubsystemName,
|
||||
CheckDescription: k8s.KubeapiAccessCheckDescription,
|
||||
Status: healthcheck.CheckOk,
|
||||
Status: healthcheckPb.CheckStatus_OK,
|
||||
FriendlyMessageToUser: "This shouldnt be printed",
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import (
|
|||
|
||||
"github.com/golang/protobuf/proto"
|
||||
common "github.com/runconduit/conduit/controller/gen/common"
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
pb "github.com/runconduit/conduit/controller/gen/public"
|
||||
"github.com/runconduit/conduit/pkg/k8s"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
|
@ -51,8 +52,8 @@ func (c *grpcOverHttpClient) Version(ctx context.Context, req *pb.Empty, _ ...gr
|
|||
return &msg, err
|
||||
}
|
||||
|
||||
func (c *grpcOverHttpClient) SelfCheck(ctx context.Context, req *common.SelfCheckRequest, _ ...grpc.CallOption) (*common.SelfCheckResponse, error) {
|
||||
var msg common.SelfCheckResponse
|
||||
func (c *grpcOverHttpClient) SelfCheck(ctx context.Context, req *healthcheckPb.SelfCheckRequest, _ ...grpc.CallOption) (*healthcheckPb.SelfCheckResponse, error) {
|
||||
var msg healthcheckPb.SelfCheckResponse
|
||||
err := c.apiRequest(ctx, "SelfCheck", req, &msg)
|
||||
return &msg, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,10 @@ import (
|
|||
|
||||
"github.com/runconduit/conduit/controller"
|
||||
"github.com/runconduit/conduit/controller/api/util"
|
||||
common "github.com/runconduit/conduit/controller/gen/common"
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
tapPb "github.com/runconduit/conduit/controller/gen/controller/tap"
|
||||
telemPb "github.com/runconduit/conduit/controller/gen/controller/telemetry"
|
||||
pb "github.com/runconduit/conduit/controller/gen/public"
|
||||
"github.com/runconduit/conduit/pkg/healthcheck"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
|
@ -131,25 +130,23 @@ func (s *grpcServer) ListPods(ctx context.Context, req *pb.Empty) (*pb.ListPodsR
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
func (s *grpcServer) SelfCheck(ctx context.Context, in *common.SelfCheckRequest) (*common.SelfCheckResponse, error) {
|
||||
telemetryClientCheck := &common.CheckResult{
|
||||
func (s *grpcServer) SelfCheck(ctx context.Context, in *healthcheckPb.SelfCheckRequest) (*healthcheckPb.SelfCheckResponse, error) {
|
||||
telemetryClientCheck := &healthcheckPb.CheckResult{
|
||||
SubsystemName: TelemetryClientSubsystemName,
|
||||
CheckDescription: TelemetryClientCheckDescription,
|
||||
Status: string(healthcheck.CheckError),
|
||||
Status: healthcheckPb.CheckStatus_OK,
|
||||
}
|
||||
|
||||
_, err := s.telemetryClient.ListPods(ctx, &telemPb.ListPodsRequest{})
|
||||
if err != nil {
|
||||
telemetryClientCheck.Status = string(healthcheck.CheckError)
|
||||
telemetryClientCheck.Status = healthcheckPb.CheckStatus_ERROR
|
||||
telemetryClientCheck.FriendlyMessageToUser = fmt.Sprintf("Error talking to telemetry service from control plane: %s", err.Error())
|
||||
} else {
|
||||
telemetryClientCheck.Status = string(healthcheck.CheckOk)
|
||||
}
|
||||
|
||||
//TODO: check other services
|
||||
|
||||
response := &common.SelfCheckResponse{
|
||||
Results: []*common.CheckResult{
|
||||
response := &healthcheckPb.SelfCheckResponse{
|
||||
Results: []*healthcheckPb.CheckResult{
|
||||
telemetryClientCheck,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
common "github.com/runconduit/conduit/controller/gen/common"
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
tapPb "github.com/runconduit/conduit/controller/gen/controller/tap"
|
||||
telemPb "github.com/runconduit/conduit/controller/gen/controller/telemetry"
|
||||
pb "github.com/runconduit/conduit/controller/gen/public"
|
||||
|
|
@ -136,7 +137,7 @@ func (h *handler) handleVersion(w http.ResponseWriter, req *http.Request) {
|
|||
}
|
||||
|
||||
func (h *handler) handleSelfCheck(w http.ResponseWriter, req *http.Request) {
|
||||
var selfCheckRequest common.SelfCheckRequest
|
||||
var selfCheckRequest healthcheckPb.SelfCheckRequest
|
||||
err := serverUnmarshal(req, &selfCheckRequest)
|
||||
if err != nil {
|
||||
serverMarshalError(w, req, err, http.StatusBadRequest)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"io"
|
||||
|
||||
common "github.com/runconduit/conduit/controller/gen/common"
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
pb "github.com/runconduit/conduit/controller/gen/public"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
|
@ -14,7 +15,7 @@ type MockConduitApiClient struct {
|
|||
VersionInfoToReturn *pb.VersionInfo
|
||||
ListPodsResponseToReturn *pb.ListPodsResponse
|
||||
MetricResponseToReturn *pb.MetricResponse
|
||||
SelfCheckResponseToReturn *common.SelfCheckResponse
|
||||
SelfCheckResponseToReturn *healthcheckPb.SelfCheckResponse
|
||||
Api_TapClientToReturn pb.Api_TapClient
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ func (c *MockConduitApiClient) Tap(ctx context.Context, in *pb.TapRequest, opts
|
|||
return c.Api_TapClientToReturn, c.ErrorToReturn
|
||||
}
|
||||
|
||||
func (c *MockConduitApiClient) SelfCheck(ctx context.Context, in *common.SelfCheckRequest, _ ...grpc.CallOption) (*common.SelfCheckResponse, error) {
|
||||
func (c *MockConduitApiClient) SelfCheck(ctx context.Context, in *healthcheckPb.SelfCheckRequest, _ ...grpc.CallOption) (*healthcheckPb.SelfCheckResponse, error) {
|
||||
return c.SelfCheckResponseToReturn, c.ErrorToReturn
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ It has these top-level messages:
|
|||
TcpAddress
|
||||
Destination
|
||||
TapEvent
|
||||
CheckResult
|
||||
SelfCheckRequest
|
||||
SelfCheckResponse
|
||||
*/
|
||||
package conduit_common
|
||||
|
||||
|
|
@ -947,70 +944,6 @@ func (m *TapEvent_Http_ResponseEnd) GetGrpcStatus() uint32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
type CheckResult struct {
|
||||
SubsystemName string `protobuf:"bytes,1,opt,name=SubsystemName" json:"SubsystemName,omitempty"`
|
||||
CheckDescription string `protobuf:"bytes,2,opt,name=CheckDescription" json:"CheckDescription,omitempty"`
|
||||
Status string `protobuf:"bytes,3,opt,name=Status" json:"Status,omitempty"`
|
||||
FriendlyMessageToUser string `protobuf:"bytes,4,opt,name=FriendlyMessageToUser" json:"FriendlyMessageToUser,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CheckResult) Reset() { *m = CheckResult{} }
|
||||
func (m *CheckResult) String() string { return proto.CompactTextString(m) }
|
||||
func (*CheckResult) ProtoMessage() {}
|
||||
func (*CheckResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
|
||||
|
||||
func (m *CheckResult) GetSubsystemName() string {
|
||||
if m != nil {
|
||||
return m.SubsystemName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CheckResult) GetCheckDescription() string {
|
||||
if m != nil {
|
||||
return m.CheckDescription
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CheckResult) GetStatus() string {
|
||||
if m != nil {
|
||||
return m.Status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CheckResult) GetFriendlyMessageToUser() string {
|
||||
if m != nil {
|
||||
return m.FriendlyMessageToUser
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SelfCheckRequest struct {
|
||||
}
|
||||
|
||||
func (m *SelfCheckRequest) Reset() { *m = SelfCheckRequest{} }
|
||||
func (m *SelfCheckRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SelfCheckRequest) ProtoMessage() {}
|
||||
func (*SelfCheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
|
||||
|
||||
type SelfCheckResponse struct {
|
||||
Results []*CheckResult `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SelfCheckResponse) Reset() { *m = SelfCheckResponse{} }
|
||||
func (m *SelfCheckResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SelfCheckResponse) ProtoMessage() {}
|
||||
func (*SelfCheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
|
||||
|
||||
func (m *SelfCheckResponse) GetResults() []*CheckResult {
|
||||
if m != nil {
|
||||
return m.Results
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*HttpMethod)(nil), "conduit.common.HttpMethod")
|
||||
proto.RegisterType((*Scheme)(nil), "conduit.common.Scheme")
|
||||
|
|
@ -1024,9 +957,6 @@ func init() {
|
|||
proto.RegisterType((*TapEvent_Http_RequestInit)(nil), "conduit.common.TapEvent.Http.RequestInit")
|
||||
proto.RegisterType((*TapEvent_Http_ResponseInit)(nil), "conduit.common.TapEvent.Http.ResponseInit")
|
||||
proto.RegisterType((*TapEvent_Http_ResponseEnd)(nil), "conduit.common.TapEvent.Http.ResponseEnd")
|
||||
proto.RegisterType((*CheckResult)(nil), "conduit.common.CheckResult")
|
||||
proto.RegisterType((*SelfCheckRequest)(nil), "conduit.common.SelfCheckRequest")
|
||||
proto.RegisterType((*SelfCheckResponse)(nil), "conduit.common.SelfCheckResponse")
|
||||
proto.RegisterEnum("conduit.common.Protocol", Protocol_name, Protocol_value)
|
||||
proto.RegisterEnum("conduit.common.HttpMethod_Registered", HttpMethod_Registered_name, HttpMethod_Registered_value)
|
||||
proto.RegisterEnum("conduit.common.Scheme_Registered", Scheme_Registered_name, Scheme_Registered_value)
|
||||
|
|
@ -1035,63 +965,56 @@ func init() {
|
|||
func init() { proto.RegisterFile("common/common.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 924 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xdd, 0x6e, 0xe3, 0x44,
|
||||
0x14, 0x8e, 0x13, 0xe7, 0xef, 0xa4, 0xa9, 0xbc, 0xb3, 0x65, 0x55, 0x02, 0x0b, 0x5d, 0x6b, 0x17,
|
||||
0xb5, 0xbd, 0x48, 0x51, 0x76, 0x89, 0xc4, 0x65, 0x9b, 0x84, 0x26, 0xc0, 0xa6, 0x66, 0xec, 0xbd,
|
||||
0xae, 0x1c, 0x7b, 0x9a, 0x58, 0x24, 0xb6, 0x99, 0x19, 0x57, 0xca, 0xcb, 0x20, 0xc1, 0x3d, 0x12,
|
||||
0xef, 0xc3, 0x43, 0x70, 0xc1, 0x0b, 0xa0, 0xf9, 0x89, 0xe3, 0xb4, 0xa5, 0x8b, 0xe0, 0x62, 0xaf,
|
||||
0x32, 0xe7, 0xf3, 0x39, 0xdf, 0x7c, 0xe7, 0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0xc8, 0x6a, 0x5c, 0xd4, 0xc0, 0xe4, 0xeb, 0x94, 0xd8, 0x3f,
|
||||
0x1b, 0x50, 0x73, 0x83, 0x05, 0x59, 0x11, 0x34, 0x78, 0x20, 0xe3, 0x17, 0x77, 0x33, 0x56, 0xbe,
|
||||
0xff, 0x37, 0xdb, 0x17, 0x3b, 0xd9, 0x0a, 0x81, 0x9e, 0xe7, 0x58, 0x25, 0x21, 0x50, 0x9c, 0x5c,
|
||||
0xcb, 0xc8, 0x05, 0xba, 0xd0, 0x9c, 0x38, 0xe7, 0x61, 0x48, 0x09, 0x63, 0xe8, 0x00, 0xcc, 0x28,
|
||||
0xbd, 0x7d, 0x23, 0xc5, 0xd5, 0xc7, 0x25, 0x2c, 0x2d, 0x74, 0x2a, 0xd1, 0xbe, 0xbc, 0xab, 0xd5,
|
||||
0x3b, 0xb8, 0x2b, 0x79, 0xe2, 0xdc, 0xf6, 0xb5, 0x6f, 0xff, 0xc2, 0x84, 0x72, 0x94, 0xda, 0x5f,
|
||||
0x82, 0x29, 0x50, 0x74, 0x00, 0xd5, 0x9b, 0x88, 0x32, 0x2e, 0x09, 0x6b, 0x58, 0x19, 0x08, 0x81,
|
||||
0xb9, 0xf4, 0x19, 0x97, 0x7c, 0x35, 0x2c, 0xcf, 0xf6, 0x77, 0x00, 0x5e, 0x90, 0x6e, 0x74, 0x9c,
|
||||
0x08, 0x16, 0x19, 0xd4, 0xea, 0x7d, 0x7c, 0xff, 0x3e, 0xed, 0x86, 0xcb, 0x51, 0x2a, 0xc8, 0xd2,
|
||||
0x84, 0x2a, 0xb2, 0x36, 0x96, 0x67, 0xfb, 0x6b, 0x68, 0x0d, 0x09, 0xe3, 0x51, 0x2c, 0xe7, 0x0f,
|
||||
0x3d, 0x83, 0x1a, 0x93, 0x65, 0x95, 0x8c, 0x4d, 0xac, 0x2d, 0x19, 0xea, 0xf3, 0x85, 0xaa, 0x21,
|
||||
0x96, 0x67, 0xfb, 0xd7, 0x26, 0x34, 0x3c, 0x3f, 0x1d, 0xdd, 0x92, 0x98, 0xa3, 0x1e, 0xd4, 0x58,
|
||||
0x92, 0xd1, 0x80, 0x68, 0x29, 0x9d, 0xbb, 0x52, 0xb6, 0x92, 0xb1, 0xf6, 0x14, 0x31, 0xdc, 0xa7,
|
||||
0x73, 0xc2, 0x75, 0xb9, 0x1e, 0x8d, 0x51, 0x9e, 0xe8, 0x35, 0x98, 0x0b, 0xce, 0xd3, 0xc3, 0x8a,
|
||||
0x8c, 0x78, 0x7e, 0x2f, 0x42, 0xeb, 0x91, 0xcf, 0x41, 0x54, 0x5a, 0x38, 0x77, 0xfe, 0xac, 0x83,
|
||||
0x29, 0x00, 0x34, 0x85, 0x3d, 0x4a, 0x7e, 0xca, 0x08, 0xe3, 0xd7, 0x51, 0x1c, 0x71, 0xad, 0xf5,
|
||||
0xe4, 0x51, 0x96, 0x2e, 0x56, 0x11, 0x93, 0x38, 0xe2, 0xe3, 0x12, 0x6e, 0xd1, 0xad, 0x89, 0x7e,
|
||||
0x80, 0x36, 0x25, 0x2c, 0x4d, 0x62, 0x46, 0x14, 0xa1, 0x4a, 0xe4, 0xf4, 0x7d, 0x84, 0x2a, 0x44,
|
||||
0x33, 0xee, 0xd1, 0x82, 0xad, 0x24, 0x6a, 0x4a, 0x12, 0x87, 0x3a, 0xd1, 0x93, 0x7f, 0xc7, 0x38,
|
||||
0x8a, 0x43, 0x25, 0x31, 0x37, 0x3b, 0x7d, 0x68, 0xb8, 0x9c, 0x12, 0x7f, 0x35, 0x09, 0x45, 0x17,
|
||||
0x67, 0x3e, 0x53, 0x2d, 0x6a, 0x63, 0x79, 0x96, 0x1d, 0x97, 0xdf, 0xa5, 0x76, 0x13, 0x6b, 0xab,
|
||||
0xf3, 0x87, 0x01, 0xad, 0x42, 0xe6, 0xa8, 0x0f, 0xe5, 0x28, 0xd4, 0x05, 0xfb, 0xe2, 0x71, 0x35,
|
||||
0x9b, 0xfb, 0x70, 0x39, 0x0a, 0x45, 0x93, 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, 0x66, 0x33, 0xb6, 0x66, 0x9c, 0xac, 0xa6, 0x7e, 0xbe, 0xe7,
|
||||
0x76, 0x41, 0x74, 0x0a, 0x96, 0x0c, 0x1a, 0x12, 0x16, 0xd0, 0x28, 0x15, 0xb2, 0xf5, 0xea, 0xbb,
|
||||
0x87, 0x8b, 0x07, 0xe4, 0x6e, 0x7b, 0xd6, 0xc4, 0xda, 0x42, 0x6f, 0xe0, 0xa3, 0x6f, 0x68, 0x44,
|
||||
0xe2, 0x70, 0xb9, 0x7e, 0x4b, 0x18, 0xf3, 0xe7, 0xc4, 0x4b, 0xde, 0x31, 0x42, 0xf5, 0x80, 0x3e,
|
||||
0xfc, 0xd1, 0x46, 0x60, 0xb9, 0x64, 0x79, 0xa3, 0x25, 0xcb, 0x62, 0xdb, 0xdf, 0xc2, 0x93, 0x02,
|
||||
0xa6, 0x0a, 0x82, 0xbe, 0x82, 0x3a, 0x95, 0x29, 0xb1, 0x43, 0xe3, 0xa8, 0x72, 0xdc, 0xea, 0x7d,
|
||||
0x72, 0x77, 0x06, 0x0a, 0x69, 0xe3, 0x8d, 0xef, 0xe9, 0x73, 0x68, 0x38, 0xa2, 0x23, 0x41, 0xb2,
|
||||
0x2c, 0xfc, 0xd9, 0xd5, 0xa1, 0xe2, 0x0d, 0x1c, 0xcb, 0x98, 0xd5, 0x64, 0xbb, 0x5e, 0xff, 0x1d,
|
||||
0x00, 0x00, 0xff, 0xff, 0x92, 0x14, 0x84, 0x25, 0xc7, 0x08, 0x00, 0x00,
|
||||
// 808 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0xdd, 0x6e, 0xe3, 0x54,
|
||||
0x10, 0x8e, 0x1d, 0xc7, 0x49, 0x26, 0x4d, 0x65, 0xce, 0x56, 0xab, 0x12, 0xb1, 0xb0, 0x1b, 0xb1,
|
||||
0x68, 0xdb, 0x0b, 0x17, 0x65, 0x51, 0x24, 0x2e, 0xf3, 0x63, 0x35, 0x11, 0x90, 0x98, 0x13, 0x73,
|
||||
0x5d, 0x39, 0xf6, 0xd9, 0xc4, 0x52, 0x63, 0x9b, 0x73, 0x8e, 0x2b, 0xf5, 0x65, 0x90, 0xe0, 0x09,
|
||||
0x78, 0x1f, 0x1e, 0x82, 0x0b, 0x5e, 0x00, 0x9d, 0x9f, 0x38, 0x4e, 0x77, 0x69, 0x11, 0x5c, 0xec,
|
||||
0x55, 0x66, 0x26, 0x33, 0x9f, 0xbf, 0xf9, 0x66, 0xce, 0xc0, 0xb3, 0x28, 0xdb, 0xed, 0xb2, 0xf4,
|
||||
0x4a, 0xfd, 0xb8, 0x39, 0xcd, 0x78, 0x86, 0x4e, 0xa3, 0x2c, 0x8d, 0x8b, 0x84, 0xbb, 0x2a, 0xda,
|
||||
0xfb, 0x7c, 0x93, 0x65, 0x9b, 0x5b, 0x72, 0x25, 0xff, 0x5d, 0x17, 0xef, 0xae, 0xe2, 0x82, 0x86,
|
||||
0x3c, 0xd9, 0xe7, 0xf7, 0xff, 0x32, 0x00, 0x66, 0x9c, 0xe7, 0x3f, 0x10, 0xbe, 0xcd, 0x62, 0x74,
|
||||
0x0d, 0x40, 0xc9, 0x26, 0x61, 0x9c, 0x50, 0x12, 0x9f, 0x1b, 0x2f, 0x8d, 0x37, 0xa7, 0x83, 0xd7,
|
||||
0xee, 0x31, 0xa6, 0x7b, 0xc8, 0x77, 0x71, 0x99, 0x3c, 0xab, 0xe1, 0x4a, 0x29, 0xfa, 0x12, 0x4e,
|
||||
0x8a, 0xb4, 0x02, 0x65, 0xbe, 0x34, 0xde, 0xb4, 0x67, 0x35, 0x7c, 0x14, 0xed, 0xa7, 0x00, 0x07,
|
||||
0x04, 0xd4, 0x84, 0xfa, 0xb5, 0x17, 0x38, 0x35, 0xd4, 0x02, 0xcb, 0x5f, 0xae, 0x02, 0xc7, 0x10,
|
||||
0x21, 0xff, 0xa7, 0xc0, 0x31, 0x11, 0x80, 0x3d, 0xf5, 0xbe, 0xf7, 0x02, 0xcf, 0xa9, 0xa3, 0x36,
|
||||
0x34, 0xfc, 0x51, 0x30, 0x99, 0x39, 0x16, 0xea, 0x40, 0x73, 0xe9, 0x07, 0xf3, 0xe5, 0x62, 0xe5,
|
||||
0x34, 0x84, 0x33, 0x59, 0x2e, 0x16, 0xde, 0x24, 0x70, 0x6c, 0x81, 0x31, 0xf3, 0x46, 0x53, 0xa7,
|
||||
0x29, 0xd2, 0x03, 0x3c, 0x9a, 0x78, 0x4e, 0x6b, 0x6c, 0x83, 0xc5, 0xef, 0x73, 0xd2, 0xff, 0xc5,
|
||||
0x00, 0x7b, 0x15, 0x6d, 0xc9, 0x8e, 0xa0, 0xc9, 0x07, 0x3a, 0x7e, 0xf5, 0xb0, 0x63, 0x95, 0xfb,
|
||||
0x7f, 0xbb, 0x7d, 0x75, 0xd4, 0xad, 0x20, 0x18, 0x04, 0xbe, 0x53, 0x13, 0x04, 0x85, 0xb5, 0x72,
|
||||
0x8c, 0x92, 0xe0, 0x0a, 0xda, 0x73, 0x7f, 0x14, 0xc7, 0x94, 0x30, 0x86, 0xce, 0xc0, 0x4a, 0xf2,
|
||||
0xbb, 0x6f, 0x24, 0xb9, 0xe6, 0xac, 0x86, 0xa5, 0x87, 0x2e, 0x65, 0x74, 0x28, 0xbf, 0xd5, 0x19,
|
||||
0x9c, 0x3d, 0xa4, 0x3c, 0xf7, 0xef, 0x86, 0x3a, 0x77, 0x38, 0xb6, 0xc0, 0x4c, 0xf2, 0xfe, 0xd7,
|
||||
0x60, 0x89, 0x28, 0x3a, 0x83, 0xc6, 0xbb, 0x84, 0x32, 0x2e, 0x01, 0x6d, 0xac, 0x1c, 0x84, 0xc0,
|
||||
0xba, 0x0d, 0x19, 0x97, 0x78, 0x36, 0x96, 0x76, 0xff, 0x3b, 0x80, 0x20, 0xca, 0xf7, 0x3c, 0x2e,
|
||||
0x04, 0x8a, 0x2c, 0xea, 0x0c, 0x3e, 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x90, 0xf5, 0x3d, 0x27, 0x4c, 0x4e, 0xd1, 0xc2, 0xe5, 0xeb, 0x1a, 0x8b, 0xa0,
|
||||
0xd0, 0x68, 0x43, 0xf3, 0x68, 0xaf, 0x51, 0x43, 0x69, 0x24, 0x42, 0x4a, 0xa3, 0x71, 0x13, 0x1a,
|
||||
0x44, 0xb4, 0x5d, 0x1a, 0x97, 0x2f, 0xa0, 0xe5, 0x0b, 0x06, 0x51, 0x76, 0x5b, 0x39, 0xee, 0x4d,
|
||||
0xa8, 0x07, 0x13, 0xdf, 0x31, 0xd6, 0xb6, 0xa4, 0xf7, 0xf6, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff,
|
||||
0x2d, 0x99, 0x17, 0xde, 0xb7, 0x07, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,149 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: common/healthcheck/healthcheck.proto
|
||||
|
||||
/*
|
||||
Package conduit_common_healthcheck is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
common/healthcheck/healthcheck.proto
|
||||
|
||||
It has these top-level messages:
|
||||
CheckResult
|
||||
SelfCheckRequest
|
||||
SelfCheckResponse
|
||||
*/
|
||||
package conduit_common_healthcheck
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type CheckStatus int32
|
||||
|
||||
const (
|
||||
CheckStatus_OK CheckStatus = 0
|
||||
CheckStatus_FAIL CheckStatus = 1
|
||||
CheckStatus_ERROR CheckStatus = 2
|
||||
)
|
||||
|
||||
var CheckStatus_name = map[int32]string{
|
||||
0: "OK",
|
||||
1: "FAIL",
|
||||
2: "ERROR",
|
||||
}
|
||||
var CheckStatus_value = map[string]int32{
|
||||
"OK": 0,
|
||||
"FAIL": 1,
|
||||
"ERROR": 2,
|
||||
}
|
||||
|
||||
func (x CheckStatus) String() string {
|
||||
return proto.EnumName(CheckStatus_name, int32(x))
|
||||
}
|
||||
func (CheckStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type CheckResult struct {
|
||||
SubsystemName string `protobuf:"bytes,1,opt,name=SubsystemName" json:"SubsystemName,omitempty"`
|
||||
CheckDescription string `protobuf:"bytes,2,opt,name=CheckDescription" json:"CheckDescription,omitempty"`
|
||||
Status CheckStatus `protobuf:"varint,3,opt,name=Status,enum=conduit.common.healthcheck.CheckStatus" json:"Status,omitempty"`
|
||||
FriendlyMessageToUser string `protobuf:"bytes,4,opt,name=FriendlyMessageToUser" json:"FriendlyMessageToUser,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CheckResult) Reset() { *m = CheckResult{} }
|
||||
func (m *CheckResult) String() string { return proto.CompactTextString(m) }
|
||||
func (*CheckResult) ProtoMessage() {}
|
||||
func (*CheckResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *CheckResult) GetSubsystemName() string {
|
||||
if m != nil {
|
||||
return m.SubsystemName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CheckResult) GetCheckDescription() string {
|
||||
if m != nil {
|
||||
return m.CheckDescription
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CheckResult) GetStatus() CheckStatus {
|
||||
if m != nil {
|
||||
return m.Status
|
||||
}
|
||||
return CheckStatus_OK
|
||||
}
|
||||
|
||||
func (m *CheckResult) GetFriendlyMessageToUser() string {
|
||||
if m != nil {
|
||||
return m.FriendlyMessageToUser
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SelfCheckRequest struct {
|
||||
}
|
||||
|
||||
func (m *SelfCheckRequest) Reset() { *m = SelfCheckRequest{} }
|
||||
func (m *SelfCheckRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SelfCheckRequest) ProtoMessage() {}
|
||||
func (*SelfCheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
type SelfCheckResponse struct {
|
||||
Results []*CheckResult `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SelfCheckResponse) Reset() { *m = SelfCheckResponse{} }
|
||||
func (m *SelfCheckResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SelfCheckResponse) ProtoMessage() {}
|
||||
func (*SelfCheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
func (m *SelfCheckResponse) GetResults() []*CheckResult {
|
||||
if m != nil {
|
||||
return m.Results
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*CheckResult)(nil), "conduit.common.healthcheck.CheckResult")
|
||||
proto.RegisterType((*SelfCheckRequest)(nil), "conduit.common.healthcheck.SelfCheckRequest")
|
||||
proto.RegisterType((*SelfCheckResponse)(nil), "conduit.common.healthcheck.SelfCheckResponse")
|
||||
proto.RegisterEnum("conduit.common.healthcheck.CheckStatus", CheckStatus_name, CheckStatus_value)
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("common/healthcheck/healthcheck.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 276 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xcf, 0x4b, 0xfb, 0x40,
|
||||
0x10, 0xc5, 0xbf, 0x9b, 0xf6, 0x1b, 0xed, 0x14, 0x25, 0x2e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bd, 0x1a, 0x24, 0x1d, 0x3e, 0xc2, 0xde, 0x40,
|
||||
0xa3, 0x56, 0x36, 0x84, 0x7c, 0x0e, 0x5b, 0xca, 0xee, 0x4e, 0x3e, 0x0b, 0x46, 0xd1, 0xf4, 0x0f,
|
||||
0x01, 0xbb, 0xae, 0xc4, 0x27, 0x17, 0xc7, 0x7d, 0x87, 0x7d, 0x60, 0x17, 0x9c, 0xe5, 0xb5, 0xf7,
|
||||
0x8f, 0x6f, 0xc3, 0x78, 0x31, 0xbf, 0xba, 0xf1, 0x18, 0x9f, 0xc0, 0xff, 0x4b, 0x21, 0x96, 0xc2,
|
||||
0x73, 0x56, 0xae, 0xbd, 0xc9, 0xc9, 0x7b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x5a, 0xd6, 0x5e,
|
||||
0xbb, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@ import fmt "fmt"
|
|||
import math "math"
|
||||
import google_protobuf "github.com/golang/protobuf/ptypes/duration"
|
||||
import conduit_common "github.com/runconduit/conduit/controller/gen/common"
|
||||
import conduit_common_healthcheck "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
|
|
@ -884,7 +885,7 @@ type ApiClient interface {
|
|||
Stat(ctx context.Context, in *MetricRequest, opts ...grpc.CallOption) (*MetricResponse, error)
|
||||
Version(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*VersionInfo, error)
|
||||
ListPods(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListPodsResponse, error)
|
||||
SelfCheck(ctx context.Context, in *conduit_common.SelfCheckRequest, opts ...grpc.CallOption) (*conduit_common.SelfCheckResponse, error)
|
||||
SelfCheck(ctx context.Context, in *conduit_common_healthcheck.SelfCheckRequest, opts ...grpc.CallOption) (*conduit_common_healthcheck.SelfCheckResponse, error)
|
||||
Tap(ctx context.Context, in *TapRequest, opts ...grpc.CallOption) (Api_TapClient, error)
|
||||
}
|
||||
|
||||
|
|
@ -923,8 +924,8 @@ func (c *apiClient) ListPods(ctx context.Context, in *Empty, opts ...grpc.CallOp
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *apiClient) SelfCheck(ctx context.Context, in *conduit_common.SelfCheckRequest, opts ...grpc.CallOption) (*conduit_common.SelfCheckResponse, error) {
|
||||
out := new(conduit_common.SelfCheckResponse)
|
||||
func (c *apiClient) SelfCheck(ctx context.Context, in *conduit_common_healthcheck.SelfCheckRequest, opts ...grpc.CallOption) (*conduit_common_healthcheck.SelfCheckResponse, error) {
|
||||
out := new(conduit_common_healthcheck.SelfCheckResponse)
|
||||
err := grpc.Invoke(ctx, "/conduit.public.Api/SelfCheck", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -970,7 +971,7 @@ type ApiServer interface {
|
|||
Stat(context.Context, *MetricRequest) (*MetricResponse, error)
|
||||
Version(context.Context, *Empty) (*VersionInfo, error)
|
||||
ListPods(context.Context, *Empty) (*ListPodsResponse, error)
|
||||
SelfCheck(context.Context, *conduit_common.SelfCheckRequest) (*conduit_common.SelfCheckResponse, error)
|
||||
SelfCheck(context.Context, *conduit_common_healthcheck.SelfCheckRequest) (*conduit_common_healthcheck.SelfCheckResponse, error)
|
||||
Tap(*TapRequest, Api_TapServer) error
|
||||
}
|
||||
|
||||
|
|
@ -1033,7 +1034,7 @@ func _Api_ListPods_Handler(srv interface{}, ctx context.Context, dec func(interf
|
|||
}
|
||||
|
||||
func _Api_SelfCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(conduit_common.SelfCheckRequest)
|
||||
in := new(conduit_common_healthcheck.SelfCheckRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -1045,7 +1046,7 @@ func _Api_SelfCheck_Handler(srv interface{}, ctx context.Context, dec func(inter
|
|||
FullMethod: "/conduit.public.Api/SelfCheck",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).SelfCheck(ctx, req.(*conduit_common.SelfCheckRequest))
|
||||
return srv.(ApiServer).SelfCheck(ctx, req.(*conduit_common_healthcheck.SelfCheckRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
|
@ -1105,81 +1106,82 @@ var _Api_serviceDesc = grpc.ServiceDesc{
|
|||
func init() { proto.RegisterFile("public/api.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 1213 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xcb, 0x6e, 0xdb, 0x46,
|
||||
0x14, 0x15, 0x45, 0xc9, 0x92, 0xae, 0x6c, 0x85, 0x9d, 0xa4, 0x81, 0xaa, 0xa6, 0xae, 0xc2, 0x45,
|
||||
0x6b, 0x78, 0x21, 0xa7, 0x6e, 0x12, 0xc0, 0x2d, 0x82, 0x40, 0x96, 0x89, 0xc8, 0x80, 0x1f, 0xea,
|
||||
0x48, 0x4e, 0x5b, 0xa0, 0x80, 0x31, 0x26, 0xc7, 0x34, 0x11, 0x92, 0xc3, 0x90, 0xc3, 0xa4, 0xee,
|
||||
0xbe, 0xdb, 0xae, 0xfb, 0x05, 0xfd, 0x89, 0xee, 0xfb, 0x33, 0xfd, 0x89, 0x62, 0x1e, 0xa4, 0x1e,
|
||||
0x51, 0x8c, 0xae, 0x3c, 0xf7, 0xdc, 0x33, 0x87, 0xf7, 0x35, 0xd7, 0x02, 0x2b, 0xc9, 0xaf, 0xc2,
|
||||
0xc0, 0xdd, 0x23, 0x49, 0x30, 0x48, 0x52, 0xc6, 0x19, 0xea, 0xb8, 0x2c, 0xf6, 0xf2, 0x80, 0x0f,
|
||||
0x94, 0xa7, 0xb7, 0xed, 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53, 0x64, 0x6d, 0x48, 0xc9, 0xcf, 0x57, 0x25, 0x17, 0xc2, 0xd6, 0x25, 0x41, 0x8f, 0x61,
|
||||
0x93, 0x07, 0x11, 0xcd, 0x38, 0x89, 0x92, 0xcb, 0x28, 0xd3, 0xf5, 0x6a, 0x97, 0xd8, 0x69, 0x66,
|
||||
0xff, 0x6d, 0xc0, 0xa6, 0xba, 0x39, 0xa5, 0x69, 0x40, 0x33, 0x34, 0x80, 0x5a, 0x4c, 0x22, 0xaa,
|
||||
0x3b, 0xd2, 0x5b, 0xff, 0x95, 0x33, 0x12, 0x51, 0x2c, 0x79, 0xe8, 0x3b, 0x68, 0x46, 0x94, 0x13,
|
||||
0x8f, 0x70, 0x22, 0xf5, 0xd7, 0xd4, 0x5a, 0xdd, 0x39, 0xd5, 0x2c, 0x5c, 0xf2, 0xd1, 0x4b, 0x00,
|
||||
0xaf, 0xc8, 0x2f, 0xeb, 0x9a, 0xb2, 0x53, 0x5f, 0xae, 0xbf, 0x5d, 0xd6, 0x01, 0x2f, 0x5c, 0xb1,
|
||||
0xff, 0x31, 0xa0, 0xb3, 0xac, 0x8e, 0x1e, 0x41, 0x8b, 0x93, 0xd4, 0xa7, 0x7c, 0xc2, 0x3c, 0x99,
|
||||
0x44, 0x0b, 0xcf, 0x01, 0x64, 0xc3, 0xa6, 0x32, 0x8e, 0x68, 0x12, 0xb2, 0x5b, 0x19, 0x71, 0x0b,
|
||||
0x2f, 0x61, 0x42, 0x21, 0x63, 0x79, 0xea, 0x52, 0xa1, 0x60, 0x2a, 0x85, 0x12, 0x10, 0x0a, 0xca,
|
||||
0xd0, 0x0a, 0x35, 0xa5, 0xb0, 0x88, 0x09, 0x05, 0x97, 0x45, 0x09, 0x8b, 0x69, 0xcc, 0xbb, 0x75,
|
||||
0xa5, 0x50, 0x02, 0x08, 0x41, 0x2d, 0x21, 0xfc, 0xa6, 0xbb, 0x21, 0x1d, 0xf2, 0x6c, 0x8f, 0x8b,
|
||||
0x3c, 0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
||||
0x65, 0x63, 0xbf, 0x86, 0x5a, 0xc2, 0xbc, 0xa2, 0xab, 0xf7, 0x57, 0xb3, 0x9c, 0x30, 0x0f, 0x4b,
|
||||
0x82, 0xfd, 0x67, 0x15, 0x4c, 0x31, 0x71, 0x68, 0xe1, 0x45, 0xb6, 0xf4, 0xab, 0x7b, 0x00, 0xf5,
|
||||
0x84, 0x79, 0xc7, 0x13, 0x1d, 0x9a, 0x32, 0xd0, 0x36, 0x80, 0x27, 0x27, 0x30, 0x12, 0x83, 0xa7,
|
||||
0x42, 0x5a, 0x40, 0xd0, 0x43, 0xd8, 0xc8, 0x38, 0xe1, 0x79, 0xa6, 0xa7, 0x56, 0x5b, 0x42, 0x8d,
|
||||
0x78, 0x1e, 0xf5, 0x74, 0xf1, 0x94, 0x81, 0x46, 0x70, 0x2f, 0x0b, 0x62, 0x97, 0x9e, 0x90, 0x8c,
|
||||
0x63, 0x9a, 0xb0, 0x94, 0xcb, 0x91, 0x15, 0xdb, 0x4c, 0x6d, 0xff, 0x41, 0xb1, 0xfd, 0x07, 0x47,
|
||||
0x7a, 0xfb, 0xe3, 0xd5, 0x1b, 0xe8, 0x09, 0xdc, 0x77, 0x59, 0xcc, 0x53, 0x16, 0x86, 0x34, 0x15,
|
||||
0x13, 0x96, 0x25, 0xc4, 0xa5, 0xdd, 0x86, 0xfc, 0xfe, 0x3a, 0x97, 0x78, 0x60, 0x1a, 0x9e, 0x84,
|
||||
0x24, 0xa6, 0xdd, 0xa6, 0x8c, 0x69, 0x09, 0xb3, 0xff, 0xaa, 0x02, 0xcc, 0x48, 0x52, 0x4c, 0x38,
|
||||
0x02, 0x33, 0x29, 0x5e, 0xfb, 0xb8, 0x82, 0x85, 0x81, 0xfa, 0x4b, 0xb5, 0xa8, 0x6a, 0xd7, 0x4a,
|
||||
0x35, 0x22, 0xf2, 0x2b, 0x4e, 0x32, 0x59, 0xa9, 0x2a, 0xd6, 0x96, 0xc0, 0x39, 0x9b, 0x88, 0x74,
|
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8, 0xe3, 0x3b, 0x18,
|
||||
0x0b, 0xb9, 0x99, 0x33, 0x92, 0xa0, 0x0f, 0xff, 0x73, 0x94, 0x2f, 0xb7, 0xd7, 0x5d, 0xd5, 0x99,
|
||||
0x91, 0xc4, 0x79, 0x47, 0x63, 0x6e, 0x57, 0x9e, 0x18, 0x57, 0x1b, 0x72, 0xc1, 0x7c, 0xfb, 0x5f,
|
||||
0x00, 0x00, 0x00, 0xff, 0xff, 0x70, 0x89, 0x4d, 0xe0, 0x90, 0x0a, 0x00, 0x00,
|
||||
// 1232 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x5b, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xf6, 0x7a, 0xed, 0xd8, 0x3e, 0x4e, 0xdc, 0x65, 0x5a, 0x2a, 0x63, 0x4a, 0x30, 0x2b, 0x04,
|
||||
0x51, 0x04, 0x4e, 0x09, 0x6d, 0xa5, 0x80, 0xaa, 0xca, 0x71, 0x56, 0x75, 0xa4, 0x5c, 0xcc, 0xd8,
|
||||
0x29, 0x20, 0x21, 0x45, 0x93, 0xdd, 0x89, 0xbd, 0x74, 0x77, 0x67, 0xbb, 0x3b, 0xdb, 0x12, 0x5e,
|
||||
0x11, 0xaf, 0x3c, 0xf3, 0x0b, 0xf8, 0x13, 0xbc, 0xf3, 0xbb, 0xd0, 0x5c, 0x76, 0x7d, 0xa9, 0x53,
|
||||
0xf5, 0xc9, 0x73, 0xbe, 0xf9, 0xe6, 0xf3, 0xb9, 0xcd, 0xd9, 0x01, 0x2b, 0xce, 0xae, 0x02, 0xdf,
|
||||
0xdd, 0x23, 0xb1, 0xdf, 0x8b, 0x13, 0xc6, 0x19, 0x6a, 0xb9, 0x2c, 0xf2, 0x32, 0x9f, 0xf7, 0xd4,
|
||||
0x4e, 0x67, 0x7b, 0xca, 0xd8, 0x34, 0xa0, 0x7b, 0x72, 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0xb9, 0x71, 0x44, 0x38, 0x89, 0x99, 0x1f, 0x71, 0xf4, 0x4d,
|
||||
0x1e, 0xb5, 0x21, 0x25, 0x3f, 0x5e, 0x95, 0x5c, 0x70, 0x5b, 0xa7, 0x04, 0x7d, 0x06, 0x9b, 0xdc,
|
||||
0x0f, 0x69, 0xca, 0x49, 0x18, 0x5f, 0x86, 0xa9, 0xce, 0x57, 0xb3, 0xc0, 0x4e, 0x53, 0xfb, 0x5f,
|
||||
0x03, 0x36, 0xd5, 0xc9, 0x31, 0x4d, 0x7c, 0x9a, 0xa2, 0x1e, 0x54, 0x22, 0x12, 0x52, 0x5d, 0x91,
|
||||
0xce, 0xfa, 0x7f, 0x39, 0x23, 0x21, 0xc5, 0x92, 0x87, 0xbe, 0x83, 0x7a, 0x48, 0x39, 0xf1, 0x08,
|
||||
0x27, 0x52, 0x7f, 0x4d, 0xae, 0xd5, 0x99, 0x53, 0xcd, 0xc2, 0x05, 0x1f, 0x3d, 0x03, 0xf0, 0xf2,
|
||||
0xf8, 0xd2, 0xb6, 0x29, 0x2b, 0xf5, 0xe9, 0xfa, 0xd3, 0x45, 0x1e, 0xf0, 0xc2, 0x11, 0xfb, 0x3f,
|
||||
0x03, 0x5a, 0xcb, 0xea, 0xe8, 0x01, 0x34, 0x38, 0x49, 0xa6, 0x94, 0x8f, 0x98, 0x27, 0x83, 0x68,
|
||||
0xe0, 0x39, 0x80, 0x6c, 0xd8, 0x54, 0xc6, 0x11, 0x8d, 0x03, 0x76, 0x23, 0x3d, 0x6e, 0xe0, 0x25,
|
||||
0x4c, 0x28, 0xa4, 0x2c, 0x4b, 0x5c, 0x2a, 0x14, 0x4c, 0xa5, 0x50, 0x00, 0x42, 0x41, 0x19, 0x5a,
|
||||
0xa1, 0xa2, 0x14, 0x16, 0x31, 0xa1, 0xe0, 0xb2, 0x30, 0x66, 0x11, 0x8d, 0x78, 0xbb, 0xaa, 0x14,
|
||||
0x0a, 0x00, 0x21, 0xa8, 0xc4, 0x84, 0xcf, 0xda, 0x1b, 0x72, 0x43, 0xae, 0xed, 0x61, 0x1e, 0x07,
|
||||
0xa6, 0x69, 0xcc, 0xa2, 0x94, 0xa2, 0x27, 0x50, 0x0b, 0x25, 0x92, 0xb7, 0xf0, 0x83, 0xf5, 0x89,
|
||||
0x51, 0x65, 0xc3, 0x39, 0xd9, 0xfe, 0xab, 0x0c, 0x5b, 0xb9, 0xd4, 0xab, 0x8c, 0xa6, 0x1c, 0x3d,
|
||||
0x5a, 0x56, 0x7a, 0x77, 0x51, 0x73, 0x2a, 0xda, 0x87, 0x8d, 0x37, 0x7e, 0xe4, 0xb1, 0x37, 0x32,
|
||||
0x47, 0x6b, 0x0e, 0x4d, 0xfc, 0x90, 0xfe, 0x28, 0x19, 0x58, 0x33, 0xd1, 0x01, 0xd4, 0xa6, 0x09,
|
||||
0xcb, 0xe2, 0xc3, 0x1b, 0x99, 0xb7, 0xd6, 0xdb, 0xc5, 0xec, 0x4f, 0xa7, 0x09, 0x9d, 0xca, 0x79,
|
||||
0x32, 0xb9, 0x89, 0x29, 0xce, 0xf9, 0xa2, 0x8d, 0xae, 0xfd, 0x80, 0xd3, 0xe4, 0x50, 0xa5, 0xf4,
|
||||
0x3d, 0xda, 0x28, 0xe7, 0xcb, 0x82, 0x65, 0x61, 0x48, 0x12, 0xff, 0x77, 0x2a, 0xd3, 0x5d, 0xc7,
|
||||
0x73, 0xc0, 0xae, 0x41, 0xd5, 0x09, 0x63, 0x7e, 0x63, 0xbf, 0x82, 0xe6, 0x0b, 0x9a, 0xa4, 0x3e,
|
||||
0x8b, 0x8e, 0xa3, 0x6b, 0x26, 0x4e, 0x4d, 0x99, 0x06, 0xf2, 0x46, 0x29, 0x00, 0xb1, 0x7b, 0x95,
|
||||
0xf9, 0x81, 0x77, 0x44, 0x38, 0xd5, 0x5d, 0x32, 0x07, 0xd0, 0x17, 0xd0, 0x4a, 0x68, 0x40, 0x49,
|
||||
0x4a, 0x73, 0x01, 0xd5, 0x27, 0x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 0xbf, 0xe1, 0x38, 0x95, 0x99, 0x2a, 0x63, 0x6d, 0x09, 0x9c, 0xb3, 0x91, 0x08,
|
||||
0x57, 0x64, 0x69, 0x0b, 0x6b, 0x4b, 0xd4, 0x81, 0xb3, 0xe3, 0x91, 0xbe, 0xd0, 0x72, 0x8d, 0x3a,
|
||||
0x50, 0xbf, 0x4e, 0x58, 0x38, 0xca, 0x93, 0xb3, 0x85, 0x0b, 0x5b, 0xe8, 0x88, 0xf5, 0xf1, 0x48,
|
||||
0x47, 0xab, 0x2d, 0x59, 0x05, 0x77, 0x46, 0x43, 0x15, 0x9a, 0xa8, 0x82, 0xb4, 0xa4, 0x3f, 0x94,
|
||||
0xcf, 0x98, 0xd7, 0x6e, 0x28, 0x5c, 0x59, 0xa2, 0x15, 0x49, 0xc6, 0x67, 0x2c, 0xf1, 0xf9, 0x4d,
|
||||
0x1b, 0x54, 0x2b, 0x16, 0x40, 0x31, 0x4d, 0x9a, 0xf3, 0x69, 0x72, 0x58, 0x87, 0x0d, 0x35, 0xd1,
|
||||
0xec, 0x2e, 0xd4, 0xfb, 0xb1, 0xef, 0x24, 0x09, 0x4b, 0x44, 0x95, 0xa9, 0x58, 0xe8, 0x46, 0x52,
|
||||
0xc6, 0xee, 0x53, 0x80, 0xf9, 0xf5, 0x47, 0x16, 0x6c, 0x62, 0xe7, 0x87, 0x0b, 0x67, 0x3c, 0xb9,
|
||||
0xc4, 0xfd, 0x89, 0x63, 0x95, 0x50, 0x13, 0x6a, 0x27, 0xfd, 0x89, 0x73, 0x36, 0xf8, 0xd9, 0x32,
|
||||
0xc4, 0xf6, 0xf8, 0x62, 0x30, 0x70, 0xc6, 0x63, 0xb5, 0x5d, 0xde, 0xed, 0x03, 0xcc, 0x07, 0x81,
|
||||
0x20, 0x4f, 0x9c, 0xb3, 0xcb, 0xb1, 0x33, 0x50, 0x27, 0xcf, 0xcf, 0x9c, 0xcb, 0xd3, 0xe3, 0x33,
|
||||
0xcb, 0xc8, 0x77, 0x84, 0x51, 0x46, 0x9b, 0x50, 0x17, 0x3b, 0xc3, 0xf3, 0x0b, 0x6c, 0x99, 0xbb,
|
||||
0x2f, 0xe1, 0xce, 0xca, 0x58, 0x40, 0x2d, 0x80, 0x49, 0x1f, 0x3f, 0x77, 0x26, 0x97, 0xa3, 0xf3,
|
||||
0x23, 0xab, 0x84, 0x3e, 0x80, 0x2d, 0x6d, 0x1f, 0x39, 0xa3, 0x93, 0x73, 0xe1, 0x4a, 0x0b, 0x60,
|
||||
0x7c, 0x7e, 0x81, 0x07, 0x8e, 0xa4, 0x94, 0x05, 0x45, 0xdb, 0x9a, 0x62, 0xa2, 0x3a, 0x54, 0x4e,
|
||||
0x9d, 0xf1, 0xd0, 0xaa, 0x88, 0xd5, 0xa8, 0x3f, 0x19, 0x5a, 0xd5, 0xdd, 0xa7, 0x0b, 0x6f, 0x10,
|
||||
0xf9, 0xa8, 0x40, 0x35, 0x30, 0x85, 0x57, 0x25, 0xb1, 0x18, 0x3d, 0x7e, 0x68, 0x19, 0x72, 0x71,
|
||||
0xf0, 0xd8, 0x2a, 0xab, 0xc5, 0x81, 0x65, 0x4a, 0x4e, 0xff, 0x27, 0xab, 0xb2, 0xff, 0x87, 0x09,
|
||||
0x66, 0x3f, 0xf6, 0xd1, 0x73, 0xa8, 0x8c, 0x39, 0xe1, 0xe8, 0x93, 0xf5, 0x43, 0x4a, 0x37, 0x66,
|
||||
0x67, 0xfb, 0xb6, 0x6d, 0x35, 0x0b, 0xec, 0x12, 0x7a, 0x06, 0xb5, 0x7c, 0xe4, 0x7c, 0xb8, 0x4a,
|
||||
0x96, 0x63, 0xab, 0xf3, 0xd6, 0x87, 0x7e, 0x61, 0x88, 0xd9, 0x25, 0xe4, 0x40, 0x3d, 0x1f, 0x31,
|
||||
0xb7, 0x29, 0x74, 0x57, 0xe1, 0xd5, 0x99, 0x64, 0x97, 0xd0, 0xaf, 0xd0, 0x18, 0xd3, 0xe0, 0x7a,
|
||||
0x20, 0x9e, 0x6b, 0xe8, 0xab, 0xe2, 0x80, 0x7e, 0xe5, 0x2d, 0xbe, 0xe5, 0x0a, 0x5a, 0x1e, 0xe4,
|
||||
0xd7, 0xef, 0xc9, 0x5e, 0x88, 0xd9, 0x9c, 0x90, 0x18, 0xbd, 0xfd, 0x45, 0x29, 0x6e, 0x74, 0xa7,
|
||||
0xbd, 0xaa, 0x39, 0x21, 0xb1, 0xf3, 0x9a, 0x46, 0xdc, 0x2e, 0x3d, 0x34, 0xae, 0x36, 0xe4, 0xe0,
|
||||
0xf9, 0xf6, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x1a, 0x7f, 0xdb, 0xce, 0x0a, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
pb "github.com/runconduit/conduit/controller/gen/common"
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type grpcStatusChecker interface {
|
||||
SelfCheck(ctx context.Context, in *pb.SelfCheckRequest, opts ...grpc.CallOption) (*pb.SelfCheckResponse, error)
|
||||
SelfCheck(ctx context.Context, in *healthcheckPb.SelfCheckRequest, opts ...grpc.CallOption) (*healthcheckPb.SelfCheckResponse, error)
|
||||
}
|
||||
|
||||
type statusCheckerProxy struct {
|
||||
|
|
@ -17,47 +17,28 @@ type statusCheckerProxy struct {
|
|||
prefix string
|
||||
}
|
||||
|
||||
func (proxy *statusCheckerProxy) SelfCheck() ([]CheckResult, error) {
|
||||
translatedResults := make([]CheckResult, 0)
|
||||
|
||||
canConnectViaGrpcCheck := CheckResult{
|
||||
func (proxy *statusCheckerProxy) SelfCheck() []*healthcheckPb.CheckResult {
|
||||
canConnectViaGrpcCheck := &healthcheckPb.CheckResult{
|
||||
Status: healthcheckPb.CheckStatus_OK,
|
||||
SubsystemName: proxy.prefix,
|
||||
CheckDescription: "can retrieve status via gRPC",
|
||||
Status: CheckError,
|
||||
}
|
||||
selfCheckResponse, err := proxy.delegate.SelfCheck(context.Background(), &pb.SelfCheckRequest{})
|
||||
|
||||
selfCheckResponse, err := proxy.delegate.SelfCheck(context.Background(), &healthcheckPb.SelfCheckRequest{})
|
||||
if err != nil {
|
||||
canConnectViaGrpcCheck.Status = CheckError
|
||||
canConnectViaGrpcCheck.Status = healthcheckPb.CheckStatus_ERROR
|
||||
canConnectViaGrpcCheck.FriendlyMessageToUser = err.Error()
|
||||
} else {
|
||||
canConnectViaGrpcCheck.Status = CheckOk
|
||||
|
||||
for _, check := range selfCheckResponse.Results {
|
||||
fullSubsystemName := fmt.Sprintf("%s[%s]", proxy.prefix, check.SubsystemName)
|
||||
|
||||
var status CheckStatus
|
||||
|
||||
switch CheckStatus(check.Status) {
|
||||
case CheckOk, CheckFailed, CheckError:
|
||||
status = CheckStatus(check.Status)
|
||||
default:
|
||||
status = CheckError
|
||||
}
|
||||
|
||||
translatedResults = append(translatedResults, CheckResult{
|
||||
SubsystemName: fullSubsystemName,
|
||||
CheckDescription: check.CheckDescription,
|
||||
Status: status,
|
||||
FriendlyMessageToUser: check.FriendlyMessageToUser,
|
||||
})
|
||||
}
|
||||
return []*healthcheckPb.CheckResult{canConnectViaGrpcCheck}
|
||||
}
|
||||
|
||||
subsystemResults := []CheckResult{
|
||||
canConnectViaGrpcCheck,
|
||||
for _, check := range selfCheckResponse.Results {
|
||||
fullSubsystemName := fmt.Sprintf("%s[%s]", proxy.prefix, check.SubsystemName)
|
||||
check.SubsystemName = fullSubsystemName
|
||||
}
|
||||
subsystemResults = append(subsystemResults, translatedResults...)
|
||||
return subsystemResults, nil
|
||||
|
||||
subsystemResults := []*healthcheckPb.CheckResult{canConnectViaGrpcCheck}
|
||||
subsystemResults = append(subsystemResults, selfCheckResponse.Results...)
|
||||
return subsystemResults
|
||||
}
|
||||
|
||||
func NewGrpcStatusChecker(name string, grpClient grpcStatusChecker) StatusChecker {
|
||||
|
|
|
|||
|
|
@ -1,32 +1,14 @@
|
|||
package healthcheck
|
||||
|
||||
import log "github.com/sirupsen/logrus"
|
||||
|
||||
type CheckStatus string
|
||||
|
||||
const (
|
||||
CheckOk = CheckStatus("OK")
|
||||
CheckFailed = CheckStatus("FAIL")
|
||||
CheckError = CheckStatus("ERROR")
|
||||
import (
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
)
|
||||
|
||||
type CheckResult struct {
|
||||
SubsystemName string
|
||||
CheckDescription string
|
||||
Status CheckStatus
|
||||
FriendlyMessageToUser string
|
||||
}
|
||||
|
||||
type Check struct {
|
||||
Results []CheckResult
|
||||
OverallStatus CheckStatus
|
||||
}
|
||||
|
||||
type StatusChecker interface {
|
||||
SelfCheck() ([]CheckResult, error)
|
||||
SelfCheck() []*healthcheckPb.CheckResult
|
||||
}
|
||||
|
||||
type CheckObserver func(result CheckResult)
|
||||
type CheckObserver func(result *healthcheckPb.CheckResult)
|
||||
|
||||
type HealthChecker struct {
|
||||
subsystemsToCheck []StatusChecker
|
||||
|
|
@ -36,35 +18,25 @@ func (hC *HealthChecker) Add(subsystemChecker StatusChecker) {
|
|||
hC.subsystemsToCheck = append(hC.subsystemsToCheck, subsystemChecker)
|
||||
}
|
||||
|
||||
func (hC *HealthChecker) PerformCheck(observer CheckObserver) Check {
|
||||
if observer == nil {
|
||||
observer = func(_ CheckResult) {}
|
||||
}
|
||||
|
||||
check := Check{
|
||||
Results: make([]CheckResult, 0),
|
||||
OverallStatus: CheckOk,
|
||||
}
|
||||
func (hC *HealthChecker) PerformCheck(observer CheckObserver) healthcheckPb.CheckStatus {
|
||||
var overallStatus healthcheckPb.CheckStatus
|
||||
|
||||
for _, checker := range hC.subsystemsToCheck {
|
||||
results, err := checker.SelfCheck()
|
||||
if err != nil {
|
||||
log.Errorf("Error checking [%s]: %s", checker, err.Error())
|
||||
check.OverallStatus = CheckError
|
||||
continue
|
||||
}
|
||||
for _, singleResult := range results {
|
||||
check.Results = append(check.Results, singleResult)
|
||||
checkResultContainsError := singleResult.Status == CheckError
|
||||
shouldOverrideStatus := singleResult.Status == CheckFailed && check.OverallStatus == CheckOk
|
||||
for _, singleResult := range checker.SelfCheck() {
|
||||
checkResultContainsError := singleResult.Status == healthcheckPb.CheckStatus_ERROR
|
||||
shouldOverrideStatus := singleResult.Status == healthcheckPb.CheckStatus_FAIL && overallStatus == healthcheckPb.CheckStatus_OK
|
||||
|
||||
if checkResultContainsError || shouldOverrideStatus {
|
||||
check.OverallStatus = singleResult.Status
|
||||
overallStatus = singleResult.Status
|
||||
}
|
||||
|
||||
if observer != nil {
|
||||
observer(singleResult)
|
||||
}
|
||||
observer(singleResult)
|
||||
}
|
||||
}
|
||||
return check
|
||||
|
||||
return overallStatus
|
||||
}
|
||||
|
||||
func MakeHealthChecker() *HealthChecker {
|
||||
|
|
|
|||
|
|
@ -1,80 +1,48 @@
|
|||
package healthcheck
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
)
|
||||
|
||||
type mockSubsystem struct {
|
||||
checksToReturn []CheckResult
|
||||
errToReturn error
|
||||
checksToReturn []*healthcheckPb.CheckResult
|
||||
}
|
||||
|
||||
func (m *mockSubsystem) SelfCheck() ([]CheckResult, error) {
|
||||
return m.checksToReturn, m.errToReturn
|
||||
func (m *mockSubsystem) SelfCheck() []*healthcheckPb.CheckResult {
|
||||
return m.checksToReturn
|
||||
}
|
||||
|
||||
func TestSelfChecker(t *testing.T) {
|
||||
workingSubsystem1 := &mockSubsystem{
|
||||
checksToReturn: []CheckResult{
|
||||
{SubsystemName: "w1", CheckDescription: "w1a", Status: CheckOk},
|
||||
{SubsystemName: "w1", CheckDescription: "w1b", Status: CheckOk},
|
||||
checksToReturn: []*healthcheckPb.CheckResult{
|
||||
{SubsystemName: "w1", CheckDescription: "w1a", Status: healthcheckPb.CheckStatus_OK},
|
||||
{SubsystemName: "w1", CheckDescription: "w1b", Status: healthcheckPb.CheckStatus_OK},
|
||||
},
|
||||
}
|
||||
workingSubsystem2 := &mockSubsystem{
|
||||
checksToReturn: []CheckResult{
|
||||
{SubsystemName: "w2", CheckDescription: "w2a", Status: CheckOk},
|
||||
{SubsystemName: "w2", CheckDescription: "w2b", Status: CheckOk},
|
||||
checksToReturn: []*healthcheckPb.CheckResult{
|
||||
{SubsystemName: "w2", CheckDescription: "w2a", Status: healthcheckPb.CheckStatus_OK},
|
||||
{SubsystemName: "w2", CheckDescription: "w2b", Status: healthcheckPb.CheckStatus_OK},
|
||||
},
|
||||
}
|
||||
|
||||
failingSubsystem1 := &mockSubsystem{
|
||||
checksToReturn: []CheckResult{
|
||||
{SubsystemName: "f1", CheckDescription: "fa", Status: CheckOk},
|
||||
{SubsystemName: "f1", CheckDescription: "fb", Status: CheckFailed},
|
||||
checksToReturn: []*healthcheckPb.CheckResult{
|
||||
{SubsystemName: "f1", CheckDescription: "fa", Status: healthcheckPb.CheckStatus_OK},
|
||||
{SubsystemName: "f1", CheckDescription: "fb", Status: healthcheckPb.CheckStatus_FAIL},
|
||||
},
|
||||
}
|
||||
|
||||
erroringSubsystem1 := &mockSubsystem{
|
||||
errToReturn: errors.New("expected"),
|
||||
checksToReturn: []CheckResult{{SubsystemName: "e1", CheckDescription: "this should always be ignored because of the error", Status: CheckOk}},
|
||||
errorSubsystem1 := &mockSubsystem{
|
||||
checksToReturn: []*healthcheckPb.CheckResult{
|
||||
{SubsystemName: "e1", CheckDescription: "ea", Status: healthcheckPb.CheckStatus_ERROR},
|
||||
{SubsystemName: "e1", CheckDescription: "eb", Status: healthcheckPb.CheckStatus_OK},
|
||||
},
|
||||
}
|
||||
|
||||
t.Run("Returns all checks by subsystems", func(t *testing.T) {
|
||||
healthChecker := MakeHealthChecker()
|
||||
|
||||
healthChecker.Add(workingSubsystem1)
|
||||
healthChecker.Add(workingSubsystem2)
|
||||
healthChecker.Add(failingSubsystem1)
|
||||
|
||||
results := healthChecker.PerformCheck(nil)
|
||||
|
||||
allExpectedResults := make([]CheckResult, 0)
|
||||
allExpectedResults = append(allExpectedResults, workingSubsystem1.checksToReturn...)
|
||||
allExpectedResults = append(allExpectedResults, workingSubsystem2.checksToReturn...)
|
||||
allExpectedResults = append(allExpectedResults, failingSubsystem1.checksToReturn...)
|
||||
|
||||
expectedLength := len(allExpectedResults)
|
||||
actualLength := len(results.Results)
|
||||
|
||||
if actualLength != expectedLength {
|
||||
t.Fatalf("Expecting check results to contain [%d] results, got [%d]", expectedLength, actualLength)
|
||||
}
|
||||
|
||||
actualChecksSet := make(map[CheckResult]bool)
|
||||
for _, result := range results.Results {
|
||||
actualChecksSet[result] = true
|
||||
}
|
||||
|
||||
for _, expected := range allExpectedResults {
|
||||
if !actualChecksSet[expected] {
|
||||
t.Fatalf("Expected results to contain [%v], but was: %v", expected,
|
||||
reflect.ValueOf(actualChecksSet).MapKeys())
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Notifies observer of all results", func(t *testing.T) {
|
||||
healthChecker := MakeHealthChecker()
|
||||
|
||||
|
|
@ -82,28 +50,38 @@ func TestSelfChecker(t *testing.T) {
|
|||
healthChecker.Add(workingSubsystem2)
|
||||
healthChecker.Add(failingSubsystem1)
|
||||
|
||||
observedResults := make([]CheckResult, 0)
|
||||
observer := func(r CheckResult) {
|
||||
observedResults := make([]*healthcheckPb.CheckResult, 0)
|
||||
observer := func(r *healthcheckPb.CheckResult) {
|
||||
observedResults = append(observedResults, r)
|
||||
}
|
||||
|
||||
check := healthChecker.PerformCheck(observer)
|
||||
allChecks := make([]*healthcheckPb.CheckResult, 0)
|
||||
allChecks = append(allChecks, workingSubsystem1.checksToReturn...)
|
||||
allChecks = append(allChecks, workingSubsystem2.checksToReturn...)
|
||||
allChecks = append(allChecks, failingSubsystem1.checksToReturn...)
|
||||
|
||||
expectedResults := make([]*healthcheckPb.CheckResult, 0)
|
||||
for _, check := range allChecks {
|
||||
expectedResults = append(expectedResults, check)
|
||||
}
|
||||
|
||||
healthChecker.PerformCheck(observer)
|
||||
|
||||
observedLength := len(observedResults)
|
||||
expectedLength := len(check.Results)
|
||||
expectedLength := len(expectedResults)
|
||||
|
||||
if expectedLength != observedLength {
|
||||
t.Fatalf("Expecting observed check to contain [%d] check, got [%d]", expectedLength, observedLength)
|
||||
}
|
||||
|
||||
observedResultsSet := make(map[CheckResult]bool)
|
||||
observedResultsSet := make(map[healthcheckPb.CheckResult]bool)
|
||||
for _, result := range observedResults {
|
||||
observedResultsSet[result] = true
|
||||
observedResultsSet[*result] = true
|
||||
}
|
||||
|
||||
for _, observed := range check.Results {
|
||||
if !observedResultsSet[observed] {
|
||||
t.Fatalf("Expected observed results to contain [%v], but was: %v", observed,
|
||||
for _, expected := range expectedResults {
|
||||
if !observedResultsSet[*expected] {
|
||||
t.Fatalf("Expected observed results to contain [%v], but was: %v", expected,
|
||||
reflect.ValueOf(observedResultsSet).MapKeys())
|
||||
}
|
||||
}
|
||||
|
|
@ -115,44 +93,38 @@ func TestSelfChecker(t *testing.T) {
|
|||
healthChecker.Add(workingSubsystem1)
|
||||
healthChecker.Add(workingSubsystem2)
|
||||
|
||||
results := healthChecker.PerformCheck(nil)
|
||||
checkStatus := healthChecker.PerformCheck(nil)
|
||||
|
||||
if results.OverallStatus != CheckOk {
|
||||
t.Fatalf("Expecting check to be successful, but got [%v]", results)
|
||||
if checkStatus != healthcheckPb.CheckStatus_OK {
|
||||
t.Fatalf("Expecting check to be successful, but got [%s]", checkStatus)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Is failure if even a single test failed", func(t *testing.T) {
|
||||
t.Run("Is failure if even a single test failed and no errors", func(t *testing.T) {
|
||||
healthChecker := MakeHealthChecker()
|
||||
|
||||
healthChecker.Add(workingSubsystem1)
|
||||
healthChecker.Add(failingSubsystem1)
|
||||
healthChecker.Add(workingSubsystem2)
|
||||
|
||||
results := healthChecker.PerformCheck(nil)
|
||||
checkStatus := healthChecker.PerformCheck(nil)
|
||||
|
||||
if results.OverallStatus != CheckFailed {
|
||||
t.Fatalf("Expecting check to be error, but got [%v]", results)
|
||||
if checkStatus != healthcheckPb.CheckStatus_FAIL {
|
||||
t.Fatalf("Expecting check to be error, but got [%s]", checkStatus)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Is in error if even a single test returned error", func(t *testing.T) {
|
||||
t.Run("Is error if even a single test errored", func(t *testing.T) {
|
||||
healthChecker := MakeHealthChecker()
|
||||
|
||||
healthChecker.Add(workingSubsystem1)
|
||||
healthChecker.Add(failingSubsystem1)
|
||||
healthChecker.Add(workingSubsystem2)
|
||||
healthChecker.Add(erroringSubsystem1)
|
||||
healthChecker.Add(errorSubsystem1)
|
||||
|
||||
results := healthChecker.PerformCheck(nil)
|
||||
checkStatus := healthChecker.PerformCheck(nil)
|
||||
|
||||
if results.OverallStatus != CheckError {
|
||||
t.Fatalf("Expecting check to be error, but got [%v]", results)
|
||||
}
|
||||
|
||||
expectedNumberOfChecks := len(workingSubsystem1.checksToReturn) + len(workingSubsystem2.checksToReturn) + len(failingSubsystem1.checksToReturn)
|
||||
if len(results.Results) > expectedNumberOfChecks {
|
||||
t.Fatalf("Expecting errored checks to be ignored, but got [%v]", results)
|
||||
if checkStatus != healthcheckPb.CheckStatus_ERROR {
|
||||
t.Fatalf("Expecting check to be error, but got [%s]", checkStatus)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"net/url"
|
||||
"os"
|
||||
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
"github.com/runconduit/conduit/pkg/healthcheck"
|
||||
"github.com/runconduit/conduit/pkg/shell"
|
||||
"k8s.io/client-go/rest"
|
||||
|
|
@ -41,61 +42,72 @@ func (kubeapi *kubernetesApi) NewClient() (*http.Client, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (kubeapi *kubernetesApi) SelfCheck() ([]healthcheck.CheckResult, error) {
|
||||
apiConnectivityCheck := healthcheck.CheckResult{
|
||||
Status: healthcheck.CheckError,
|
||||
func (kubeapi *kubernetesApi) SelfCheck() []*healthcheckPb.CheckResult {
|
||||
apiConnectivityCheck, client := kubeapi.checkApiConnectivity()
|
||||
apiAccessCheck := kubeapi.checkApiAccess(client)
|
||||
return []*healthcheckPb.CheckResult{apiConnectivityCheck, apiAccessCheck}
|
||||
}
|
||||
|
||||
func (kubeapi *kubernetesApi) checkApiConnectivity() (*healthcheckPb.CheckResult, *http.Client) {
|
||||
checkResult := &healthcheckPb.CheckResult{
|
||||
Status: healthcheckPb.CheckStatus_OK,
|
||||
SubsystemName: KubeapiSubsystemName,
|
||||
CheckDescription: KubeapiClientCheckDescription,
|
||||
}
|
||||
|
||||
client, err := kubeapi.NewClient()
|
||||
if err != nil {
|
||||
apiConnectivityCheck.Status = healthcheck.CheckError
|
||||
apiConnectivityCheck.FriendlyMessageToUser = fmt.Sprintf("Error connecting to the API. Error message is [%s]", err.Error())
|
||||
} else {
|
||||
apiConnectivityCheck.Status = healthcheck.CheckOk
|
||||
checkResult.Status = healthcheckPb.CheckStatus_ERROR
|
||||
checkResult.FriendlyMessageToUser = fmt.Sprintf("Error connecting to the API. Error message is [%s]", err.Error())
|
||||
return checkResult, client
|
||||
}
|
||||
|
||||
apiAccessCheck := healthcheck.CheckResult{
|
||||
Status: healthcheck.CheckError,
|
||||
return checkResult, client
|
||||
}
|
||||
|
||||
func (kubeapi *kubernetesApi) checkApiAccess(client *http.Client) *healthcheckPb.CheckResult {
|
||||
checkResult := &healthcheckPb.CheckResult{
|
||||
Status: healthcheckPb.CheckStatus_OK,
|
||||
SubsystemName: KubeapiSubsystemName,
|
||||
CheckDescription: KubeapiAccessCheckDescription,
|
||||
}
|
||||
|
||||
if client == nil {
|
||||
checkResult.Status = healthcheckPb.CheckStatus_ERROR
|
||||
checkResult.FriendlyMessageToUser = "Error building Kubernetes API client."
|
||||
return checkResult
|
||||
}
|
||||
|
||||
endpointToCheck, err := generateBaseKubernetesApiUrl(kubeapi.apiSchemeHostAndPort)
|
||||
if err != nil {
|
||||
apiAccessCheck.Status = healthcheck.CheckError
|
||||
apiAccessCheck.FriendlyMessageToUser = fmt.Sprintf("Error querying Kubernetes API. Configured host is [%s], error message is [%s]", kubeapi.apiSchemeHostAndPort, err.Error())
|
||||
} else {
|
||||
if client != nil {
|
||||
resp, err := client.Get(endpointToCheck.String())
|
||||
if err != nil {
|
||||
apiAccessCheck.Status = healthcheck.CheckError
|
||||
apiAccessCheck.FriendlyMessageToUser = fmt.Sprintf("HTTP GET request to endpoint [%s] resulted in error: [%s]", endpointToCheck, err.Error())
|
||||
} else {
|
||||
statusCodeReturnedIsWithinSuccessRange := resp.StatusCode < 400
|
||||
if statusCodeReturnedIsWithinSuccessRange {
|
||||
apiAccessCheck.Status = healthcheck.CheckOk
|
||||
} else {
|
||||
bytes, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
apiAccessCheck.Status = healthcheck.CheckError
|
||||
apiAccessCheck.FriendlyMessageToUser = fmt.Sprintf("HTTP GET request to endpoint [%s] resulted in invalid response: [%v]", endpointToCheck, resp)
|
||||
} else {
|
||||
body := string(bytes)
|
||||
checkResult.Status = healthcheckPb.CheckStatus_ERROR
|
||||
checkResult.FriendlyMessageToUser = fmt.Sprintf("Error querying Kubernetes API. Configured host is [%s], error message is [%s]", kubeapi.apiSchemeHostAndPort, err.Error())
|
||||
return checkResult
|
||||
}
|
||||
|
||||
apiAccessCheck.Status = healthcheck.CheckFailed
|
||||
apiAccessCheck.FriendlyMessageToUser = fmt.Sprintf("HTTP GET request to endpoint [%s] resulted in Status: [%s], body: [%s]", endpointToCheck, resp.Status, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
resp, err := client.Get(endpointToCheck.String())
|
||||
if err != nil {
|
||||
checkResult.Status = healthcheckPb.CheckStatus_ERROR
|
||||
checkResult.FriendlyMessageToUser = fmt.Sprintf("HTTP GET request to endpoint [%s] resulted in error: [%s]", endpointToCheck, err.Error())
|
||||
return checkResult
|
||||
}
|
||||
|
||||
statusCodeReturnedIsWithinSuccessRange := resp.StatusCode < 400
|
||||
if !statusCodeReturnedIsWithinSuccessRange {
|
||||
bytes, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
checkResult.Status = healthcheckPb.CheckStatus_ERROR
|
||||
checkResult.FriendlyMessageToUser = fmt.Sprintf("HTTP GET request to endpoint [%s] resulted in invalid response: [%v]", endpointToCheck, resp)
|
||||
return checkResult
|
||||
}
|
||||
|
||||
body := string(bytes)
|
||||
checkResult.Status = healthcheckPb.CheckStatus_FAIL
|
||||
checkResult.FriendlyMessageToUser = fmt.Sprintf("HTTP GET request to endpoint [%s] resulted in Status: [%s], body: [%s]", endpointToCheck, resp.Status, body)
|
||||
return checkResult
|
||||
}
|
||||
results := []healthcheck.CheckResult{
|
||||
apiConnectivityCheck,
|
||||
apiAccessCheck,
|
||||
}
|
||||
return results, nil
|
||||
|
||||
return checkResult
|
||||
}
|
||||
|
||||
func (kubeapi *kubernetesApi) UrlFor(namespace string, extraPathStartingWithSlash string) (*url.URL, error) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
"github.com/runconduit/conduit/pkg/healthcheck"
|
||||
"github.com/runconduit/conduit/pkg/shell"
|
||||
)
|
||||
|
|
@ -110,61 +111,72 @@ func (kctl *kubectl) UrlFor(namespace string, extraPathStartingWithSlash string)
|
|||
return generateKubernetesApiBaseUrlFor(schemeHostAndPort, namespace, extraPathStartingWithSlash)
|
||||
}
|
||||
|
||||
func (kctl *kubectl) SelfCheck() ([]healthcheck.CheckResult, error) {
|
||||
func (kctl *kubectl) SelfCheck() []*healthcheckPb.CheckResult {
|
||||
return []*healthcheckPb.CheckResult{
|
||||
kctl.checkKubectlOnPath(),
|
||||
kctl.checkKubectlVersion(),
|
||||
kctl.checkKubectlApiAccess(),
|
||||
}
|
||||
}
|
||||
|
||||
kubectlOnPathCheck := healthcheck.CheckResult{
|
||||
func (kctl *kubectl) checkKubectlOnPath() *healthcheckPb.CheckResult {
|
||||
checkResult := &healthcheckPb.CheckResult{
|
||||
Status: healthcheckPb.CheckStatus_OK,
|
||||
SubsystemName: KubectlSubsystemName,
|
||||
CheckDescription: KubectlIsInstalledCheckDescription,
|
||||
Status: healthcheck.CheckError,
|
||||
}
|
||||
_, err := kctl.sh.CombinedOutput("kubectl", "config")
|
||||
if err != nil {
|
||||
kubectlOnPathCheck.Status = healthcheck.CheckFailed
|
||||
kubectlOnPathCheck.FriendlyMessageToUser = fmt.Sprintf("Could not run the command `kubectl`. The error message is: [%s] and the current $PATH is: %s", err.Error(), kctl.sh.Path())
|
||||
} else {
|
||||
kubectlOnPathCheck.Status = healthcheck.CheckOk
|
||||
}
|
||||
|
||||
kubectlVersionCheck := healthcheck.CheckResult{
|
||||
_, err := kctl.sh.CombinedOutput("kubectl", "config")
|
||||
if err != nil {
|
||||
checkResult.Status = healthcheckPb.CheckStatus_ERROR
|
||||
checkResult.FriendlyMessageToUser = fmt.Sprintf("Could not run the command `kubectl`. The error message is: [%s] and the current $PATH is: %s", err.Error(), kctl.sh.Path())
|
||||
return checkResult
|
||||
}
|
||||
|
||||
return checkResult
|
||||
}
|
||||
|
||||
func (kctl *kubectl) checkKubectlVersion() *healthcheckPb.CheckResult {
|
||||
checkResult := &healthcheckPb.CheckResult{
|
||||
Status: healthcheckPb.CheckStatus_OK,
|
||||
SubsystemName: KubectlSubsystemName,
|
||||
CheckDescription: KubectlVersionCheckDescription,
|
||||
Status: healthcheck.CheckError,
|
||||
}
|
||||
|
||||
actualVersion, err := kctl.Version()
|
||||
if err != nil {
|
||||
kubectlVersionCheck.Status = healthcheck.CheckError
|
||||
kubectlVersionCheck.FriendlyMessageToUser = fmt.Sprintf("Error getting version from kubectl. The error message is: [%s].", err.Error())
|
||||
} else {
|
||||
if isCompatibleVersion(minimumKubectlVersionExpected, actualVersion) {
|
||||
kubectlVersionCheck.Status = healthcheck.CheckOk
|
||||
} else {
|
||||
kubectlVersionCheck.Status = healthcheck.CheckFailed
|
||||
kubectlVersionCheck.FriendlyMessageToUser = fmt.Sprintf("Kubectl is on version [%d.%d.%d], but version [%d.%d.%d] or more recent is required.",
|
||||
actualVersion[0], actualVersion[1], actualVersion[2],
|
||||
minimumKubectlVersionExpected[0], minimumKubectlVersionExpected[1], minimumKubectlVersionExpected[2])
|
||||
}
|
||||
checkResult.Status = healthcheckPb.CheckStatus_ERROR
|
||||
checkResult.FriendlyMessageToUser = fmt.Sprintf("Error getting version from kubectl. The error message is: [%s].", err.Error())
|
||||
return checkResult
|
||||
}
|
||||
|
||||
kubectlApiAccessCheck := healthcheck.CheckResult{
|
||||
if !isCompatibleVersion(minimumKubectlVersionExpected, actualVersion) {
|
||||
checkResult.Status = healthcheckPb.CheckStatus_FAIL
|
||||
checkResult.FriendlyMessageToUser = fmt.Sprintf("Kubectl is on version [%d.%d.%d], but version [%d.%d.%d] or more recent is required.",
|
||||
actualVersion[0], actualVersion[1], actualVersion[2],
|
||||
minimumKubectlVersionExpected[0], minimumKubectlVersionExpected[1], minimumKubectlVersionExpected[2])
|
||||
return checkResult
|
||||
}
|
||||
|
||||
return checkResult
|
||||
}
|
||||
|
||||
func (kctl *kubectl) checkKubectlApiAccess() *healthcheckPb.CheckResult {
|
||||
kubectlApiAccessCheck := &healthcheckPb.CheckResult{
|
||||
Status: healthcheckPb.CheckStatus_OK,
|
||||
SubsystemName: KubectlSubsystemName,
|
||||
CheckDescription: KubectlConnectivityCheckDescription,
|
||||
Status: healthcheck.CheckError,
|
||||
}
|
||||
output, err := kctl.sh.CombinedOutput("kubectl", "get", "pods")
|
||||
if err != nil {
|
||||
kubectlApiAccessCheck.Status = healthcheck.CheckFailed
|
||||
kubectlApiAccessCheck.FriendlyMessageToUser = output
|
||||
} else {
|
||||
kubectlApiAccessCheck.Status = healthcheck.CheckOk
|
||||
}
|
||||
|
||||
results := []healthcheck.CheckResult{
|
||||
kubectlOnPathCheck,
|
||||
kubectlVersionCheck,
|
||||
kubectlApiAccessCheck,
|
||||
output, err := kctl.sh.CombinedOutput("kubectl", "get", "pods")
|
||||
if err != nil {
|
||||
kubectlApiAccessCheck.Status = healthcheckPb.CheckStatus_FAIL
|
||||
kubectlApiAccessCheck.FriendlyMessageToUser = output
|
||||
return kubectlApiAccessCheck
|
||||
}
|
||||
return results, nil
|
||||
|
||||
kubectlApiAccessCheck.Status = healthcheckPb.CheckStatus_OK
|
||||
return kubectlApiAccessCheck
|
||||
}
|
||||
|
||||
func isCompatibleVersion(minimalRequirementVersion [3]int, actualVersion [3]int) bool {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"net/url"
|
||||
"testing"
|
||||
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
"github.com/runconduit/conduit/pkg/healthcheck"
|
||||
"github.com/runconduit/conduit/pkg/shell"
|
||||
)
|
||||
|
|
@ -236,10 +237,7 @@ func TestKubectlSelfCheck(t *testing.T) {
|
|||
}
|
||||
shell.OutputToReturn = append(shell.OutputToReturn, string(output))
|
||||
|
||||
results, err := kubectlAsStatusChecker.SelfCheck()
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
results := kubectlAsStatusChecker.SelfCheck()
|
||||
|
||||
expectedNumChecks := 3
|
||||
actualNumChecks := len(results)
|
||||
|
|
@ -247,9 +245,9 @@ func TestKubectlSelfCheck(t *testing.T) {
|
|||
t.Fatalf("Expecting [%d] checks, got [%d]", expectedNumChecks, actualNumChecks)
|
||||
}
|
||||
|
||||
checkResult(t, results[0], KubectlIsInstalledCheckDescription, healthcheck.CheckOk)
|
||||
checkResult(t, results[1], KubectlVersionCheckDescription, healthcheck.CheckOk)
|
||||
checkResult(t, results[2], KubectlConnectivityCheckDescription, healthcheck.CheckOk)
|
||||
checkResult(t, results[0], KubectlIsInstalledCheckDescription, healthcheckPb.CheckStatus_OK)
|
||||
checkResult(t, results[1], KubectlVersionCheckDescription, healthcheckPb.CheckStatus_OK)
|
||||
checkResult(t, results[2], KubectlConnectivityCheckDescription, healthcheckPb.CheckStatus_OK)
|
||||
})
|
||||
|
||||
t.Run("Returns failures when problems were found", func(t *testing.T) {
|
||||
|
|
@ -272,21 +270,17 @@ func TestKubectlSelfCheck(t *testing.T) {
|
|||
}
|
||||
shell.OutputToReturn = append(shell.OutputToReturn, string(output))
|
||||
|
||||
results, err := kubectlAsStatusChecker.SelfCheck()
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
results := kubectlAsStatusChecker.SelfCheck()
|
||||
|
||||
expectedNumChecks := 3
|
||||
actualNumChecks := len(results)
|
||||
if actualNumChecks != expectedNumChecks {
|
||||
t.Fatalf("Expecting [%d] checks, got [%d]", expectedNumChecks, actualNumChecks)
|
||||
}
|
||||
checkResult(t, results[0], KubectlIsInstalledCheckDescription, healthcheck.CheckOk)
|
||||
checkResult(t, results[1], KubectlVersionCheckDescription, healthcheck.CheckFailed)
|
||||
checkResult(t, results[2], KubectlConnectivityCheckDescription, healthcheck.CheckOk)
|
||||
checkResult(t, results[0], KubectlIsInstalledCheckDescription, healthcheckPb.CheckStatus_OK)
|
||||
checkResult(t, results[1], KubectlVersionCheckDescription, healthcheckPb.CheckStatus_FAIL)
|
||||
checkResult(t, results[2], KubectlConnectivityCheckDescription, healthcheckPb.CheckStatus_OK)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestNewKubectl(t *testing.T) {
|
||||
|
|
@ -360,7 +354,7 @@ func TestCanonicalKubernetesNameFromFriendlyName(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func checkResult(t *testing.T, actualResult healthcheck.CheckResult, expectedDescription string, expectedStatus healthcheck.CheckStatus) {
|
||||
func checkResult(t *testing.T, actualResult *healthcheckPb.CheckResult, expectedDescription string, expectedStatus healthcheckPb.CheckStatus) {
|
||||
if actualResult.SubsystemName != KubectlSubsystemName || actualResult.CheckDescription != expectedDescription || actualResult.Status != expectedStatus {
|
||||
t.Fatalf("Expecting results to have subsytem [%s], description [%s] and status [%s], but got: %v", KubectlSubsystemName, expectedDescription, expectedStatus, actualResult)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/runconduit/conduit/pkg/healthcheck"
|
||||
healthcheckPb "github.com/runconduit/conduit/controller/gen/common/healthcheck"
|
||||
)
|
||||
|
||||
type MockKubeApi struct {
|
||||
SelfCheckResultsToReturn []healthcheck.CheckResult
|
||||
SelfCheckResultsToReturn []*healthcheckPb.CheckResult
|
||||
UrlForNamespaceReceived string
|
||||
UrlExtraPathStartingWithSlashReceived string
|
||||
UrlForUrlToReturn *url.URL
|
||||
|
|
@ -26,13 +26,12 @@ func (m *MockKubeApi) NewClient() (*http.Client, error) {
|
|||
return m.NewClientClientToReturn, m.ErrorToReturn
|
||||
}
|
||||
|
||||
func (m *MockKubeApi) SelfCheck() ([]healthcheck.CheckResult, error) {
|
||||
return m.SelfCheckResultsToReturn, m.ErrorToReturn
|
||||
func (m *MockKubeApi) SelfCheck() []*healthcheckPb.CheckResult {
|
||||
return m.SelfCheckResultsToReturn
|
||||
}
|
||||
|
||||
type MockKubectl struct {
|
||||
SelfCheckResultsToReturn []healthcheck.CheckResult
|
||||
ErrorToReturn error
|
||||
SelfCheckResultsToReturn []*healthcheckPb.CheckResult
|
||||
}
|
||||
|
||||
func (m *MockKubectl) Version() ([3]int, error) { return [3]int{}, nil }
|
||||
|
|
@ -47,6 +46,6 @@ func (m *MockKubectl) UrlFor(namespace string, extraPathStartingWithSlash string
|
|||
|
||||
func (m *MockKubectl) ProxyPort() int { return -666 }
|
||||
|
||||
func (m *MockKubectl) SelfCheck() ([]healthcheck.CheckResult, error) {
|
||||
return m.SelfCheckResultsToReturn, m.ErrorToReturn
|
||||
func (m *MockKubectl) SelfCheck() []*healthcheckPb.CheckResult {
|
||||
return m.SelfCheckResultsToReturn
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,16 +113,3 @@ enum Protocol {
|
|||
HTTP = 0;
|
||||
TCP = 1;
|
||||
}
|
||||
|
||||
message CheckResult {
|
||||
string SubsystemName = 1;
|
||||
string CheckDescription = 2;
|
||||
string Status = 3;
|
||||
string FriendlyMessageToUser = 4;
|
||||
}
|
||||
|
||||
message SelfCheckRequest {}
|
||||
|
||||
message SelfCheckResponse {
|
||||
repeated CheckResult results = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package conduit.common.healthcheck;
|
||||
|
||||
enum CheckStatus {
|
||||
OK = 0;
|
||||
FAIL = 1;
|
||||
ERROR = 2;
|
||||
}
|
||||
|
||||
message CheckResult {
|
||||
string SubsystemName = 1;
|
||||
string CheckDescription = 2;
|
||||
CheckStatus Status = 3;
|
||||
string FriendlyMessageToUser = 4;
|
||||
}
|
||||
|
||||
message SelfCheckRequest {}
|
||||
|
||||
message SelfCheckResponse {
|
||||
repeated CheckResult results = 1;
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ package conduit.public;
|
|||
import "google/protobuf/duration.proto";
|
||||
|
||||
import "common/common.proto";
|
||||
import "common/healthcheck/healthcheck.proto";
|
||||
|
||||
enum MetricName {
|
||||
REQUEST_RATE = 0;
|
||||
|
|
@ -133,6 +134,6 @@ service Api {
|
|||
rpc Stat(MetricRequest) returns (MetricResponse) {}
|
||||
rpc Version(Empty) returns (VersionInfo) {}
|
||||
rpc ListPods(Empty) returns (ListPodsResponse) {}
|
||||
rpc SelfCheck(common.SelfCheckRequest) returns (common.SelfCheckResponse) {}
|
||||
rpc SelfCheck(common.healthcheck.SelfCheckRequest) returns (common.healthcheck.SelfCheckResponse) {}
|
||||
rpc Tap(TapRequest) returns (stream common.TapEvent) {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue