From a719d120968d30197f36e00d2b6eb1d8f9872a36 Mon Sep 17 00:00:00 2001 From: Timofey Kirillov Date: Thu, 2 May 2024 11:29:44 +0300 Subject: [PATCH] [dhctl] (feat/dhctl-server): add abort, destroy, import, converge rpc Signed-off-by: Ilya Mayorov --- dhctl/Makefile | 6 +- dhctl/go.mod | 3 +- dhctl/go.sum | 2 + dhctl/pkg/server/api/dhctl/abort.proto | 72 ++ dhctl/pkg/server/api/dhctl/bootstrap.proto | 17 +- dhctl/pkg/server/api/dhctl/check.proto | 11 +- dhctl/pkg/server/api/dhctl/common.proto | 9 +- dhctl/pkg/server/api/dhctl/converge.proto | 71 ++ dhctl/pkg/server/api/dhctl/destroy.proto | 70 ++ dhctl/pkg/server/api/dhctl/dhctl.proto | 8 + dhctl/pkg/server/api/dhctl/import.proto | 72 ++ dhctl/pkg/server/interceptors/interceptors.go | 139 --- dhctl/pkg/server/pb/dhctl/abort.pb.go | 825 ++++++++++++++++++ dhctl/pkg/server/pb/dhctl/bootstrap.pb.go | 343 +++----- dhctl/pkg/server/pb/dhctl/check.pb.go | 225 ++--- dhctl/pkg/server/pb/dhctl/common.pb.go | 74 +- dhctl/pkg/server/pb/dhctl/converge.pb.go | 819 +++++++++++++++++ dhctl/pkg/server/pb/dhctl/destroy.pb.go | 806 +++++++++++++++++ dhctl/pkg/server/pb/dhctl/dhctl.pb.go | 82 +- dhctl/pkg/server/pb/dhctl/dhctl_grpc.pb.go | 276 ++++++ dhctl/pkg/server/pb/dhctl/import.pb.go | 824 +++++++++++++++++ dhctl/pkg/server/{ => pkg}/fsm/fsm.go | 0 dhctl/pkg/server/{ => pkg}/fsm/fsm_test.go | 2 +- .../server/pkg/interceptors/interceptors.go | 139 +++ dhctl/pkg/server/{ => pkg}/logger/logger.go | 39 + dhctl/pkg/server/proxy/proxy.go | 46 +- dhctl/pkg/server/rpc/dhctl/abort.go | 381 ++++++++ dhctl/pkg/server/rpc/dhctl/bootstrap.go | 385 ++++---- dhctl/pkg/server/rpc/dhctl/check.go | 316 ++++--- dhctl/pkg/server/rpc/dhctl/converge.go | 397 +++++++++ dhctl/pkg/server/rpc/dhctl/destroy.go | 381 ++++++++ dhctl/pkg/server/rpc/dhctl/dhctl.go | 83 +- dhctl/pkg/server/rpc/dhctl/import.go | 345 ++++++++ dhctl/pkg/server/server/server.go | 56 +- 34 files changed, 6466 insertions(+), 858 deletions(-) create mode 100644 dhctl/pkg/server/api/dhctl/abort.proto create mode 100644 dhctl/pkg/server/api/dhctl/converge.proto create mode 100644 dhctl/pkg/server/api/dhctl/destroy.proto create mode 100644 dhctl/pkg/server/api/dhctl/import.proto delete mode 100644 dhctl/pkg/server/interceptors/interceptors.go create mode 100644 dhctl/pkg/server/pb/dhctl/abort.pb.go create mode 100644 dhctl/pkg/server/pb/dhctl/converge.pb.go create mode 100644 dhctl/pkg/server/pb/dhctl/destroy.pb.go create mode 100644 dhctl/pkg/server/pb/dhctl/import.pb.go rename dhctl/pkg/server/{ => pkg}/fsm/fsm.go (100%) rename dhctl/pkg/server/{ => pkg}/fsm/fsm_test.go (98%) create mode 100644 dhctl/pkg/server/pkg/interceptors/interceptors.go rename dhctl/pkg/server/{ => pkg}/logger/logger.go (61%) create mode 100644 dhctl/pkg/server/rpc/dhctl/abort.go create mode 100644 dhctl/pkg/server/rpc/dhctl/converge.go create mode 100644 dhctl/pkg/server/rpc/dhctl/destroy.go create mode 100644 dhctl/pkg/server/rpc/dhctl/import.go diff --git a/dhctl/Makefile b/dhctl/Makefile index 7c17157b4801..d3bac96ae3ba 100644 --- a/dhctl/Makefile +++ b/dhctl/Makefile @@ -94,7 +94,11 @@ protoc: pkg/server/api/dhctl/dhctl.proto \ pkg/server/api/dhctl/common.proto \ pkg/server/api/dhctl/check.proto \ - pkg/server/api/dhctl/bootstrap.proto + pkg/server/api/dhctl/bootstrap.proto \ + pkg/server/api/dhctl/destroy.proto \ + pkg/server/api/dhctl/abort.proto \ + pkg/server/api/dhctl/converge.proto \ + pkg/server/api/dhctl/import.proto generate: protoc go generate ./... diff --git a/dhctl/go.mod b/dhctl/go.mod index 4dccb1d644cc..a43732ab742d 100644 --- a/dhctl/go.mod +++ b/dhctl/go.mod @@ -6,6 +6,7 @@ require ( github.com/BurntSushi/toml v1.3.2 github.com/Masterminds/semver/v3 v3.2.1 github.com/Masterminds/sprig/v3 v3.2.3 + github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d github.com/alessio/shellescape v1.4.1 github.com/deckhouse/deckhouse/go_lib/registry-packages-proxy v0.0.0-00010101000000-000000000000 github.com/flant/addon-operator v1.3.12 @@ -30,7 +31,6 @@ require ( github.com/werf/logboek v0.5.5 go.cypherpunks.ru/gogost/v5 v5.13.0 golang.org/x/crypto v0.21.0 - golang.org/x/sync v0.6.0 golang.org/x/term v0.18.0 google.golang.org/grpc v1.63.0 google.golang.org/protobuf v1.33.0 @@ -111,6 +111,7 @@ require ( go.mongodb.org/mongo-driver v1.5.4 // indirect golang.org/x/net v0.23.0 // indirect golang.org/x/oauth2 v0.17.0 // indirect + golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect diff --git a/dhctl/go.sum b/dhctl/go.sum index 23b896fdfeb2..4e349a1dd24b 100644 --- a/dhctl/go.sum +++ b/dhctl/go.sum @@ -13,6 +13,8 @@ github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBa github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= +github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/alecthomas/kingpin v1.3.8-0.20200323085623-b6657d9477a6 h1:nesv3dEn8GDv0ZMxkoCSvrxOE5KbzXXHtWEqJvYA/gw= github.com/alecthomas/kingpin v1.3.8-0.20200323085623-b6657d9477a6/go.mod h1:b6br6/pDFSfMkBgC96TbpOji05q5pa+v5rIlS0Y6XtI= diff --git a/dhctl/pkg/server/api/dhctl/abort.proto b/dhctl/pkg/server/api/dhctl/abort.proto new file mode 100644 index 000000000000..12f03ef13e34 --- /dev/null +++ b/dhctl/pkg/server/api/dhctl/abort.proto @@ -0,0 +1,72 @@ +// Copyright 2024 Flant JSC +// +// 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. + +syntax = "proto3"; + +option go_package = "pb/dhctl"; + +package dhctl; + +import "google/protobuf/duration.proto"; +import "common.proto"; + +message AbortRequest { + oneof message { + AbortStart start = 1; + AbortContinue continue = 2; + } +} + +message AbortResponse { + oneof message { + AbortResult result = 1; + AbortPhaseEnd phase_end = 2; + Logs logs = 3; + } +} + +message AbortStart { + string connection_config = 1; + string init_config = 2; + string cluster_config = 3; + string provider_specific_cluster_config = 4; + string init_resources = 5; + string resources = 6; + string state = 7; + AbortStartOptions options = 8; +} + +message AbortPhaseEnd { + string completed_phase = 1; + map completed_phase_state = 2; + string next_phase = 3; + bool next_phase_critical = 4; +} + +message AbortContinue { + Continue continue = 1; + string err = 2; +} + +message AbortStartOptions { + bool commander_mode = 1; + int32 log_width = 2; + google.protobuf.Duration resources_timeout = 3; + google.protobuf.Duration deckhouse_timeout = 4; +} + +message AbortResult { + string state = 1; + string err = 2; +} diff --git a/dhctl/pkg/server/api/dhctl/bootstrap.proto b/dhctl/pkg/server/api/dhctl/bootstrap.proto index f8834be96cec..fff94feb4295 100644 --- a/dhctl/pkg/server/api/dhctl/bootstrap.proto +++ b/dhctl/pkg/server/api/dhctl/bootstrap.proto @@ -21,12 +21,10 @@ package dhctl; import "google/protobuf/duration.proto"; import "common.proto"; - message BootstrapRequest { oneof message { BootstrapStart start = 1; - BootstrapStop stop = 2; - BootstrapContinue continue = 3; + BootstrapContinue continue = 2; } } @@ -50,8 +48,6 @@ message BootstrapStart { BootstrapStartOptions options = 9; } -message BootstrapStop {} - message BootstrapPhaseEnd { string completed_phase = 1; map completed_phase_state = 2; @@ -60,17 +56,18 @@ message BootstrapPhaseEnd { } message BootstrapContinue { - string error = 1; + Continue continue = 1; + string err = 2; } message BootstrapStartOptions { bool commander_mode = 1; - bool sanity_check = 2; - int32 log_width = 3; - google.protobuf.Duration resources_timeout = 4; - google.protobuf.Duration deckhouse_timeout = 5; + int32 log_width = 2; + google.protobuf.Duration resources_timeout = 3; + google.protobuf.Duration deckhouse_timeout = 4; } message BootstrapResult { string state = 1; + string err = 2; } diff --git a/dhctl/pkg/server/api/dhctl/check.proto b/dhctl/pkg/server/api/dhctl/check.proto index 4d65bd9cef63..19590a7c51bd 100644 --- a/dhctl/pkg/server/api/dhctl/check.proto +++ b/dhctl/pkg/server/api/dhctl/check.proto @@ -24,7 +24,6 @@ import "common.proto"; message CheckRequest { oneof message { CheckStart start = 1; - CheckStop stop = 2; } } @@ -43,16 +42,14 @@ message CheckStart { CheckStartOptions options = 5; } -message CheckStop {} - message CheckStartOptions { bool commander_mode = 1; - bool sanity_check = 2; - int32 log_width = 3; - google.protobuf.Duration resources_timeout = 4; - google.protobuf.Duration deckhouse_timeout = 5; + int32 log_width = 2; + google.protobuf.Duration resources_timeout = 3; + google.protobuf.Duration deckhouse_timeout = 4; } message CheckResult { string result = 1; + string err = 2; } diff --git a/dhctl/pkg/server/api/dhctl/common.proto b/dhctl/pkg/server/api/dhctl/common.proto index fc2f76edfca0..2c7fbd9d49c7 100644 --- a/dhctl/pkg/server/api/dhctl/common.proto +++ b/dhctl/pkg/server/api/dhctl/common.proto @@ -18,6 +18,13 @@ option go_package = "pb/dhctl"; package dhctl; +enum Continue { + CONTINUE_UNSPECIFIED = 0; + CONTINUE_NEXT_PHASE = 1; + CONTINUE_STOP_OPERATION = 2; + CONTINUE_ERROR = 3; +} + message Logs { - bytes logs = 1; + repeated string logs = 1; } diff --git a/dhctl/pkg/server/api/dhctl/converge.proto b/dhctl/pkg/server/api/dhctl/converge.proto new file mode 100644 index 000000000000..c9dcec6fe2b8 --- /dev/null +++ b/dhctl/pkg/server/api/dhctl/converge.proto @@ -0,0 +1,71 @@ +// Copyright 2024 Flant JSC +// +// 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. + +syntax = "proto3"; + +option go_package = "pb/dhctl"; + +package dhctl; + +import "google/protobuf/duration.proto"; +import "common.proto"; + +message ConvergeRequest { + oneof message { + ConvergeStart start = 1; + ConvergeContinue continue = 2; + } +} + +message ConvergeResponse { + oneof message { + ConvergeResult result = 1; + ConvergePhaseEnd phase_end = 2; + Logs logs = 3; + } +} + +message ConvergeStart { + string connection_config = 1; + string cluster_config = 2; + string provider_specific_cluster_config = 3; + string state = 4; + string approve_destruction_change_id = 5; + ConvergeStartOptions options = 6; +} + +message ConvergePhaseEnd { + string completed_phase = 1; + map completed_phase_state = 2; + string next_phase = 3; + bool next_phase_critical = 4; +} + +message ConvergeContinue { + Continue continue = 1; + string err = 2; +} + +message ConvergeStartOptions { + bool commander_mode = 1; + int32 log_width = 2; + google.protobuf.Duration resources_timeout = 3; + google.protobuf.Duration deckhouse_timeout = 4; +} + +message ConvergeResult { + string state = 1; + string result = 2; + string err = 3; +} diff --git a/dhctl/pkg/server/api/dhctl/destroy.proto b/dhctl/pkg/server/api/dhctl/destroy.proto new file mode 100644 index 000000000000..0cf0e1470536 --- /dev/null +++ b/dhctl/pkg/server/api/dhctl/destroy.proto @@ -0,0 +1,70 @@ +// Copyright 2024 Flant JSC +// +// 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. + +syntax = "proto3"; + +option go_package = "pb/dhctl"; + +package dhctl; + +import "google/protobuf/duration.proto"; +import "common.proto"; + +message DestroyRequest { + oneof message { + DestroyStart start = 1; + DestroyContinue continue = 2; + } +} + +message DestroyResponse { + oneof message { + DestroyResult result = 1; + DestroyPhaseEnd phase_end = 2; + Logs logs = 3; + } +} + +message DestroyStart { + string connection_config = 1; + string init_config = 2; + string cluster_config = 3; + string provider_specific_cluster_config = 4; + string state = 5; + DestroyStartOptions options = 6; +} + +message DestroyPhaseEnd { + string completed_phase = 1; + map completed_phase_state = 2; + string next_phase = 3; + bool next_phase_critical = 4; +} + +message DestroyContinue { + Continue continue = 1; + string err = 2; +} + +message DestroyStartOptions { + bool commander_mode = 1; + int32 log_width = 2; + google.protobuf.Duration resources_timeout = 3; + google.protobuf.Duration deckhouse_timeout = 4; +} + +message DestroyResult { + string state = 1; + string err = 2; +} diff --git a/dhctl/pkg/server/api/dhctl/dhctl.proto b/dhctl/pkg/server/api/dhctl/dhctl.proto index 9f6838ab1b5b..1e2560ae39e9 100644 --- a/dhctl/pkg/server/api/dhctl/dhctl.proto +++ b/dhctl/pkg/server/api/dhctl/dhctl.proto @@ -20,8 +20,16 @@ package dhctl; import "check.proto"; import "bootstrap.proto"; +import "destroy.proto"; +import "abort.proto"; +import "converge.proto"; +import "import.proto"; service DHCTL { rpc Check (stream CheckRequest) returns (stream CheckResponse) {} rpc Bootstrap (stream BootstrapRequest) returns (stream BootstrapResponse) {} + rpc Destroy (stream DestroyRequest) returns (stream DestroyResponse) {} + rpc Abort (stream AbortRequest) returns (stream AbortResponse) {} + rpc Converge (stream ConvergeRequest) returns (stream ConvergeResponse) {} + rpc Import (stream ImportRequest) returns (stream ImportResponse) {} } diff --git a/dhctl/pkg/server/api/dhctl/import.proto b/dhctl/pkg/server/api/dhctl/import.proto new file mode 100644 index 000000000000..2b2a8cece855 --- /dev/null +++ b/dhctl/pkg/server/api/dhctl/import.proto @@ -0,0 +1,72 @@ +// Copyright 2024 Flant JSC +// +// 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. + +syntax = "proto3"; + +option go_package = "pb/dhctl"; + +package dhctl; + +import "google/protobuf/duration.proto"; +import "google/protobuf/struct.proto"; +import "common.proto"; + +message ImportRequest { + oneof message { + ImportStart start = 1; + ImportContinue continue = 2; + } +} + +message ImportResponse { + oneof message { + ImportResult result = 1; + ImportPhaseEnd phase_end = 2; + Logs logs = 3; + } +} + +message ImportStart { + string connection_config = 1; + optional bool scan_only = 2; + string resources_template = 3; + google.protobuf.Struct resources_values = 4; + ImportStartOptions options = 5; +} + +message ImportPhaseEnd { + string completed_phase = 1; + map completed_phase_state = 2; + string completed_phase_data = 3; + string next_phase = 4; + bool next_phase_critical = 5; +} + +message ImportContinue { + Continue continue = 1; + string err = 2; +} + +message ImportStartOptions { + bool commander_mode = 1; + int32 log_width = 2; + google.protobuf.Duration resources_timeout = 3; + google.protobuf.Duration deckhouse_timeout = 4; +} + +message ImportResult { + string state = 1; + string result = 2; + string err = 3; +} diff --git a/dhctl/pkg/server/interceptors/interceptors.go b/dhctl/pkg/server/interceptors/interceptors.go deleted file mode 100644 index 92918e3e2808..000000000000 --- a/dhctl/pkg/server/interceptors/interceptors.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2024 Flant JSC -// -// 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 interceptors - -import ( - "context" - "log/slog" - "runtime/debug" - "strings" - "sync" - "time" - - "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/deckhouse/deckhouse/dhctl/pkg/app" - dhctllog "github.com/deckhouse/deckhouse/dhctl/pkg/log" - "github.com/deckhouse/deckhouse/dhctl/pkg/util/tomb" -) - -func PanicRecoveryHandler(log *slog.Logger) func(p any) error { - return func(p any) error { - log.Error( - "recovered from panic", - slog.Any("panic", p), - slog.Any("stack", string(debug.Stack())), - ) - return status.Errorf(codes.Internal, "%s", p) - } -} - -func Logger(log *slog.Logger) logging.Logger { - return logging.LoggerFunc(func(ctx context.Context, lvl logging.Level, msg string, fields ...any) { - log.Log(ctx, slog.Level(lvl), msg, fields...) - }) -} - -func UnaryParallelTasksLimiter(sem chan struct{}, log *slog.Logger) grpc.UnaryServerInterceptor { - return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) { - log.Info("limiter", slog.Int("concurrent_tasks", len(sem))) - timeout := time.After(5 * time.Minute) - select { - case <-timeout: - return nil, status.Error(codes.ResourceExhausted, "ResourceExhausted") - case sem <- struct{}{}: - defer func() { - <-sem - log.Info("limiter", slog.Int("concurrent_tasks", len(sem))) - }() - - return handler(ctx, req) - } - } -} - -func StreamParallelTasksLimiter(sem chan struct{}, log *slog.Logger) grpc.StreamServerInterceptor { - return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - log.Info("limiter", slog.Int("concurrent_tasks", len(sem))) - timeout := time.After(5 * time.Minute) - select { - case <-timeout: - return status.Error(codes.ResourceExhausted, "ResourceExhausted") - case sem <- struct{}{}: - defer func() { - <-sem - log.Info("limiter", slog.Int("concurrent_tasks", len(sem))) - }() - - return handler(srv, ss) - } - } -} - -func UnaryServerSinglefligt(m *sync.Mutex, log *slog.Logger) grpc.UnaryServerInterceptor { - return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { - if !strings.Contains(info.FullMethod, "dhctl") { - return handler(ctx, req) - } - - log.Info("global lock acquired", slog.String("method", info.FullMethod)) - locked := m.TryLock() - if !locked { - return nil, status.Error(codes.ResourceExhausted, "one dhctl operation has already started") - } - defer func() { - rollbackAppVars() - tomb.Shutdown(0) - m.Unlock() - log.Info("global lock released", slog.String("method", info.FullMethod)) - }() - return handler(ctx, req) - } -} - -func StreamServerSinglefligt(m *sync.Mutex, log *slog.Logger) grpc.StreamServerInterceptor { - return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - if !strings.Contains(info.FullMethod, "dhctl") { - return handler(srv, ss) - } - - log.Info("global lock acquired", slog.String("method", info.FullMethod)) - locked := m.TryLock() - if !locked { - return status.Error(codes.ResourceExhausted, "one dhctl operation has already started") - } - defer func() { - rollbackAppVars() - tomb.Shutdown(0) - m.Unlock() - log.Info("global lock released", slog.String("method", info.FullMethod)) - }() - return handler(srv, ss) - } -} - -func rollbackAppVars() { - dhctllog.InitLoggerWithOptions("silent", dhctllog.LoggerOptions{}) - - app.SanityCheck = false - app.UseTfCache = "ask" - app.ResourcesTimeout = 15 * time.Minute - app.DeckhouseTimeout = 15 * time.Minute - app.PreflightSkipDeckhouseVersionCheck = false - app.PreflightSkipAll = false -} diff --git a/dhctl/pkg/server/pb/dhctl/abort.pb.go b/dhctl/pkg/server/pb/dhctl/abort.pb.go new file mode 100644 index 000000000000..0cc9eebaa04d --- /dev/null +++ b/dhctl/pkg/server/pb/dhctl/abort.pb.go @@ -0,0 +1,825 @@ +// Copyright 2024 Flant JSC +// +// 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.2 +// source: abort.proto + +package dhctl + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + durationpb "google.golang.org/protobuf/types/known/durationpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AbortRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // + // *AbortRequest_Start + // *AbortRequest_Continue + Message isAbortRequest_Message `protobuf_oneof:"message"` +} + +func (x *AbortRequest) Reset() { + *x = AbortRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_abort_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AbortRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AbortRequest) ProtoMessage() {} + +func (x *AbortRequest) ProtoReflect() protoreflect.Message { + mi := &file_abort_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AbortRequest.ProtoReflect.Descriptor instead. +func (*AbortRequest) Descriptor() ([]byte, []int) { + return file_abort_proto_rawDescGZIP(), []int{0} +} + +func (m *AbortRequest) GetMessage() isAbortRequest_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *AbortRequest) GetStart() *AbortStart { + if x, ok := x.GetMessage().(*AbortRequest_Start); ok { + return x.Start + } + return nil +} + +func (x *AbortRequest) GetContinue() *AbortContinue { + if x, ok := x.GetMessage().(*AbortRequest_Continue); ok { + return x.Continue + } + return nil +} + +type isAbortRequest_Message interface { + isAbortRequest_Message() +} + +type AbortRequest_Start struct { + Start *AbortStart `protobuf:"bytes,1,opt,name=start,proto3,oneof"` +} + +type AbortRequest_Continue struct { + Continue *AbortContinue `protobuf:"bytes,2,opt,name=continue,proto3,oneof"` +} + +func (*AbortRequest_Start) isAbortRequest_Message() {} + +func (*AbortRequest_Continue) isAbortRequest_Message() {} + +type AbortResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // + // *AbortResponse_Result + // *AbortResponse_PhaseEnd + // *AbortResponse_Logs + Message isAbortResponse_Message `protobuf_oneof:"message"` +} + +func (x *AbortResponse) Reset() { + *x = AbortResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_abort_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AbortResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AbortResponse) ProtoMessage() {} + +func (x *AbortResponse) ProtoReflect() protoreflect.Message { + mi := &file_abort_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AbortResponse.ProtoReflect.Descriptor instead. +func (*AbortResponse) Descriptor() ([]byte, []int) { + return file_abort_proto_rawDescGZIP(), []int{1} +} + +func (m *AbortResponse) GetMessage() isAbortResponse_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *AbortResponse) GetResult() *AbortResult { + if x, ok := x.GetMessage().(*AbortResponse_Result); ok { + return x.Result + } + return nil +} + +func (x *AbortResponse) GetPhaseEnd() *AbortPhaseEnd { + if x, ok := x.GetMessage().(*AbortResponse_PhaseEnd); ok { + return x.PhaseEnd + } + return nil +} + +func (x *AbortResponse) GetLogs() *Logs { + if x, ok := x.GetMessage().(*AbortResponse_Logs); ok { + return x.Logs + } + return nil +} + +type isAbortResponse_Message interface { + isAbortResponse_Message() +} + +type AbortResponse_Result struct { + Result *AbortResult `protobuf:"bytes,1,opt,name=result,proto3,oneof"` +} + +type AbortResponse_PhaseEnd struct { + PhaseEnd *AbortPhaseEnd `protobuf:"bytes,2,opt,name=phase_end,json=phaseEnd,proto3,oneof"` +} + +type AbortResponse_Logs struct { + Logs *Logs `protobuf:"bytes,3,opt,name=logs,proto3,oneof"` +} + +func (*AbortResponse_Result) isAbortResponse_Message() {} + +func (*AbortResponse_PhaseEnd) isAbortResponse_Message() {} + +func (*AbortResponse_Logs) isAbortResponse_Message() {} + +type AbortStart struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConnectionConfig string `protobuf:"bytes,1,opt,name=connection_config,json=connectionConfig,proto3" json:"connection_config,omitempty"` + InitConfig string `protobuf:"bytes,2,opt,name=init_config,json=initConfig,proto3" json:"init_config,omitempty"` + ClusterConfig string `protobuf:"bytes,3,opt,name=cluster_config,json=clusterConfig,proto3" json:"cluster_config,omitempty"` + ProviderSpecificClusterConfig string `protobuf:"bytes,4,opt,name=provider_specific_cluster_config,json=providerSpecificClusterConfig,proto3" json:"provider_specific_cluster_config,omitempty"` + InitResources string `protobuf:"bytes,5,opt,name=init_resources,json=initResources,proto3" json:"init_resources,omitempty"` + Resources string `protobuf:"bytes,6,opt,name=resources,proto3" json:"resources,omitempty"` + State string `protobuf:"bytes,7,opt,name=state,proto3" json:"state,omitempty"` + Options *AbortStartOptions `protobuf:"bytes,8,opt,name=options,proto3" json:"options,omitempty"` +} + +func (x *AbortStart) Reset() { + *x = AbortStart{} + if protoimpl.UnsafeEnabled { + mi := &file_abort_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AbortStart) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AbortStart) ProtoMessage() {} + +func (x *AbortStart) ProtoReflect() protoreflect.Message { + mi := &file_abort_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AbortStart.ProtoReflect.Descriptor instead. +func (*AbortStart) Descriptor() ([]byte, []int) { + return file_abort_proto_rawDescGZIP(), []int{2} +} + +func (x *AbortStart) GetConnectionConfig() string { + if x != nil { + return x.ConnectionConfig + } + return "" +} + +func (x *AbortStart) GetInitConfig() string { + if x != nil { + return x.InitConfig + } + return "" +} + +func (x *AbortStart) GetClusterConfig() string { + if x != nil { + return x.ClusterConfig + } + return "" +} + +func (x *AbortStart) GetProviderSpecificClusterConfig() string { + if x != nil { + return x.ProviderSpecificClusterConfig + } + return "" +} + +func (x *AbortStart) GetInitResources() string { + if x != nil { + return x.InitResources + } + return "" +} + +func (x *AbortStart) GetResources() string { + if x != nil { + return x.Resources + } + return "" +} + +func (x *AbortStart) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *AbortStart) GetOptions() *AbortStartOptions { + if x != nil { + return x.Options + } + return nil +} + +type AbortPhaseEnd struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CompletedPhase string `protobuf:"bytes,1,opt,name=completed_phase,json=completedPhase,proto3" json:"completed_phase,omitempty"` + CompletedPhaseState map[string][]byte `protobuf:"bytes,2,rep,name=completed_phase_state,json=completedPhaseState,proto3" json:"completed_phase_state,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + NextPhase string `protobuf:"bytes,3,opt,name=next_phase,json=nextPhase,proto3" json:"next_phase,omitempty"` + NextPhaseCritical bool `protobuf:"varint,4,opt,name=next_phase_critical,json=nextPhaseCritical,proto3" json:"next_phase_critical,omitempty"` +} + +func (x *AbortPhaseEnd) Reset() { + *x = AbortPhaseEnd{} + if protoimpl.UnsafeEnabled { + mi := &file_abort_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AbortPhaseEnd) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AbortPhaseEnd) ProtoMessage() {} + +func (x *AbortPhaseEnd) ProtoReflect() protoreflect.Message { + mi := &file_abort_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AbortPhaseEnd.ProtoReflect.Descriptor instead. +func (*AbortPhaseEnd) Descriptor() ([]byte, []int) { + return file_abort_proto_rawDescGZIP(), []int{3} +} + +func (x *AbortPhaseEnd) GetCompletedPhase() string { + if x != nil { + return x.CompletedPhase + } + return "" +} + +func (x *AbortPhaseEnd) GetCompletedPhaseState() map[string][]byte { + if x != nil { + return x.CompletedPhaseState + } + return nil +} + +func (x *AbortPhaseEnd) GetNextPhase() string { + if x != nil { + return x.NextPhase + } + return "" +} + +func (x *AbortPhaseEnd) GetNextPhaseCritical() bool { + if x != nil { + return x.NextPhaseCritical + } + return false +} + +type AbortContinue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Continue Continue `protobuf:"varint,1,opt,name=continue,proto3,enum=dhctl.Continue" json:"continue,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` +} + +func (x *AbortContinue) Reset() { + *x = AbortContinue{} + if protoimpl.UnsafeEnabled { + mi := &file_abort_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AbortContinue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AbortContinue) ProtoMessage() {} + +func (x *AbortContinue) ProtoReflect() protoreflect.Message { + mi := &file_abort_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AbortContinue.ProtoReflect.Descriptor instead. +func (*AbortContinue) Descriptor() ([]byte, []int) { + return file_abort_proto_rawDescGZIP(), []int{4} +} + +func (x *AbortContinue) GetContinue() Continue { + if x != nil { + return x.Continue + } + return Continue_CONTINUE_UNSPECIFIED +} + +func (x *AbortContinue) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + +type AbortStartOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CommanderMode bool `protobuf:"varint,1,opt,name=commander_mode,json=commanderMode,proto3" json:"commander_mode,omitempty"` + LogWidth int32 `protobuf:"varint,2,opt,name=log_width,json=logWidth,proto3" json:"log_width,omitempty"` + ResourcesTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=resources_timeout,json=resourcesTimeout,proto3" json:"resources_timeout,omitempty"` + DeckhouseTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=deckhouse_timeout,json=deckhouseTimeout,proto3" json:"deckhouse_timeout,omitempty"` +} + +func (x *AbortStartOptions) Reset() { + *x = AbortStartOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_abort_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AbortStartOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AbortStartOptions) ProtoMessage() {} + +func (x *AbortStartOptions) ProtoReflect() protoreflect.Message { + mi := &file_abort_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AbortStartOptions.ProtoReflect.Descriptor instead. +func (*AbortStartOptions) Descriptor() ([]byte, []int) { + return file_abort_proto_rawDescGZIP(), []int{5} +} + +func (x *AbortStartOptions) GetCommanderMode() bool { + if x != nil { + return x.CommanderMode + } + return false +} + +func (x *AbortStartOptions) GetLogWidth() int32 { + if x != nil { + return x.LogWidth + } + return 0 +} + +func (x *AbortStartOptions) GetResourcesTimeout() *durationpb.Duration { + if x != nil { + return x.ResourcesTimeout + } + return nil +} + +func (x *AbortStartOptions) GetDeckhouseTimeout() *durationpb.Duration { + if x != nil { + return x.DeckhouseTimeout + } + return nil +} + +type AbortResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` +} + +func (x *AbortResult) Reset() { + *x = AbortResult{} + if protoimpl.UnsafeEnabled { + mi := &file_abort_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AbortResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AbortResult) ProtoMessage() {} + +func (x *AbortResult) ProtoReflect() protoreflect.Message { + mi := &file_abort_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AbortResult.ProtoReflect.Descriptor instead. +func (*AbortResult) Descriptor() ([]byte, []int) { + return file_abort_proto_rawDescGZIP(), []int{6} +} + +func (x *AbortResult) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *AbortResult) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + +var File_abort_proto protoreflect.FileDescriptor + +var file_abort_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x61, 0x62, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x64, + 0x68, 0x63, 0x74, 0x6c, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x78, 0x0a, 0x0c, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x29, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x32, 0x0a, + 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x6e, + 0x74, 0x69, 0x6e, 0x75, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, + 0x65, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xa0, 0x01, 0x0a, + 0x0d, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, + 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x33, 0x0a, 0x09, + 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x50, 0x68, 0x61, + 0x73, 0x65, 0x45, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x08, 0x70, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, + 0x64, 0x12, 0x21, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0b, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x48, 0x00, 0x52, 0x04, + 0x6c, 0x6f, 0x67, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, + 0xd9, 0x02, 0x0a, 0x0a, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x2b, + 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x69, + 0x6e, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, 0x0e, + 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x12, 0x47, 0x0a, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1d, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x43, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, 0x0e, + 0x69, 0x6e, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, + 0x2e, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb2, 0x02, 0x0a, 0x0d, + 0x41, 0x62, 0x6f, 0x72, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x27, 0x0a, + 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, + 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, + 0x74, 0x65, 0x64, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x41, 0x62, + 0x6f, 0x72, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x70, + 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, + 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, 0x78, + 0x74, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, + 0x65, 0x78, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x6e, 0x65, 0x78, 0x74, + 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, + 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x1a, 0x46, 0x0a, 0x18, 0x43, 0x6f, 0x6d, 0x70, + 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x22, 0x4e, 0x0a, 0x0d, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, + 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x74, + 0x69, 0x6e, 0x75, 0x65, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x72, 0x72, + 0x22, 0xe7, 0x01, 0x0a, 0x11, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x65, 0x72, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, + 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, + 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x46, 0x0a, 0x11, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x6f, + 0x75, 0x74, 0x12, 0x46, 0x0a, 0x11, 0x64, 0x65, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x64, 0x65, 0x63, 0x6b, 0x68, 0x6f, + 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x35, 0x0a, 0x0b, 0x41, 0x62, + 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x10, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x72, + 0x72, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x62, 0x2f, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_abort_proto_rawDescOnce sync.Once + file_abort_proto_rawDescData = file_abort_proto_rawDesc +) + +func file_abort_proto_rawDescGZIP() []byte { + file_abort_proto_rawDescOnce.Do(func() { + file_abort_proto_rawDescData = protoimpl.X.CompressGZIP(file_abort_proto_rawDescData) + }) + return file_abort_proto_rawDescData +} + +var file_abort_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_abort_proto_goTypes = []interface{}{ + (*AbortRequest)(nil), // 0: dhctl.AbortRequest + (*AbortResponse)(nil), // 1: dhctl.AbortResponse + (*AbortStart)(nil), // 2: dhctl.AbortStart + (*AbortPhaseEnd)(nil), // 3: dhctl.AbortPhaseEnd + (*AbortContinue)(nil), // 4: dhctl.AbortContinue + (*AbortStartOptions)(nil), // 5: dhctl.AbortStartOptions + (*AbortResult)(nil), // 6: dhctl.AbortResult + nil, // 7: dhctl.AbortPhaseEnd.CompletedPhaseStateEntry + (*Logs)(nil), // 8: dhctl.Logs + (Continue)(0), // 9: dhctl.Continue + (*durationpb.Duration)(nil), // 10: google.protobuf.Duration +} +var file_abort_proto_depIdxs = []int32{ + 2, // 0: dhctl.AbortRequest.start:type_name -> dhctl.AbortStart + 4, // 1: dhctl.AbortRequest.continue:type_name -> dhctl.AbortContinue + 6, // 2: dhctl.AbortResponse.result:type_name -> dhctl.AbortResult + 3, // 3: dhctl.AbortResponse.phase_end:type_name -> dhctl.AbortPhaseEnd + 8, // 4: dhctl.AbortResponse.logs:type_name -> dhctl.Logs + 5, // 5: dhctl.AbortStart.options:type_name -> dhctl.AbortStartOptions + 7, // 6: dhctl.AbortPhaseEnd.completed_phase_state:type_name -> dhctl.AbortPhaseEnd.CompletedPhaseStateEntry + 9, // 7: dhctl.AbortContinue.continue:type_name -> dhctl.Continue + 10, // 8: dhctl.AbortStartOptions.resources_timeout:type_name -> google.protobuf.Duration + 10, // 9: dhctl.AbortStartOptions.deckhouse_timeout:type_name -> google.protobuf.Duration + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_abort_proto_init() } +func file_abort_proto_init() { + if File_abort_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_abort_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AbortRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_abort_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AbortResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_abort_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AbortStart); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_abort_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AbortPhaseEnd); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_abort_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AbortContinue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_abort_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AbortStartOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_abort_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AbortResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_abort_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*AbortRequest_Start)(nil), + (*AbortRequest_Continue)(nil), + } + file_abort_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*AbortResponse_Result)(nil), + (*AbortResponse_PhaseEnd)(nil), + (*AbortResponse_Logs)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_abort_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_abort_proto_goTypes, + DependencyIndexes: file_abort_proto_depIdxs, + MessageInfos: file_abort_proto_msgTypes, + }.Build() + File_abort_proto = out.File + file_abort_proto_rawDesc = nil + file_abort_proto_goTypes = nil + file_abort_proto_depIdxs = nil +} diff --git a/dhctl/pkg/server/pb/dhctl/bootstrap.pb.go b/dhctl/pkg/server/pb/dhctl/bootstrap.pb.go index 2dad5effe279..86b10d999670 100644 --- a/dhctl/pkg/server/pb/dhctl/bootstrap.pb.go +++ b/dhctl/pkg/server/pb/dhctl/bootstrap.pb.go @@ -43,7 +43,6 @@ type BootstrapRequest struct { // Types that are assignable to Message: // // *BootstrapRequest_Start - // *BootstrapRequest_Stop // *BootstrapRequest_Continue Message isBootstrapRequest_Message `protobuf_oneof:"message"` } @@ -94,13 +93,6 @@ func (x *BootstrapRequest) GetStart() *BootstrapStart { return nil } -func (x *BootstrapRequest) GetStop() *BootstrapStop { - if x, ok := x.GetMessage().(*BootstrapRequest_Stop); ok { - return x.Stop - } - return nil -} - func (x *BootstrapRequest) GetContinue() *BootstrapContinue { if x, ok := x.GetMessage().(*BootstrapRequest_Continue); ok { return x.Continue @@ -116,18 +108,12 @@ type BootstrapRequest_Start struct { Start *BootstrapStart `protobuf:"bytes,1,opt,name=start,proto3,oneof"` } -type BootstrapRequest_Stop struct { - Stop *BootstrapStop `protobuf:"bytes,2,opt,name=stop,proto3,oneof"` -} - type BootstrapRequest_Continue struct { - Continue *BootstrapContinue `protobuf:"bytes,3,opt,name=continue,proto3,oneof"` + Continue *BootstrapContinue `protobuf:"bytes,2,opt,name=continue,proto3,oneof"` } func (*BootstrapRequest_Start) isBootstrapRequest_Message() {} -func (*BootstrapRequest_Stop) isBootstrapRequest_Message() {} - func (*BootstrapRequest_Continue) isBootstrapRequest_Message() {} type BootstrapResponse struct { @@ -336,44 +322,6 @@ func (x *BootstrapStart) GetOptions() *BootstrapStartOptions { return nil } -type BootstrapStop struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *BootstrapStop) Reset() { - *x = BootstrapStop{} - if protoimpl.UnsafeEnabled { - mi := &file_bootstrap_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BootstrapStop) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BootstrapStop) ProtoMessage() {} - -func (x *BootstrapStop) ProtoReflect() protoreflect.Message { - mi := &file_bootstrap_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BootstrapStop.ProtoReflect.Descriptor instead. -func (*BootstrapStop) Descriptor() ([]byte, []int) { - return file_bootstrap_proto_rawDescGZIP(), []int{3} -} - type BootstrapPhaseEnd struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -388,7 +336,7 @@ type BootstrapPhaseEnd struct { func (x *BootstrapPhaseEnd) Reset() { *x = BootstrapPhaseEnd{} if protoimpl.UnsafeEnabled { - mi := &file_bootstrap_proto_msgTypes[4] + mi := &file_bootstrap_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -401,7 +349,7 @@ func (x *BootstrapPhaseEnd) String() string { func (*BootstrapPhaseEnd) ProtoMessage() {} func (x *BootstrapPhaseEnd) ProtoReflect() protoreflect.Message { - mi := &file_bootstrap_proto_msgTypes[4] + mi := &file_bootstrap_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -414,7 +362,7 @@ func (x *BootstrapPhaseEnd) ProtoReflect() protoreflect.Message { // Deprecated: Use BootstrapPhaseEnd.ProtoReflect.Descriptor instead. func (*BootstrapPhaseEnd) Descriptor() ([]byte, []int) { - return file_bootstrap_proto_rawDescGZIP(), []int{4} + return file_bootstrap_proto_rawDescGZIP(), []int{3} } func (x *BootstrapPhaseEnd) GetCompletedPhase() string { @@ -450,13 +398,14 @@ type BootstrapContinue struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + Continue Continue `protobuf:"varint,1,opt,name=continue,proto3,enum=dhctl.Continue" json:"continue,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` } func (x *BootstrapContinue) Reset() { *x = BootstrapContinue{} if protoimpl.UnsafeEnabled { - mi := &file_bootstrap_proto_msgTypes[5] + mi := &file_bootstrap_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -469,7 +418,7 @@ func (x *BootstrapContinue) String() string { func (*BootstrapContinue) ProtoMessage() {} func (x *BootstrapContinue) ProtoReflect() protoreflect.Message { - mi := &file_bootstrap_proto_msgTypes[5] + mi := &file_bootstrap_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -482,12 +431,19 @@ func (x *BootstrapContinue) ProtoReflect() protoreflect.Message { // Deprecated: Use BootstrapContinue.ProtoReflect.Descriptor instead. func (*BootstrapContinue) Descriptor() ([]byte, []int) { - return file_bootstrap_proto_rawDescGZIP(), []int{5} + return file_bootstrap_proto_rawDescGZIP(), []int{4} } -func (x *BootstrapContinue) GetError() string { +func (x *BootstrapContinue) GetContinue() Continue { if x != nil { - return x.Error + return x.Continue + } + return Continue_CONTINUE_UNSPECIFIED +} + +func (x *BootstrapContinue) GetErr() string { + if x != nil { + return x.Err } return "" } @@ -498,16 +454,15 @@ type BootstrapStartOptions struct { unknownFields protoimpl.UnknownFields CommanderMode bool `protobuf:"varint,1,opt,name=commander_mode,json=commanderMode,proto3" json:"commander_mode,omitempty"` - SanityCheck bool `protobuf:"varint,2,opt,name=sanity_check,json=sanityCheck,proto3" json:"sanity_check,omitempty"` - LogWidth int32 `protobuf:"varint,3,opt,name=log_width,json=logWidth,proto3" json:"log_width,omitempty"` - ResourcesTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=resources_timeout,json=resourcesTimeout,proto3" json:"resources_timeout,omitempty"` - DeckhouseTimeout *durationpb.Duration `protobuf:"bytes,5,opt,name=deckhouse_timeout,json=deckhouseTimeout,proto3" json:"deckhouse_timeout,omitempty"` + LogWidth int32 `protobuf:"varint,2,opt,name=log_width,json=logWidth,proto3" json:"log_width,omitempty"` + ResourcesTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=resources_timeout,json=resourcesTimeout,proto3" json:"resources_timeout,omitempty"` + DeckhouseTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=deckhouse_timeout,json=deckhouseTimeout,proto3" json:"deckhouse_timeout,omitempty"` } func (x *BootstrapStartOptions) Reset() { *x = BootstrapStartOptions{} if protoimpl.UnsafeEnabled { - mi := &file_bootstrap_proto_msgTypes[6] + mi := &file_bootstrap_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -520,7 +475,7 @@ func (x *BootstrapStartOptions) String() string { func (*BootstrapStartOptions) ProtoMessage() {} func (x *BootstrapStartOptions) ProtoReflect() protoreflect.Message { - mi := &file_bootstrap_proto_msgTypes[6] + mi := &file_bootstrap_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -533,7 +488,7 @@ func (x *BootstrapStartOptions) ProtoReflect() protoreflect.Message { // Deprecated: Use BootstrapStartOptions.ProtoReflect.Descriptor instead. func (*BootstrapStartOptions) Descriptor() ([]byte, []int) { - return file_bootstrap_proto_rawDescGZIP(), []int{6} + return file_bootstrap_proto_rawDescGZIP(), []int{5} } func (x *BootstrapStartOptions) GetCommanderMode() bool { @@ -543,13 +498,6 @@ func (x *BootstrapStartOptions) GetCommanderMode() bool { return false } -func (x *BootstrapStartOptions) GetSanityCheck() bool { - if x != nil { - return x.SanityCheck - } - return false -} - func (x *BootstrapStartOptions) GetLogWidth() int32 { if x != nil { return x.LogWidth @@ -577,12 +525,13 @@ type BootstrapResult struct { unknownFields protoimpl.UnknownFields State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` } func (x *BootstrapResult) Reset() { *x = BootstrapResult{} if protoimpl.UnsafeEnabled { - mi := &file_bootstrap_proto_msgTypes[7] + mi := &file_bootstrap_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -595,7 +544,7 @@ func (x *BootstrapResult) String() string { func (*BootstrapResult) ProtoMessage() {} func (x *BootstrapResult) ProtoReflect() protoreflect.Message { - mi := &file_bootstrap_proto_msgTypes[7] + mi := &file_bootstrap_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -608,7 +557,7 @@ func (x *BootstrapResult) ProtoReflect() protoreflect.Message { // Deprecated: Use BootstrapResult.ProtoReflect.Descriptor instead. func (*BootstrapResult) Descriptor() ([]byte, []int) { - return file_bootstrap_proto_rawDescGZIP(), []int{7} + return file_bootstrap_proto_rawDescGZIP(), []int{6} } func (x *BootstrapResult) GetState() string { @@ -618,6 +567,13 @@ func (x *BootstrapResult) GetState() string { return "" } +func (x *BootstrapResult) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + var File_bootstrap_proto protoreflect.FileDescriptor var file_bootstrap_proto_rawDesc = []byte{ @@ -625,99 +581,97 @@ var file_bootstrap_proto_rawDesc = []byte{ 0x6f, 0x12, 0x05, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb0, 0x01, 0x0a, 0x10, 0x42, 0x6f, 0x6f, 0x74, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x84, 0x01, 0x0a, 0x10, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x53, 0x74, 0x61, 0x72, - 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x2a, 0x0a, 0x04, 0x73, 0x74, - 0x6f, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, - 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x53, 0x74, 0x6f, 0x70, 0x48, 0x00, - 0x52, 0x04, 0x73, 0x74, 0x6f, 0x70, 0x12, 0x36, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, - 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, - 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, - 0x75, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x42, 0x09, - 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xac, 0x01, 0x0a, 0x11, 0x42, 0x6f, - 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x30, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x16, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, - 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x12, 0x37, 0x0a, 0x09, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, - 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x48, 0x00, - 0x52, 0x08, 0x70, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x21, 0x0a, 0x04, 0x6c, 0x6f, - 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, - 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x42, 0x09, 0x0a, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x95, 0x03, 0x0a, 0x0e, 0x42, 0x6f, 0x6f, - 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x63, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x69, 0x74, - 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, - 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6c, 0x75, - 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x47, 0x0a, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x63, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1d, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x75, 0x73, - 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x6e, 0x69, - 0x74, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x69, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x14, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x74, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x6f, - 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x13, 0x70, 0x6f, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, - 0x61, 0x70, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x36, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x64, 0x68, 0x63, 0x74, - 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x22, 0x0f, 0x0a, 0x0d, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x53, 0x74, 0x6f, - 0x70, 0x22, 0xba, 0x02, 0x0a, 0x11, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, - 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, - 0x65, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, - 0x12, 0x65, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x68, - 0x61, 0x73, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x31, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, - 0x70, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, - 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x13, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, - 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, 0x78, 0x74, 0x5f, - 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x65, 0x78, - 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, - 0x68, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x43, 0x72, - 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x1a, 0x46, 0x0a, 0x18, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, - 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x29, - 0x0a, 0x11, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x69, - 0x6e, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x8e, 0x02, 0x0a, 0x15, 0x42, 0x6f, - 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, - 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x63, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x61, - 0x6e, 0x69, 0x74, 0x79, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0b, 0x73, 0x61, 0x6e, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1b, 0x0a, - 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x46, 0x0a, 0x11, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x6f, - 0x75, 0x74, 0x12, 0x46, 0x0a, 0x11, 0x64, 0x65, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x5f, - 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x64, 0x65, 0x63, 0x6b, 0x68, 0x6f, - 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x27, 0x0a, 0x0f, 0x42, 0x6f, - 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x62, 0x2f, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x36, 0x0a, 0x08, 0x63, 0x6f, + 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, + 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x43, 0x6f, + 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, + 0x75, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xac, 0x01, + 0x0a, 0x11, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x74, + 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x06, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x37, 0x0a, 0x09, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x65, + 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, + 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, + 0x6e, 0x64, 0x48, 0x00, 0x52, 0x08, 0x70, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x21, + 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x64, + 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x6f, 0x67, + 0x73, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x95, 0x03, 0x0a, + 0x0e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, + 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x0b, + 0x69, 0x6e, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, + 0x0e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x12, 0x47, 0x0a, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1d, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, + 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, + 0x0e, 0x69, 0x6e, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x70, 0x6f, 0x73, 0x74, + 0x5f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x70, 0x6f, 0x73, 0x74, 0x42, 0x6f, 0x6f, + 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x36, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xba, 0x02, 0x0a, 0x11, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, + 0x61, 0x70, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, + 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, + 0x61, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, + 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, + 0x74, 0x72, 0x61, 0x70, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x2e, 0x43, 0x6f, 0x6d, + 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, + 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6e, 0x65, 0x78, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x6e, 0x65, 0x78, + 0x74, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x68, 0x61, 0x73, + 0x65, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x1a, 0x46, 0x0a, 0x18, 0x43, 0x6f, 0x6d, + 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x22, 0x52, 0x0a, 0x11, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x43, 0x6f, + 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, + 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, + 0x6e, 0x75, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x65, 0x72, 0x72, 0x22, 0xeb, 0x01, 0x0a, 0x15, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x6d, 0x6f, 0x64, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x77, 0x69, + 0x64, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x57, 0x69, + 0x64, 0x74, 0x68, 0x12, 0x46, 0x0a, 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x46, 0x0a, 0x11, 0x64, + 0x65, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x10, 0x64, 0x65, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, + 0x6f, 0x75, 0x74, 0x22, 0x39, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, + 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x72, 0x72, 0x42, 0x0a, + 0x5a, 0x08, 0x70, 0x62, 0x2f, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -732,29 +686,29 @@ func file_bootstrap_proto_rawDescGZIP() []byte { return file_bootstrap_proto_rawDescData } -var file_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_bootstrap_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_bootstrap_proto_goTypes = []interface{}{ (*BootstrapRequest)(nil), // 0: dhctl.BootstrapRequest (*BootstrapResponse)(nil), // 1: dhctl.BootstrapResponse (*BootstrapStart)(nil), // 2: dhctl.BootstrapStart - (*BootstrapStop)(nil), // 3: dhctl.BootstrapStop - (*BootstrapPhaseEnd)(nil), // 4: dhctl.BootstrapPhaseEnd - (*BootstrapContinue)(nil), // 5: dhctl.BootstrapContinue - (*BootstrapStartOptions)(nil), // 6: dhctl.BootstrapStartOptions - (*BootstrapResult)(nil), // 7: dhctl.BootstrapResult - nil, // 8: dhctl.BootstrapPhaseEnd.CompletedPhaseStateEntry - (*Logs)(nil), // 9: dhctl.Logs + (*BootstrapPhaseEnd)(nil), // 3: dhctl.BootstrapPhaseEnd + (*BootstrapContinue)(nil), // 4: dhctl.BootstrapContinue + (*BootstrapStartOptions)(nil), // 5: dhctl.BootstrapStartOptions + (*BootstrapResult)(nil), // 6: dhctl.BootstrapResult + nil, // 7: dhctl.BootstrapPhaseEnd.CompletedPhaseStateEntry + (*Logs)(nil), // 8: dhctl.Logs + (Continue)(0), // 9: dhctl.Continue (*durationpb.Duration)(nil), // 10: google.protobuf.Duration } var file_bootstrap_proto_depIdxs = []int32{ 2, // 0: dhctl.BootstrapRequest.start:type_name -> dhctl.BootstrapStart - 3, // 1: dhctl.BootstrapRequest.stop:type_name -> dhctl.BootstrapStop - 5, // 2: dhctl.BootstrapRequest.continue:type_name -> dhctl.BootstrapContinue - 7, // 3: dhctl.BootstrapResponse.result:type_name -> dhctl.BootstrapResult - 4, // 4: dhctl.BootstrapResponse.phase_end:type_name -> dhctl.BootstrapPhaseEnd - 9, // 5: dhctl.BootstrapResponse.logs:type_name -> dhctl.Logs - 6, // 6: dhctl.BootstrapStart.options:type_name -> dhctl.BootstrapStartOptions - 8, // 7: dhctl.BootstrapPhaseEnd.completed_phase_state:type_name -> dhctl.BootstrapPhaseEnd.CompletedPhaseStateEntry + 4, // 1: dhctl.BootstrapRequest.continue:type_name -> dhctl.BootstrapContinue + 6, // 2: dhctl.BootstrapResponse.result:type_name -> dhctl.BootstrapResult + 3, // 3: dhctl.BootstrapResponse.phase_end:type_name -> dhctl.BootstrapPhaseEnd + 8, // 4: dhctl.BootstrapResponse.logs:type_name -> dhctl.Logs + 5, // 5: dhctl.BootstrapStart.options:type_name -> dhctl.BootstrapStartOptions + 7, // 6: dhctl.BootstrapPhaseEnd.completed_phase_state:type_name -> dhctl.BootstrapPhaseEnd.CompletedPhaseStateEntry + 9, // 7: dhctl.BootstrapContinue.continue:type_name -> dhctl.Continue 10, // 8: dhctl.BootstrapStartOptions.resources_timeout:type_name -> google.protobuf.Duration 10, // 9: dhctl.BootstrapStartOptions.deckhouse_timeout:type_name -> google.protobuf.Duration 10, // [10:10] is the sub-list for method output_type @@ -808,18 +762,6 @@ func file_bootstrap_proto_init() { } } file_bootstrap_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BootstrapStop); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_bootstrap_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BootstrapPhaseEnd); i { case 0: return &v.state @@ -831,7 +773,7 @@ func file_bootstrap_proto_init() { return nil } } - file_bootstrap_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_bootstrap_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BootstrapContinue); i { case 0: return &v.state @@ -843,7 +785,7 @@ func file_bootstrap_proto_init() { return nil } } - file_bootstrap_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_bootstrap_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BootstrapStartOptions); i { case 0: return &v.state @@ -855,7 +797,7 @@ func file_bootstrap_proto_init() { return nil } } - file_bootstrap_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_bootstrap_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BootstrapResult); i { case 0: return &v.state @@ -870,7 +812,6 @@ func file_bootstrap_proto_init() { } file_bootstrap_proto_msgTypes[0].OneofWrappers = []interface{}{ (*BootstrapRequest_Start)(nil), - (*BootstrapRequest_Stop)(nil), (*BootstrapRequest_Continue)(nil), } file_bootstrap_proto_msgTypes[1].OneofWrappers = []interface{}{ @@ -884,7 +825,7 @@ func file_bootstrap_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_bootstrap_proto_rawDesc, NumEnums: 0, - NumMessages: 9, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/dhctl/pkg/server/pb/dhctl/check.pb.go b/dhctl/pkg/server/pb/dhctl/check.pb.go index 7b74887030db..99f63542c681 100644 --- a/dhctl/pkg/server/pb/dhctl/check.pb.go +++ b/dhctl/pkg/server/pb/dhctl/check.pb.go @@ -43,7 +43,6 @@ type CheckRequest struct { // Types that are assignable to Message: // // *CheckRequest_Start - // *CheckRequest_Stop Message isCheckRequest_Message `protobuf_oneof:"message"` } @@ -93,13 +92,6 @@ func (x *CheckRequest) GetStart() *CheckStart { return nil } -func (x *CheckRequest) GetStop() *CheckStop { - if x, ok := x.GetMessage().(*CheckRequest_Stop); ok { - return x.Stop - } - return nil -} - type isCheckRequest_Message interface { isCheckRequest_Message() } @@ -108,14 +100,8 @@ type CheckRequest_Start struct { Start *CheckStart `protobuf:"bytes,1,opt,name=start,proto3,oneof"` } -type CheckRequest_Stop struct { - Stop *CheckStop `protobuf:"bytes,2,opt,name=stop,proto3,oneof"` -} - func (*CheckRequest_Start) isCheckRequest_Message() {} -func (*CheckRequest_Stop) isCheckRequest_Message() {} - type CheckResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -276,60 +262,21 @@ func (x *CheckStart) GetOptions() *CheckStartOptions { return nil } -type CheckStop struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *CheckStop) Reset() { - *x = CheckStop{} - if protoimpl.UnsafeEnabled { - mi := &file_check_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CheckStop) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CheckStop) ProtoMessage() {} - -func (x *CheckStop) ProtoReflect() protoreflect.Message { - mi := &file_check_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CheckStop.ProtoReflect.Descriptor instead. -func (*CheckStop) Descriptor() ([]byte, []int) { - return file_check_proto_rawDescGZIP(), []int{3} -} - type CheckStartOptions struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields CommanderMode bool `protobuf:"varint,1,opt,name=commander_mode,json=commanderMode,proto3" json:"commander_mode,omitempty"` - SanityCheck bool `protobuf:"varint,2,opt,name=sanity_check,json=sanityCheck,proto3" json:"sanity_check,omitempty"` - LogWidth int32 `protobuf:"varint,3,opt,name=log_width,json=logWidth,proto3" json:"log_width,omitempty"` - ResourcesTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=resources_timeout,json=resourcesTimeout,proto3" json:"resources_timeout,omitempty"` - DeckhouseTimeout *durationpb.Duration `protobuf:"bytes,5,opt,name=deckhouse_timeout,json=deckhouseTimeout,proto3" json:"deckhouse_timeout,omitempty"` + LogWidth int32 `protobuf:"varint,2,opt,name=log_width,json=logWidth,proto3" json:"log_width,omitempty"` + ResourcesTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=resources_timeout,json=resourcesTimeout,proto3" json:"resources_timeout,omitempty"` + DeckhouseTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=deckhouse_timeout,json=deckhouseTimeout,proto3" json:"deckhouse_timeout,omitempty"` } func (x *CheckStartOptions) Reset() { *x = CheckStartOptions{} if protoimpl.UnsafeEnabled { - mi := &file_check_proto_msgTypes[4] + mi := &file_check_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -342,7 +289,7 @@ func (x *CheckStartOptions) String() string { func (*CheckStartOptions) ProtoMessage() {} func (x *CheckStartOptions) ProtoReflect() protoreflect.Message { - mi := &file_check_proto_msgTypes[4] + mi := &file_check_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -355,7 +302,7 @@ func (x *CheckStartOptions) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckStartOptions.ProtoReflect.Descriptor instead. func (*CheckStartOptions) Descriptor() ([]byte, []int) { - return file_check_proto_rawDescGZIP(), []int{4} + return file_check_proto_rawDescGZIP(), []int{3} } func (x *CheckStartOptions) GetCommanderMode() bool { @@ -365,13 +312,6 @@ func (x *CheckStartOptions) GetCommanderMode() bool { return false } -func (x *CheckStartOptions) GetSanityCheck() bool { - if x != nil { - return x.SanityCheck - } - return false -} - func (x *CheckStartOptions) GetLogWidth() int32 { if x != nil { return x.LogWidth @@ -399,12 +339,13 @@ type CheckResult struct { unknownFields protoimpl.UnknownFields Result string `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` } func (x *CheckResult) Reset() { *x = CheckResult{} if protoimpl.UnsafeEnabled { - mi := &file_check_proto_msgTypes[5] + mi := &file_check_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -417,7 +358,7 @@ func (x *CheckResult) String() string { func (*CheckResult) ProtoMessage() {} func (x *CheckResult) ProtoReflect() protoreflect.Message { - mi := &file_check_proto_msgTypes[5] + mi := &file_check_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -430,7 +371,7 @@ func (x *CheckResult) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckResult.ProtoReflect.Descriptor instead. func (*CheckResult) Descriptor() ([]byte, []int) { - return file_check_proto_rawDescGZIP(), []int{5} + return file_check_proto_rawDescGZIP(), []int{4} } func (x *CheckResult) GetResult() string { @@ -440,6 +381,13 @@ func (x *CheckResult) GetResult() string { return "" } +func (x *CheckResult) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + var File_check_proto protoreflect.FileDescriptor var file_check_proto_rawDesc = []byte{ @@ -447,57 +395,53 @@ var file_check_proto_rawDesc = []byte{ 0x68, 0x63, 0x74, 0x6c, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x6c, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x74, 0x6f, 0x22, 0x44, 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, - 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x26, 0x0a, - 0x04, 0x73, 0x74, 0x6f, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x64, 0x68, - 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, 0x6f, 0x70, 0x48, 0x00, 0x52, - 0x04, 0x73, 0x74, 0x6f, 0x70, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x22, 0x6b, 0x0a, 0x0d, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, - 0x21, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, - 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x6f, - 0x67, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xf3, 0x01, - 0x0a, 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x2b, 0x0a, 0x11, - 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6c, 0x75, - 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x47, 0x0a, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x63, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1d, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x75, 0x73, - 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, - 0x32, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, - 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x22, 0x0b, 0x0a, 0x09, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, 0x6f, 0x70, - 0x22, 0x8a, 0x02, 0x0a, 0x11, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, - 0x64, 0x65, 0x72, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, - 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x21, 0x0a, - 0x0c, 0x73, 0x61, 0x6e, 0x69, 0x74, 0x79, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, 0x61, 0x6e, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x46, 0x0a, - 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, + 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x09, 0x0a, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x6b, 0x0a, 0x0d, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x64, 0x68, 0x63, 0x74, + 0x6c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, + 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x21, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x4c, 0x6f, + 0x67, 0x73, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xf3, 0x01, 0x0a, 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x47, 0x0a, 0x20, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x5f, 0x63, 0x6c, + 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x1d, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, + 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xe7, 0x01, 0x0a, 0x11, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x6d, + 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x61, + 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, + 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6c, 0x6f, 0x67, + 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x46, 0x0a, 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x46, 0x0a, + 0x11, 0x64, 0x65, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x54, 0x69, - 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x46, 0x0a, 0x11, 0x64, 0x65, 0x63, 0x6b, 0x68, 0x6f, 0x75, - 0x73, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x64, 0x65, 0x63, - 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x25, 0x0a, - 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x62, 0x2f, 0x64, 0x68, 0x63, 0x74, 0x6c, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x64, 0x65, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x37, 0x0a, 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, + 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x72, 0x72, 0x42, 0x0a, + 0x5a, 0x08, 0x70, 0x62, 0x2f, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -512,30 +456,28 @@ func file_check_proto_rawDescGZIP() []byte { return file_check_proto_rawDescData } -var file_check_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_check_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_check_proto_goTypes = []interface{}{ (*CheckRequest)(nil), // 0: dhctl.CheckRequest (*CheckResponse)(nil), // 1: dhctl.CheckResponse (*CheckStart)(nil), // 2: dhctl.CheckStart - (*CheckStop)(nil), // 3: dhctl.CheckStop - (*CheckStartOptions)(nil), // 4: dhctl.CheckStartOptions - (*CheckResult)(nil), // 5: dhctl.CheckResult - (*Logs)(nil), // 6: dhctl.Logs - (*durationpb.Duration)(nil), // 7: google.protobuf.Duration + (*CheckStartOptions)(nil), // 3: dhctl.CheckStartOptions + (*CheckResult)(nil), // 4: dhctl.CheckResult + (*Logs)(nil), // 5: dhctl.Logs + (*durationpb.Duration)(nil), // 6: google.protobuf.Duration } var file_check_proto_depIdxs = []int32{ 2, // 0: dhctl.CheckRequest.start:type_name -> dhctl.CheckStart - 3, // 1: dhctl.CheckRequest.stop:type_name -> dhctl.CheckStop - 5, // 2: dhctl.CheckResponse.result:type_name -> dhctl.CheckResult - 6, // 3: dhctl.CheckResponse.logs:type_name -> dhctl.Logs - 4, // 4: dhctl.CheckStart.options:type_name -> dhctl.CheckStartOptions - 7, // 5: dhctl.CheckStartOptions.resources_timeout:type_name -> google.protobuf.Duration - 7, // 6: dhctl.CheckStartOptions.deckhouse_timeout:type_name -> google.protobuf.Duration - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 4, // 1: dhctl.CheckResponse.result:type_name -> dhctl.CheckResult + 5, // 2: dhctl.CheckResponse.logs:type_name -> dhctl.Logs + 3, // 3: dhctl.CheckStart.options:type_name -> dhctl.CheckStartOptions + 6, // 4: dhctl.CheckStartOptions.resources_timeout:type_name -> google.protobuf.Duration + 6, // 5: dhctl.CheckStartOptions.deckhouse_timeout:type_name -> google.protobuf.Duration + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_check_proto_init() } @@ -582,18 +524,6 @@ func file_check_proto_init() { } } file_check_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CheckStop); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_check_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CheckStartOptions); i { case 0: return &v.state @@ -605,7 +535,7 @@ func file_check_proto_init() { return nil } } - file_check_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_check_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CheckResult); i { case 0: return &v.state @@ -620,7 +550,6 @@ func file_check_proto_init() { } file_check_proto_msgTypes[0].OneofWrappers = []interface{}{ (*CheckRequest_Start)(nil), - (*CheckRequest_Stop)(nil), } file_check_proto_msgTypes[1].OneofWrappers = []interface{}{ (*CheckResponse_Result)(nil), @@ -632,7 +561,7 @@ func file_check_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_check_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/dhctl/pkg/server/pb/dhctl/common.pb.go b/dhctl/pkg/server/pb/dhctl/common.pb.go index 6c7c6ab826d6..fb547c29870e 100644 --- a/dhctl/pkg/server/pb/dhctl/common.pb.go +++ b/dhctl/pkg/server/pb/dhctl/common.pb.go @@ -34,12 +34,64 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type Continue int32 + +const ( + Continue_CONTINUE_UNSPECIFIED Continue = 0 + Continue_CONTINUE_NEXT_PHASE Continue = 1 + Continue_CONTINUE_STOP_OPERATION Continue = 2 + Continue_CONTINUE_ERROR Continue = 3 +) + +// Enum value maps for Continue. +var ( + Continue_name = map[int32]string{ + 0: "CONTINUE_UNSPECIFIED", + 1: "CONTINUE_NEXT_PHASE", + 2: "CONTINUE_STOP_OPERATION", + 3: "CONTINUE_ERROR", + } + Continue_value = map[string]int32{ + "CONTINUE_UNSPECIFIED": 0, + "CONTINUE_NEXT_PHASE": 1, + "CONTINUE_STOP_OPERATION": 2, + "CONTINUE_ERROR": 3, + } +) + +func (x Continue) Enum() *Continue { + p := new(Continue) + *p = x + return p +} + +func (x Continue) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Continue) Descriptor() protoreflect.EnumDescriptor { + return file_common_proto_enumTypes[0].Descriptor() +} + +func (Continue) Type() protoreflect.EnumType { + return &file_common_proto_enumTypes[0] +} + +func (x Continue) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Continue.Descriptor instead. +func (Continue) EnumDescriptor() ([]byte, []int) { + return file_common_proto_rawDescGZIP(), []int{0} +} + type Logs struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Logs []byte `protobuf:"bytes,1,opt,name=logs,proto3" json:"logs,omitempty"` + Logs []string `protobuf:"bytes,1,rep,name=logs,proto3" json:"logs,omitempty"` } func (x *Logs) Reset() { @@ -74,7 +126,7 @@ func (*Logs) Descriptor() ([]byte, []int) { return file_common_proto_rawDescGZIP(), []int{0} } -func (x *Logs) GetLogs() []byte { +func (x *Logs) GetLogs() []string { if x != nil { return x.Logs } @@ -86,8 +138,15 @@ var File_common_proto protoreflect.FileDescriptor var file_common_proto_rawDesc = []byte{ 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x22, 0x1a, 0x0a, 0x04, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x12, 0x0a, - 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x6c, 0x6f, 0x67, - 0x73, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x62, 0x2f, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, + 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x6f, 0x67, + 0x73, 0x2a, 0x6e, 0x0a, 0x08, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x12, 0x18, 0x0a, + 0x14, 0x43, 0x4f, 0x4e, 0x54, 0x49, 0x4e, 0x55, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x54, 0x49, + 0x4e, 0x55, 0x45, 0x5f, 0x4e, 0x45, 0x58, 0x54, 0x5f, 0x50, 0x48, 0x41, 0x53, 0x45, 0x10, 0x01, + 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4e, 0x54, 0x49, 0x4e, 0x55, 0x45, 0x5f, 0x53, 0x54, 0x4f, + 0x50, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x12, 0x0a, + 0x0e, 0x43, 0x4f, 0x4e, 0x54, 0x49, 0x4e, 0x55, 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, + 0x03, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x62, 0x2f, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } @@ -103,9 +162,11 @@ func file_common_proto_rawDescGZIP() []byte { return file_common_proto_rawDescData } +var file_common_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_common_proto_goTypes = []interface{}{ - (*Logs)(nil), // 0: dhctl.Logs + (Continue)(0), // 0: dhctl.Continue + (*Logs)(nil), // 1: dhctl.Logs } var file_common_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -139,13 +200,14 @@ func file_common_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_common_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, GoTypes: file_common_proto_goTypes, DependencyIndexes: file_common_proto_depIdxs, + EnumInfos: file_common_proto_enumTypes, MessageInfos: file_common_proto_msgTypes, }.Build() File_common_proto = out.File diff --git a/dhctl/pkg/server/pb/dhctl/converge.pb.go b/dhctl/pkg/server/pb/dhctl/converge.pb.go new file mode 100644 index 000000000000..d55e19f8a46e --- /dev/null +++ b/dhctl/pkg/server/pb/dhctl/converge.pb.go @@ -0,0 +1,819 @@ +// Copyright 2024 Flant JSC +// +// 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.2 +// source: converge.proto + +package dhctl + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + durationpb "google.golang.org/protobuf/types/known/durationpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ConvergeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // + // *ConvergeRequest_Start + // *ConvergeRequest_Continue + Message isConvergeRequest_Message `protobuf_oneof:"message"` +} + +func (x *ConvergeRequest) Reset() { + *x = ConvergeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_converge_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConvergeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvergeRequest) ProtoMessage() {} + +func (x *ConvergeRequest) ProtoReflect() protoreflect.Message { + mi := &file_converge_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvergeRequest.ProtoReflect.Descriptor instead. +func (*ConvergeRequest) Descriptor() ([]byte, []int) { + return file_converge_proto_rawDescGZIP(), []int{0} +} + +func (m *ConvergeRequest) GetMessage() isConvergeRequest_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *ConvergeRequest) GetStart() *ConvergeStart { + if x, ok := x.GetMessage().(*ConvergeRequest_Start); ok { + return x.Start + } + return nil +} + +func (x *ConvergeRequest) GetContinue() *ConvergeContinue { + if x, ok := x.GetMessage().(*ConvergeRequest_Continue); ok { + return x.Continue + } + return nil +} + +type isConvergeRequest_Message interface { + isConvergeRequest_Message() +} + +type ConvergeRequest_Start struct { + Start *ConvergeStart `protobuf:"bytes,1,opt,name=start,proto3,oneof"` +} + +type ConvergeRequest_Continue struct { + Continue *ConvergeContinue `protobuf:"bytes,2,opt,name=continue,proto3,oneof"` +} + +func (*ConvergeRequest_Start) isConvergeRequest_Message() {} + +func (*ConvergeRequest_Continue) isConvergeRequest_Message() {} + +type ConvergeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // + // *ConvergeResponse_Result + // *ConvergeResponse_PhaseEnd + // *ConvergeResponse_Logs + Message isConvergeResponse_Message `protobuf_oneof:"message"` +} + +func (x *ConvergeResponse) Reset() { + *x = ConvergeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_converge_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConvergeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvergeResponse) ProtoMessage() {} + +func (x *ConvergeResponse) ProtoReflect() protoreflect.Message { + mi := &file_converge_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvergeResponse.ProtoReflect.Descriptor instead. +func (*ConvergeResponse) Descriptor() ([]byte, []int) { + return file_converge_proto_rawDescGZIP(), []int{1} +} + +func (m *ConvergeResponse) GetMessage() isConvergeResponse_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *ConvergeResponse) GetResult() *ConvergeResult { + if x, ok := x.GetMessage().(*ConvergeResponse_Result); ok { + return x.Result + } + return nil +} + +func (x *ConvergeResponse) GetPhaseEnd() *ConvergePhaseEnd { + if x, ok := x.GetMessage().(*ConvergeResponse_PhaseEnd); ok { + return x.PhaseEnd + } + return nil +} + +func (x *ConvergeResponse) GetLogs() *Logs { + if x, ok := x.GetMessage().(*ConvergeResponse_Logs); ok { + return x.Logs + } + return nil +} + +type isConvergeResponse_Message interface { + isConvergeResponse_Message() +} + +type ConvergeResponse_Result struct { + Result *ConvergeResult `protobuf:"bytes,1,opt,name=result,proto3,oneof"` +} + +type ConvergeResponse_PhaseEnd struct { + PhaseEnd *ConvergePhaseEnd `protobuf:"bytes,2,opt,name=phase_end,json=phaseEnd,proto3,oneof"` +} + +type ConvergeResponse_Logs struct { + Logs *Logs `protobuf:"bytes,3,opt,name=logs,proto3,oneof"` +} + +func (*ConvergeResponse_Result) isConvergeResponse_Message() {} + +func (*ConvergeResponse_PhaseEnd) isConvergeResponse_Message() {} + +func (*ConvergeResponse_Logs) isConvergeResponse_Message() {} + +type ConvergeStart struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConnectionConfig string `protobuf:"bytes,1,opt,name=connection_config,json=connectionConfig,proto3" json:"connection_config,omitempty"` + ClusterConfig string `protobuf:"bytes,2,opt,name=cluster_config,json=clusterConfig,proto3" json:"cluster_config,omitempty"` + ProviderSpecificClusterConfig string `protobuf:"bytes,3,opt,name=provider_specific_cluster_config,json=providerSpecificClusterConfig,proto3" json:"provider_specific_cluster_config,omitempty"` + State string `protobuf:"bytes,4,opt,name=state,proto3" json:"state,omitempty"` + ApproveDestructionChangeId string `protobuf:"bytes,5,opt,name=approve_destruction_change_id,json=approveDestructionChangeId,proto3" json:"approve_destruction_change_id,omitempty"` + Options *ConvergeStartOptions `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` +} + +func (x *ConvergeStart) Reset() { + *x = ConvergeStart{} + if protoimpl.UnsafeEnabled { + mi := &file_converge_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConvergeStart) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvergeStart) ProtoMessage() {} + +func (x *ConvergeStart) ProtoReflect() protoreflect.Message { + mi := &file_converge_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvergeStart.ProtoReflect.Descriptor instead. +func (*ConvergeStart) Descriptor() ([]byte, []int) { + return file_converge_proto_rawDescGZIP(), []int{2} +} + +func (x *ConvergeStart) GetConnectionConfig() string { + if x != nil { + return x.ConnectionConfig + } + return "" +} + +func (x *ConvergeStart) GetClusterConfig() string { + if x != nil { + return x.ClusterConfig + } + return "" +} + +func (x *ConvergeStart) GetProviderSpecificClusterConfig() string { + if x != nil { + return x.ProviderSpecificClusterConfig + } + return "" +} + +func (x *ConvergeStart) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *ConvergeStart) GetApproveDestructionChangeId() string { + if x != nil { + return x.ApproveDestructionChangeId + } + return "" +} + +func (x *ConvergeStart) GetOptions() *ConvergeStartOptions { + if x != nil { + return x.Options + } + return nil +} + +type ConvergePhaseEnd struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CompletedPhase string `protobuf:"bytes,1,opt,name=completed_phase,json=completedPhase,proto3" json:"completed_phase,omitempty"` + CompletedPhaseState map[string][]byte `protobuf:"bytes,2,rep,name=completed_phase_state,json=completedPhaseState,proto3" json:"completed_phase_state,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + NextPhase string `protobuf:"bytes,3,opt,name=next_phase,json=nextPhase,proto3" json:"next_phase,omitempty"` + NextPhaseCritical bool `protobuf:"varint,4,opt,name=next_phase_critical,json=nextPhaseCritical,proto3" json:"next_phase_critical,omitempty"` +} + +func (x *ConvergePhaseEnd) Reset() { + *x = ConvergePhaseEnd{} + if protoimpl.UnsafeEnabled { + mi := &file_converge_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConvergePhaseEnd) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvergePhaseEnd) ProtoMessage() {} + +func (x *ConvergePhaseEnd) ProtoReflect() protoreflect.Message { + mi := &file_converge_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvergePhaseEnd.ProtoReflect.Descriptor instead. +func (*ConvergePhaseEnd) Descriptor() ([]byte, []int) { + return file_converge_proto_rawDescGZIP(), []int{3} +} + +func (x *ConvergePhaseEnd) GetCompletedPhase() string { + if x != nil { + return x.CompletedPhase + } + return "" +} + +func (x *ConvergePhaseEnd) GetCompletedPhaseState() map[string][]byte { + if x != nil { + return x.CompletedPhaseState + } + return nil +} + +func (x *ConvergePhaseEnd) GetNextPhase() string { + if x != nil { + return x.NextPhase + } + return "" +} + +func (x *ConvergePhaseEnd) GetNextPhaseCritical() bool { + if x != nil { + return x.NextPhaseCritical + } + return false +} + +type ConvergeContinue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Continue Continue `protobuf:"varint,1,opt,name=continue,proto3,enum=dhctl.Continue" json:"continue,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` +} + +func (x *ConvergeContinue) Reset() { + *x = ConvergeContinue{} + if protoimpl.UnsafeEnabled { + mi := &file_converge_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConvergeContinue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvergeContinue) ProtoMessage() {} + +func (x *ConvergeContinue) ProtoReflect() protoreflect.Message { + mi := &file_converge_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvergeContinue.ProtoReflect.Descriptor instead. +func (*ConvergeContinue) Descriptor() ([]byte, []int) { + return file_converge_proto_rawDescGZIP(), []int{4} +} + +func (x *ConvergeContinue) GetContinue() Continue { + if x != nil { + return x.Continue + } + return Continue_CONTINUE_UNSPECIFIED +} + +func (x *ConvergeContinue) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + +type ConvergeStartOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CommanderMode bool `protobuf:"varint,1,opt,name=commander_mode,json=commanderMode,proto3" json:"commander_mode,omitempty"` + LogWidth int32 `protobuf:"varint,2,opt,name=log_width,json=logWidth,proto3" json:"log_width,omitempty"` + ResourcesTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=resources_timeout,json=resourcesTimeout,proto3" json:"resources_timeout,omitempty"` + DeckhouseTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=deckhouse_timeout,json=deckhouseTimeout,proto3" json:"deckhouse_timeout,omitempty"` +} + +func (x *ConvergeStartOptions) Reset() { + *x = ConvergeStartOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_converge_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConvergeStartOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvergeStartOptions) ProtoMessage() {} + +func (x *ConvergeStartOptions) ProtoReflect() protoreflect.Message { + mi := &file_converge_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvergeStartOptions.ProtoReflect.Descriptor instead. +func (*ConvergeStartOptions) Descriptor() ([]byte, []int) { + return file_converge_proto_rawDescGZIP(), []int{5} +} + +func (x *ConvergeStartOptions) GetCommanderMode() bool { + if x != nil { + return x.CommanderMode + } + return false +} + +func (x *ConvergeStartOptions) GetLogWidth() int32 { + if x != nil { + return x.LogWidth + } + return 0 +} + +func (x *ConvergeStartOptions) GetResourcesTimeout() *durationpb.Duration { + if x != nil { + return x.ResourcesTimeout + } + return nil +} + +func (x *ConvergeStartOptions) GetDeckhouseTimeout() *durationpb.Duration { + if x != nil { + return x.DeckhouseTimeout + } + return nil +} + +type ConvergeResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` + Err string `protobuf:"bytes,3,opt,name=err,proto3" json:"err,omitempty"` +} + +func (x *ConvergeResult) Reset() { + *x = ConvergeResult{} + if protoimpl.UnsafeEnabled { + mi := &file_converge_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConvergeResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConvergeResult) ProtoMessage() {} + +func (x *ConvergeResult) ProtoReflect() protoreflect.Message { + mi := &file_converge_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConvergeResult.ProtoReflect.Descriptor instead. +func (*ConvergeResult) Descriptor() ([]byte, []int) { + return file_converge_proto_rawDescGZIP(), []int{6} +} + +func (x *ConvergeResult) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *ConvergeResult) GetResult() string { + if x != nil { + return x.Result + } + return "" +} + +func (x *ConvergeResult) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + +var File_converge_proto protoreflect.FileDescriptor + +var file_converge_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x05, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x81, 0x01, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, + 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x35, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, + 0x6e, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x64, 0x68, 0x63, 0x74, + 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, + 0x75, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x42, 0x09, + 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x10, 0x43, 0x6f, + 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, + 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, + 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, + 0x36, 0x0a, 0x09, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x67, 0x65, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x08, 0x70, + 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x21, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x4c, 0x6f, + 0x67, 0x73, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xbc, 0x02, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x67, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6c, + 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x47, 0x0a, 0x20, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, + 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1d, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, + 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x41, 0x0a, 0x1d, 0x61, 0x70, + 0x70, 0x72, 0x6f, 0x76, 0x65, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x1a, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x44, 0x65, 0x73, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x64, 0x12, 0x35, 0x0a, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb8, 0x02, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, + 0x65, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, + 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, + 0x73, 0x65, 0x12, 0x64, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, + 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x30, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x67, 0x65, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, + 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x13, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, + 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, 0x78, 0x74, + 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x65, + 0x78, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x6e, 0x65, 0x78, 0x74, 0x5f, + 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x43, + 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x1a, 0x46, 0x0a, 0x18, 0x43, 0x6f, 0x6d, 0x70, 0x6c, + 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0x51, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x69, + 0x6e, 0x75, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x6f, + 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, + 0x72, 0x72, 0x22, 0xea, 0x01, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x63, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x6f, + 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, + 0x46, 0x0a, 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x46, 0x0a, 0x11, 0x64, 0x65, 0x63, 0x6b, 0x68, + 0x6f, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x64, + 0x65, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, + 0x50, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, + 0x10, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x72, + 0x72, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x62, 0x2f, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_converge_proto_rawDescOnce sync.Once + file_converge_proto_rawDescData = file_converge_proto_rawDesc +) + +func file_converge_proto_rawDescGZIP() []byte { + file_converge_proto_rawDescOnce.Do(func() { + file_converge_proto_rawDescData = protoimpl.X.CompressGZIP(file_converge_proto_rawDescData) + }) + return file_converge_proto_rawDescData +} + +var file_converge_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_converge_proto_goTypes = []interface{}{ + (*ConvergeRequest)(nil), // 0: dhctl.ConvergeRequest + (*ConvergeResponse)(nil), // 1: dhctl.ConvergeResponse + (*ConvergeStart)(nil), // 2: dhctl.ConvergeStart + (*ConvergePhaseEnd)(nil), // 3: dhctl.ConvergePhaseEnd + (*ConvergeContinue)(nil), // 4: dhctl.ConvergeContinue + (*ConvergeStartOptions)(nil), // 5: dhctl.ConvergeStartOptions + (*ConvergeResult)(nil), // 6: dhctl.ConvergeResult + nil, // 7: dhctl.ConvergePhaseEnd.CompletedPhaseStateEntry + (*Logs)(nil), // 8: dhctl.Logs + (Continue)(0), // 9: dhctl.Continue + (*durationpb.Duration)(nil), // 10: google.protobuf.Duration +} +var file_converge_proto_depIdxs = []int32{ + 2, // 0: dhctl.ConvergeRequest.start:type_name -> dhctl.ConvergeStart + 4, // 1: dhctl.ConvergeRequest.continue:type_name -> dhctl.ConvergeContinue + 6, // 2: dhctl.ConvergeResponse.result:type_name -> dhctl.ConvergeResult + 3, // 3: dhctl.ConvergeResponse.phase_end:type_name -> dhctl.ConvergePhaseEnd + 8, // 4: dhctl.ConvergeResponse.logs:type_name -> dhctl.Logs + 5, // 5: dhctl.ConvergeStart.options:type_name -> dhctl.ConvergeStartOptions + 7, // 6: dhctl.ConvergePhaseEnd.completed_phase_state:type_name -> dhctl.ConvergePhaseEnd.CompletedPhaseStateEntry + 9, // 7: dhctl.ConvergeContinue.continue:type_name -> dhctl.Continue + 10, // 8: dhctl.ConvergeStartOptions.resources_timeout:type_name -> google.protobuf.Duration + 10, // 9: dhctl.ConvergeStartOptions.deckhouse_timeout:type_name -> google.protobuf.Duration + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_converge_proto_init() } +func file_converge_proto_init() { + if File_converge_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_converge_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConvergeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_converge_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConvergeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_converge_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConvergeStart); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_converge_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConvergePhaseEnd); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_converge_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConvergeContinue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_converge_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConvergeStartOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_converge_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConvergeResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_converge_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*ConvergeRequest_Start)(nil), + (*ConvergeRequest_Continue)(nil), + } + file_converge_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*ConvergeResponse_Result)(nil), + (*ConvergeResponse_PhaseEnd)(nil), + (*ConvergeResponse_Logs)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_converge_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_converge_proto_goTypes, + DependencyIndexes: file_converge_proto_depIdxs, + MessageInfos: file_converge_proto_msgTypes, + }.Build() + File_converge_proto = out.File + file_converge_proto_rawDesc = nil + file_converge_proto_goTypes = nil + file_converge_proto_depIdxs = nil +} diff --git a/dhctl/pkg/server/pb/dhctl/destroy.pb.go b/dhctl/pkg/server/pb/dhctl/destroy.pb.go new file mode 100644 index 000000000000..e320f64407ba --- /dev/null +++ b/dhctl/pkg/server/pb/dhctl/destroy.pb.go @@ -0,0 +1,806 @@ +// Copyright 2024 Flant JSC +// +// 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.2 +// source: destroy.proto + +package dhctl + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + durationpb "google.golang.org/protobuf/types/known/durationpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type DestroyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // + // *DestroyRequest_Start + // *DestroyRequest_Continue + Message isDestroyRequest_Message `protobuf_oneof:"message"` +} + +func (x *DestroyRequest) Reset() { + *x = DestroyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_destroy_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DestroyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DestroyRequest) ProtoMessage() {} + +func (x *DestroyRequest) ProtoReflect() protoreflect.Message { + mi := &file_destroy_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DestroyRequest.ProtoReflect.Descriptor instead. +func (*DestroyRequest) Descriptor() ([]byte, []int) { + return file_destroy_proto_rawDescGZIP(), []int{0} +} + +func (m *DestroyRequest) GetMessage() isDestroyRequest_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *DestroyRequest) GetStart() *DestroyStart { + if x, ok := x.GetMessage().(*DestroyRequest_Start); ok { + return x.Start + } + return nil +} + +func (x *DestroyRequest) GetContinue() *DestroyContinue { + if x, ok := x.GetMessage().(*DestroyRequest_Continue); ok { + return x.Continue + } + return nil +} + +type isDestroyRequest_Message interface { + isDestroyRequest_Message() +} + +type DestroyRequest_Start struct { + Start *DestroyStart `protobuf:"bytes,1,opt,name=start,proto3,oneof"` +} + +type DestroyRequest_Continue struct { + Continue *DestroyContinue `protobuf:"bytes,2,opt,name=continue,proto3,oneof"` +} + +func (*DestroyRequest_Start) isDestroyRequest_Message() {} + +func (*DestroyRequest_Continue) isDestroyRequest_Message() {} + +type DestroyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // + // *DestroyResponse_Result + // *DestroyResponse_PhaseEnd + // *DestroyResponse_Logs + Message isDestroyResponse_Message `protobuf_oneof:"message"` +} + +func (x *DestroyResponse) Reset() { + *x = DestroyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_destroy_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DestroyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DestroyResponse) ProtoMessage() {} + +func (x *DestroyResponse) ProtoReflect() protoreflect.Message { + mi := &file_destroy_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DestroyResponse.ProtoReflect.Descriptor instead. +func (*DestroyResponse) Descriptor() ([]byte, []int) { + return file_destroy_proto_rawDescGZIP(), []int{1} +} + +func (m *DestroyResponse) GetMessage() isDestroyResponse_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *DestroyResponse) GetResult() *DestroyResult { + if x, ok := x.GetMessage().(*DestroyResponse_Result); ok { + return x.Result + } + return nil +} + +func (x *DestroyResponse) GetPhaseEnd() *DestroyPhaseEnd { + if x, ok := x.GetMessage().(*DestroyResponse_PhaseEnd); ok { + return x.PhaseEnd + } + return nil +} + +func (x *DestroyResponse) GetLogs() *Logs { + if x, ok := x.GetMessage().(*DestroyResponse_Logs); ok { + return x.Logs + } + return nil +} + +type isDestroyResponse_Message interface { + isDestroyResponse_Message() +} + +type DestroyResponse_Result struct { + Result *DestroyResult `protobuf:"bytes,1,opt,name=result,proto3,oneof"` +} + +type DestroyResponse_PhaseEnd struct { + PhaseEnd *DestroyPhaseEnd `protobuf:"bytes,2,opt,name=phase_end,json=phaseEnd,proto3,oneof"` +} + +type DestroyResponse_Logs struct { + Logs *Logs `protobuf:"bytes,3,opt,name=logs,proto3,oneof"` +} + +func (*DestroyResponse_Result) isDestroyResponse_Message() {} + +func (*DestroyResponse_PhaseEnd) isDestroyResponse_Message() {} + +func (*DestroyResponse_Logs) isDestroyResponse_Message() {} + +type DestroyStart struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConnectionConfig string `protobuf:"bytes,1,opt,name=connection_config,json=connectionConfig,proto3" json:"connection_config,omitempty"` + InitConfig string `protobuf:"bytes,2,opt,name=init_config,json=initConfig,proto3" json:"init_config,omitempty"` + ClusterConfig string `protobuf:"bytes,3,opt,name=cluster_config,json=clusterConfig,proto3" json:"cluster_config,omitempty"` + ProviderSpecificClusterConfig string `protobuf:"bytes,4,opt,name=provider_specific_cluster_config,json=providerSpecificClusterConfig,proto3" json:"provider_specific_cluster_config,omitempty"` + State string `protobuf:"bytes,5,opt,name=state,proto3" json:"state,omitempty"` + Options *DestroyStartOptions `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` +} + +func (x *DestroyStart) Reset() { + *x = DestroyStart{} + if protoimpl.UnsafeEnabled { + mi := &file_destroy_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DestroyStart) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DestroyStart) ProtoMessage() {} + +func (x *DestroyStart) ProtoReflect() protoreflect.Message { + mi := &file_destroy_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DestroyStart.ProtoReflect.Descriptor instead. +func (*DestroyStart) Descriptor() ([]byte, []int) { + return file_destroy_proto_rawDescGZIP(), []int{2} +} + +func (x *DestroyStart) GetConnectionConfig() string { + if x != nil { + return x.ConnectionConfig + } + return "" +} + +func (x *DestroyStart) GetInitConfig() string { + if x != nil { + return x.InitConfig + } + return "" +} + +func (x *DestroyStart) GetClusterConfig() string { + if x != nil { + return x.ClusterConfig + } + return "" +} + +func (x *DestroyStart) GetProviderSpecificClusterConfig() string { + if x != nil { + return x.ProviderSpecificClusterConfig + } + return "" +} + +func (x *DestroyStart) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *DestroyStart) GetOptions() *DestroyStartOptions { + if x != nil { + return x.Options + } + return nil +} + +type DestroyPhaseEnd struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CompletedPhase string `protobuf:"bytes,1,opt,name=completed_phase,json=completedPhase,proto3" json:"completed_phase,omitempty"` + CompletedPhaseState map[string][]byte `protobuf:"bytes,2,rep,name=completed_phase_state,json=completedPhaseState,proto3" json:"completed_phase_state,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + NextPhase string `protobuf:"bytes,3,opt,name=next_phase,json=nextPhase,proto3" json:"next_phase,omitempty"` + NextPhaseCritical bool `protobuf:"varint,4,opt,name=next_phase_critical,json=nextPhaseCritical,proto3" json:"next_phase_critical,omitempty"` +} + +func (x *DestroyPhaseEnd) Reset() { + *x = DestroyPhaseEnd{} + if protoimpl.UnsafeEnabled { + mi := &file_destroy_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DestroyPhaseEnd) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DestroyPhaseEnd) ProtoMessage() {} + +func (x *DestroyPhaseEnd) ProtoReflect() protoreflect.Message { + mi := &file_destroy_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DestroyPhaseEnd.ProtoReflect.Descriptor instead. +func (*DestroyPhaseEnd) Descriptor() ([]byte, []int) { + return file_destroy_proto_rawDescGZIP(), []int{3} +} + +func (x *DestroyPhaseEnd) GetCompletedPhase() string { + if x != nil { + return x.CompletedPhase + } + return "" +} + +func (x *DestroyPhaseEnd) GetCompletedPhaseState() map[string][]byte { + if x != nil { + return x.CompletedPhaseState + } + return nil +} + +func (x *DestroyPhaseEnd) GetNextPhase() string { + if x != nil { + return x.NextPhase + } + return "" +} + +func (x *DestroyPhaseEnd) GetNextPhaseCritical() bool { + if x != nil { + return x.NextPhaseCritical + } + return false +} + +type DestroyContinue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Continue Continue `protobuf:"varint,1,opt,name=continue,proto3,enum=dhctl.Continue" json:"continue,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` +} + +func (x *DestroyContinue) Reset() { + *x = DestroyContinue{} + if protoimpl.UnsafeEnabled { + mi := &file_destroy_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DestroyContinue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DestroyContinue) ProtoMessage() {} + +func (x *DestroyContinue) ProtoReflect() protoreflect.Message { + mi := &file_destroy_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DestroyContinue.ProtoReflect.Descriptor instead. +func (*DestroyContinue) Descriptor() ([]byte, []int) { + return file_destroy_proto_rawDescGZIP(), []int{4} +} + +func (x *DestroyContinue) GetContinue() Continue { + if x != nil { + return x.Continue + } + return Continue_CONTINUE_UNSPECIFIED +} + +func (x *DestroyContinue) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + +type DestroyStartOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CommanderMode bool `protobuf:"varint,1,opt,name=commander_mode,json=commanderMode,proto3" json:"commander_mode,omitempty"` + LogWidth int32 `protobuf:"varint,2,opt,name=log_width,json=logWidth,proto3" json:"log_width,omitempty"` + ResourcesTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=resources_timeout,json=resourcesTimeout,proto3" json:"resources_timeout,omitempty"` + DeckhouseTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=deckhouse_timeout,json=deckhouseTimeout,proto3" json:"deckhouse_timeout,omitempty"` +} + +func (x *DestroyStartOptions) Reset() { + *x = DestroyStartOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_destroy_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DestroyStartOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DestroyStartOptions) ProtoMessage() {} + +func (x *DestroyStartOptions) ProtoReflect() protoreflect.Message { + mi := &file_destroy_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DestroyStartOptions.ProtoReflect.Descriptor instead. +func (*DestroyStartOptions) Descriptor() ([]byte, []int) { + return file_destroy_proto_rawDescGZIP(), []int{5} +} + +func (x *DestroyStartOptions) GetCommanderMode() bool { + if x != nil { + return x.CommanderMode + } + return false +} + +func (x *DestroyStartOptions) GetLogWidth() int32 { + if x != nil { + return x.LogWidth + } + return 0 +} + +func (x *DestroyStartOptions) GetResourcesTimeout() *durationpb.Duration { + if x != nil { + return x.ResourcesTimeout + } + return nil +} + +func (x *DestroyStartOptions) GetDeckhouseTimeout() *durationpb.Duration { + if x != nil { + return x.DeckhouseTimeout + } + return nil +} + +type DestroyResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` +} + +func (x *DestroyResult) Reset() { + *x = DestroyResult{} + if protoimpl.UnsafeEnabled { + mi := &file_destroy_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DestroyResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DestroyResult) ProtoMessage() {} + +func (x *DestroyResult) ProtoReflect() protoreflect.Message { + mi := &file_destroy_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DestroyResult.ProtoReflect.Descriptor instead. +func (*DestroyResult) Descriptor() ([]byte, []int) { + return file_destroy_proto_rawDescGZIP(), []int{6} +} + +func (x *DestroyResult) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *DestroyResult) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + +var File_destroy_proto protoreflect.FileDescriptor + +var file_destroy_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x05, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7e, 0x0a, 0x0e, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x44, 0x65, + 0x73, 0x74, 0x72, 0x6f, 0x79, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x44, 0x65, + 0x73, 0x74, 0x72, 0x6f, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x48, 0x00, 0x52, + 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x0f, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, + 0x2e, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, + 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x35, 0x0a, 0x09, 0x70, 0x68, 0x61, 0x73, + 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x64, 0x68, + 0x63, 0x74, 0x6c, 0x2e, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x50, 0x68, 0x61, 0x73, 0x65, + 0x45, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x08, 0x70, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x12, + 0x21, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, + 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x6f, + 0x67, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x98, 0x02, + 0x0a, 0x0c, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x2b, + 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x69, + 0x6e, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x25, 0x0a, 0x0e, + 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x12, 0x47, 0x0a, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1d, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x43, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x44, 0x65, 0x73, 0x74, + 0x72, 0x6f, 0x79, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb6, 0x02, 0x0a, 0x0f, 0x44, 0x65, 0x73, + 0x74, 0x72, 0x6f, 0x79, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x27, 0x0a, 0x0f, + 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, + 0x50, 0x68, 0x61, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x44, 0x65, 0x73, + 0x74, 0x72, 0x6f, 0x79, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x2e, 0x43, 0x6f, 0x6d, + 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, + 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x6e, 0x65, 0x78, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x6e, 0x65, 0x78, + 0x74, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x68, 0x61, 0x73, + 0x65, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x1a, 0x46, 0x0a, 0x18, 0x43, 0x6f, 0x6d, + 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x22, 0x50, 0x0a, 0x0f, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x43, 0x6f, 0x6e, 0x74, + 0x69, 0x6e, 0x75, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, + 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x65, 0x72, 0x72, 0x22, 0xe9, 0x01, 0x0a, 0x13, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x63, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x6f, + 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, + 0x46, 0x0a, 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x46, 0x0a, 0x11, 0x64, 0x65, 0x63, 0x6b, 0x68, + 0x6f, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x64, + 0x65, 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, + 0x37, 0x0a, 0x0d, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x72, 0x72, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x62, 0x2f, 0x64, + 0x68, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_destroy_proto_rawDescOnce sync.Once + file_destroy_proto_rawDescData = file_destroy_proto_rawDesc +) + +func file_destroy_proto_rawDescGZIP() []byte { + file_destroy_proto_rawDescOnce.Do(func() { + file_destroy_proto_rawDescData = protoimpl.X.CompressGZIP(file_destroy_proto_rawDescData) + }) + return file_destroy_proto_rawDescData +} + +var file_destroy_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_destroy_proto_goTypes = []interface{}{ + (*DestroyRequest)(nil), // 0: dhctl.DestroyRequest + (*DestroyResponse)(nil), // 1: dhctl.DestroyResponse + (*DestroyStart)(nil), // 2: dhctl.DestroyStart + (*DestroyPhaseEnd)(nil), // 3: dhctl.DestroyPhaseEnd + (*DestroyContinue)(nil), // 4: dhctl.DestroyContinue + (*DestroyStartOptions)(nil), // 5: dhctl.DestroyStartOptions + (*DestroyResult)(nil), // 6: dhctl.DestroyResult + nil, // 7: dhctl.DestroyPhaseEnd.CompletedPhaseStateEntry + (*Logs)(nil), // 8: dhctl.Logs + (Continue)(0), // 9: dhctl.Continue + (*durationpb.Duration)(nil), // 10: google.protobuf.Duration +} +var file_destroy_proto_depIdxs = []int32{ + 2, // 0: dhctl.DestroyRequest.start:type_name -> dhctl.DestroyStart + 4, // 1: dhctl.DestroyRequest.continue:type_name -> dhctl.DestroyContinue + 6, // 2: dhctl.DestroyResponse.result:type_name -> dhctl.DestroyResult + 3, // 3: dhctl.DestroyResponse.phase_end:type_name -> dhctl.DestroyPhaseEnd + 8, // 4: dhctl.DestroyResponse.logs:type_name -> dhctl.Logs + 5, // 5: dhctl.DestroyStart.options:type_name -> dhctl.DestroyStartOptions + 7, // 6: dhctl.DestroyPhaseEnd.completed_phase_state:type_name -> dhctl.DestroyPhaseEnd.CompletedPhaseStateEntry + 9, // 7: dhctl.DestroyContinue.continue:type_name -> dhctl.Continue + 10, // 8: dhctl.DestroyStartOptions.resources_timeout:type_name -> google.protobuf.Duration + 10, // 9: dhctl.DestroyStartOptions.deckhouse_timeout:type_name -> google.protobuf.Duration + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_destroy_proto_init() } +func file_destroy_proto_init() { + if File_destroy_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_destroy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DestroyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_destroy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DestroyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_destroy_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DestroyStart); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_destroy_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DestroyPhaseEnd); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_destroy_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DestroyContinue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_destroy_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DestroyStartOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_destroy_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DestroyResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_destroy_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*DestroyRequest_Start)(nil), + (*DestroyRequest_Continue)(nil), + } + file_destroy_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*DestroyResponse_Result)(nil), + (*DestroyResponse_PhaseEnd)(nil), + (*DestroyResponse_Logs)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_destroy_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_destroy_proto_goTypes, + DependencyIndexes: file_destroy_proto_depIdxs, + MessageInfos: file_destroy_proto_msgTypes, + }.Build() + File_destroy_proto = out.File + file_destroy_proto_rawDesc = nil + file_destroy_proto_goTypes = nil + file_destroy_proto_depIdxs = nil +} diff --git a/dhctl/pkg/server/pb/dhctl/dhctl.pb.go b/dhctl/pkg/server/pb/dhctl/dhctl.pb.go index f2fe202acd36..0ddd56ae6996 100644 --- a/dhctl/pkg/server/pb/dhctl/dhctl.pb.go +++ b/dhctl/pkg/server/pb/dhctl/dhctl.pb.go @@ -39,34 +39,70 @@ var file_dhctl_proto_rawDesc = []byte{ 0x0a, 0x0b, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x1a, 0x0b, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x32, 0x87, 0x01, 0x0a, 0x05, 0x44, 0x48, 0x43, 0x54, 0x4c, 0x12, 0x38, 0x0a, 0x05, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x13, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x64, 0x68, 0x63, - 0x74, 0x6c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, - 0x72, 0x61, 0x70, 0x12, 0x17, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x74, - 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x64, - 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x0a, 0x5a, 0x08, - 0x70, 0x62, 0x2f, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x6f, 0x1a, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x0b, 0x61, 0x62, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0e, + 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, + 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x81, 0x03, 0x0a, + 0x05, 0x44, 0x48, 0x43, 0x54, 0x4c, 0x12, 0x38, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, + 0x13, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, + 0x12, 0x44, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x12, 0x17, 0x2e, + 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x42, + 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x3e, 0x0a, 0x07, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, + 0x79, 0x12, 0x15, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, + 0x2e, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x38, 0x0a, 0x05, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x12, + 0x13, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x41, 0x62, 0x6f, + 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, + 0x12, 0x41, 0x0a, 0x08, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x12, 0x16, 0x2e, 0x64, + 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x67, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, + 0x01, 0x30, 0x01, 0x12, 0x3b, 0x0a, 0x06, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x2e, + 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x49, 0x6d, 0x70, 0x6f, + 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, + 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x62, 0x2f, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var file_dhctl_proto_goTypes = []interface{}{ (*CheckRequest)(nil), // 0: dhctl.CheckRequest (*BootstrapRequest)(nil), // 1: dhctl.BootstrapRequest - (*CheckResponse)(nil), // 2: dhctl.CheckResponse - (*BootstrapResponse)(nil), // 3: dhctl.BootstrapResponse + (*DestroyRequest)(nil), // 2: dhctl.DestroyRequest + (*AbortRequest)(nil), // 3: dhctl.AbortRequest + (*ConvergeRequest)(nil), // 4: dhctl.ConvergeRequest + (*ImportRequest)(nil), // 5: dhctl.ImportRequest + (*CheckResponse)(nil), // 6: dhctl.CheckResponse + (*BootstrapResponse)(nil), // 7: dhctl.BootstrapResponse + (*DestroyResponse)(nil), // 8: dhctl.DestroyResponse + (*AbortResponse)(nil), // 9: dhctl.AbortResponse + (*ConvergeResponse)(nil), // 10: dhctl.ConvergeResponse + (*ImportResponse)(nil), // 11: dhctl.ImportResponse } var file_dhctl_proto_depIdxs = []int32{ - 0, // 0: dhctl.DHCTL.Check:input_type -> dhctl.CheckRequest - 1, // 1: dhctl.DHCTL.Bootstrap:input_type -> dhctl.BootstrapRequest - 2, // 2: dhctl.DHCTL.Check:output_type -> dhctl.CheckResponse - 3, // 3: dhctl.DHCTL.Bootstrap:output_type -> dhctl.BootstrapResponse - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: dhctl.DHCTL.Check:input_type -> dhctl.CheckRequest + 1, // 1: dhctl.DHCTL.Bootstrap:input_type -> dhctl.BootstrapRequest + 2, // 2: dhctl.DHCTL.Destroy:input_type -> dhctl.DestroyRequest + 3, // 3: dhctl.DHCTL.Abort:input_type -> dhctl.AbortRequest + 4, // 4: dhctl.DHCTL.Converge:input_type -> dhctl.ConvergeRequest + 5, // 5: dhctl.DHCTL.Import:input_type -> dhctl.ImportRequest + 6, // 6: dhctl.DHCTL.Check:output_type -> dhctl.CheckResponse + 7, // 7: dhctl.DHCTL.Bootstrap:output_type -> dhctl.BootstrapResponse + 8, // 8: dhctl.DHCTL.Destroy:output_type -> dhctl.DestroyResponse + 9, // 9: dhctl.DHCTL.Abort:output_type -> dhctl.AbortResponse + 10, // 10: dhctl.DHCTL.Converge:output_type -> dhctl.ConvergeResponse + 11, // 11: dhctl.DHCTL.Import:output_type -> dhctl.ImportResponse + 6, // [6:12] is the sub-list for method output_type + 0, // [0:6] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_dhctl_proto_init() } @@ -76,6 +112,10 @@ func file_dhctl_proto_init() { } file_check_proto_init() file_bootstrap_proto_init() + file_destroy_proto_init() + file_abort_proto_init() + file_converge_proto_init() + file_import_proto_init() type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/dhctl/pkg/server/pb/dhctl/dhctl_grpc.pb.go b/dhctl/pkg/server/pb/dhctl/dhctl_grpc.pb.go index 346be7e023f4..e9a265da9e79 100644 --- a/dhctl/pkg/server/pb/dhctl/dhctl_grpc.pb.go +++ b/dhctl/pkg/server/pb/dhctl/dhctl_grpc.pb.go @@ -35,6 +35,10 @@ const _ = grpc.SupportPackageIsVersion7 const ( DHCTL_Check_FullMethodName = "/dhctl.DHCTL/Check" DHCTL_Bootstrap_FullMethodName = "/dhctl.DHCTL/Bootstrap" + DHCTL_Destroy_FullMethodName = "/dhctl.DHCTL/Destroy" + DHCTL_Abort_FullMethodName = "/dhctl.DHCTL/Abort" + DHCTL_Converge_FullMethodName = "/dhctl.DHCTL/Converge" + DHCTL_Import_FullMethodName = "/dhctl.DHCTL/Import" ) // DHCTLClient is the client API for DHCTL service. @@ -43,6 +47,10 @@ const ( type DHCTLClient interface { Check(ctx context.Context, opts ...grpc.CallOption) (DHCTL_CheckClient, error) Bootstrap(ctx context.Context, opts ...grpc.CallOption) (DHCTL_BootstrapClient, error) + Destroy(ctx context.Context, opts ...grpc.CallOption) (DHCTL_DestroyClient, error) + Abort(ctx context.Context, opts ...grpc.CallOption) (DHCTL_AbortClient, error) + Converge(ctx context.Context, opts ...grpc.CallOption) (DHCTL_ConvergeClient, error) + Import(ctx context.Context, opts ...grpc.CallOption) (DHCTL_ImportClient, error) } type dHCTLClient struct { @@ -115,12 +123,140 @@ func (x *dHCTLBootstrapClient) Recv() (*BootstrapResponse, error) { return m, nil } +func (c *dHCTLClient) Destroy(ctx context.Context, opts ...grpc.CallOption) (DHCTL_DestroyClient, error) { + stream, err := c.cc.NewStream(ctx, &DHCTL_ServiceDesc.Streams[2], DHCTL_Destroy_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &dHCTLDestroyClient{stream} + return x, nil +} + +type DHCTL_DestroyClient interface { + Send(*DestroyRequest) error + Recv() (*DestroyResponse, error) + grpc.ClientStream +} + +type dHCTLDestroyClient struct { + grpc.ClientStream +} + +func (x *dHCTLDestroyClient) Send(m *DestroyRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *dHCTLDestroyClient) Recv() (*DestroyResponse, error) { + m := new(DestroyResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *dHCTLClient) Abort(ctx context.Context, opts ...grpc.CallOption) (DHCTL_AbortClient, error) { + stream, err := c.cc.NewStream(ctx, &DHCTL_ServiceDesc.Streams[3], DHCTL_Abort_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &dHCTLAbortClient{stream} + return x, nil +} + +type DHCTL_AbortClient interface { + Send(*AbortRequest) error + Recv() (*AbortResponse, error) + grpc.ClientStream +} + +type dHCTLAbortClient struct { + grpc.ClientStream +} + +func (x *dHCTLAbortClient) Send(m *AbortRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *dHCTLAbortClient) Recv() (*AbortResponse, error) { + m := new(AbortResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *dHCTLClient) Converge(ctx context.Context, opts ...grpc.CallOption) (DHCTL_ConvergeClient, error) { + stream, err := c.cc.NewStream(ctx, &DHCTL_ServiceDesc.Streams[4], DHCTL_Converge_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &dHCTLConvergeClient{stream} + return x, nil +} + +type DHCTL_ConvergeClient interface { + Send(*ConvergeRequest) error + Recv() (*ConvergeResponse, error) + grpc.ClientStream +} + +type dHCTLConvergeClient struct { + grpc.ClientStream +} + +func (x *dHCTLConvergeClient) Send(m *ConvergeRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *dHCTLConvergeClient) Recv() (*ConvergeResponse, error) { + m := new(ConvergeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *dHCTLClient) Import(ctx context.Context, opts ...grpc.CallOption) (DHCTL_ImportClient, error) { + stream, err := c.cc.NewStream(ctx, &DHCTL_ServiceDesc.Streams[5], DHCTL_Import_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &dHCTLImportClient{stream} + return x, nil +} + +type DHCTL_ImportClient interface { + Send(*ImportRequest) error + Recv() (*ImportResponse, error) + grpc.ClientStream +} + +type dHCTLImportClient struct { + grpc.ClientStream +} + +func (x *dHCTLImportClient) Send(m *ImportRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *dHCTLImportClient) Recv() (*ImportResponse, error) { + m := new(ImportResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // DHCTLServer is the server API for DHCTL service. // All implementations must embed UnimplementedDHCTLServer // for forward compatibility type DHCTLServer interface { Check(DHCTL_CheckServer) error Bootstrap(DHCTL_BootstrapServer) error + Destroy(DHCTL_DestroyServer) error + Abort(DHCTL_AbortServer) error + Converge(DHCTL_ConvergeServer) error + Import(DHCTL_ImportServer) error mustEmbedUnimplementedDHCTLServer() } @@ -134,6 +270,18 @@ func (UnimplementedDHCTLServer) Check(DHCTL_CheckServer) error { func (UnimplementedDHCTLServer) Bootstrap(DHCTL_BootstrapServer) error { return status.Errorf(codes.Unimplemented, "method Bootstrap not implemented") } +func (UnimplementedDHCTLServer) Destroy(DHCTL_DestroyServer) error { + return status.Errorf(codes.Unimplemented, "method Destroy not implemented") +} +func (UnimplementedDHCTLServer) Abort(DHCTL_AbortServer) error { + return status.Errorf(codes.Unimplemented, "method Abort not implemented") +} +func (UnimplementedDHCTLServer) Converge(DHCTL_ConvergeServer) error { + return status.Errorf(codes.Unimplemented, "method Converge not implemented") +} +func (UnimplementedDHCTLServer) Import(DHCTL_ImportServer) error { + return status.Errorf(codes.Unimplemented, "method Import not implemented") +} func (UnimplementedDHCTLServer) mustEmbedUnimplementedDHCTLServer() {} // UnsafeDHCTLServer may be embedded to opt out of forward compatibility for this service. @@ -199,6 +347,110 @@ func (x *dHCTLBootstrapServer) Recv() (*BootstrapRequest, error) { return m, nil } +func _DHCTL_Destroy_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(DHCTLServer).Destroy(&dHCTLDestroyServer{stream}) +} + +type DHCTL_DestroyServer interface { + Send(*DestroyResponse) error + Recv() (*DestroyRequest, error) + grpc.ServerStream +} + +type dHCTLDestroyServer struct { + grpc.ServerStream +} + +func (x *dHCTLDestroyServer) Send(m *DestroyResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *dHCTLDestroyServer) Recv() (*DestroyRequest, error) { + m := new(DestroyRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _DHCTL_Abort_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(DHCTLServer).Abort(&dHCTLAbortServer{stream}) +} + +type DHCTL_AbortServer interface { + Send(*AbortResponse) error + Recv() (*AbortRequest, error) + grpc.ServerStream +} + +type dHCTLAbortServer struct { + grpc.ServerStream +} + +func (x *dHCTLAbortServer) Send(m *AbortResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *dHCTLAbortServer) Recv() (*AbortRequest, error) { + m := new(AbortRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _DHCTL_Converge_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(DHCTLServer).Converge(&dHCTLConvergeServer{stream}) +} + +type DHCTL_ConvergeServer interface { + Send(*ConvergeResponse) error + Recv() (*ConvergeRequest, error) + grpc.ServerStream +} + +type dHCTLConvergeServer struct { + grpc.ServerStream +} + +func (x *dHCTLConvergeServer) Send(m *ConvergeResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *dHCTLConvergeServer) Recv() (*ConvergeRequest, error) { + m := new(ConvergeRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _DHCTL_Import_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(DHCTLServer).Import(&dHCTLImportServer{stream}) +} + +type DHCTL_ImportServer interface { + Send(*ImportResponse) error + Recv() (*ImportRequest, error) + grpc.ServerStream +} + +type dHCTLImportServer struct { + grpc.ServerStream +} + +func (x *dHCTLImportServer) Send(m *ImportResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *dHCTLImportServer) Recv() (*ImportRequest, error) { + m := new(ImportRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // DHCTL_ServiceDesc is the grpc.ServiceDesc for DHCTL service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -219,6 +471,30 @@ var DHCTL_ServiceDesc = grpc.ServiceDesc{ ServerStreams: true, ClientStreams: true, }, + { + StreamName: "Destroy", + Handler: _DHCTL_Destroy_Handler, + ServerStreams: true, + ClientStreams: true, + }, + { + StreamName: "Abort", + Handler: _DHCTL_Abort_Handler, + ServerStreams: true, + ClientStreams: true, + }, + { + StreamName: "Converge", + Handler: _DHCTL_Converge_Handler, + ServerStreams: true, + ClientStreams: true, + }, + { + StreamName: "Import", + Handler: _DHCTL_Import_Handler, + ServerStreams: true, + ClientStreams: true, + }, }, Metadata: "dhctl.proto", } diff --git a/dhctl/pkg/server/pb/dhctl/import.pb.go b/dhctl/pkg/server/pb/dhctl/import.pb.go new file mode 100644 index 000000000000..523eadd57930 --- /dev/null +++ b/dhctl/pkg/server/pb/dhctl/import.pb.go @@ -0,0 +1,824 @@ +// Copyright 2024 Flant JSC +// +// 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.2 +// source: import.proto + +package dhctl + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + durationpb "google.golang.org/protobuf/types/known/durationpb" + structpb "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ImportRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // + // *ImportRequest_Start + // *ImportRequest_Continue + Message isImportRequest_Message `protobuf_oneof:"message"` +} + +func (x *ImportRequest) Reset() { + *x = ImportRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_import_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportRequest) ProtoMessage() {} + +func (x *ImportRequest) ProtoReflect() protoreflect.Message { + mi := &file_import_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportRequest.ProtoReflect.Descriptor instead. +func (*ImportRequest) Descriptor() ([]byte, []int) { + return file_import_proto_rawDescGZIP(), []int{0} +} + +func (m *ImportRequest) GetMessage() isImportRequest_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *ImportRequest) GetStart() *ImportStart { + if x, ok := x.GetMessage().(*ImportRequest_Start); ok { + return x.Start + } + return nil +} + +func (x *ImportRequest) GetContinue() *ImportContinue { + if x, ok := x.GetMessage().(*ImportRequest_Continue); ok { + return x.Continue + } + return nil +} + +type isImportRequest_Message interface { + isImportRequest_Message() +} + +type ImportRequest_Start struct { + Start *ImportStart `protobuf:"bytes,1,opt,name=start,proto3,oneof"` +} + +type ImportRequest_Continue struct { + Continue *ImportContinue `protobuf:"bytes,2,opt,name=continue,proto3,oneof"` +} + +func (*ImportRequest_Start) isImportRequest_Message() {} + +func (*ImportRequest_Continue) isImportRequest_Message() {} + +type ImportResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // + // *ImportResponse_Result + // *ImportResponse_PhaseEnd + // *ImportResponse_Logs + Message isImportResponse_Message `protobuf_oneof:"message"` +} + +func (x *ImportResponse) Reset() { + *x = ImportResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_import_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportResponse) ProtoMessage() {} + +func (x *ImportResponse) ProtoReflect() protoreflect.Message { + mi := &file_import_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportResponse.ProtoReflect.Descriptor instead. +func (*ImportResponse) Descriptor() ([]byte, []int) { + return file_import_proto_rawDescGZIP(), []int{1} +} + +func (m *ImportResponse) GetMessage() isImportResponse_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *ImportResponse) GetResult() *ImportResult { + if x, ok := x.GetMessage().(*ImportResponse_Result); ok { + return x.Result + } + return nil +} + +func (x *ImportResponse) GetPhaseEnd() *ImportPhaseEnd { + if x, ok := x.GetMessage().(*ImportResponse_PhaseEnd); ok { + return x.PhaseEnd + } + return nil +} + +func (x *ImportResponse) GetLogs() *Logs { + if x, ok := x.GetMessage().(*ImportResponse_Logs); ok { + return x.Logs + } + return nil +} + +type isImportResponse_Message interface { + isImportResponse_Message() +} + +type ImportResponse_Result struct { + Result *ImportResult `protobuf:"bytes,1,opt,name=result,proto3,oneof"` +} + +type ImportResponse_PhaseEnd struct { + PhaseEnd *ImportPhaseEnd `protobuf:"bytes,2,opt,name=phase_end,json=phaseEnd,proto3,oneof"` +} + +type ImportResponse_Logs struct { + Logs *Logs `protobuf:"bytes,3,opt,name=logs,proto3,oneof"` +} + +func (*ImportResponse_Result) isImportResponse_Message() {} + +func (*ImportResponse_PhaseEnd) isImportResponse_Message() {} + +func (*ImportResponse_Logs) isImportResponse_Message() {} + +type ImportStart struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConnectionConfig string `protobuf:"bytes,1,opt,name=connection_config,json=connectionConfig,proto3" json:"connection_config,omitempty"` + ScanOnly *bool `protobuf:"varint,2,opt,name=scan_only,json=scanOnly,proto3,oneof" json:"scan_only,omitempty"` + ResourcesTemplate string `protobuf:"bytes,3,opt,name=resources_template,json=resourcesTemplate,proto3" json:"resources_template,omitempty"` + ResourcesValues *structpb.Struct `protobuf:"bytes,4,opt,name=resources_values,json=resourcesValues,proto3" json:"resources_values,omitempty"` + Options *ImportStartOptions `protobuf:"bytes,5,opt,name=options,proto3" json:"options,omitempty"` +} + +func (x *ImportStart) Reset() { + *x = ImportStart{} + if protoimpl.UnsafeEnabled { + mi := &file_import_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportStart) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportStart) ProtoMessage() {} + +func (x *ImportStart) ProtoReflect() protoreflect.Message { + mi := &file_import_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportStart.ProtoReflect.Descriptor instead. +func (*ImportStart) Descriptor() ([]byte, []int) { + return file_import_proto_rawDescGZIP(), []int{2} +} + +func (x *ImportStart) GetConnectionConfig() string { + if x != nil { + return x.ConnectionConfig + } + return "" +} + +func (x *ImportStart) GetScanOnly() bool { + if x != nil && x.ScanOnly != nil { + return *x.ScanOnly + } + return false +} + +func (x *ImportStart) GetResourcesTemplate() string { + if x != nil { + return x.ResourcesTemplate + } + return "" +} + +func (x *ImportStart) GetResourcesValues() *structpb.Struct { + if x != nil { + return x.ResourcesValues + } + return nil +} + +func (x *ImportStart) GetOptions() *ImportStartOptions { + if x != nil { + return x.Options + } + return nil +} + +type ImportPhaseEnd struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CompletedPhase string `protobuf:"bytes,1,opt,name=completed_phase,json=completedPhase,proto3" json:"completed_phase,omitempty"` + CompletedPhaseState map[string][]byte `protobuf:"bytes,2,rep,name=completed_phase_state,json=completedPhaseState,proto3" json:"completed_phase_state,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + CompletedPhaseData string `protobuf:"bytes,3,opt,name=completed_phase_data,json=completedPhaseData,proto3" json:"completed_phase_data,omitempty"` + NextPhase string `protobuf:"bytes,4,opt,name=next_phase,json=nextPhase,proto3" json:"next_phase,omitempty"` + NextPhaseCritical bool `protobuf:"varint,5,opt,name=next_phase_critical,json=nextPhaseCritical,proto3" json:"next_phase_critical,omitempty"` +} + +func (x *ImportPhaseEnd) Reset() { + *x = ImportPhaseEnd{} + if protoimpl.UnsafeEnabled { + mi := &file_import_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportPhaseEnd) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportPhaseEnd) ProtoMessage() {} + +func (x *ImportPhaseEnd) ProtoReflect() protoreflect.Message { + mi := &file_import_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportPhaseEnd.ProtoReflect.Descriptor instead. +func (*ImportPhaseEnd) Descriptor() ([]byte, []int) { + return file_import_proto_rawDescGZIP(), []int{3} +} + +func (x *ImportPhaseEnd) GetCompletedPhase() string { + if x != nil { + return x.CompletedPhase + } + return "" +} + +func (x *ImportPhaseEnd) GetCompletedPhaseState() map[string][]byte { + if x != nil { + return x.CompletedPhaseState + } + return nil +} + +func (x *ImportPhaseEnd) GetCompletedPhaseData() string { + if x != nil { + return x.CompletedPhaseData + } + return "" +} + +func (x *ImportPhaseEnd) GetNextPhase() string { + if x != nil { + return x.NextPhase + } + return "" +} + +func (x *ImportPhaseEnd) GetNextPhaseCritical() bool { + if x != nil { + return x.NextPhaseCritical + } + return false +} + +type ImportContinue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Continue Continue `protobuf:"varint,1,opt,name=continue,proto3,enum=dhctl.Continue" json:"continue,omitempty"` + Err string `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"` +} + +func (x *ImportContinue) Reset() { + *x = ImportContinue{} + if protoimpl.UnsafeEnabled { + mi := &file_import_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportContinue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportContinue) ProtoMessage() {} + +func (x *ImportContinue) ProtoReflect() protoreflect.Message { + mi := &file_import_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportContinue.ProtoReflect.Descriptor instead. +func (*ImportContinue) Descriptor() ([]byte, []int) { + return file_import_proto_rawDescGZIP(), []int{4} +} + +func (x *ImportContinue) GetContinue() Continue { + if x != nil { + return x.Continue + } + return Continue_CONTINUE_UNSPECIFIED +} + +func (x *ImportContinue) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + +type ImportStartOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CommanderMode bool `protobuf:"varint,1,opt,name=commander_mode,json=commanderMode,proto3" json:"commander_mode,omitempty"` + LogWidth int32 `protobuf:"varint,2,opt,name=log_width,json=logWidth,proto3" json:"log_width,omitempty"` + ResourcesTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=resources_timeout,json=resourcesTimeout,proto3" json:"resources_timeout,omitempty"` + DeckhouseTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=deckhouse_timeout,json=deckhouseTimeout,proto3" json:"deckhouse_timeout,omitempty"` +} + +func (x *ImportStartOptions) Reset() { + *x = ImportStartOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_import_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportStartOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportStartOptions) ProtoMessage() {} + +func (x *ImportStartOptions) ProtoReflect() protoreflect.Message { + mi := &file_import_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportStartOptions.ProtoReflect.Descriptor instead. +func (*ImportStartOptions) Descriptor() ([]byte, []int) { + return file_import_proto_rawDescGZIP(), []int{5} +} + +func (x *ImportStartOptions) GetCommanderMode() bool { + if x != nil { + return x.CommanderMode + } + return false +} + +func (x *ImportStartOptions) GetLogWidth() int32 { + if x != nil { + return x.LogWidth + } + return 0 +} + +func (x *ImportStartOptions) GetResourcesTimeout() *durationpb.Duration { + if x != nil { + return x.ResourcesTimeout + } + return nil +} + +func (x *ImportStartOptions) GetDeckhouseTimeout() *durationpb.Duration { + if x != nil { + return x.DeckhouseTimeout + } + return nil +} + +type ImportResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` + Err string `protobuf:"bytes,3,opt,name=err,proto3" json:"err,omitempty"` +} + +func (x *ImportResult) Reset() { + *x = ImportResult{} + if protoimpl.UnsafeEnabled { + mi := &file_import_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportResult) ProtoMessage() {} + +func (x *ImportResult) ProtoReflect() protoreflect.Message { + mi := &file_import_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportResult.ProtoReflect.Descriptor instead. +func (*ImportResult) Descriptor() ([]byte, []int) { + return file_import_proto_rawDescGZIP(), []int{6} +} + +func (x *ImportResult) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *ImportResult) GetResult() string { + if x != nil { + return x.Result + } + return "" +} + +func (x *ImportResult) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + +var File_import_proto protoreflect.FileDescriptor + +var file_import_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, + 0x64, 0x68, 0x63, 0x74, 0x6c, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x7b, 0x0a, 0x0d, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x33, + 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x15, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x43, + 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, + 0x6e, 0x75, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xa3, + 0x01, 0x0a, 0x0e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2d, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x13, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x34, 0x0a, 0x09, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x49, 0x6d, 0x70, 0x6f, + 0x72, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x08, 0x70, 0x68, + 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x21, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x4c, 0x6f, 0x67, + 0x73, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x22, 0x92, 0x02, 0x0a, 0x0b, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x12, 0x20, 0x0a, 0x09, 0x73, 0x63, 0x61, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x08, 0x73, 0x63, 0x61, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, + 0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a, 0x12, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x12, 0x42, 0x0a, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, + 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, + 0x73, 0x63, 0x61, 0x6e, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x22, 0xe6, 0x02, 0x0a, 0x0e, 0x49, 0x6d, + 0x70, 0x6f, 0x72, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x12, 0x27, 0x0a, 0x0f, + 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, + 0x50, 0x68, 0x61, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x49, 0x6d, 0x70, + 0x6f, 0x72, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x2e, 0x43, 0x6f, 0x6d, 0x70, + 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, + 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, 0x6d, + 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, + 0x65, 0x78, 0x74, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x68, 0x61, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x6e, 0x65, + 0x78, 0x74, 0x5f, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, + 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x68, 0x61, + 0x73, 0x65, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x1a, 0x46, 0x0a, 0x18, 0x43, 0x6f, + 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x22, 0x4f, 0x0a, 0x0e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, + 0x69, 0x6e, 0x75, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x2e, 0x43, + 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x65, 0x72, 0x72, 0x22, 0xe8, 0x01, 0x0a, 0x12, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, + 0x61, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x6f, 0x64, + 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x46, + 0x0a, 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x54, + 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x46, 0x0a, 0x11, 0x64, 0x65, 0x63, 0x6b, 0x68, 0x6f, + 0x75, 0x73, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x64, 0x65, + 0x63, 0x6b, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x4e, + 0x0a, 0x0c, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, + 0x65, 0x72, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x72, 0x72, 0x42, 0x0a, + 0x5a, 0x08, 0x70, 0x62, 0x2f, 0x64, 0x68, 0x63, 0x74, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_import_proto_rawDescOnce sync.Once + file_import_proto_rawDescData = file_import_proto_rawDesc +) + +func file_import_proto_rawDescGZIP() []byte { + file_import_proto_rawDescOnce.Do(func() { + file_import_proto_rawDescData = protoimpl.X.CompressGZIP(file_import_proto_rawDescData) + }) + return file_import_proto_rawDescData +} + +var file_import_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_import_proto_goTypes = []interface{}{ + (*ImportRequest)(nil), // 0: dhctl.ImportRequest + (*ImportResponse)(nil), // 1: dhctl.ImportResponse + (*ImportStart)(nil), // 2: dhctl.ImportStart + (*ImportPhaseEnd)(nil), // 3: dhctl.ImportPhaseEnd + (*ImportContinue)(nil), // 4: dhctl.ImportContinue + (*ImportStartOptions)(nil), // 5: dhctl.ImportStartOptions + (*ImportResult)(nil), // 6: dhctl.ImportResult + nil, // 7: dhctl.ImportPhaseEnd.CompletedPhaseStateEntry + (*Logs)(nil), // 8: dhctl.Logs + (*structpb.Struct)(nil), // 9: google.protobuf.Struct + (Continue)(0), // 10: dhctl.Continue + (*durationpb.Duration)(nil), // 11: google.protobuf.Duration +} +var file_import_proto_depIdxs = []int32{ + 2, // 0: dhctl.ImportRequest.start:type_name -> dhctl.ImportStart + 4, // 1: dhctl.ImportRequest.continue:type_name -> dhctl.ImportContinue + 6, // 2: dhctl.ImportResponse.result:type_name -> dhctl.ImportResult + 3, // 3: dhctl.ImportResponse.phase_end:type_name -> dhctl.ImportPhaseEnd + 8, // 4: dhctl.ImportResponse.logs:type_name -> dhctl.Logs + 9, // 5: dhctl.ImportStart.resources_values:type_name -> google.protobuf.Struct + 5, // 6: dhctl.ImportStart.options:type_name -> dhctl.ImportStartOptions + 7, // 7: dhctl.ImportPhaseEnd.completed_phase_state:type_name -> dhctl.ImportPhaseEnd.CompletedPhaseStateEntry + 10, // 8: dhctl.ImportContinue.continue:type_name -> dhctl.Continue + 11, // 9: dhctl.ImportStartOptions.resources_timeout:type_name -> google.protobuf.Duration + 11, // 10: dhctl.ImportStartOptions.deckhouse_timeout:type_name -> google.protobuf.Duration + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_import_proto_init() } +func file_import_proto_init() { + if File_import_proto != nil { + return + } + file_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_import_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_import_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_import_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportStart); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_import_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportPhaseEnd); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_import_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportContinue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_import_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportStartOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_import_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_import_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*ImportRequest_Start)(nil), + (*ImportRequest_Continue)(nil), + } + file_import_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*ImportResponse_Result)(nil), + (*ImportResponse_PhaseEnd)(nil), + (*ImportResponse_Logs)(nil), + } + file_import_proto_msgTypes[2].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_import_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_import_proto_goTypes, + DependencyIndexes: file_import_proto_depIdxs, + MessageInfos: file_import_proto_msgTypes, + }.Build() + File_import_proto = out.File + file_import_proto_rawDesc = nil + file_import_proto_goTypes = nil + file_import_proto_depIdxs = nil +} diff --git a/dhctl/pkg/server/fsm/fsm.go b/dhctl/pkg/server/pkg/fsm/fsm.go similarity index 100% rename from dhctl/pkg/server/fsm/fsm.go rename to dhctl/pkg/server/pkg/fsm/fsm.go diff --git a/dhctl/pkg/server/fsm/fsm_test.go b/dhctl/pkg/server/pkg/fsm/fsm_test.go similarity index 98% rename from dhctl/pkg/server/fsm/fsm_test.go rename to dhctl/pkg/server/pkg/fsm/fsm_test.go index 037508785267..ff5823e8ab5c 100644 --- a/dhctl/pkg/server/fsm/fsm_test.go +++ b/dhctl/pkg/server/pkg/fsm/fsm_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/deckhouse/deckhouse/dhctl/pkg/server/fsm" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/fsm" ) func TestFiniteStateMachine(t *testing.T) { diff --git a/dhctl/pkg/server/pkg/interceptors/interceptors.go b/dhctl/pkg/server/pkg/interceptors/interceptors.go new file mode 100644 index 000000000000..44d09ecddc0b --- /dev/null +++ b/dhctl/pkg/server/pkg/interceptors/interceptors.go @@ -0,0 +1,139 @@ +// Copyright 2024 Flant JSC +// +// 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 interceptors + +import ( + "context" + "log/slog" + "runtime/debug" + "strings" + "time" + + "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/logger" +) + +const resourceExhaustedTimeout = time.Second + +func PanicRecoveryHandler() func(ctx context.Context, p any) error { + return func(ctx context.Context, p any) error { + logger.L(ctx).Error( + "recovered from panic", + slog.Any("panic", p), + slog.Any("stack", string(debug.Stack())), + ) + return status.Errorf(codes.Internal, "%s", p) + } +} + +func UnaryLogger(log *slog.Logger) grpc.UnaryServerInterceptor { + return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) { + return handler(logger.ToContext(ctx, log), req) + } +} + +func StreamLogger(log *slog.Logger) grpc.StreamServerInterceptor { + return func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { + wss := newStreamContextWrapper(ss) + wss.SetContext(logger.ToContext(ss.Context(), log)) + return handler(srv, wss) + } +} + +func Logger() logging.Logger { + return logging.LoggerFunc(func(ctx context.Context, lvl logging.Level, msg string, fields ...any) { + logger.L(ctx).Log(ctx, slog.Level(lvl), msg, fields...) + }) +} + +func UnaryParallelTasksLimiter(sem chan struct{}) grpc.UnaryServerInterceptor { + return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) { + if !strings.Contains(info.FullMethod, "dhctl") { + return handler(ctx, req) + } + + log := logger.L(ctx) + log.Info("limiter tries to start operation", slog.Int("concurrent_operation", len(sem))) + timeout := time.After(5 * time.Minute) + select { + case <-timeout: + log.Info("limiter couldn't start operation due to timeout", slog.Int("concurrent_operation", len(sem))) + return nil, status.Error(codes.ResourceExhausted, "too many dhctl operation has already started") + case sem <- struct{}{}: + log.Info("limiter started operation", slog.Int("concurrent_operation", len(sem))) + defer func() { + <-sem + log.Info("limiter finished operation", slog.Int("concurrent_operation", len(sem))) + }() + + return handler(ctx, req) + } + } +} + +func StreamParallelTasksLimiter(sem chan struct{}) grpc.StreamServerInterceptor { + return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { + if !strings.Contains(info.FullMethod, "dhctl") { + return handler(srv, ss) + } + + log := logger.L(ss.Context()) + log.Info("limiter tries to start operation", slog.Int("concurrent_operation", len(sem))) + timeout := time.After(resourceExhaustedTimeout) + select { + case <-timeout: + log.Info("limiter couldn't start operation due to timeout", slog.Int("concurrent_operation", len(sem))) + return status.Error(codes.ResourceExhausted, "too many dhctl operations has already started") + case sem <- struct{}{}: + log.Info("limiter started operation", slog.Int("concurrent_operation", len(sem))) + defer func() { + <-sem + log.Info("limiter finished operation", slog.Int("concurrent_operation", len(sem))) + }() + + return handler(srv, ss) + } + } +} + +type StreamContextWrapper interface { + grpc.ServerStream + SetContext(context.Context) +} + +type wrapper struct { + grpc.ServerStream + ctx context.Context +} + +func (w *wrapper) Context() context.Context { + return w.ctx +} + +func (w *wrapper) SetContext(ctx context.Context) { + w.ctx = ctx +} + +func newStreamContextWrapper(inner grpc.ServerStream) StreamContextWrapper { + ctx := inner.Context() + return &wrapper{ + ServerStream: inner, + ctx: ctx, + } +} diff --git a/dhctl/pkg/server/logger/logger.go b/dhctl/pkg/server/pkg/logger/logger.go similarity index 61% rename from dhctl/pkg/server/logger/logger.go rename to dhctl/pkg/server/pkg/logger/logger.go index 36f28d2e4ab3..ce116dbc3a98 100644 --- a/dhctl/pkg/server/logger/logger.go +++ b/dhctl/pkg/server/pkg/logger/logger.go @@ -15,12 +15,18 @@ package logger import ( + "context" "fmt" "log/slog" "os" "time" + + "github.com/acarl005/stripansi" + "google.golang.org/grpc/metadata" ) +type loggerCtxKey struct{} + // NewLogger returns initialized slog logger func NewLogger(level *slog.LevelVar) *slog.Logger { replace := func(_ []string, attr slog.Attr) slog.Attr { @@ -32,6 +38,9 @@ func NewLogger(level *slog.LevelVar) *slog.Logger { } case slog.TimeKey: return slog.String(slog.TimeKey, attr.Value.Time().Format(time.RFC3339)) + case slog.MessageKey: + // Strip ANSI escape sequences from the message. + attr.Value = slog.StringValue(stripansi.Strip(attr.Value.String())) } return attr @@ -56,3 +65,33 @@ func Err(err error) slog.Attr { } return slog.Attr{Key: errKey, Value: slog.StringValue(err.Error())} } + +func ToContext(ctx context.Context, log *slog.Logger) context.Context { + return context.WithValue(ctx, loggerCtxKey{}, log.With(attrFromCtx(ctx)...)) +} + +func L(ctx context.Context) *slog.Logger { + l := ctx.Value(loggerCtxKey{}) + if l == nil { + logger := NewLogger(&slog.LevelVar{}).With(slog.String("UNINITIALIZED", "UNINITIALIZED")) + return logger + } + + return l.(*slog.Logger) +} + +func attrFromCtx(ctx context.Context) []any { + attrs := make([]any, 0, 1) + + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return attrs + } + + values := md.Get("task_id") + if len(values) != 0 { + attrs = append(attrs, slog.String("task_id", values[0])) + } + + return attrs +} diff --git a/dhctl/pkg/server/proxy/proxy.go b/dhctl/pkg/server/proxy/proxy.go index d8ebfd4aed57..b575fb6a26b0 100644 --- a/dhctl/pkg/server/proxy/proxy.go +++ b/dhctl/pkg/server/proxy/proxy.go @@ -36,8 +36,8 @@ import ( "google.golang.org/grpc/reflection" dhctllog "github.com/deckhouse/deckhouse/dhctl/pkg/log" - "github.com/deckhouse/deckhouse/dhctl/pkg/server/interceptors" - "github.com/deckhouse/deckhouse/dhctl/pkg/server/logger" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/interceptors" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/logger" "github.com/deckhouse/deckhouse/dhctl/pkg/util/retry" "github.com/deckhouse/deckhouse/dhctl/pkg/util/tomb" ) @@ -47,7 +47,7 @@ func Serve(network, address string, parallelTasksLimit int) error { dhctllog.InitLoggerWithOptions("silent", dhctllog.LoggerOptions{}) lvl := &slog.LevelVar{} lvl.Set(slog.LevelDebug) - log := logger.NewLogger(lvl) + log := logger.NewLogger(lvl).With(slog.String("component", "proxy")) ctx, cancel := context.WithCancel(context.Background()) done := make(chan struct{}) @@ -77,14 +77,16 @@ func Serve(network, address string, parallelTasksLimit int) error { } s := grpc.NewServer( grpc.ChainUnaryInterceptor( - logging.UnaryServerInterceptor(interceptors.Logger(log)), - recovery.UnaryServerInterceptor(recovery.WithRecoveryHandler(interceptors.PanicRecoveryHandler(log))), - interceptors.UnaryParallelTasksLimiter(sem, log), + interceptors.UnaryLogger(log), + logging.UnaryServerInterceptor(interceptors.Logger()), + recovery.UnaryServerInterceptor(recovery.WithRecoveryHandlerContext(interceptors.PanicRecoveryHandler())), + interceptors.UnaryParallelTasksLimiter(sem), ), grpc.ChainStreamInterceptor( - logging.StreamServerInterceptor(interceptors.Logger(log)), - recovery.StreamServerInterceptor(recovery.WithRecoveryHandler(interceptors.PanicRecoveryHandler(log))), - interceptors.StreamParallelTasksLimiter(sem, log), + interceptors.StreamLogger(log), + logging.StreamServerInterceptor(interceptors.Logger()), + recovery.StreamServerInterceptor(recovery.WithRecoveryHandlerContext(interceptors.PanicRecoveryHandler())), + interceptors.StreamParallelTasksLimiter(sem), ), grpc.UnknownServiceHandler(proxy.TransparentHandler(director.new())), ) @@ -135,13 +137,10 @@ func (d *streamDirector) new() proxy.StreamDirector { md, _ := metadata.FromIncomingContext(ctx) outCtx := metadata.NewOutgoingContext(ctx, md.Copy()) - sockUUID, err := uuid.NewUUID() + address, err := socketPath() if err != nil { - return outCtx, nil, fmt.Errorf("creating uuid for socket path") + return outCtx, nil, err } - address := filepath.Join(os.TempDir(), "dhctl", sockUUID.String()) - - d.log.Info("starting new dhctl instance", "addr", address) cmd := exec.Command( os.Args[0], @@ -150,6 +149,7 @@ func (d *streamDirector) new() proxy.StreamDirector { fmt.Sprintf("--server-address=%s", address), ) + // todo: handle logs from parallel server instances cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr @@ -158,6 +158,14 @@ func (d *streamDirector) new() proxy.StreamDirector { return outCtx, nil, fmt.Errorf("starting dhctl server: %w", err) } + logger.L(ctx).Info("started new dhctl instance", slog.String("addr", address)) + + go func() { + exitErr := cmd.Wait() + logger.L(ctx). + Info("stopped dhctl instance", slog.String("addr", address), logger.Err(exitErr)) + }() + conn, err := grpc.NewClient( "unix://"+address, grpc.WithTransportCredentials(insecure.NewCredentials()), @@ -189,3 +197,13 @@ func checkDHCTLServer(ctx context.Context, conn grpc.ClientConnInterface) error return nil }) } + +func socketPath() (string, error) { + sockUUID, err := uuid.NewUUID() + if err != nil { + return "", fmt.Errorf("creating uuid for socket path") + } + + address := filepath.Join("/var/run/dhctl", sockUUID.String()+".sock") + return address, nil +} diff --git a/dhctl/pkg/server/rpc/dhctl/abort.go b/dhctl/pkg/server/rpc/dhctl/abort.go new file mode 100644 index 000000000000..4c87f31016af --- /dev/null +++ b/dhctl/pkg/server/rpc/dhctl/abort.go @@ -0,0 +1,381 @@ +// Copyright 2024 Flant JSC +// +// 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 dhctl + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "log/slog" + "sync" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "k8s.io/utils/pointer" + + "github.com/deckhouse/deckhouse/dhctl/pkg/app" + "github.com/deckhouse/deckhouse/dhctl/pkg/config" + "github.com/deckhouse/deckhouse/dhctl/pkg/log" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/bootstrap" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/phases" + pb "github.com/deckhouse/deckhouse/dhctl/pkg/server/pb/dhctl" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/fsm" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/logger" + "github.com/deckhouse/deckhouse/dhctl/pkg/system/ssh" + "github.com/deckhouse/deckhouse/dhctl/pkg/terraform" + "github.com/deckhouse/deckhouse/dhctl/pkg/util/input" + "github.com/deckhouse/deckhouse/dhctl/pkg/util/retry" +) + +func (s *Service) Abort(server pb.DHCTL_AbortServer) error { + ctx := operationCtx(server) + + logger.L(ctx).Info("started") + + f := fsm.New("initial", s.abortServerTransitions()) + + doneCh := make(chan struct{}) + internalErrCh := make(chan error) + receiveCh := make(chan *pb.AbortRequest) + sendCh := make(chan *pb.AbortResponse) + phaseSwitcher := &abortPhaseSwitcher{ + sendCh: sendCh, + f: f, + next: make(chan error), + } + + s.startAborterReceiver(server, receiveCh, doneCh, internalErrCh) + s.startAborterSender(server, sendCh, internalErrCh) + +connectionProcessor: + for { + select { + case <-doneCh: + logger.L(ctx).Info("finished") + return nil + + case err := <-internalErrCh: + logger.L(ctx).Error("finished with internal error", logger.Err(err)) + return status.Errorf(codes.Internal, "%s", err) + + case request := <-receiveCh: + logger.L(ctx).Info( + "processing AbortRequest", + slog.String("message", fmt.Sprintf("%T", request.Message)), + ) + switch message := request.Message.(type) { + case *pb.AbortRequest_Start: + err := f.Event("start") + if err != nil { + logger.L(ctx).Error("got unprocessable message", + logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + s.startAbort( + ctx, message.Start, phaseSwitcher, &abortLogWriter{l: logger.L(ctx), sendCh: sendCh}, sendCh, + ) + + case *pb.AbortRequest_Continue: + err := f.Event("toNextPhase") + if err != nil { + logger.L(ctx).Error("got unprocessable message", + logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + switch message.Continue.Continue { + case pb.Continue_CONTINUE_UNSPECIFIED: + phaseSwitcher.next <- errors.New("bad continue message") + case pb.Continue_CONTINUE_NEXT_PHASE: + phaseSwitcher.next <- nil + case pb.Continue_CONTINUE_STOP_OPERATION: + phaseSwitcher.next <- phases.StopOperationCondition + case pb.Continue_CONTINUE_ERROR: + phaseSwitcher.next <- errors.New(message.Continue.Err) + } + + default: + logger.L(ctx).Error("got unprocessable message", + slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + } + } +} + +func (s *Service) startAborterReceiver( + server pb.DHCTL_AbortServer, + receiveCh chan *pb.AbortRequest, + doneCh chan struct{}, + internalErrCh chan error, +) { + go func() { + for { + request, err := server.Recv() + if errors.Is(err, io.EOF) { + close(doneCh) + return + } + if err != nil { + internalErrCh <- fmt.Errorf("receiving message: %w", err) + return + } + receiveCh <- request + } + }() +} + +func (s *Service) startAborterSender( + server pb.DHCTL_AbortServer, + sendCh chan *pb.AbortResponse, + internalErrCh chan error, +) { + go func() { + for response := range sendCh { + loop := retry.NewSilentLoop("send message", 10, time.Millisecond*100) + err := loop.Run(func() error { + return server.Send(response) + }) + if err != nil { + internalErrCh <- fmt.Errorf("sending message: %w", err) + return + } + } + }() +} + +func (s *Service) startAbort( + ctx context.Context, + request *pb.AbortStart, + phaseSwitcher *abortPhaseSwitcher, + logWriter *abortLogWriter, + sendCh chan *pb.AbortResponse, +) { + go func() { + result := s.abort(ctx, request, phaseSwitcher, logWriter) + sendCh <- &pb.AbortResponse{ + Message: &pb.AbortResponse_Result{ + Result: result, + }, + } + }() +} + +func (s *Service) abort( + _ context.Context, + request *pb.AbortStart, + phaseSwitcher *abortPhaseSwitcher, + logWriter io.Writer, +) *pb.AbortResult { + var err error + + log.InitLoggerWithOptions("pretty", log.LoggerOptions{ + OutStream: logWriter, + Width: int(request.Options.LogWidth), + }) + app.SanityCheck = true + app.UseTfCache = app.UseStateCacheYes + app.ResourcesTimeout = request.Options.ResourcesTimeout.AsDuration() + app.DeckhouseTimeout = request.Options.DeckhouseTimeout.AsDuration() + app.CacheDir = s.cacheDir + + log.InfoF("Task is running by DHCTL Server pod/%s\n", s.podName) + defer func() { + log.InfoF("Task done by DHCTL Server pod/%s\n", s.podName) + }() + + var ( + configPath string + resourcesPath string + ) + err = log.Process("default", "Preparing configuration", func() error { + configPath, err = writeTempFile([]byte(input.CombineYAMLs( + request.ClusterConfig, request.InitConfig, request.ProviderSpecificClusterConfig, + ))) + if err != nil { + return fmt.Errorf("failed to write init configuration: %w", err) + } + + resourcesPath, err = writeTempFile([]byte(input.CombineYAMLs( + request.InitResources, request.Resources, + ))) + if err != nil { + return fmt.Errorf("failed to write resources: %w", err) + } + + return nil + }) + if err != nil { + return &pb.AbortResult{Err: err.Error()} + } + + var initialState phases.DhctlState + err = log.Process("default", "Preparing DHCTL state", func() error { + if request.State != "" { + err = json.Unmarshal([]byte(request.State), &initialState) + if err != nil { + return fmt.Errorf("unmarshalling dhctl state: %w", err) + } + } + return nil + }) + if err != nil { + return &pb.AbortResult{Err: err.Error()} + } + + var sshClient *ssh.Client + err = log.Process("default", "Preparing SSH client", func() error { + connectionConfig, err := config.ParseConnectionConfig( + request.ConnectionConfig, + config.NewSchemaStore(), + config.ValidateOptionCommanderMode(request.Options.CommanderMode), + config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), + config.ValidateOptionValidateExtensions(request.Options.CommanderMode), + ) + if err != nil { + return fmt.Errorf("parsing connection config: %w", err) + } + + sshClient, err = prepareSSHClient(connectionConfig) + if err != nil { + return fmt.Errorf("preparing ssh client: %w", err) + } + return nil + }) + if err != nil { + return &pb.AbortResult{Err: err.Error()} + } + defer sshClient.Stop() + + bootstrapper := bootstrap.NewClusterBootstrapper(&bootstrap.Params{ + ConfigPaths: []string{configPath}, + ResourcesPath: resourcesPath, + InitialState: initialState, + SSHClient: sshClient, + UseTfCache: pointer.Bool(true), + AutoApprove: pointer.Bool(true), + ResourcesTimeout: request.Options.ResourcesTimeout.AsDuration(), + DeckhouseTimeout: request.Options.DeckhouseTimeout.AsDuration(), + + ResetInitialState: true, + OnPhaseFunc: phaseSwitcher.switchPhase, + CommanderMode: request.Options.CommanderMode, + TerraformContext: terraform.NewTerraformContext(), + }) + + abortErr := bootstrapper.Abort(false) + state := bootstrapper.GetLastState() + stateData, marshalErr := json.Marshal(state) + err = errors.Join(abortErr, marshalErr) + + return &pb.AbortResult{State: string(stateData), Err: errToString(err)} +} + +func (s *Service) abortServerTransitions() []fsm.Transition { + return []fsm.Transition{ + { + Event: "start", + Sources: []fsm.State{"initial"}, + Destination: "running", + }, + { + Event: "wait", + Sources: []fsm.State{"running"}, + Destination: "waiting", + }, + { + Event: "toNextPhase", + Sources: []fsm.State{"waiting"}, + Destination: "running", + }, + } +} + +type abortLogWriter struct { + l *slog.Logger + sendCh chan *pb.AbortResponse + + m sync.Mutex + prev []byte +} + +func (w *abortLogWriter) Write(p []byte) (n int, err error) { + w.m.Lock() + defer w.m.Unlock() + + var r []string + + for _, b := range p { + switch b { + case '\n', '\r': + s := string(w.prev) + if s != "" { + r = append(r, s) + } + w.prev = []byte{} + default: + w.prev = append(w.prev, b) + } + } + + if len(r) > 0 { + for _, line := range r { + w.l.Info(line, logTypeDHCTL) + } + w.sendCh <- &pb.AbortResponse{ + Message: &pb.AbortResponse_Logs{Logs: &pb.Logs{Logs: r}}, + } + } + + return len(p), nil +} + +type abortPhaseSwitcher struct { + sendCh chan *pb.AbortResponse + f *fsm.FiniteStateMachine + next chan error +} + +func (b *abortPhaseSwitcher) switchPhase( + completedPhase phases.OperationPhase, + completedPhaseState phases.DhctlState, + _ interface{}, + nextPhase phases.OperationPhase, + nextPhaseCritical bool, +) error { + err := b.f.Event("wait") + if err != nil { + return fmt.Errorf("changing state to waiting: %w", err) + } + + b.sendCh <- &pb.AbortResponse{ + Message: &pb.AbortResponse_PhaseEnd{ + PhaseEnd: &pb.AbortPhaseEnd{ + CompletedPhase: string(completedPhase), + CompletedPhaseState: completedPhaseState, + NextPhase: string(nextPhase), + NextPhaseCritical: nextPhaseCritical, + }, + }, + } + + switchErr, ok := <-b.next + if !ok { + return fmt.Errorf("server stopped, cancel task") + } + return switchErr +} diff --git a/dhctl/pkg/server/rpc/dhctl/bootstrap.go b/dhctl/pkg/server/rpc/dhctl/bootstrap.go index f4869952d792..9e755c9510ba 100644 --- a/dhctl/pkg/server/rpc/dhctl/bootstrap.go +++ b/dhctl/pkg/server/rpc/dhctl/bootstrap.go @@ -21,201 +21,261 @@ import ( "fmt" "io" "log/slog" + "os" + "sync" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "k8s.io/utils/pointer" "github.com/deckhouse/deckhouse/dhctl/pkg/app" "github.com/deckhouse/deckhouse/dhctl/pkg/config" "github.com/deckhouse/deckhouse/dhctl/pkg/log" "github.com/deckhouse/deckhouse/dhctl/pkg/operations/bootstrap" "github.com/deckhouse/deckhouse/dhctl/pkg/operations/phases" - "github.com/deckhouse/deckhouse/dhctl/pkg/server/fsm" - "github.com/deckhouse/deckhouse/dhctl/pkg/server/logger" pb "github.com/deckhouse/deckhouse/dhctl/pkg/server/pb/dhctl" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/fsm" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/logger" + "github.com/deckhouse/deckhouse/dhctl/pkg/system/ssh" "github.com/deckhouse/deckhouse/dhctl/pkg/terraform" "github.com/deckhouse/deckhouse/dhctl/pkg/util/input" - "golang.org/x/sync/errgroup" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "k8s.io/utils/pointer" + "github.com/deckhouse/deckhouse/dhctl/pkg/util/retry" ) func (s *Service) Bootstrap(server pb.DHCTL_BootstrapServer) error { - ctx, cancel := context.WithCancel(server.Context()) - defer cancel() + ctx := operationCtx(server) - gr, ctx := errgroup.WithContext(ctx) + logger.L(ctx).Info("started") f := fsm.New("initial", s.bootstrapServerTransitions()) + doneCh := make(chan struct{}) + internalErrCh := make(chan error) + receiveCh := make(chan *pb.BootstrapRequest) + sendCh := make(chan *pb.BootstrapResponse) phaseSwitcher := &bootstrapPhaseSwitcher{ - server: server, + sendCh: sendCh, f: f, - next: make(chan struct{ err error }), + next: make(chan error), } - defer close(phaseSwitcher.next) - - gr.Go(func() error { - for { - request, err := server.Recv() - if err != nil { - if errors.Is(err, io.EOF) { - return nil - } - return status.Errorf(codes.Internal, "receiving message: %s", err) - } + s.startBootstrapperReceiver(server, receiveCh, doneCh, internalErrCh) + s.startBootstrapperSender(server, sendCh, internalErrCh) + +connectionProcessor: + for { + select { + case <-doneCh: + logger.L(ctx).Info("finished") + return nil + + case err := <-internalErrCh: + logger.L(ctx).Error("finished with internal error", logger.Err(err)) + return status.Errorf(codes.Internal, "%s", err) + + case request := <-receiveCh: + logger.L(ctx).Info( + "processing BootstrapRequest", + slog.String("message", fmt.Sprintf("%T", request.Message)), + ) switch message := request.Message.(type) { case *pb.BootstrapRequest_Start: - err = f.Event("start") - if err != nil { - s.log.Error("got unprocessable message", - logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) - continue - } - err = s.startBootstrap(ctx, gr, server, phaseSwitcher, message.Start) - - case *pb.BootstrapRequest_Stop: - err = f.Event("stop") + err := f.Event("start") if err != nil { - s.log.Error("got unprocessable message", + logger.L(ctx).Error("got unprocessable message", logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) - continue + continue connectionProcessor } - err = s.stopBootstrap(cancel, message.Stop) + s.startBootstrap( + ctx, message.Start, phaseSwitcher, &bootstrapLogWriter{l: logger.L(ctx), sendCh: sendCh}, sendCh, + ) case *pb.BootstrapRequest_Continue: - if message.Continue.Error != "" { - err = f.Event("toStop") - if err != nil { - s.log.Error("got unprocessable message", - logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) - continue - } - phaseSwitcher.next <- struct{ err error }{err: errors.New(message.Continue.Error)} - continue - } - - err = f.Event("toNextPhase") + err := f.Event("toNextPhase") if err != nil { - s.log.Error("got unprocessable message", + logger.L(ctx).Error("got unprocessable message", logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) - continue + continue connectionProcessor + } + switch message.Continue.Continue { + case pb.Continue_CONTINUE_UNSPECIFIED: + phaseSwitcher.next <- errors.New("bad continue message") + case pb.Continue_CONTINUE_NEXT_PHASE: + phaseSwitcher.next <- nil + case pb.Continue_CONTINUE_STOP_OPERATION: + phaseSwitcher.next <- phases.StopOperationCondition + case pb.Continue_CONTINUE_ERROR: + phaseSwitcher.next <- errors.New(message.Continue.Err) } - phaseSwitcher.next <- struct{ err error }{err: nil} default: - s.log.Error("got unprocessable message", + logger.L(ctx).Error("got unprocessable message", slog.String("message", fmt.Sprintf("%T", message))) - continue + continue connectionProcessor } } - }) + } +} + +func (s *Service) startBootstrapperReceiver( + server pb.DHCTL_BootstrapServer, + receiveCh chan *pb.BootstrapRequest, + doneCh chan struct{}, + internalErrCh chan error, +) { + go func() { + for { + request, err := server.Recv() + if errors.Is(err, io.EOF) { + close(doneCh) + return + } + if err != nil { + internalErrCh <- fmt.Errorf("receiving message: %w", err) + return + } + receiveCh <- request + } + }() +} - return gr.Wait() +func (s *Service) startBootstrapperSender( + server pb.DHCTL_BootstrapServer, + sendCh chan *pb.BootstrapResponse, + internalErrCh chan error, +) { + go func() { + for response := range sendCh { + loop := retry.NewSilentLoop("send message", 10, time.Millisecond*100) + err := loop.Run(func() error { + return server.Send(response) + }) + if err != nil { + internalErrCh <- fmt.Errorf("sending message: %w", err) + return + } + } + }() } func (s *Service) startBootstrap( ctx context.Context, - gr *errgroup.Group, - server pb.DHCTL_BootstrapServer, - phaseSwitcher *bootstrapPhaseSwitcher, request *pb.BootstrapStart, -) error { - gr.Go(func() error { - result, err := s.boostrap(ctx, request, phaseSwitcher, &bootstrapLogWriter{server: server}) - if err != nil { - return err - } - - err = server.Send(&pb.BootstrapResponse{ + phaseSwitcher *bootstrapPhaseSwitcher, + logWriter *bootstrapLogWriter, + sendCh chan *pb.BootstrapResponse, +) { + go func() { + result := s.bootstrap(ctx, request, phaseSwitcher, logWriter) + sendCh <- &pb.BootstrapResponse{ Message: &pb.BootstrapResponse_Result{ Result: result, }, - }) - if err != nil { - return status.Errorf(codes.Internal, "sending message: %s", err) } - return nil - }) - - return nil -} - -func (s *Service) stopBootstrap( - cancel context.CancelFunc, - _ *pb.BootstrapStop, -) error { - cancel() - return nil + }() } -func (s *Service) boostrap( +func (s *Service) bootstrap( _ context.Context, request *pb.BootstrapStart, phaseSwitcher *bootstrapPhaseSwitcher, logWriter io.Writer, -) (*pb.BootstrapResult, error) { - // set global variables from options +) *pb.BootstrapResult { + var err error + log.InitLoggerWithOptions("pretty", log.LoggerOptions{ OutStream: logWriter, Width: int(request.Options.LogWidth), }) - app.SanityCheck = request.Options.SanityCheck + app.SanityCheck = true app.UseTfCache = app.UseStateCacheYes app.PreflightSkipDeckhouseVersionCheck = true app.PreflightSkipAll = true app.CacheDir = s.cacheDir log.InfoF("Task is running by DHCTL Server pod/%s\n", s.podName) - - // parse connection config - connectionConfig, err := config.ParseConnectionConfig( - request.ConnectionConfig, - config.NewSchemaStore(), - config.ValidateOptionCommanderMode(request.Options.CommanderMode), - config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), - config.ValidateOptionValidateExtensions(request.Options.CommanderMode), + defer func() { + log.InfoF("Task done by DHCTL Server pod/%s\n", s.podName) + }() + + var ( + configPath string + resourcesPath string + postBootstrapScriptPath string ) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "parsing connection config: %s", err) - } + err = log.Process("default", "Preparing configuration", func() error { + configPath, err = writeTempFile([]byte(input.CombineYAMLs( + request.ClusterConfig, request.InitConfig, request.ProviderSpecificClusterConfig, + ))) + if err != nil { + return fmt.Errorf("failed to write init configuration: %w", err) + } - // preparse ssh client - sshClient, err := prepareSSHClient(connectionConfig) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - defer sshClient.Stop() + resourcesPath, err = writeTempFile([]byte(input.CombineYAMLs( + request.InitResources, request.Resources, + ))) + if err != nil { + return fmt.Errorf("failed to write resources: %w", err) + } - // prepare config files - configPath, err := writeTempFile([]byte(input.CombineYAMLs( - request.ClusterConfig, request.InitConfig, request.ProviderSpecificClusterConfig, - ))) - if err != nil { - return nil, fmt.Errorf("failed to write init configuration: %w", err) - } + postBootstrapScriptPath, err = writeTempFile([]byte(request.PostBootstrapScript)) + if err != nil { + return fmt.Errorf("failed to write post bootstrap script: %w", err) + } + postBootstrapScript, err := os.Open(postBootstrapScriptPath) + if err != nil { + return fmt.Errorf("failed to open post bootstrap script: %w", err) + } + err = postBootstrapScript.Chmod(0555) + if err != nil { + return fmt.Errorf("failed to chmod post bootstrap script: %w", err) + } - resourcesPath, err := writeTempFile([]byte(input.CombineYAMLs( - request.InitResources, request.Resources, - ))) + return nil + }) if err != nil { - return nil, fmt.Errorf("failed to write resources: %w", err) + return &pb.BootstrapResult{Err: err.Error()} } - postBootstrapScriptPath, err := writeTempFile([]byte(request.PostBootstrapScript)) + var initialState phases.DhctlState + err = log.Process("default", "Preparing DHCTL state", func() error { + if request.State != "" { + err = json.Unmarshal([]byte(request.State), &initialState) + if err != nil { + return fmt.Errorf("unmarshalling dhctl state: %w", err) + } + } + return nil + }) if err != nil { - return nil, fmt.Errorf("failed to write resources: %w", err) + return &pb.BootstrapResult{Err: err.Error()} } - // init dhctl state - var initialState phases.DhctlState - if request.State != "" { - err = json.Unmarshal([]byte(request.State), &initialState) + var sshClient *ssh.Client + err = log.Process("default", "Preparing SSH client", func() error { + connectionConfig, err := config.ParseConnectionConfig( + request.ConnectionConfig, + config.NewSchemaStore(), + config.ValidateOptionCommanderMode(request.Options.CommanderMode), + config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), + config.ValidateOptionValidateExtensions(request.Options.CommanderMode), + ) + if err != nil { + return fmt.Errorf("parsing connection config: %w", err) + } + + sshClient, err = prepareSSHClient(connectionConfig) if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "unmarshalling dhctl state: %s", err) + return fmt.Errorf("preparing ssh client: %w", err) } + return nil + }) + if err != nil { + return &pb.BootstrapResult{Err: err.Error()} } + defer sshClient.Stop() - // boostrap cluster bootstrapper := bootstrap.NewClusterBootstrapper(&bootstrap.Params{ SSHClient: sshClient, InitialState: initialState, @@ -236,27 +296,10 @@ func (s *Service) boostrap( bootstrapErr := bootstrapper.Bootstrap() state := bootstrapper.GetLastState() - data, marshalErr := json.Marshal(state) - - return &pb.BootstrapResult{State: string(data)}, errors.Join(bootstrapErr, marshalErr) -} - -type bootstrapLogWriter struct { - server pb.DHCTL_BootstrapServer -} + stateData, marshalErr := json.Marshal(state) + err = errors.Join(bootstrapErr, marshalErr) -func (w *bootstrapLogWriter) Write(p []byte) (int, error) { - err := w.server.Send(&pb.BootstrapResponse{ - Message: &pb.BootstrapResponse_Logs{ - Logs: &pb.Logs{ - Logs: p, - }, - }, - }) - if err != nil { - return 0, fmt.Errorf("writing check logs: %w", err) - } - return len(p), nil + return &pb.BootstrapResult{State: string(stateData), Err: errToString(err)} } func (s *Service) bootstrapServerTransitions() []fsm.Transition { @@ -276,23 +319,52 @@ func (s *Service) bootstrapServerTransitions() []fsm.Transition { Sources: []fsm.State{"waiting"}, Destination: "running", }, - { - Event: "toStop", - Sources: []fsm.State{"waiting"}, - Destination: "stopped", - }, - { - Event: "stop", - Sources: []fsm.State{"running", "waiting"}, - Destination: "stopped", - }, } } +type bootstrapLogWriter struct { + l *slog.Logger + sendCh chan *pb.BootstrapResponse + + m sync.Mutex + prev []byte +} + +func (w *bootstrapLogWriter) Write(p []byte) (n int, err error) { + w.m.Lock() + defer w.m.Unlock() + + var r []string + + for _, b := range p { + switch b { + case '\n', '\r': + s := string(w.prev) + if s != "" { + r = append(r, s) + } + w.prev = []byte{} + default: + w.prev = append(w.prev, b) + } + } + + if len(r) > 0 { + for _, line := range r { + w.l.Info(line, logTypeDHCTL) + } + w.sendCh <- &pb.BootstrapResponse{ + Message: &pb.BootstrapResponse_Logs{Logs: &pb.Logs{Logs: r}}, + } + } + + return len(p), nil +} + type bootstrapPhaseSwitcher struct { - server pb.DHCTL_BootstrapServer + sendCh chan *pb.BootstrapResponse f *fsm.FiniteStateMachine - next chan struct{ err error } + next chan error } func (b *bootstrapPhaseSwitcher) switchPhase( @@ -307,7 +379,7 @@ func (b *bootstrapPhaseSwitcher) switchPhase( return fmt.Errorf("changing state to waiting: %w", err) } - err = b.server.Send(&pb.BootstrapResponse{ + b.sendCh <- &pb.BootstrapResponse{ Message: &pb.BootstrapResponse_PhaseEnd{ PhaseEnd: &pb.BootstrapPhaseEnd{ CompletedPhase: string(completedPhase), @@ -316,14 +388,11 @@ func (b *bootstrapPhaseSwitcher) switchPhase( NextPhaseCritical: nextPhaseCritical, }, }, - }) - if err != nil { - return fmt.Errorf("sending on phase message: %w", err) } - msg, ok := <-b.next + switchErr, ok := <-b.next if !ok { return fmt.Errorf("server stopped, cancel task") } - return msg.err + return switchErr } diff --git a/dhctl/pkg/server/rpc/dhctl/check.go b/dhctl/pkg/server/rpc/dhctl/check.go index f7adf1a48775..e642e646142d 100644 --- a/dhctl/pkg/server/rpc/dhctl/check.go +++ b/dhctl/pkg/server/rpc/dhctl/check.go @@ -21,8 +21,9 @@ import ( "fmt" "io" "log/slog" + "sync" + "time" - "golang.org/x/sync/errgroup" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -32,162 +33,210 @@ import ( "github.com/deckhouse/deckhouse/dhctl/pkg/operations/check" "github.com/deckhouse/deckhouse/dhctl/pkg/operations/commander" "github.com/deckhouse/deckhouse/dhctl/pkg/operations/phases" - "github.com/deckhouse/deckhouse/dhctl/pkg/server/fsm" - "github.com/deckhouse/deckhouse/dhctl/pkg/server/logger" pb "github.com/deckhouse/deckhouse/dhctl/pkg/server/pb/dhctl" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/fsm" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/logger" "github.com/deckhouse/deckhouse/dhctl/pkg/state/cache" + "github.com/deckhouse/deckhouse/dhctl/pkg/system/ssh" "github.com/deckhouse/deckhouse/dhctl/pkg/terraform" "github.com/deckhouse/deckhouse/dhctl/pkg/util/input" + "github.com/deckhouse/deckhouse/dhctl/pkg/util/retry" ) func (s *Service) Check(server pb.DHCTL_CheckServer) error { - ctx, cancel := context.WithCancel(server.Context()) - defer cancel() + ctx := operationCtx(server) - gr, ctx := errgroup.WithContext(ctx) + logger.L(ctx).Info("started") f := fsm.New("initial", s.checkServerTransitions()) - gr.Go(func() error { - for { - request, err := server.Recv() - if err != nil { - if errors.Is(err, io.EOF) { - return nil - } - return status.Errorf(codes.Internal, "receiving message: %s", err) - } + doneCh := make(chan struct{}) + internalErrCh := make(chan error) + receiveCh := make(chan *pb.CheckRequest) + sendCh := make(chan *pb.CheckResponse, 100) + + s.startCheckerReceiver(server, receiveCh, doneCh, internalErrCh) + s.startCheckerSender(server, sendCh, internalErrCh) +connectionProcessor: + for { + select { + case <-doneCh: + logger.L(ctx).Info("finished") + return nil + + case err := <-internalErrCh: + logger.L(ctx).Error("finished with internal error", logger.Err(err)) + return status.Errorf(codes.Internal, "%s", err) + + case request := <-receiveCh: + logger.L(ctx).Info( + "processing CheckRequest", + slog.String("message", fmt.Sprintf("%T", request.Message)), + ) switch message := request.Message.(type) { case *pb.CheckRequest_Start: - err = f.Event("start") - if err != nil { - s.log.Error("got unprocessable message", - logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) - continue - } - err = s.startCheck(ctx, gr, server, message.Start) - - case *pb.CheckRequest_Stop: - err = f.Event("stop") + err := f.Event("start") if err != nil { - s.log.Error("got unprocessable message", + logger.L(ctx).Error("got unprocessable message", logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) - continue + continue connectionProcessor } - err = s.stopCheck(cancel, message.Stop) + s.startChecker( + ctx, message.Start, &checkLogWriter{l: logger.L(ctx), sendCh: sendCh}, sendCh, + ) default: - s.log.Error("got unprocessable message", + logger.L(ctx).Error("got unprocessable message", slog.String("message", fmt.Sprintf("%T", message))) - continue + continue connectionProcessor } } - }) + } +} - return gr.Wait() +func (s *Service) startCheckerReceiver( + server pb.DHCTL_CheckServer, + receiveCh chan *pb.CheckRequest, + doneCh chan struct{}, + internalErrCh chan error, +) { + go func() { + for { + request, err := server.Recv() + if errors.Is(err, io.EOF) { + close(doneCh) + return + } + if err != nil { + internalErrCh <- fmt.Errorf("receiving message: %w", err) + return + } + receiveCh <- request + } + }() } -func (s *Service) startCheck( - ctx context.Context, - gr *errgroup.Group, +func (s *Service) startCheckerSender( server pb.DHCTL_CheckServer, - request *pb.CheckStart, -) error { - gr.Go(func() error { - result, err := s.check(ctx, request, &checkLogWriter{server: server}) - if err != nil { - return err + sendCh chan *pb.CheckResponse, + internalErrCh chan error, +) { + go func() { + for response := range sendCh { + loop := retry.NewSilentLoop("send message", 10, time.Millisecond*100) + err := loop.Run(func() error { + return server.Send(response) + }) + if err != nil { + internalErrCh <- fmt.Errorf("sending message: %w", err) + return + } } + }() +} - err = server.Send(&pb.CheckResponse{ +func (s *Service) startChecker( + ctx context.Context, + request *pb.CheckStart, + logWriter *checkLogWriter, + sendCh chan *pb.CheckResponse, +) { + go func() { + result := s.check(ctx, request, logWriter) + sendCh <- &pb.CheckResponse{ Message: &pb.CheckResponse_Result{ Result: result, }, - }) - if err != nil { - return status.Errorf(codes.Internal, "sending message: %s", err) } - return nil - }) - - return nil -} - -func (s *Service) stopCheck( - cancel context.CancelFunc, - _ *pb.CheckStop, -) error { - cancel() - return nil + }() } func (s *Service) check( ctx context.Context, request *pb.CheckStart, logWriter io.Writer, -) (*pb.CheckResult, error) { - // set global variables from options +) *pb.CheckResult { + var err error + log.InitLoggerWithOptions("pretty", log.LoggerOptions{ OutStream: logWriter, Width: int(request.Options.LogWidth), }) - app.SanityCheck = request.Options.SanityCheck + app.SanityCheck = true app.UseTfCache = app.UseStateCacheYes app.ResourcesTimeout = request.Options.ResourcesTimeout.AsDuration() app.DeckhouseTimeout = request.Options.DeckhouseTimeout.AsDuration() app.CacheDir = s.cacheDir log.InfoF("Task is running by DHCTL Server pod/%s\n", s.podName) + defer func() { + log.InfoF("Task done by DHCTL Server pod/%s\n", s.podName) + }() - // parse connection config - connectionConfig, err := config.ParseConnectionConfig( - request.ConnectionConfig, - config.NewSchemaStore(), - config.ValidateOptionCommanderMode(request.Options.CommanderMode), - config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), - config.ValidateOptionValidateExtensions(request.Options.CommanderMode), - ) + var metaConfig *config.MetaConfig + err = log.Process("default", "Parsing cluster config", func() error { + metaConfig, err = config.ParseConfigFromData( + input.CombineYAMLs(request.ClusterConfig, request.ProviderSpecificClusterConfig), + config.ValidateOptionCommanderMode(request.Options.CommanderMode), + config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), + config.ValidateOptionValidateExtensions(request.Options.CommanderMode), + ) + if err != nil { + return fmt.Errorf("parsing cluster meta config: %w", err) + } + return nil + }) if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "parsing connection config: %s", err) + return &pb.CheckResult{Err: err.Error()} } - // parse meta config - metaConfig, err := config.ParseConfigFromData( - input.CombineYAMLs(request.ClusterConfig, request.ProviderSpecificClusterConfig), - config.ValidateOptionCommanderMode(request.Options.CommanderMode), - config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), - config.ValidateOptionValidateExtensions(request.Options.CommanderMode), - ) + err = log.Process("default", "Preparing DHCTL state", func() error { + cachePath := metaConfig.CachePath() + var initialState phases.DhctlState + if request.State != "" { + err = json.Unmarshal([]byte(request.State), &initialState) + if err != nil { + return fmt.Errorf("unmarshalling dhctl state: %w", err) + } + } + err = cache.InitWithOptions( + cachePath, + cache.CacheOptions{InitialState: initialState, ResetInitialState: true}, + ) + if err != nil { + return fmt.Errorf("initializing cache at %s: %w", cachePath, err) + } + return nil + }) if err != nil { - return nil, status.Errorf(codes.Internal, "parsing meta config: %s", err) + return &pb.CheckResult{Err: err.Error()} } - // init dhctl cache - cachePath := metaConfig.CachePath() - var initialState phases.DhctlState - if request.State != "" { - err = json.Unmarshal([]byte(request.State), &initialState) + var sshClient *ssh.Client + err = log.Process("default", "Preparing SSH client", func() error { + connectionConfig, err := config.ParseConnectionConfig( + request.ConnectionConfig, + config.NewSchemaStore(), + config.ValidateOptionCommanderMode(request.Options.CommanderMode), + config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), + config.ValidateOptionValidateExtensions(request.Options.CommanderMode), + ) if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "unmarshalling dhctl state: %s", err) + return fmt.Errorf("parsing connection config: %w", err) } - } - err = cache.InitWithOptions( - cachePath, - cache.CacheOptions{InitialState: initialState, ResetInitialState: true}, - ) - if err != nil { - return nil, status.Errorf(codes.Internal, "initializing cache at %s: %s", cachePath, err) - } - // preparse ssh client - sshClient, err := prepareSSHClient(connectionConfig) + sshClient, err = prepareSSHClient(connectionConfig) + if err != nil { + return fmt.Errorf("preparing ssh client: %w", err) + } + return nil + }) if err != nil { - return nil, status.Error(codes.Internal, err.Error()) + return &pb.CheckResult{Err: err.Error()} } defer sshClient.Stop() - // check cluster state checker := check.NewChecker(&check.Params{ SSHClient: sshClient, StateCache: cache.Global(), @@ -199,35 +248,16 @@ func (s *Service) check( TerraformContext: terraform.NewTerraformContext(), }) - result, err := checker.Check(ctx) - if err != nil { - return nil, status.Errorf(codes.Internal, "checking cluster state: %s", err) - } + result, checkErr := checker.Check(ctx) + resultData, marshalErr := json.Marshal(result) + err = errors.Join(checkErr, marshalErr) - resultString, err := json.Marshal(result) - if err != nil { - return nil, status.Errorf(codes.Internal, "marshalling check result: %s", err) + if result != nil { + // todo: move onCheckResult call to check.Check() func (as in converge) + _ = onCheckResult(result) } - return &pb.CheckResult{Result: string(resultString)}, nil -} - -type checkLogWriter struct { - server pb.DHCTL_CheckServer -} - -func (w *checkLogWriter) Write(p []byte) (int, error) { - err := w.server.Send(&pb.CheckResponse{ - Message: &pb.CheckResponse_Logs{ - Logs: &pb.Logs{ - Logs: p, - }, - }, - }) - if err != nil { - return 0, fmt.Errorf("writing check logs: %w", err) - } - return len(p), nil + return &pb.CheckResult{Result: string(resultData), Err: errToString(err)} } func (s *Service) checkServerTransitions() []fsm.Transition { @@ -237,10 +267,44 @@ func (s *Service) checkServerTransitions() []fsm.Transition { Sources: []fsm.State{"initial"}, Destination: "running", }, - { - Event: "stop", - Sources: []fsm.State{"running"}, - Destination: "stopped", - }, } } + +type checkLogWriter struct { + l *slog.Logger + sendCh chan *pb.CheckResponse + + m sync.Mutex + prev []byte +} + +func (w *checkLogWriter) Write(p []byte) (n int, err error) { + w.m.Lock() + defer w.m.Unlock() + + var r []string + + for _, b := range p { + switch b { + case '\n', '\r': + s := string(w.prev) + if s != "" { + r = append(r, s) + } + w.prev = []byte{} + default: + w.prev = append(w.prev, b) + } + } + + if len(r) > 0 { + for _, line := range r { + w.l.Info(line, logTypeDHCTL) + } + w.sendCh <- &pb.CheckResponse{ + Message: &pb.CheckResponse_Logs{Logs: &pb.Logs{Logs: r}}, + } + } + + return len(p), nil +} diff --git a/dhctl/pkg/server/rpc/dhctl/converge.go b/dhctl/pkg/server/rpc/dhctl/converge.go new file mode 100644 index 000000000000..83d13350a390 --- /dev/null +++ b/dhctl/pkg/server/rpc/dhctl/converge.go @@ -0,0 +1,397 @@ +// Copyright 2024 Flant JSC +// +// 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 dhctl + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "log/slog" + "sync" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/deckhouse/deckhouse/dhctl/pkg/app" + "github.com/deckhouse/deckhouse/dhctl/pkg/config" + "github.com/deckhouse/deckhouse/dhctl/pkg/log" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/check" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/commander" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/converge" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/phases" + pb "github.com/deckhouse/deckhouse/dhctl/pkg/server/pb/dhctl" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/fsm" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/logger" + "github.com/deckhouse/deckhouse/dhctl/pkg/state/cache" + "github.com/deckhouse/deckhouse/dhctl/pkg/system/ssh" + "github.com/deckhouse/deckhouse/dhctl/pkg/terraform" + "github.com/deckhouse/deckhouse/dhctl/pkg/util/input" + "github.com/deckhouse/deckhouse/dhctl/pkg/util/retry" +) + +func (s *Service) Converge(server pb.DHCTL_ConvergeServer) error { + ctx := operationCtx(server) + + logger.L(ctx).Info("started") + + f := fsm.New("initial", s.convergeServerTransitions()) + + doneCh := make(chan struct{}) + internalErrCh := make(chan error) + receiveCh := make(chan *pb.ConvergeRequest) + sendCh := make(chan *pb.ConvergeResponse) + phaseSwitcher := &convergePhaseSwitcher{ + sendCh: sendCh, + f: f, + next: make(chan error), + } + + s.startConvergerReceiver(server, receiveCh, doneCh, internalErrCh) + s.startConvergerSender(server, sendCh, internalErrCh) + +connectionProcessor: + for { + select { + case <-doneCh: + logger.L(ctx).Info("finished") + return nil + + case err := <-internalErrCh: + logger.L(ctx).Error("finished with internal error", logger.Err(err)) + return status.Errorf(codes.Internal, "%s", err) + + case request := <-receiveCh: + logger.L(ctx).Info( + "processing ConvergeRequest", + slog.String("message", fmt.Sprintf("%T", request.Message)), + ) + switch message := request.Message.(type) { + case *pb.ConvergeRequest_Start: + err := f.Event("start") + if err != nil { + logger.L(ctx).Error("got unprocessable message", + logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + s.startConverge( + ctx, message.Start, phaseSwitcher, &convergeLogWriter{l: logger.L(ctx), sendCh: sendCh}, sendCh, + ) + + case *pb.ConvergeRequest_Continue: + err := f.Event("toNextPhase") + if err != nil { + logger.L(ctx).Error("got unprocessable message", + logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + switch message.Continue.Continue { + case pb.Continue_CONTINUE_UNSPECIFIED: + phaseSwitcher.next <- errors.New("bad continue message") + case pb.Continue_CONTINUE_NEXT_PHASE: + phaseSwitcher.next <- nil + case pb.Continue_CONTINUE_STOP_OPERATION: + phaseSwitcher.next <- phases.StopOperationCondition + case pb.Continue_CONTINUE_ERROR: + phaseSwitcher.next <- errors.New(message.Continue.Err) + } + + default: + logger.L(ctx).Error("got unprocessable message", + slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + } + } +} + +func (s *Service) startConvergerReceiver( + server pb.DHCTL_ConvergeServer, + receiveCh chan *pb.ConvergeRequest, + doneCh chan struct{}, + internalErrCh chan error, +) { + go func() { + for { + request, err := server.Recv() + if errors.Is(err, io.EOF) { + close(doneCh) + return + } + if err != nil { + internalErrCh <- fmt.Errorf("receiving message: %w", err) + return + } + receiveCh <- request + } + }() +} + +func (s *Service) startConvergerSender( + server pb.DHCTL_ConvergeServer, + sendCh chan *pb.ConvergeResponse, + internalErrCh chan error, +) { + go func() { + for response := range sendCh { + loop := retry.NewSilentLoop("send message", 10, time.Millisecond*100) + err := loop.Run(func() error { + return server.Send(response) + }) + if err != nil { + internalErrCh <- fmt.Errorf("sending message: %w", err) + return + } + } + }() +} + +func (s *Service) startConverge( + ctx context.Context, + request *pb.ConvergeStart, + phaseSwitcher *convergePhaseSwitcher, + logWriter *convergeLogWriter, + sendCh chan *pb.ConvergeResponse, +) { + go func() { + result := s.converge(ctx, request, phaseSwitcher, logWriter) + sendCh <- &pb.ConvergeResponse{ + Message: &pb.ConvergeResponse_Result{ + Result: result, + }, + } + }() +} + +func (s *Service) converge( + ctx context.Context, + request *pb.ConvergeStart, + phaseSwitcher *convergePhaseSwitcher, + logWriter io.Writer, +) *pb.ConvergeResult { + var err error + + log.InitLoggerWithOptions("pretty", log.LoggerOptions{ + OutStream: logWriter, + Width: int(request.Options.LogWidth), + }) + app.SanityCheck = true + app.UseTfCache = app.UseStateCacheYes + app.ResourcesTimeout = request.Options.ResourcesTimeout.AsDuration() + app.DeckhouseTimeout = request.Options.DeckhouseTimeout.AsDuration() + app.CacheDir = s.cacheDir + + log.InfoF("Task is running by DHCTL Server pod/%s\n", s.podName) + defer func() { + log.InfoF("Task done by DHCTL Server pod/%s\n", s.podName) + }() + + var metaConfig *config.MetaConfig + err = log.Process("default", "Parsing cluster config", func() error { + metaConfig, err = config.ParseConfigFromData( + input.CombineYAMLs(request.ClusterConfig, request.ProviderSpecificClusterConfig), + config.ValidateOptionCommanderMode(request.Options.CommanderMode), + config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), + config.ValidateOptionValidateExtensions(request.Options.CommanderMode), + ) + if err != nil { + return fmt.Errorf("parsing cluster meta config: %w", err) + } + return nil + }) + if err != nil { + return &pb.ConvergeResult{Err: err.Error()} + } + + err = log.Process("default", "Preparing DHCTL state", func() error { + cachePath := metaConfig.CachePath() + var initialState phases.DhctlState + if request.State != "" { + err = json.Unmarshal([]byte(request.State), &initialState) + if err != nil { + return fmt.Errorf("unmarshalling dhctl state: %w", err) + } + } + err = cache.InitWithOptions( + cachePath, + cache.CacheOptions{InitialState: initialState, ResetInitialState: true}, + ) + if err != nil { + return fmt.Errorf("initializing cache at %s: %w", cachePath, err) + } + return nil + }) + if err != nil { + return &pb.ConvergeResult{Err: err.Error()} + } + + var sshClient *ssh.Client + err = log.Process("default", "Preparing SSH client", func() error { + connectionConfig, err := config.ParseConnectionConfig( + request.ConnectionConfig, + config.NewSchemaStore(), + config.ValidateOptionCommanderMode(request.Options.CommanderMode), + config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), + config.ValidateOptionValidateExtensions(request.Options.CommanderMode), + ) + if err != nil { + return fmt.Errorf("parsing connection config: %w", err) + } + + sshClient, err = prepareSSHClient(connectionConfig) + if err != nil { + return fmt.Errorf("preparing ssh client: %w", err) + } + return nil + }) + if err != nil { + return &pb.ConvergeResult{Err: err.Error()} + } + defer sshClient.Stop() + + terraformContext := terraform.NewTerraformContext() + + checker := check.NewChecker(&check.Params{ + SSHClient: sshClient, + StateCache: cache.Global(), + CommanderMode: request.Options.CommanderMode, + CommanderModeParams: commander.NewCommanderModeParams( + []byte(request.ClusterConfig), + []byte(request.ProviderSpecificClusterConfig), + ), + TerraformContext: terraform.NewTerraformContext(), + }) + + converger := converge.NewConverger(&converge.Params{ + SSHClient: sshClient, + OnPhaseFunc: phaseSwitcher.switchPhase, + AutoApprove: true, + AutoDismissDestructive: false, + CommanderMode: true, + CommanderModeParams: commander.NewCommanderModeParams( + []byte(request.ClusterConfig), + []byte(request.ProviderSpecificClusterConfig), + ), + TerraformContext: terraformContext, + Checker: checker, + ApproveDestructiveChangeID: request.ApproveDestructionChangeId, + OnCheckResult: onCheckResult, + }) + + result, convergeErr := converger.Converge(ctx) + state := converger.GetLastState() + stateData, marshalStateErr := json.Marshal(state) + resultString, marshalResultErr := json.Marshal(result) + err = errors.Join(convergeErr, marshalStateErr, marshalResultErr) + + return &pb.ConvergeResult{State: string(stateData), Result: string(resultString), Err: errToString(err)} +} + +func (s *Service) convergeServerTransitions() []fsm.Transition { + return []fsm.Transition{ + { + Event: "start", + Sources: []fsm.State{"initial"}, + Destination: "running", + }, + { + Event: "wait", + Sources: []fsm.State{"running"}, + Destination: "waiting", + }, + { + Event: "toNextPhase", + Sources: []fsm.State{"waiting"}, + Destination: "running", + }, + } +} + +type convergeLogWriter struct { + l *slog.Logger + sendCh chan *pb.ConvergeResponse + + m sync.Mutex + prev []byte +} + +func (w *convergeLogWriter) Write(p []byte) (n int, err error) { + w.m.Lock() + defer w.m.Unlock() + + var r []string + + for _, b := range p { + switch b { + case '\n', '\r': + s := string(w.prev) + if s != "" { + r = append(r, s) + } + w.prev = []byte{} + default: + w.prev = append(w.prev, b) + } + } + + if len(r) > 0 { + for _, line := range r { + w.l.Info(line, logTypeDHCTL) + } + w.sendCh <- &pb.ConvergeResponse{ + Message: &pb.ConvergeResponse_Logs{Logs: &pb.Logs{Logs: r}}, + } + } + + return len(p), nil +} + +type convergePhaseSwitcher struct { + sendCh chan *pb.ConvergeResponse + f *fsm.FiniteStateMachine + next chan error +} + +func (b *convergePhaseSwitcher) switchPhase( + completedPhase phases.OperationPhase, + completedPhaseState phases.DhctlState, + _ interface{}, + nextPhase phases.OperationPhase, + nextPhaseCritical bool, +) error { + err := b.f.Event("wait") + if err != nil { + return fmt.Errorf("changing state to waiting: %w", err) + } + + b.sendCh <- &pb.ConvergeResponse{ + Message: &pb.ConvergeResponse_PhaseEnd{ + PhaseEnd: &pb.ConvergePhaseEnd{ + CompletedPhase: string(completedPhase), + CompletedPhaseState: completedPhaseState, + NextPhase: string(nextPhase), + NextPhaseCritical: nextPhaseCritical, + }, + }, + } + + switchErr, ok := <-b.next + if !ok { + return fmt.Errorf("server stopped, cancel task") + } + return switchErr +} diff --git a/dhctl/pkg/server/rpc/dhctl/destroy.go b/dhctl/pkg/server/rpc/dhctl/destroy.go new file mode 100644 index 000000000000..50de16fcb8f3 --- /dev/null +++ b/dhctl/pkg/server/rpc/dhctl/destroy.go @@ -0,0 +1,381 @@ +// Copyright 2024 Flant JSC +// +// 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 dhctl + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "log/slog" + "sync" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/deckhouse/deckhouse/dhctl/pkg/app" + "github.com/deckhouse/deckhouse/dhctl/pkg/config" + "github.com/deckhouse/deckhouse/dhctl/pkg/log" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/commander" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/destroy" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/phases" + pb "github.com/deckhouse/deckhouse/dhctl/pkg/server/pb/dhctl" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/fsm" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/logger" + "github.com/deckhouse/deckhouse/dhctl/pkg/state/cache" + "github.com/deckhouse/deckhouse/dhctl/pkg/system/ssh" + "github.com/deckhouse/deckhouse/dhctl/pkg/terraform" + "github.com/deckhouse/deckhouse/dhctl/pkg/util/input" + "github.com/deckhouse/deckhouse/dhctl/pkg/util/retry" +) + +func (s *Service) Destroy(server pb.DHCTL_DestroyServer) error { + ctx := operationCtx(server) + + logger.L(ctx).Info("started") + + f := fsm.New("initial", s.destroyServerTransitions()) + + doneCh := make(chan struct{}) + internalErrCh := make(chan error) + receiveCh := make(chan *pb.DestroyRequest) + sendCh := make(chan *pb.DestroyResponse) + phaseSwitcher := &destroyPhaseSwitcher{ + sendCh: sendCh, + f: f, + next: make(chan error), + } + + s.startDestroyerReceiver(server, receiveCh, doneCh, internalErrCh) + s.startDestroyerSender(server, sendCh, internalErrCh) + +connectionProcessor: + for { + select { + case <-doneCh: + logger.L(ctx).Info("finished") + return nil + + case err := <-internalErrCh: + logger.L(ctx).Error("finished with internal error", logger.Err(err)) + return status.Errorf(codes.Internal, "%s", err) + + case request := <-receiveCh: + logger.L(ctx).Info( + "processing DestroyRequest", + slog.String("message", fmt.Sprintf("%T", request.Message)), + ) + switch message := request.Message.(type) { + case *pb.DestroyRequest_Start: + err := f.Event("start") + if err != nil { + logger.L(ctx).Error("got unprocessable message", + logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + s.startDestroy( + ctx, message.Start, phaseSwitcher, &destroyLogWriter{l: logger.L(ctx), sendCh: sendCh}, sendCh, + ) + + case *pb.DestroyRequest_Continue: + err := f.Event("toNextPhase") + if err != nil { + logger.L(ctx).Error("got unprocessable message", + logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + switch message.Continue.Continue { + case pb.Continue_CONTINUE_UNSPECIFIED: + phaseSwitcher.next <- errors.New("bad continue message") + case pb.Continue_CONTINUE_NEXT_PHASE: + phaseSwitcher.next <- nil + case pb.Continue_CONTINUE_STOP_OPERATION: + phaseSwitcher.next <- phases.StopOperationCondition + case pb.Continue_CONTINUE_ERROR: + phaseSwitcher.next <- errors.New(message.Continue.Err) + } + + default: + logger.L(ctx).Error("got unprocessable message", + slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + } + } +} + +func (s *Service) startDestroyerReceiver( + server pb.DHCTL_DestroyServer, + receiveCh chan *pb.DestroyRequest, + doneCh chan struct{}, + internalErrCh chan error, +) { + go func() { + for { + request, err := server.Recv() + if errors.Is(err, io.EOF) { + close(doneCh) + return + } + if err != nil { + internalErrCh <- fmt.Errorf("receiving message: %w", err) + return + } + receiveCh <- request + } + }() +} + +func (s *Service) startDestroyerSender( + server pb.DHCTL_DestroyServer, + sendCh chan *pb.DestroyResponse, + internalErrCh chan error, +) { + go func() { + for response := range sendCh { + loop := retry.NewSilentLoop("send message", 10, time.Millisecond*100) + err := loop.Run(func() error { + return server.Send(response) + }) + if err != nil { + internalErrCh <- fmt.Errorf("sending message: %w", err) + return + } + } + }() +} + +func (s *Service) startDestroy( + ctx context.Context, + request *pb.DestroyStart, + phaseSwitcher *destroyPhaseSwitcher, + logWriter *destroyLogWriter, + sendCh chan *pb.DestroyResponse, +) { + go func() { + result := s.destroy(ctx, request, phaseSwitcher, logWriter) + sendCh <- &pb.DestroyResponse{ + Message: &pb.DestroyResponse_Result{ + Result: result, + }, + } + }() +} + +func (s *Service) destroy( + _ context.Context, + request *pb.DestroyStart, + phaseSwitcher *destroyPhaseSwitcher, + logWriter io.Writer, +) *pb.DestroyResult { + var err error + + log.InitLoggerWithOptions("pretty", log.LoggerOptions{ + OutStream: logWriter, + Width: int(request.Options.LogWidth), + }) + app.SanityCheck = true + app.UseTfCache = app.UseStateCacheYes + app.ResourcesTimeout = request.Options.ResourcesTimeout.AsDuration() + app.DeckhouseTimeout = request.Options.DeckhouseTimeout.AsDuration() + app.CacheDir = s.cacheDir + + log.InfoF("Task is running by DHCTL Server pod/%s\n", s.podName) + defer func() { + log.InfoF("Task done by DHCTL Server pod/%s\n", s.podName) + }() + + var metaConfig *config.MetaConfig + err = log.Process("default", "Parsing cluster config", func() error { + metaConfig, err = config.ParseConfigFromData( + input.CombineYAMLs(request.ClusterConfig, request.InitConfig, request.ProviderSpecificClusterConfig), + config.ValidateOptionCommanderMode(request.Options.CommanderMode), + config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), + config.ValidateOptionValidateExtensions(request.Options.CommanderMode), + ) + if err != nil { + return fmt.Errorf("parsing cluster meta config: %w", err) + } + return nil + }) + if err != nil { + return &pb.DestroyResult{Err: err.Error()} + } + + err = log.Process("default", "Preparing DHCTL state", func() error { + cachePath := metaConfig.CachePath() + var initialState phases.DhctlState + if request.State != "" { + err = json.Unmarshal([]byte(request.State), &initialState) + if err != nil { + return fmt.Errorf("unmarshalling dhctl state: %w", err) + } + } + err = cache.InitWithOptions( + cachePath, + cache.CacheOptions{InitialState: initialState, ResetInitialState: true}, + ) + if err != nil { + return fmt.Errorf("initializing cache at %s: %w", cachePath, err) + } + return nil + }) + if err != nil { + return &pb.DestroyResult{Err: err.Error()} + } + + var sshClient *ssh.Client + err = log.Process("default", "Preparing SSH client", func() error { + connectionConfig, err := config.ParseConnectionConfig( + request.ConnectionConfig, + config.NewSchemaStore(), + config.ValidateOptionCommanderMode(request.Options.CommanderMode), + config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), + config.ValidateOptionValidateExtensions(request.Options.CommanderMode), + ) + if err != nil { + return fmt.Errorf("parsing connection config: %w", err) + } + + sshClient, err = prepareSSHClient(connectionConfig) + if err != nil { + return fmt.Errorf("preparing ssh client: %w", err) + } + return nil + }) + if err != nil { + return &pb.DestroyResult{Err: err.Error()} + } + defer sshClient.Stop() + + destroyer, err := destroy.NewClusterDestroyer(&destroy.Params{ + SSHClient: sshClient, + StateCache: cache.Global(), + OnPhaseFunc: phaseSwitcher.switchPhase, + CommanderMode: true, + CommanderModeParams: commander.NewCommanderModeParams( + []byte(request.ClusterConfig), + []byte(request.ProviderSpecificClusterConfig), + ), + TerraformContext: terraform.NewTerraformContext(), + }) + if err != nil { + return &pb.DestroyResult{Err: fmt.Errorf("unable to initialize cluster destroyer: %w", err).Error()} + } + + destroyErr := destroyer.DestroyCluster(true) + state := destroyer.PhasedExecutionContext.GetLastState() + data, marshalErr := json.Marshal(state) + err = errors.Join(destroyErr, marshalErr) + + return &pb.DestroyResult{State: string(data), Err: errToString(err)} +} + +func (s *Service) destroyServerTransitions() []fsm.Transition { + return []fsm.Transition{ + { + Event: "start", + Sources: []fsm.State{"initial"}, + Destination: "running", + }, + { + Event: "wait", + Sources: []fsm.State{"running"}, + Destination: "waiting", + }, + { + Event: "toNextPhase", + Sources: []fsm.State{"waiting"}, + Destination: "running", + }, + } +} + +type destroyLogWriter struct { + l *slog.Logger + sendCh chan *pb.DestroyResponse + + m sync.Mutex + prev []byte +} + +func (w *destroyLogWriter) Write(p []byte) (n int, err error) { + w.m.Lock() + defer w.m.Unlock() + + var r []string + + for _, b := range p { + switch b { + case '\n', '\r': + s := string(w.prev) + if s != "" { + r = append(r, s) + } + w.prev = []byte{} + default: + w.prev = append(w.prev, b) + } + } + + if len(r) > 0 { + for _, line := range r { + w.l.Info(line, logTypeDHCTL) + } + w.sendCh <- &pb.DestroyResponse{ + Message: &pb.DestroyResponse_Logs{Logs: &pb.Logs{Logs: r}}, + } + } + + return len(p), nil +} + +type destroyPhaseSwitcher struct { + sendCh chan *pb.DestroyResponse + f *fsm.FiniteStateMachine + next chan error +} + +func (b *destroyPhaseSwitcher) switchPhase( + completedPhase phases.OperationPhase, + completedPhaseState phases.DhctlState, + _ interface{}, + nextPhase phases.OperationPhase, + nextPhaseCritical bool, +) error { + err := b.f.Event("wait") + if err != nil { + return fmt.Errorf("changing state to waiting: %w", err) + } + + b.sendCh <- &pb.DestroyResponse{ + Message: &pb.DestroyResponse_PhaseEnd{ + PhaseEnd: &pb.DestroyPhaseEnd{ + CompletedPhase: string(completedPhase), + CompletedPhaseState: completedPhaseState, + NextPhase: string(nextPhase), + NextPhaseCritical: nextPhaseCritical, + }, + }, + } + + switchErr, ok := <-b.next + if !ok { + return fmt.Errorf("server stopped, cancel task") + } + return switchErr +} diff --git a/dhctl/pkg/server/rpc/dhctl/dhctl.go b/dhctl/pkg/server/rpc/dhctl/dhctl.go index 171b79130346..4f946c4c50a8 100644 --- a/dhctl/pkg/server/rpc/dhctl/dhctl.go +++ b/dhctl/pkg/server/rpc/dhctl/dhctl.go @@ -15,34 +15,79 @@ package dhctl import ( + "context" + "encoding/json" "fmt" "log/slog" "os" "strconv" "strings" + "google.golang.org/grpc" + "github.com/deckhouse/deckhouse/dhctl/pkg/app" "github.com/deckhouse/deckhouse/dhctl/pkg/config" + "github.com/deckhouse/deckhouse/dhctl/pkg/log" "github.com/deckhouse/deckhouse/dhctl/pkg/operations/bootstrap" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/check" pb "github.com/deckhouse/deckhouse/dhctl/pkg/server/pb/dhctl" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/logger" "github.com/deckhouse/deckhouse/dhctl/pkg/system/ssh" "github.com/deckhouse/deckhouse/dhctl/pkg/system/ssh/session" + "github.com/deckhouse/deckhouse/dhctl/pkg/util/tomb" ) -func New(podName, cacheDir string, log *slog.Logger) *Service { +var logTypeDHCTL = slog.String("type", "dhctl") + +type Service struct { + pb.UnimplementedDHCTLServer + + podName string + cacheDir string +} + +func New(podName, cacheDir string) *Service { return &Service{ podName: podName, cacheDir: cacheDir, - log: log, } } -type Service struct { - pb.UnimplementedDHCTLServer +func (s *Service) shutdown(done <-chan struct{}) { + go func() { + <-done + tomb.Shutdown(0) + }() +} - podName string - cacheDir string - log *slog.Logger +func operationCtx(server grpc.ServerStream) context.Context { + ctx := server.Context() + + var operation string + switch server.(type) { + case pb.DHCTL_CheckServer: + operation = "check" + case pb.DHCTL_BootstrapServer: + operation = "bootstrap" + case pb.DHCTL_ConvergeServer: + operation = "converge" + case pb.DHCTL_DestroyServer: + operation = "destroy" + case pb.DHCTL_AbortServer: + operation = "abort" + case pb.DHCTL_ImportServer: + operation = "import" + default: + operation = "unknown" + } + go func() { + <-ctx.Done() + tomb.Shutdown(0) + }() + return logger.ToContext( + ctx, + logger.L(ctx).With(slog.String("operation", operation)), + ) } func prepareSSHClient(config *config.ConnectionConfig) (*ssh.Client, error) { @@ -120,9 +165,33 @@ func writeTempFile(data []byte) (string, error) { return f.Name(), nil } +func onCheckResult(checkRes *check.CheckResult) error { + printableCheckRes := *checkRes + printableCheckRes.StatusDetails.TerraformPlan = nil + + printableCheckResDump, err := json.MarshalIndent(printableCheckRes, "", " ") + if err != nil { + return fmt.Errorf("unable to encode check result json: %w", err) + } + + _ = log.Process("default", "Check result", func() error { + log.InfoF("%s\n", printableCheckResDump) + return nil + }) + + return nil +} + func portToString(p *int32) string { if p == nil { return "" } return strconv.Itoa(int(*p)) } + +func errToString(err error) string { + if err != nil { + return err.Error() + } + return "" +} diff --git a/dhctl/pkg/server/rpc/dhctl/import.go b/dhctl/pkg/server/rpc/dhctl/import.go new file mode 100644 index 000000000000..e7cb1009fffc --- /dev/null +++ b/dhctl/pkg/server/rpc/dhctl/import.go @@ -0,0 +1,345 @@ +// Copyright 2024 Flant JSC +// +// 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 dhctl + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "log/slog" + "sync" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/deckhouse/deckhouse/dhctl/pkg/app" + "github.com/deckhouse/deckhouse/dhctl/pkg/config" + "github.com/deckhouse/deckhouse/dhctl/pkg/log" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/import" + "github.com/deckhouse/deckhouse/dhctl/pkg/operations/phases" + pb "github.com/deckhouse/deckhouse/dhctl/pkg/server/pb/dhctl" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/fsm" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/logger" + "github.com/deckhouse/deckhouse/dhctl/pkg/system/ssh" + "github.com/deckhouse/deckhouse/dhctl/pkg/terraform" + "github.com/deckhouse/deckhouse/dhctl/pkg/util/retry" +) + +func (s *Service) Import(server pb.DHCTL_ImportServer) error { + ctx := operationCtx(server) + + logger.L(ctx).Info("started") + + f := fsm.New("initial", s.importServerTransitions()) + + doneCh := make(chan struct{}) + internalErrCh := make(chan error) + receiveCh := make(chan *pb.ImportRequest) + sendCh := make(chan *pb.ImportResponse) + + phaseSwitcher := &importPhaseSwitcher{ + sendCh: sendCh, + f: f, + next: make(chan error), + } + + s.startImporterReceiver(server, receiveCh, doneCh, internalErrCh) + s.startImporterSender(server, sendCh, internalErrCh) + +connectionProcessor: + for { + select { + case <-doneCh: + logger.L(ctx).Info("finished") + return nil + + case err := <-internalErrCh: + logger.L(ctx).Error("finished with internal error", logger.Err(err)) + return status.Errorf(codes.Internal, "%s", err) + + case request := <-receiveCh: + logger.L(ctx).Info( + "processing ImportRequest", + slog.String("message", fmt.Sprintf("%T", request.Message)), + ) + switch message := request.Message.(type) { + case *pb.ImportRequest_Start: + err := f.Event("start") + if err != nil { + logger.L(ctx).Error("got unprocessable message", + logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + s.startImport( + ctx, message.Start, phaseSwitcher, &importLogWriter{l: logger.L(ctx), sendCh: sendCh}, sendCh, + ) + + case *pb.ImportRequest_Continue: + err := f.Event("toNextPhase") + if err != nil { + logger.L(ctx).Error("got unprocessable message", + logger.Err(err), slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + switch message.Continue.Continue { + case pb.Continue_CONTINUE_UNSPECIFIED: + phaseSwitcher.next <- errors.New("bad continue message") + case pb.Continue_CONTINUE_NEXT_PHASE: + phaseSwitcher.next <- nil + case pb.Continue_CONTINUE_STOP_OPERATION: + phaseSwitcher.next <- phases.StopOperationCondition + case pb.Continue_CONTINUE_ERROR: + phaseSwitcher.next <- errors.New(message.Continue.Err) + } + + default: + logger.L(ctx).Error("got unprocessable message", + slog.String("message", fmt.Sprintf("%T", message))) + continue connectionProcessor + } + } + } +} + +func (s *Service) startImporterReceiver( + server pb.DHCTL_ImportServer, + receiveCh chan *pb.ImportRequest, + doneCh chan struct{}, + internalErrCh chan error, +) { + go func() { + for { + request, err := server.Recv() + if errors.Is(err, io.EOF) { + close(doneCh) + return + } + if err != nil { + internalErrCh <- fmt.Errorf("receiving message: %w", err) + return + } + receiveCh <- request + } + }() +} + +func (s *Service) startImporterSender( + server pb.DHCTL_ImportServer, + sendCh chan *pb.ImportResponse, + internalErrCh chan error, +) { + go func() { + for response := range sendCh { + loop := retry.NewSilentLoop("send message", 10, time.Millisecond*100) + err := loop.Run(func() error { + return server.Send(response) + }) + if err != nil { + internalErrCh <- fmt.Errorf("sending message: %w", err) + return + } + } + }() +} + +func (s *Service) startImport( + ctx context.Context, + request *pb.ImportStart, + phaseSwitcher *importPhaseSwitcher, + logWriter *importLogWriter, + sendCh chan *pb.ImportResponse, +) { + go func() { + result := s.importCluster(ctx, request, phaseSwitcher, logWriter) + sendCh <- &pb.ImportResponse{ + Message: &pb.ImportResponse_Result{ + Result: result, + }, + } + }() +} + +func (s *Service) importCluster( + ctx context.Context, + request *pb.ImportStart, + phaseSwitcher *importPhaseSwitcher, + logWriter io.Writer, +) *pb.ImportResult { + var err error + + log.InitLoggerWithOptions("pretty", log.LoggerOptions{ + OutStream: logWriter, + Width: int(request.Options.LogWidth), + }) + app.SanityCheck = true + app.UseTfCache = app.UseStateCacheYes + app.ResourcesTimeout = request.Options.ResourcesTimeout.AsDuration() + app.DeckhouseTimeout = request.Options.DeckhouseTimeout.AsDuration() + app.CacheDir = s.cacheDir + + log.InfoF("Task is running by DHCTL Server pod/%s\n", s.podName) + defer func() { + log.InfoF("Task done by DHCTL Server pod/%s\n", s.podName) + }() + + var sshClient *ssh.Client + err = log.Process("default", "Preparing SSH client", func() error { + connectionConfig, err := config.ParseConnectionConfig( + request.ConnectionConfig, + config.NewSchemaStore(), + config.ValidateOptionCommanderMode(request.Options.CommanderMode), + config.ValidateOptionStrictUnmarshal(request.Options.CommanderMode), + config.ValidateOptionValidateExtensions(request.Options.CommanderMode), + ) + if err != nil { + return fmt.Errorf("parsing connection config: %w", err) + } + + sshClient, err = prepareSSHClient(connectionConfig) + if err != nil { + return fmt.Errorf("preparing ssh client: %w", err) + } + return nil + }) + if err != nil { + return &pb.ImportResult{Err: err.Error()} + } + defer sshClient.Stop() + + importer := _import.NewImporter(&_import.Params{ + CommanderMode: request.Options.CommanderMode, + SSHClient: sshClient, + OnCheckResult: onCheckResult, + TerraformContext: terraform.NewTerraformContext(), + OnPhaseFunc: phaseSwitcher.switchPhase, + ImportResources: _import.ImportResources{ + Template: request.ResourcesTemplate, + Values: request.ResourcesValues.AsMap(), + }, + ScanOnly: request.ScanOnly, + }) + + result, importErr := importer.Import(ctx) + state := importer.PhasedExecutionContext.GetLastState() + stateData, marshalStateErr := json.Marshal(state) + resultString, marshalResultErr := json.Marshal(result) + err = errors.Join(importErr, marshalStateErr, marshalResultErr) + + return &pb.ImportResult{State: string(stateData), Result: string(resultString), Err: errToString(err)} +} + +func (s *Service) importServerTransitions() []fsm.Transition { + return []fsm.Transition{ + { + Event: "start", + Sources: []fsm.State{"initial"}, + Destination: "running", + }, + { + Event: "wait", + Sources: []fsm.State{"running"}, + Destination: "waiting", + }, + { + Event: "toNextPhase", + Sources: []fsm.State{"waiting"}, + Destination: "running", + }, + } +} + +type importLogWriter struct { + l *slog.Logger + sendCh chan *pb.ImportResponse + + m sync.Mutex + prev []byte +} + +func (w *importLogWriter) Write(p []byte) (n int, err error) { + w.m.Lock() + defer w.m.Unlock() + + var r []string + + for _, b := range p { + switch b { + case '\n', '\r': + s := string(w.prev) + if s != "" { + r = append(r, s) + } + w.prev = []byte{} + default: + w.prev = append(w.prev, b) + } + } + + if len(r) > 0 { + for _, line := range r { + w.l.Info(line, logTypeDHCTL) + } + w.sendCh <- &pb.ImportResponse{ + Message: &pb.ImportResponse_Logs{Logs: &pb.Logs{Logs: r}}, + } + } + + return len(p), nil +} + +type importPhaseSwitcher struct { + sendCh chan *pb.ImportResponse + f *fsm.FiniteStateMachine + next chan error +} + +func (b *importPhaseSwitcher) switchPhase( + completedPhase phases.OperationPhase, + completedPhaseState phases.DhctlState, + phaseData _import.PhaseData, + nextPhase phases.OperationPhase, + nextPhaseCritical bool, +) error { + err := b.f.Event("wait") + if err != nil { + return fmt.Errorf("changing state to waiting: %w", err) + } + + phaseDataBytes, err := json.Marshal(phaseData) + if err != nil { + return fmt.Errorf("changing state to waiting: %w", err) + } + + b.sendCh <- &pb.ImportResponse{ + Message: &pb.ImportResponse_PhaseEnd{ + PhaseEnd: &pb.ImportPhaseEnd{ + CompletedPhase: string(completedPhase), + CompletedPhaseState: completedPhaseState, + CompletedPhaseData: string(phaseDataBytes), + NextPhase: string(nextPhase), + NextPhaseCritical: nextPhaseCritical, + }, + }, + } + + switchErr, ok := <-b.next + if !ok { + return fmt.Errorf("server stopped, cancel task") + } + return switchErr +} diff --git a/dhctl/pkg/server/server/server.go b/dhctl/pkg/server/server/server.go index efa845e89c1c..7c778092757c 100644 --- a/dhctl/pkg/server/server/server.go +++ b/dhctl/pkg/server/server/server.go @@ -16,12 +16,14 @@ package server import ( "context" + "fmt" "log/slog" "net" "os" - "sync" + "path/filepath" "time" + "github.com/google/uuid" "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging" "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/recovery" "google.golang.org/grpc" @@ -30,9 +32,9 @@ import ( "google.golang.org/grpc/reflection" dhctllog "github.com/deckhouse/deckhouse/dhctl/pkg/log" - "github.com/deckhouse/deckhouse/dhctl/pkg/server/interceptors" - "github.com/deckhouse/deckhouse/dhctl/pkg/server/logger" pbdhctl "github.com/deckhouse/deckhouse/dhctl/pkg/server/pb/dhctl" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/interceptors" + "github.com/deckhouse/deckhouse/dhctl/pkg/server/pkg/logger" "github.com/deckhouse/deckhouse/dhctl/pkg/server/rpc/dhctl" "github.com/deckhouse/deckhouse/dhctl/pkg/util/tomb" ) @@ -42,20 +44,15 @@ func Serve(network, address string) error { dhctllog.InitLoggerWithOptions("silent", dhctllog.LoggerOptions{}) lvl := &slog.LevelVar{} lvl.Set(slog.LevelDebug) - log := logger.NewLogger(lvl) + log := logger.NewLogger(lvl).With(slog.String("component", "server")) ctx, cancel := context.WithCancel(context.Background()) done := make(chan struct{}) defer close(done) - globalLock := &sync.Mutex{} + sem := make(chan struct{}, 1) podName := os.Getenv("HOSTNAME") - log.Info( - "starting grpc server", - slog.String("network", network), - slog.String("address", address), - ) tomb.RegisterOnShutdown("server", func() { log.Info("stopping grpc server") cancel() @@ -63,6 +60,18 @@ func Serve(network, address string) error { log.Info("grpc server stopped") }) + cacheDir, err := cacheDirectory() + if err != nil { + return fmt.Errorf("failed to init grpc server: %w", err) + } + + log.Info( + "starting grpc server", + slog.String("network", network), + slog.String("address", address), + slog.String("cache directory", cacheDir), + ) + listener, err := net.Listen(network, address) if err != nil { log.Error("failed to listen", logger.Err(err)) @@ -70,14 +79,16 @@ func Serve(network, address string) error { } s := grpc.NewServer( grpc.ChainUnaryInterceptor( - logging.UnaryServerInterceptor(interceptors.Logger(log)), - recovery.UnaryServerInterceptor(recovery.WithRecoveryHandler(interceptors.PanicRecoveryHandler(log))), - interceptors.UnaryServerSinglefligt(globalLock, log), + interceptors.UnaryLogger(log), + logging.UnaryServerInterceptor(interceptors.Logger()), + recovery.UnaryServerInterceptor(recovery.WithRecoveryHandlerContext(interceptors.PanicRecoveryHandler())), + interceptors.UnaryParallelTasksLimiter(sem), ), grpc.ChainStreamInterceptor( - logging.StreamServerInterceptor(interceptors.Logger(log)), - recovery.StreamServerInterceptor(recovery.WithRecoveryHandler(interceptors.PanicRecoveryHandler(log))), - interceptors.StreamServerSinglefligt(globalLock, log), + interceptors.StreamLogger(log), + logging.StreamServerInterceptor(interceptors.Logger()), + recovery.StreamServerInterceptor(recovery.WithRecoveryHandlerContext(interceptors.PanicRecoveryHandler())), + interceptors.StreamParallelTasksLimiter(sem), ), ) @@ -89,7 +100,7 @@ func Serve(network, address string) error { reflection.Register(s) // services - dhctlService := dhctl.New(podName, address, log) + dhctlService := dhctl.New(podName, cacheDir) // register services pbdhctl.RegisterDHCTLServer(s, dhctlService) @@ -122,3 +133,14 @@ func gracefulStop(s *grpc.Server, timeout time.Duration) { t.Stop() } } + +func cacheDirectory() (string, error) { + id, err := uuid.NewUUID() + if err != nil { + return "", fmt.Errorf("creating uuid for cache directory") + } + + path := filepath.Join(os.TempDir(), "dhctl", "cache_"+id.String()) + + return path, nil +}