From 15417ca4cd9fceeab245e388fbb388970c192035 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Wed, 28 Jul 2021 18:30:28 +0800 Subject: [PATCH 01/43] setup config file permission mode --- api/controller/volume.go | 12 ++++++++++ api/handler/service.go | 38 +++++++------------------------ api/model/volume.go | 4 +++- db/model/tenant.go | 1 + go.mod | 1 + worker/appm/volume/config-file.go | 6 ++--- worker/appm/volume/volume.go | 11 ++++++--- 7 files changed, 36 insertions(+), 37 deletions(-) diff --git a/api/controller/volume.go b/api/controller/volume.go index 7fe0d00d3..373381185 100644 --- a/api/controller/volume.go +++ b/api/controller/volume.go @@ -25,6 +25,7 @@ import ( "github.com/go-chi/chi" "github.com/goodrain/rainbond/api/handler" api_model "github.com/goodrain/rainbond/api/model" + "github.com/goodrain/rainbond/api/util/bcode" ctxutil "github.com/goodrain/rainbond/api/util/ctx" dbmodel "github.com/goodrain/rainbond/db/model" httputil "github.com/goodrain/rainbond/util/http" @@ -186,6 +187,11 @@ func (t *TenantStruct) UpdVolume(w http.ResponseWriter, r *http.Request) { return } + if req.Mode != nil && (*req.Mode > 777 || *req.Mode < 0) { + httputil.ReturnBcodeError(r, w, bcode.NewBadRequest("mode be a number between 0 and 777 (octal)")) + return + } + sid := r.Context().Value(ctxutil.ContextKey("service_id")).(string) if err := handler.GetServiceManager().UpdVolume(sid, &req); err != nil { httputil.ReturnError(r, w, 500, err.Error()) @@ -354,6 +360,11 @@ func AddVolume(w http.ResponseWriter, r *http.Request) { return } + if avs.Body.Mode != nil && (*avs.Body.Mode > 777 || *avs.Body.Mode < 0) { + httputil.ReturnBcodeError(r, w, bcode.NewBadRequest("mode be a number between 0 and 777 (octal)")) + return + } + tsv := &dbmodel.TenantServiceVolume{ ServiceID: serviceID, VolumeName: avs.Body.VolumeName, @@ -368,6 +379,7 @@ func AddVolume(w http.ResponseWriter, r *http.Request) { BackupPolicy: avs.Body.BackupPolicy, ReclaimPolicy: avs.Body.ReclaimPolicy, AllowExpansion: avs.Body.AllowExpansion, + Mode: avs.Body.Mode, } // TODO fanyangyang validate VolumeCapacity AccessMode SharePolicy BackupPolicy ReclaimPolicy AllowExpansion diff --git a/api/handler/service.go b/api/handler/service.go index 392df0f08..984d555bd 100644 --- a/api/handler/service.go +++ b/api/handler/service.go @@ -51,9 +51,7 @@ import ( api_model "github.com/goodrain/rainbond/api/model" dberr "github.com/goodrain/rainbond/db/errors" - core_model "github.com/goodrain/rainbond/db/model" dbmodel "github.com/goodrain/rainbond/db/model" - eventutil "github.com/goodrain/rainbond/eventlog/util" gclient "github.com/goodrain/rainbond/mq/client" core_util "github.com/goodrain/rainbond/util" typesv1 "github.com/goodrain/rainbond/worker/appm/types/v1" @@ -713,10 +711,10 @@ func (s *ServiceAction) ServiceCreate(sc *api_model.ServiceStruct) error { if sc.OSType == "windows" { if err := db.GetManager().TenantServiceLabelDaoTransactions(tx).AddModel(&dbmodel.TenantServiceLable{ ServiceID: ts.ServiceID, - LabelKey: core_model.LabelKeyNodeSelector, + LabelKey: dbmodel.LabelKeyNodeSelector, LabelValue: sc.OSType, }); err != nil { - logrus.Errorf("add label %s=%s %v error, %v", core_model.LabelKeyNodeSelector, sc.OSType, ts.ServiceID, err) + logrus.Errorf("add label %s=%s %v error, %v", dbmodel.LabelKeyNodeSelector, sc.OSType, ts.ServiceID, err) tx.Rollback() return err } @@ -1745,6 +1743,7 @@ func (s *ServiceAction) UpdVolume(sid string, req *api_model.UpdVolumeReq) error return err } v.VolumePath = req.VolumePath + v.Mode = req.Mode if err := db.GetManager().TenantServiceVolumeDaoTransactions(tx).UpdateModel(v); err != nil { tx.Rollback() return err @@ -1939,7 +1938,7 @@ func (s *ServiceAction) GetStatus(serviceID string) (*api_model.StatusList, erro //GetServicesStatus 获取一组应用状态,若 serviceIDs为空,获取租户所有应用状态 func (s *ServiceAction) GetServicesStatus(tenantID string, serviceIDs []string) []map[string]interface{} { - if serviceIDs == nil || len(serviceIDs) == 0 { + if len(serviceIDs) == 0 { services, _ := db.GetManager().TenantServiceDao().GetServicesByTenantID(tenantID) for _, s := range services { serviceIDs = append(serviceIDs, s.ServiceID) @@ -1950,11 +1949,9 @@ func (s *ServiceAction) GetServicesStatus(tenantID string, serviceIDs []string) } statusList := s.statusCli.GetStatuss(strings.Join(serviceIDs, ",")) var info = make([]map[string]interface{}, 0) - if statusList != nil { - for k, v := range statusList { - serviceInfo := map[string]interface{}{"service_id": k, "status": v, "status_cn": TransStatus(v), "used_mem": 0} - info = append(info, serviceInfo) - } + for k, v := range statusList { + serviceInfo := map[string]interface{}{"service_id": k, "status": v, "status_cn": TransStatus(v), "used_mem": 0} + info = append(info, serviceInfo) } return info } @@ -2019,7 +2016,7 @@ func (s *ServiceAction) CreateTenant(t *dbmodel.Tenants) error { //CreateTenandIDAndName create tenant_id and tenant_name func (s *ServiceAction) CreateTenandIDAndName(eid string) (string, string, error) { - id := fmt.Sprintf("%s", uuid.NewV4()) + id := uuid.NewV4().String() uid := strings.Replace(id, "-", "", -1) name := strings.Split(id, "-")[0] logrus.Debugf("uuid is %v, name is %v", uid, name) @@ -2103,14 +2100,12 @@ func (s *ServiceAction) GetMultiServicePods(serviceIDs []string) (*K8sPodInfos, } convpod := func(serviceID string, pods []*pb.ServiceAppPod) []*K8sPodInfo { var podsInfoList []*K8sPodInfo - var podNames []string for _, v := range pods { var podInfo K8sPodInfo podInfo.PodName = v.PodName podInfo.PodIP = v.PodIp podInfo.PodStatus = v.PodStatus podInfo.ServiceID = serviceID - podNames = append(podNames, v.PodName) podsInfoList = append(podsInfoList, &podInfo) } return podsInfoList @@ -2298,23 +2293,6 @@ func (s *ServiceAction) deleteThirdComponent(ctx context.Context, component *dbm return nil } -// delLogFile deletes persistent data related to the service based on serviceID. -func (s *ServiceAction) delLogFile(serviceID string, eventIDs []string) { - // log generated during service running - dockerLogPath := eventutil.DockerLogFilePath(s.conf.LogPath, serviceID) - if err := os.RemoveAll(dockerLogPath); err != nil { - logrus.Warningf("remove docker log files: %v", err) - } - // log generated by the service event - eventLogPath := eventutil.EventLogFilePath(s.conf.LogPath) - for _, eventID := range eventIDs { - eventLogFileName := eventutil.EventLogFileName(eventLogPath, eventID) - if err := os.RemoveAll(eventLogFileName); err != nil { - logrus.Warningf("file: %s; remove event log file: %v", eventLogFileName, err) - } - } -} - func (s *ServiceAction) gcTaskBody(tenantID, serviceID string) (map[string]interface{}, error) { events, err := db.GetManager().ServiceEventDao().ListByTargetID(serviceID) if err != nil { diff --git a/api/model/volume.go b/api/model/volume.go index fea1e9a78..47d1e0ad8 100644 --- a/api/model/volume.go +++ b/api/model/volume.go @@ -60,7 +60,8 @@ type AddVolumeStruct struct { // ReclaimPolicy 回收策略 ReclaimPolicy string `json:"reclaim_policy"` // AllowExpansion 是否支持扩展 - AllowExpansion bool `json:"allow_expansion"` + AllowExpansion bool `json:"allow_expansion"` + Mode *int32 `json:"mode"` } } @@ -243,6 +244,7 @@ type UpdVolumeReq struct { VolumeType string `json:"volume_type" validate:"volume_type|required"` FileContent string `json:"file_content"` VolumePath string `json:"volume_path" validate:"volume_path|required"` + Mode *int32 `json:"mode"` } // VolumeWithStatusResp volume status diff --git a/db/model/tenant.go b/db/model/tenant.go index 66f13facf..40b024fbd 100644 --- a/db/model/tenant.go +++ b/db/model/tenant.go @@ -476,6 +476,7 @@ type TenantServiceVolume struct { AllowExpansion bool `gorm:"column:allow_expansion" json:"allow_expansion"` // VolumeProviderName 使用的存储驱动别名 VolumeProviderName string `gorm:"column:volume_provider_name" json:"volume_provider_name"` + Mode *int32 `gorm:"column:mode" json:"mode"` } //TableName 表名 diff --git a/go.mod b/go.mod index 54c6a930e..e6ef3a744 100644 --- a/go.mod +++ b/go.mod @@ -99,6 +99,7 @@ require ( google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e // indirect google.golang.org/grpc v1.33.2 + google.golang.org/protobuf v1.25.0 gopkg.in/alecthomas/kingpin.v2 v2.2.6 gopkg.in/src-d/go-git.v4 v4.13.1 gopkg.in/yaml.v2 v2.4.0 diff --git a/worker/appm/volume/config-file.go b/worker/appm/volume/config-file.go index da77e8e5b..fe2ed4b72 100644 --- a/worker/appm/volume/config-file.go +++ b/worker/appm/volume/config-file.go @@ -67,7 +67,7 @@ func (v *ConfigFileVolume) CreateVolume(define *Define) error { } cmap.Data[path.Base(v.svm.VolumePath)] = util.ParseVariable(cf.FileContent, configs) v.as.SetConfigMap(cmap) - define.SetVolumeCMap(cmap, path.Base(v.svm.VolumePath), v.svm.VolumePath, false) + define.SetVolumeCMap(cmap, path.Base(v.svm.VolumePath), v.svm.VolumePath, false, v.svm.Mode) return nil } @@ -77,7 +77,7 @@ func (v *ConfigFileVolume) CreateDependVolume(define *Define) error { for _, env := range v.envs { configs[env.Name] = env.Value } - _, err := v.dbmanager.TenantServiceVolumeDao().GetVolumeByServiceIDAndName(v.smr.DependServiceID, v.smr.VolumeName) + depVol, err := v.dbmanager.TenantServiceVolumeDao().GetVolumeByServiceIDAndName(v.smr.DependServiceID, v.smr.VolumeName) if err != nil { return fmt.Errorf("error getting TenantServiceVolume according to serviceID(%s) and volumeName(%s): %v", v.smr.DependServiceID, v.smr.VolumeName, err) @@ -98,6 +98,6 @@ func (v *ConfigFileVolume) CreateDependVolume(define *Define) error { cmap.Data[path.Base(v.smr.VolumePath)] = util.ParseVariable(cf.FileContent, configs) v.as.SetConfigMap(cmap) - define.SetVolumeCMap(cmap, path.Base(v.smr.VolumePath), v.smr.VolumePath, false) + define.SetVolumeCMap(cmap, path.Base(v.smr.VolumePath), v.smr.VolumePath, false, depVol.Mode) return nil } diff --git a/worker/appm/volume/volume.go b/worker/appm/volume/volume.go index 52a3aebe9..6406257f2 100644 --- a/worker/appm/volume/volume.go +++ b/worker/appm/volume/volume.go @@ -23,6 +23,7 @@ import ( "os" "path" "sort" + "strconv" "strings" "github.com/goodrain/rainbond/db" @@ -211,8 +212,7 @@ func (v *Define) SetVolume(VolumeType dbmodel.VolumeType, name, mountPath, hostP } // SetVolumeCMap sets volumes and volumeMounts. The type of volumes is configMap. -func (v *Define) SetVolumeCMap(cmap *corev1.ConfigMap, k, p string, isReadOnly bool) { - var configFileMode int32 = 0777 +func (v *Define) SetVolumeCMap(cmap *corev1.ConfigMap, k, p string, isReadOnly bool, mode *int32) { vm := corev1.VolumeMount{ MountPath: p, Name: cmap.Name, @@ -221,6 +221,11 @@ func (v *Define) SetVolumeCMap(cmap *corev1.ConfigMap, k, p string, isReadOnly b } v.volumeMounts = append(v.volumeMounts, vm) var defaultMode int32 = 0777 + if mode != nil { + // convert int to octal + octal, _ := strconv.ParseInt(strconv.Itoa(int(*mode)), 8, 64) + defaultMode = int32(octal) + } vo := corev1.Volume{ Name: cmap.Name, VolumeSource: corev1.VolumeSource{ @@ -233,7 +238,7 @@ func (v *Define) SetVolumeCMap(cmap *corev1.ConfigMap, k, p string, isReadOnly b { Key: k, Path: path.Base(p), // subpath - Mode: &configFileMode, + Mode: &defaultMode, }, }, }, From acc4c3e36c85686b1e5c0e40c365948153e6056e Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Wed, 28 Jul 2021 18:54:24 +0800 Subject: [PATCH 02/43] do not check resource usage for third component --- api/controller/service_action.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/controller/service_action.go b/api/controller/service_action.go index 2bd24e991..f60b4dab9 100644 --- a/api/controller/service_action.go +++ b/api/controller/service_action.go @@ -68,9 +68,11 @@ func (t *TenantStruct) StartService(w http.ResponseWriter, r *http.Request) { tenant := r.Context().Value(ctxutil.ContextKey("tenant")).(*dbmodel.Tenants) service := r.Context().Value(ctxutil.ContextKey("service")).(*dbmodel.TenantServices) sEvent := r.Context().Value(ctxutil.ContextKey("event")).(*dbmodel.ServiceEvent) - if err := handler.CheckTenantResource(r.Context(), tenant, service.Replicas*service.ContainerMemory); err != nil { - httputil.ReturnResNotEnough(r, w, sEvent.EventID, err.Error()) - return + if service.Kind != "third_party" { + if err := handler.CheckTenantResource(r.Context(), tenant, service.Replicas*service.ContainerMemory); err != nil { + httputil.ReturnResNotEnough(r, w, sEvent.EventID, err.Error()) + return + } } startStopStruct := &api_model.StartStopStruct{ From efc2acaa07b0156be8a3701dbbb100e31bcac33d Mon Sep 17 00:00:00 2001 From: barnettZQG Date: Wed, 28 Jul 2021 21:31:58 +0800 Subject: [PATCH 03/43] support oss code source --- builder/build/build.go | 3 + builder/build/code_build.go | 117 ++++++++----------- builder/build/code_build_test.go | 52 ++++++++- builder/exector/build_from_sourcecode_run.go | 30 ++--- builder/exector/exector.go | 2 +- builder/exector/service_check.go | 14 +-- builder/parser/code/lang.go | 3 + builder/parser/source_code.go | 113 +++++++++++++----- builder/parser/source_code_test.go | 22 ++++ go.mod | 2 + go.sum | 20 ++-- util/comman.go | 10 ++ 12 files changed, 242 insertions(+), 146 deletions(-) diff --git a/builder/build/build.go b/builder/build/build.go index 7b5d7bd5a..98747325a 100644 --- a/builder/build/build.go +++ b/builder/build/build.go @@ -25,6 +25,7 @@ import ( "github.com/goodrain/rainbond/builder" "github.com/goodrain/rainbond/builder/parser/code" + "github.com/goodrain/rainbond/builder/sources" "github.com/goodrain/rainbond/event" "k8s.io/client-go/kubernetes" @@ -43,6 +44,7 @@ func init() { buildcreaters[code.Python] = slugBuilder buildcreaters[code.Nodejs] = slugBuilder buildcreaters[code.Golang] = slugBuilder + buildcreaters[code.OSS] = slugBuilder } var buildcreaters map[code.Lang]CreaterBuild @@ -82,6 +84,7 @@ type Request struct { CacheDir string TGZDir string RepositoryURL string + CodeSouceInfo sources.CodeSourceInfo Branch string ServiceAlias string ServiceID string diff --git a/builder/build/code_build.go b/builder/build/code_build.go index 7a19d4d7b..1d670691d 100644 --- a/builder/build/code_build.go +++ b/builder/build/code_build.go @@ -19,11 +19,9 @@ package build import ( - "bufio" "context" "encoding/json" "fmt" - "io" "io/ioutil" "os" "os/exec" @@ -33,14 +31,11 @@ import ( "github.com/docker/docker/api/types" "github.com/eapache/channels" - "github.com/fsnotify/fsnotify" "github.com/goodrain/rainbond/builder" jobc "github.com/goodrain/rainbond/builder/job" "github.com/goodrain/rainbond/builder/parser/code" "github.com/goodrain/rainbond/builder/sources" - "github.com/goodrain/rainbond/event" "github.com/goodrain/rainbond/util" - "github.com/pquerna/ffjson/ffjson" "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -53,7 +48,6 @@ func slugBuilder() (Build, error) { type slugBuild struct { tgzDir string buildCacheDir string - sourceDir string re *Request } @@ -107,8 +101,14 @@ func (s *slugBuild) Build(re *Request) (*Response, error) { func (s *slugBuild) writeRunDockerfile(sourceDir, packageName string, envs map[string]string) error { runDockerfile := ` FROM %s + ARG CODE_COMMIT_HASH + ARG CODE_COMMIT_USER + ARG CODE_COMMIT_MESSAGE COPY %s /tmp/slug/slug.tgz RUN chown rain:rain /tmp/slug/slug.tgz + ENV CODE_COMMIT_HASH=${CODE_COMMIT_HASH} + ENV CODE_COMMIT_USER=${CODE_COMMIT_USER} + ENV CODE_COMMIT_MESSAGE=${CODE_COMMIT_MESSAGE} ENV VERSION=%s ` result := util.ParseVariable(fmt.Sprintf(runDockerfile, builder.RUNNERIMAGENAME, packageName, s.re.DeployVersion), envs) @@ -138,6 +138,11 @@ func (s *slugBuild) buildRunnerImage(slugPackage string) (string, error) { } //build runtime image runbuildOptions := types.ImageBuildOptions{ + BuildArgs: map[string]*string{ + "CODE_COMMIT_HASH": &s.re.Commit.Hash, + "CODE_COMMIT_USER": &s.re.Commit.User, + "CODE_COMMIT_MESSAGE": &s.re.Commit.Message, + }, Tags: []string{imageName}, Remove: true, } @@ -178,56 +183,6 @@ func (s *slugBuild) buildRunnerImage(slugPackage string) (string, error) { return imageName, nil } -func (s *slugBuild) readLogFile(logfile string, logger event.Logger, closed chan struct{}) { - file, _ := os.Open(logfile) - watcher, _ := fsnotify.NewWatcher() - defer watcher.Close() - _ = watcher.Add(logfile) - readerr := bufio.NewReader(file) - for { - line, _, err := readerr.ReadLine() - if err != nil { - if err != io.EOF { - logrus.Errorf("Read build container log error:%s", err.Error()) - return - } - wait := func() error { - for { - select { - case <-closed: - return nil - case evt := <-watcher.Events: - if evt.Op&fsnotify.Write == fsnotify.Write { - return nil - } - case err := <-watcher.Errors: - return err - } - } - } - if err := wait(); err != nil { - logrus.Errorf("Read build container log error:%s", err.Error()) - return - } - } - if logger != nil { - var message = make(map[string]string) - if err := ffjson.Unmarshal(line, &message); err == nil { - if m, ok := message["log"]; ok { - logger.Info(m, map[string]string{"step": "build-exector"}) - } - } else { - fmt.Println(err.Error()) - } - } - select { - case <-closed: - return - default: - } - } -} - func (s *slugBuild) getSourceCodeTarFile(re *Request) (string, error) { var cmd []string sourceTarFile := fmt.Sprintf("%s/%s-%s.tar", util.GetParentDirectory(re.SourceDir), re.ServiceID, re.DeployVersion) @@ -253,7 +208,7 @@ func (s *slugBuild) stopPreBuildJob(re *Request) error { if err != nil { logrus.Errorf("get pre build job for service %s failure ,%s", re.ServiceID, err.Error()) } - if jobList != nil && len(jobList) > 0 { + if len(jobList) > 0 { for _, job := range jobList { jobc.GetJobController().DeleteJob(job.Name) } @@ -263,6 +218,7 @@ func (s *slugBuild) stopPreBuildJob(re *Request) error { func (s *slugBuild) createVolumeAndMount(re *Request, sourceTarFileName string) (volumes []corev1.Volume, volumeMounts []corev1.VolumeMount) { slugSubPath := strings.TrimPrefix(re.TGZDir, "/grdata/") + lazyloading := sourceTarFileName == "" sourceTarPath := strings.TrimPrefix(sourceTarFileName, "/cache/") cacheSubPath := strings.TrimPrefix(re.CacheDir, "/cache/") @@ -279,10 +235,12 @@ func (s *slugBuild) createVolumeAndMount(re *Request, sourceTarFileName string) MountPath: "/tmp/slug", SubPath: slugSubPath, }, - { + } + if !lazyloading { + volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: "source-file", MountPath: "/tmp/app-source.tar", - }, + }) } volumes = []corev1.Volume{ { @@ -302,7 +260,9 @@ func (s *slugBuild) createVolumeAndMount(re *Request, sourceTarFileName string) }, }, }, - { + } + if !lazyloading { + volumes = append(volumes, corev1.Volume{ Name: "source-file", VolumeSource: corev1.VolumeSource{ HostPath: &corev1.HostPathVolumeSource{ @@ -311,7 +271,7 @@ func (s *slugBuild) createVolumeAndMount(re *Request, sourceTarFileName string) Type: &unset, }, }, - }, + }) } } else { volumes = []corev1.Volume{ @@ -343,11 +303,13 @@ func (s *slugBuild) createVolumeAndMount(re *Request, sourceTarFileName string) MountPath: "/tmp/slug", SubPath: slugSubPath, }, - { + } + if !lazyloading { + volumeMounts = append(volumeMounts, corev1.VolumeMount{ Name: "app", MountPath: "/tmp/app-source.tar", SubPath: sourceTarPath, - }, + }) } } return volumes, volumeMounts @@ -357,16 +319,21 @@ func (s *slugBuild) runBuildJob(re *Request) error { //prepare build code dir re.Logger.Info(util.Translation("Start make code package"), map[string]string{"step": "build-exector"}) start := time.Now() - sourceTarFileName, err := s.getSourceCodeTarFile(re) - if err != nil { - return fmt.Errorf("create source code tar file error:%s", err.Error()) + var sourceTarFileName string + if re.ServerType != "oss" { + var err error + sourceTarFileName, err = s.getSourceCodeTarFile(re) + if err != nil { + return fmt.Errorf("create source code tar file error:%s", err.Error()) + } + // remove source cache tar file + defer func() { + os.Remove(sourceTarFileName) + }() } re.Logger.Info(util.Translation("make code package success"), map[string]string{"step": "build-exector"}) logrus.Infof("package code for building service %s version %s successful, take time %s", re.ServiceID, re.DeployVersion, time.Now().Sub(start)) - // remove source cache tar file - defer func() { - os.Remove(sourceTarFileName) - }() + name := fmt.Sprintf("%s-%s", re.ServiceID, re.DeployVersion) namespace := re.RbdNamespace job := corev1.Pod{ @@ -383,8 +350,16 @@ func (s *slugBuild) runBuildJob(re *Request) error { {Name: "SLUG_VERSION", Value: re.DeployVersion}, {Name: "SERVICE_ID", Value: re.ServiceID}, {Name: "TENANT_ID", Value: re.TenantID}, + {Name: "CODE_COMMIT_HASH", Value: re.Commit.Hash}, + {Name: "CODE_COMMIT_USER", Value: re.Commit.User}, + {Name: "CODE_COMMIT_MESSAGE", Value: re.Commit.Message}, {Name: "LANGUAGE", Value: re.Lang.String()}, } + if re.ServerType == "oss" { + envs = append(envs, corev1.EnvVar{Name: "PACKAGE_DOWNLOAD_URL", Value: re.RepositoryURL}) + envs = append(envs, corev1.EnvVar{Name: "PACKAGE_DOWNLOAD_USER", Value: re.CodeSouceInfo.User}) + envs = append(envs, corev1.EnvVar{Name: "PACKAGE_DOWNLOAD_PASS", Value: re.CodeSouceInfo.Password}) + } var mavenSettingName string for k, v := range re.BuildEnvs { if k == "MAVEN_SETTING_NAME" { @@ -489,7 +464,7 @@ func (s *slugBuild) runBuildJob(re *Request) error { ctx, cancel := context.WithCancel(context.Background()) defer cancel() logrus.Debugf("create job[name: %s; namespace: %s]", job.Name, job.Namespace) - err = jobc.GetJobController().ExecJob(ctx, &job, writer, reChan) + err := jobc.GetJobController().ExecJob(ctx, &job, writer, reChan) if err != nil { logrus.Errorf("create new job:%s failed: %s", name, err.Error()) return err diff --git a/builder/build/code_build_test.go b/builder/build/code_build_test.go index c5049230d..197467909 100644 --- a/builder/build/code_build_test.go +++ b/builder/build/code_build_test.go @@ -11,12 +11,13 @@ import ( "testing" "time" - "github.com/goodrain/rainbond/builder/parser/code" - "github.com/goodrain/rainbond/cmd/builder/option" - "github.com/goodrain/rainbond/event" - "github.com/docker/docker/api/types" "github.com/docker/docker/client" + jobc "github.com/goodrain/rainbond/builder/job" + "github.com/goodrain/rainbond/builder/parser/code" + "github.com/goodrain/rainbond/builder/sources" + "github.com/goodrain/rainbond/cmd/builder/option" + "github.com/goodrain/rainbond/event" etcdutil "github.com/goodrain/rainbond/util/etcd" k8sutil "github.com/goodrain/rainbond/util/k8s" @@ -126,3 +127,46 @@ func TestDockerClient(t *testing.T) { // t.Log("image is : ", image.ID) // } } + +func TestBuildFromOSS(t *testing.T) { + restConfig, err := k8sutil.NewRestConfig("/Users/barnett/.kube/config") + if err != nil { + t.Fatal(err) + } + os.Setenv("IMAGE_PULL_SECRET", "rbd-hub-credentials") + clientset, err := kubernetes.NewForConfig(restConfig) + if err != nil { + t.Fatal(err) + } + stop := make(chan struct{}) + if err := jobc.InitJobController("rbd-system", stop, clientset); err != nil { + t.Fatal(err) + } + logger := event.GetTestLogger() + req := &Request{ + ServerType: "oss", + RepositoryURL: "http://8081.gr021644.64q1jlfb.17f4cc.grapps.cn/artifactory/dev/java-war-demo-master.zip", + CodeSouceInfo: sources.CodeSourceInfo{ + User: "demo", + Password: "gr123465!", + }, + KubeClient: clientset, + Ctx: context.Background(), + ServiceID: "d9b8d718510dc53118af1e1219e36d3a", + DeployVersion: "123asdadsadsasdasd1", + TenantID: "7c89455140284fd7b263038b44dc65bc", + Lang: code.OSS, + Logger: logger, + GRDataPVCName: "rbd-cpt-grdata", + CachePVCName: "rbd-chaos-cache", + } + build, err := GetBuild(code.OSS) + if err != nil { + t.Fatal(err) + } + res, err := build.Build(req) + if err != nil { + t.Fatal(err) + } + t.Log(res.MediumPath) +} diff --git a/builder/exector/build_from_sourcecode_run.go b/builder/exector/build_from_sourcecode_run.go index 61d55be4e..e0bc6e857 100644 --- a/builder/exector/build_from_sourcecode_run.go +++ b/builder/exector/build_from_sourcecode_run.go @@ -40,9 +40,8 @@ import ( "github.com/goodrain/rainbond/util" "github.com/pquerna/ffjson/ffjson" "github.com/sirupsen/logrus" - "github.com/tidwall/gjson" //"github.com/docker/docker/api/types" + "github.com/tidwall/gjson" "k8s.io/client-go/kubernetes" - //"github.com/docker/docker/client" ) //SourceCodeBuildItem SouceCodeBuildItem @@ -59,8 +58,7 @@ type SourceCodeBuildItem struct { Logger event.Logger `json:"logger"` EventID string `json:"event_id"` CacheDir string `json:"cache_dir"` - //SourceDir string `json:"source_dir"` - TGZDir string `json:"tgz_dir"` + TGZDir string `json:"tgz_dir"` DockerClient *client.Client KubeClient kubernetes.Interface RbdNamespace string @@ -139,7 +137,7 @@ func (i *SourceCodeBuildItem) Run(timeout time.Duration) error { i.RepoInfo = rbi if err := i.prepare(); err != nil { logrus.Errorf("prepare build code error: %s", err.Error()) - i.Logger.Error(fmt.Sprintf("准备源码构建失败"), map[string]string{"step": "builder-exector", "status": "failure"}) + i.Logger.Error("准备源码构建失败", map[string]string{"step": "builder-exector", "status": "failure"}) return err } i.CodeSouceInfo.RepositoryURL = rbi.RepostoryURL @@ -163,19 +161,21 @@ func (i *SourceCodeBuildItem) Run(timeout time.Duration) error { Message: rs.Logs.CommitEntrys[0].Msg, Author: rs.Logs.CommitEntrys[0].Author, } + case "oss": + i.commit = Commit{} default: //default git rs, err := sources.GitCloneOrPull(i.CodeSouceInfo, rbi.GetCodeHome(), i.Logger, 5) if err != nil { logrus.Errorf("pull git code error: %s", err.Error()) - i.Logger.Error(fmt.Sprintf("拉取代码失败,请确保代码可以被正常下载"), map[string]string{"step": "builder-exector", "status": "failure"}) + i.Logger.Error("拉取代码失败,请确保代码可以被正常下载", map[string]string{"step": "builder-exector", "status": "failure"}) return err } //get last commit commit, err := sources.GetLastCommit(rs) if err != nil || commit == nil { logrus.Errorf("get code commit info error: %s", err.Error()) - i.Logger.Error(fmt.Sprintf("读取代码版本信息失败"), map[string]string{"step": "builder-exector", "status": "failure"}) + i.Logger.Error("读取代码版本信息失败", map[string]string{"step": "builder-exector", "status": "failure"}) return err } i.commit = Commit{ @@ -241,6 +241,7 @@ func (i *SourceCodeBuildItem) codeBuild() (*build.Response, error) { CacheDir: i.CacheDir, TGZDir: i.TGZDir, RepositoryURL: i.RepoInfo.RepostoryURL, + CodeSouceInfo: i.CodeSouceInfo, ServiceAlias: i.ServiceAlias, ServiceID: i.ServiceID, TenantID: i.TenantID, @@ -265,21 +266,6 @@ func (i *SourceCodeBuildItem) codeBuild() (*build.Response, error) { return res, err } -func (i *SourceCodeBuildItem) getExtraHosts() (extraHosts []string, err error) { - endpoints, err := i.KubeClient.CoreV1().Endpoints(i.RbdNamespace).Get(context.Background(), i.RbdRepoName, metav1.GetOptions{}) - if err != nil { - logrus.Errorf("do not found ep by name: %s in namespace: %s", i.RbdRepoName, i.Namespace) - return nil, err - } - for _, subset := range endpoints.Subsets { - for _, addr := range subset.Addresses { - extraHosts = append(extraHosts, fmt.Sprintf("maven.goodrain.me:%s", addr.IP)) - extraHosts = append(extraHosts, fmt.Sprintf("lang.goodrain.me:%s", addr.IP)) - } - } - return -} - func (i *SourceCodeBuildItem) getHostAlias() (hostAliasList []build.HostAlias, err error) { endpoints, err := i.KubeClient.CoreV1().Endpoints(i.RbdNamespace).Get(context.Background(), i.RbdRepoName, metav1.GetOptions{}) if err != nil { diff --git a/builder/exector/exector.go b/builder/exector/exector.go index c372509f9..1bcc1f514 100644 --- a/builder/exector/exector.go +++ b/builder/exector/exector.go @@ -287,7 +287,7 @@ func (e *exectorManager) buildFromImage(task *pb.TaskMessage) { }() start := time.Now() defer func() { - logrus.Debugf("complete build from source code, consuming time %s", time.Now().Sub(start).String()) + logrus.Debugf("complete build from source code, consuming time %s", time.Since(start).String()) }() for n := 0; n < 2; n++ { err := i.Run(time.Minute * 30) diff --git a/builder/exector/service_check.go b/builder/exector/service_check.go index 73cd8ce81..c392e7005 100644 --- a/builder/exector/service_check.go +++ b/builder/exector/service_check.go @@ -125,14 +125,12 @@ func (e *exectorManager) serviceCheck(task *pb.TaskMessage) { return } errList := pr.Parse() - if errList != nil { - for i, err := range errList { - if err.SolveAdvice == "" && input.SourceType != "sourcecode" { - errList[i].SolveAdvice = fmt.Sprintf("解析器认为镜像名为:%s,请确认是否正确或镜像是否存在", pr.GetImage()) - } - if err.SolveAdvice == "" && input.SourceType == "sourcecode" { - errList[i].SolveAdvice = fmt.Sprintf("源码智能解析失败,请联系客服") - } + for i, err := range errList { + if err.SolveAdvice == "" && input.SourceType != "sourcecode" { + errList[i].SolveAdvice = fmt.Sprintf("解析器认为镜像名为:%s,请确认是否正确或镜像是否存在", pr.GetImage()) + } + if err.SolveAdvice == "" && input.SourceType == "sourcecode" { + errList[i].SolveAdvice = "源码智能解析失败" } } serviceInfos := pr.GetServiceInfo() diff --git a/builder/parser/code/lang.go b/builder/parser/code/lang.go index 4540056f9..90005f69d 100644 --- a/builder/parser/code/lang.go +++ b/builder/parser/code/lang.go @@ -115,6 +115,9 @@ var Grails Lang = "Grails" //NetCore Lang var NetCore Lang = ".NetCore" +//OSS Lang +var OSS Lang = "OSS" + //GetLangType check code lang func GetLangType(homepath string) (Lang, error) { if ok, _ := util.FileExists(homepath); !ok { diff --git a/builder/parser/source_code.go b/builder/parser/source_code.go index f0fb8bd95..d58c0d38c 100644 --- a/builder/parser/source_code.go +++ b/builder/parser/source_code.go @@ -19,13 +19,15 @@ package parser import ( + "context" + "encoding/base64" "fmt" + "os" "path" "runtime" "strconv" "strings" - "github.com/docker/docker/client" "github.com/goodrain/rainbond/builder" "github.com/goodrain/rainbond/builder/parser/code" multi "github.com/goodrain/rainbond/builder/parser/code/multisvc" @@ -34,6 +36,7 @@ import ( "github.com/goodrain/rainbond/db/model" "github.com/goodrain/rainbond/event" "github.com/goodrain/rainbond/util" + "github.com/melbahja/got" "github.com/pquerna/ffjson/ffjson" "github.com/sirupsen/logrus" "gopkg.in/src-d/go-git.v4/plumbing" @@ -42,18 +45,17 @@ import ( //SourceCodeParse docker run 命令解析或直接镜像名解析 type SourceCodeParse struct { - ports map[int]*types.Port - volumes map[string]*types.Volume - envs map[string]*types.Env - source string - memory int - image Image - args []string - branchs []string - errors []ParseError - dockerclient *client.Client - logger event.Logger - Lang code.Lang + ports map[int]*types.Port + volumes map[string]*types.Volume + envs map[string]*types.Env + source string + memory int + image Image + args []string + branchs []string + errors []ParseError + logger event.Logger + Lang code.Lang Runtime bool `json:"runtime"` Dependencies bool `json:"dependencies"` @@ -83,6 +85,7 @@ func (d *SourceCodeParse) Parse() ParseErrorList { d.errappend(Errorf(FatalError, "source can not be empty")) return d.errors } + logrus.Debugf("component source check info: %s", d.source) var csi sources.CodeSourceInfo err := ffjson.Unmarshal([]byte(d.source), &csi) if err != nil { @@ -105,6 +108,14 @@ func (d *SourceCodeParse) Parse() ParseErrorList { d.errappend(ErrorAndSolve(FatalError, "Git项目仓库地址格式错误", SolveAdvice("modify_url", "请确认并修改仓库地址"))) return d.errors } + // The source code is useless after the test is completed, and needs to be deleted. + defer func() { + if sources.CheckFileExist(buildInfo.GetCodeHome()) { + if err := sources.RemoveDir(buildInfo.GetCodeHome()); err != nil { + logrus.Warningf("remove source code: %v", err) + } + } + }() gitFunc := func() ParseErrorList { //get code if !util.DirIsEmpty(buildInfo.GetCodeHome()) { @@ -131,26 +142,26 @@ func (d *SourceCodeParse) Parse() ParseErrorList { } if err == transport.ErrRepositoryNotFound { solve := SolveAdvice("modify_repo", "请确认仓库地址是否正确") - d.errappend(ErrorAndSolve(FatalError, fmt.Sprintf("Git项目仓库不存在"), solve)) + d.errappend(ErrorAndSolve(FatalError, "Git项目仓库不存在", solve)) return d.errors } if err == transport.ErrEmptyRemoteRepository { solve := SolveAdvice("open_repo", "请确认已提交代码") - d.errappend(ErrorAndSolve(FatalError, fmt.Sprintf("Git项目仓库无有效文件"), solve)) + d.errappend(ErrorAndSolve(FatalError, "Git项目仓库无有效文件", solve)) return d.errors } if strings.Contains(err.Error(), "ssh: unable to authenticate") { solve := SolveAdvice("get_publickey", "请获取授权Key配置到你的仓库项目试试?") - d.errappend(ErrorAndSolve(FatalError, fmt.Sprintf("远程仓库SSH验证错误"), solve)) + d.errappend(ErrorAndSolve(FatalError, "远程仓库SSH验证错误", solve)) return d.errors } if strings.Contains(err.Error(), "context deadline exceeded") { solve := "请确认源码仓库能否正常访问" - d.errappend(ErrorAndSolve(FatalError, fmt.Sprintf("获取代码超时"), solve)) + d.errappend(ErrorAndSolve(FatalError, "获取代码超时", solve)) return d.errors } logrus.Errorf("git clone error,%s", err.Error()) - d.errappend(ErrorAndSolve(FatalError, fmt.Sprintf("获取代码失败"), "请确认仓库能否正常访问,或联系客服咨询")) + d.errappend(ErrorAndSolve(FatalError, "获取代码失败"+err.Error(), "请确认仓库能否正常访问。")) return d.errors } //获取分支 @@ -172,7 +183,6 @@ func (d *SourceCodeParse) Parse() ParseErrorList { svnFunc := func() ParseErrorList { if sources.CheckFileExist(buildInfo.GetCodeHome()) { if err := sources.RemoveDir(buildInfo.GetCodeHome()); err != nil { - //d.errappend(ErrorAndSolve(err, "清理cache dir错误", "请提交代码到仓库")) return d.errors } } @@ -186,14 +196,56 @@ func (d *SourceCodeParse) Parse() ParseErrorList { return d.errors } logrus.Errorf("svn checkout or update error,%s", err.Error()) - d.errappend(ErrorAndSolve(FatalError, fmt.Sprintf("获取代码失败"), "请确认仓库能否正常访问,或查看社区文档")) + d.errappend(ErrorAndSolve(FatalError, "获取代码失败"+err.Error(), "请确认仓库能否正常访问,或查看社区文档")) return d.errors } //get branchs d.branchs = rs.Branchs return nil } - logrus.Debugf("start get service code by %s server type", csi.ServerType) + ossFunc := func() ParseErrorList { + g := got.NewWithContext(context.Background()) + util.CheckAndCreateDir(buildInfo.GetCodeHome()) + fileName := path.Join(buildInfo.GetCodeHome(), path.Base(csi.RepositoryURL)) + if err := g.Do(&got.Download{ + URL: csi.RepositoryURL, + Dest: fileName, + Header: []got.GotHeader{ + {Key: "Authorization", Value: "Basic " + basicAuth(csi.User, csi.Password)}, + }, + }); err != nil { + logrus.Errorf("download package file from oss failure %s", err.Error()) + d.errappend(ErrorAndSolve(FatalError, "文件下载失败:"+err.Error(), "请确认该文件可以被正常下载")) + return d.errors + } + fi, err := os.Stat(fileName) + if err != nil { + d.errappend(ErrorAndSolve(FatalError, "文件下载失败:"+err.Error(), "请确认该文件可以被正常下载")) + return d.errors + } + logrus.Infof("download package file success, size %d MB", fi.Size()/1024/1024) + ext := path.Ext(csi.RepositoryURL) + switch ext { + case ".tar": + if err := util.UnTar(fileName, buildInfo.GetCodeHome(), false); err != nil { + logrus.Errorf("untar package file failure %s", err.Error()) + d.errappend(ErrorAndSolve(FatalError, "文件解压失败", "请确认该文件是否为tar规范文件")) + } + case ".tgz", ".tar.gz": + if err := util.UnTar(fileName, buildInfo.GetCodeHome(), true); err != nil { + logrus.Errorf("untar package file failure %s", err.Error()) + d.errappend(ErrorAndSolve(FatalError, "文件解压失败", "请确认该文件是否为tgz规范文件")) + } + case ".zip": + if err := util.Unzip(fileName, buildInfo.GetCodeHome()); err != nil { + logrus.Errorf("untar package file failure %s", err.Error()) + d.errappend(ErrorAndSolve(FatalError, "文件解压失败", "请确认该文件是否为zip规范文件")) + } + } + logrus.Infof("unpack package file success") + return d.errors + } + logrus.Debugf("start get service %s code by %s server type", csi.ServiceID, csi.ServerType) //获取代码仓库 switch csi.ServerType { case "git": @@ -204,6 +256,10 @@ func (d *SourceCodeParse) Parse() ParseErrorList { if err := svnFunc(); err != nil && err.IsFatalError() { return err } + case "oss": + if err := ossFunc(); err != nil && err.IsFatalError() { + return err + } default: //default git logrus.Warningf("do not get void server type,default use git") @@ -211,14 +267,6 @@ func (d *SourceCodeParse) Parse() ParseErrorList { return err } } - // The source code is useless after the test is completed, and needs to be deleted. - defer func() { - if sources.CheckFileExist(buildInfo.GetCodeHome()) { - if err := sources.RemoveDir(buildInfo.GetCodeHome()); err != nil { - logrus.Warningf("remove source code: %v", err) - } - } - }() //read rainbondfile rbdfileConfig, err := code.ReadRainbondFile(buildInfo.GetCodeBuildAbsPath()) @@ -303,7 +351,7 @@ func (d *SourceCodeParse) Parse() ParseErrorList { d.errappend(ErrorAndSolve(FatalError, fmt.Sprintf("error listing modules: %v", err), "check source code for multi-modules")) return d.errors } - if services != nil && len(services) > 1 { + if len(services) > 1 { d.isMulti = true d.services = services } @@ -579,3 +627,8 @@ func (d *SourceCodeParse) parseDockerfileInfo(dockerfile string) bool { d.args = []string{} return true } + +func basicAuth(username, password string) string { + auth := username + ":" + password + return base64.StdEncoding.EncodeToString([]byte(auth)) +} diff --git a/builder/parser/source_code_test.go b/builder/parser/source_code_test.go index 068481717..232fb8037 100644 --- a/builder/parser/source_code_test.go +++ b/builder/parser/source_code_test.go @@ -70,3 +70,25 @@ func TestSourceCode(t *testing.T) { body, _ := json.Marshal(re) fmt.Printf("%s \n", string(body)) } + +func TestOSSCheck(t *testing.T) { + sc := sources.CodeSourceInfo{ + ServerType: "oss", + RepositoryURL: "http://8081.gr021644.64q1jlfb.17f4cc.grapps.cn/artifactory/dev/java-war-demo-master.tar.gz", + User: "demo", + Password: "gr123465!", + } + b, _ := json.Marshal(sc) + p := CreateSourceCodeParse(string(b), nil) + err := p.Parse() + if err != nil && err.IsFatalError() { + t.Fatal(err) + } + re := ServiceCheckResult{ + CheckStatus: "Success", + ErrorInfos: err, + ServiceInfo: p.GetServiceInfo(), + } + body, _ := json.Marshal(re) + fmt.Printf("%s \n", string(body)) +} diff --git a/go.mod b/go.mod index 54c6a930e..8848c9b44 100644 --- a/go.mod +++ b/go.mod @@ -58,6 +58,7 @@ require ( github.com/kr/pretty v0.2.1 // indirect github.com/kr/pty v1.1.8 github.com/mattn/go-runewidth v0.0.6 + github.com/melbahja/got v0.5.0 github.com/mitchellh/go-ps v1.0.0 github.com/mitchellh/go-wordwrap v1.0.0 github.com/mitchellh/mapstructure v1.3.3 @@ -99,6 +100,7 @@ require ( google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e // indirect google.golang.org/grpc v1.33.2 + google.golang.org/protobuf v1.25.0 gopkg.in/alecthomas/kingpin.v2 v2.2.6 gopkg.in/src-d/go-git.v4 v4.13.1 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index 417474ccd..78a8ce5ad 100644 --- a/go.sum +++ b/go.sum @@ -93,12 +93,6 @@ github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/GLYASAI/rainbond-oam v0.0.0-20210720142412-6faa7418c0ab h1:IvNXJNJhmZeMPbulJ7SMtcR9DduQIj0FyUsS5dcLqAQ= -github.com/GLYASAI/rainbond-oam v0.0.0-20210720142412-6faa7418c0ab/go.mod h1:/dRehR3e1pGexOaIDjA44AHBlVPbb7v+O7GWAVyo740= -github.com/GLYASAI/rainbond-oam v0.0.0-20210720150350-96daaa6aec86 h1:wCxXRbtOrsCjw9+gp8n5t1kTFy9/xsWyuZOPR5zvypY= -github.com/GLYASAI/rainbond-oam v0.0.0-20210720150350-96daaa6aec86/go.mod h1:/dRehR3e1pGexOaIDjA44AHBlVPbb7v+O7GWAVyo740= -github.com/GLYASAI/rainbond-oam v0.0.0-20210721020036-158e1be667dc h1:UMR1n8LoCY79PvroSDDlGfSSomqEgeQAgZ+k8MBgcYk= -github.com/GLYASAI/rainbond-oam v0.0.0-20210721020036-158e1be667dc/go.mod h1:/dRehR3e1pGexOaIDjA44AHBlVPbb7v+O7GWAVyo740= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd h1:sjQovDkwrZp8u+gxLtPgKGjk5hCxuy2hrRejBTA9xFU= @@ -384,6 +378,7 @@ github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3 github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo= github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/channels v1.1.0 h1:F1taHcn7/F0i8DYqKXJnyhJcVpp2kgFcNePxXtnyu4k= github.com/eapache/channels v1.1.0/go.mod h1:jMm2qB5Ubtg9zLd+inMZd2/NUvXgzmWXsDaLyQIGfH0= @@ -699,10 +694,6 @@ github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkY github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk= github.com/goodrain/gorm-bulk-upsert v1.0.1-0.20210608013724-7e7870d16357 h1:kdSSrpA5yNvgqbfpMlEr8bvQWiLc1Uz9g0vYf3JVT7s= github.com/goodrain/gorm-bulk-upsert v1.0.1-0.20210608013724-7e7870d16357/go.mod h1:b7/GgeVNbf/SFw4FYIWslxNV5I10C9Mhf/++3jsDk3M= -github.com/goodrain/rainbond-oam v0.0.0-20210206075623-511d0796af43 h1:xhUwEWQKk+maL6CmV5Y6kxKb+jA/RvN6SZcDbNm51FM= -github.com/goodrain/rainbond-oam v0.0.0-20210206075623-511d0796af43/go.mod h1:/dRehR3e1pGexOaIDjA44AHBlVPbb7v+O7GWAVyo740= -github.com/goodrain/rainbond-oam v0.0.0-20210531110322-0fc33198e2d1 h1:XnipcyrdVCxtKYpy7APoaQwXOX4WGwxgZVpy1XvYb/A= -github.com/goodrain/rainbond-oam v0.0.0-20210531110322-0fc33198e2d1/go.mod h1:/dRehR3e1pGexOaIDjA44AHBlVPbb7v+O7GWAVyo740= github.com/goodrain/rainbond-oam v0.0.0-20210721020036-158e1be667dc h1:hCtxb/Yy4G+wEc2n+yaXx3j4SF/s34zNI8XK5qkHqXk= github.com/goodrain/rainbond-oam v0.0.0-20210721020036-158e1be667dc/go.mod h1:/dRehR3e1pGexOaIDjA44AHBlVPbb7v+O7GWAVyo740= github.com/goodrain/rainbond-operator v1.3.1-0.20210401055914-f8fe4bf89a21 h1:iCPI96slvJv88iPc1NJW8zhpkiza0kwB0jtsuZIJLRQ= @@ -1081,6 +1072,8 @@ github.com/mdlayher/netlink v1.1.0 h1:mpdLgm+brq10nI9zM1BpX1kpDbh3NLl3RSnVq6ZSkf github.com/mdlayher/netlink v1.1.0/go.mod h1:H4WCitaheIsdF9yOYu8CFmCgQthAPIWZmcKp9uZHgmY= github.com/mdlayher/wifi v0.0.0-20190303161829-b1436901ddee h1:hZDujBrW3ye2xxdKNFYT59D4yCH5Q0zLuNBNtysKtok= github.com/mdlayher/wifi v0.0.0-20190303161829-b1436901ddee/go.mod h1:Evt/EIne46u9PtQbeTx2NTcqURpr5K4SvKtGmBuDPN8= +github.com/melbahja/got v0.5.0 h1:tFp5WasOUeZ/SiW82G4SS8clb5Q/Pw6IFYvOcLgt/ZY= +github.com/melbahja/got v0.5.0/go.mod h1:z/sG672dxMFNDZtZ9CHBbfuYeTzV0Xqilq6BUEw41oY= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mholt/archiver/v3 v3.3.0/go.mod h1:YnQtqsp+94Rwd0D/rk5cnLrxusUBUXg+08Ebtr1Mqao= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= @@ -1499,6 +1492,8 @@ github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4= +github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= @@ -1545,6 +1540,11 @@ github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUA github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs= github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= +gitlab.com/poldi1405/go-ansi v1.1.0 h1:BrWoD9TivJKjdnQUwiHVzyqAemDiRpDVBCbbNOPoySQ= +gitlab.com/poldi1405/go-ansi v1.1.0/go.mod h1:TLoRttGdPaq5H2qfF7I1cC5Lt2WXtQeIkFurjbUf6OI= +gitlab.com/poldi1405/go-indicators v0.0.0-20200820134929-9b373aa411a5/go.mod h1:jn34qwBiXTHz73wD9neAMeJGCeMijVro+WCqk1RJXL4= +gitlab.com/poldi1405/go-indicators v1.0.0 h1:miZ7CisCvAH6G16OuY6ATtC8QUUjVCYabNgVsRYjJIs= +gitlab.com/poldi1405/go-indicators v1.0.0/go.mod h1:jn34qwBiXTHz73wD9neAMeJGCeMijVro+WCqk1RJXL4= go.elastic.co/apm v1.5.0/go.mod h1:OdB9sPtM6Vt7oz3VXt7+KR96i9li74qrxBGHTQygFvk= go.elastic.co/apm/module/apmhttp v1.5.0/go.mod h1:1FbmNuyD3ddauwzgVwFB0fqY6KbZt3JkV187tGCYYhY= go.elastic.co/apm/module/apmot v1.5.0/go.mod h1:d2KYwhJParTpyw2WnTNy8geNlHKKFX+4oK3YLlsesWE= diff --git a/util/comman.go b/util/comman.go index 15fe66aac..e0127e61f 100644 --- a/util/comman.go +++ b/util/comman.go @@ -527,6 +527,16 @@ func Zip(source, target string) error { return err } +func UnTar(archive, target string, zip bool) error { + parameter := "-x" + if zip { + parameter = "-zx" + } + command := []string{"tar", parameter, "-C", target, "-f", archive} + cmd := exec.Command(command[0], command[1:]...) + return cmd.Run() +} + //Unzip archive file to target dir func Unzip(archive, target string) error { reader, err := zip.OpenDirectReader(archive) From 1fc0c77b93b057ff708ddadd939599f762da7201 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Thu, 29 Jul 2021 14:14:14 +0800 Subject: [PATCH 04/43] go lint --- api/controller/service_action.go | 33 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/api/controller/service_action.go b/api/controller/service_action.go index f60b4dab9..09302d9a2 100644 --- a/api/controller/service_action.go +++ b/api/controller/service_action.go @@ -86,7 +86,6 @@ func (t *TenantStruct) StartService(w http.ResponseWriter, r *http.Request) { return } httputil.ReturnSuccess(r, w, sEvent) - return } //StopService StopService @@ -179,7 +178,6 @@ func (t *TenantStruct) RestartService(w http.ResponseWriter, r *http.Request) { return } httputil.ReturnSuccess(r, w, sEvent) - return } //VerticalService VerticalService @@ -215,23 +213,23 @@ func (t *TenantStruct) VerticalService(w http.ResponseWriter, r *http.Request) { tenantID := r.Context().Value(ctxutil.ContextKey("tenant_id")).(string) serviceID := r.Context().Value(ctxutil.ContextKey("service_id")).(string) sEvent := r.Context().Value(ctxutil.ContextKey("event")).(*dbmodel.ServiceEvent) - var cpu_set, gpu_set, memory_set *int + var cpuSet, gpuSet, memorySet *int if cpu, ok := data["container_cpu"].(float64); ok { - cpu_int := int(cpu) - cpu_set = &cpu_int + cpuInt := int(cpu) + cpuSet = &cpuInt } if memory, ok := data["container_memory"].(float64); ok { - memory_int := int(memory) - memory_set = &memory_int + memoryInt := int(memory) + memorySet = &memoryInt } if gpu, ok := data["container_gpu"].(float64); ok { - gpu_int := int(gpu) - gpu_set = &gpu_int + gpuInt := int(gpu) + gpuSet = &gpuInt } tenant := r.Context().Value(ctxutil.ContextKey("tenant")).(*dbmodel.Tenants) service := r.Context().Value(ctxutil.ContextKey("service")).(*dbmodel.TenantServices) - if memory_set != nil { - if err := handler.CheckTenantResource(r.Context(), tenant, service.Replicas*(*memory_set)); err != nil { + if memorySet != nil { + if err := handler.CheckTenantResource(r.Context(), tenant, service.Replicas*(*memorySet)); err != nil { httputil.ReturnResNotEnough(r, w, sEvent.EventID, err.Error()) return } @@ -240,9 +238,9 @@ func (t *TenantStruct) VerticalService(w http.ResponseWriter, r *http.Request) { TenantID: tenantID, ServiceID: serviceID, EventID: sEvent.EventID, - ContainerCPU: cpu_set, - ContainerMemory: memory_set, - ContainerGPU: gpu_set, + ContainerCPU: cpuSet, + ContainerMemory: memorySet, + ContainerGPU: gpuSet, } if err := handler.GetServiceManager().ServiceVertical(r.Context(), verticalTask); err != nil { httputil.ReturnError(r, w, 500, fmt.Sprintf("service vertical error. %v", err)) @@ -477,7 +475,7 @@ func (t *TenantStruct) GetDeployVersion(w http.ResponseWriter, r *http.Request) return } if err == gorm.ErrRecordNotFound { - httputil.ReturnError(r, w, 404, fmt.Sprintf("build version do not exist")) + httputil.ReturnError(r, w, 404, "build version do not exist") return } httputil.ReturnSuccess(r, w, version) @@ -494,7 +492,7 @@ func (t *TenantStruct) GetManyDeployVersion(w http.ResponseWriter, r *http.Reque } serviceIDs, ok := data["service_ids"].([]interface{}) if !ok { - httputil.ReturnError(r, w, 400, fmt.Sprintf("service ids must be a array")) + httputil.ReturnError(r, w, 400, "service ids must be a array") return } var list []string @@ -503,7 +501,7 @@ func (t *TenantStruct) GetManyDeployVersion(w http.ResponseWriter, r *http.Reque } services, err := db.GetManager().TenantServiceDao().GetServiceByIDs(list) if err != nil { - httputil.ReturnError(r, w, 500, fmt.Sprintf(err.Error())) + httputil.ReturnError(r, w, 500, err.Error()) return } var versionList []*dbmodel.VersionInfo @@ -658,7 +656,6 @@ func (t *TenantStruct) RollBack(w http.ResponseWriter, r *http.Request) { re := handler.GetOperationHandler().RollBack(rollbackRequest) httputil.ReturnSuccess(r, w, re) - return } type limitMemory struct { From 4ee348bb222a5feaaed4a07c1837a5f6ef6f8647 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Fri, 30 Jul 2021 16:17:33 +0800 Subject: [PATCH 05/43] sync rule extensions --- api/handler/gateway_action.go | 31 +++++++++++++++++++++++++++++-- db/dao/dao.go | 1 + db/mysql/dao/gateway.go | 18 +++++++++++++++--- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/api/handler/gateway_action.go b/api/handler/gateway_action.go index d7d4232ba..6ee9d9d56 100644 --- a/api/handler/gateway_action.go +++ b/api/handler/gateway_action.go @@ -885,8 +885,9 @@ func (g *GatewayAction) listHTTPRuleIDs(componentID string, port int) ([]string, // SyncHTTPRules - func (g *GatewayAction) SyncHTTPRules(tx *gorm.DB, components []*apimodel.Component) error { var ( - componentIDs []string - httpRules []*model.HTTPRule + componentIDs []string + httpRules []*model.HTTPRule + ruleExtensions []*model.RuleExtension ) for _, component := range components { if component.HTTPRules == nil { @@ -895,14 +896,40 @@ func (g *GatewayAction) SyncHTTPRules(tx *gorm.DB, components []*apimodel.Compon componentIDs = append(componentIDs, component.ComponentBase.ComponentID) for _, httpRule := range component.HTTPRules { httpRules = append(httpRules, httpRule.DbModel(component.ComponentBase.ComponentID)) + + for _, ext := range httpRule.RuleExtensions { + ruleExtensions = append(ruleExtensions, &model.RuleExtension{ + UUID: util.NewUUID(), + RuleID: httpRule.HTTPRuleID, + Key: ext.Key, + Value: ext.Value, + }) + } } } + + if err := g.syncRuleExtensions(tx, httpRules, ruleExtensions); err != nil { + return err + } + if err := db.GetManager().HTTPRuleDaoTransactions(tx).DeleteByComponentIDs(componentIDs); err != nil { return err } return db.GetManager().HTTPRuleDaoTransactions(tx).CreateOrUpdateHTTPRuleInBatch(httpRules) } +func (g *GatewayAction) syncRuleExtensions(tx *gorm.DB, httpRules []*model.HTTPRule, exts []*model.RuleExtension) error { + var ruleIDs []string + for _, hr := range httpRules { + ruleIDs = append(ruleIDs, hr.UUID) + } + + if err := db.GetManager().RuleExtensionDaoTransactions(tx).DeleteByRuleIDs(ruleIDs); err != nil { + return err + } + return db.GetManager().RuleExtensionDaoTransactions(tx).CreateOrUpdateRuleExtensionsInBatch(exts) +} + // SyncTCPRules - func (g *GatewayAction) SyncTCPRules(tx *gorm.DB, components []*apimodel.Component) error { var ( diff --git a/db/dao/dao.go b/db/dao/dao.go index 5bfffedbc..2d5c09429 100644 --- a/db/dao/dao.go +++ b/db/dao/dao.go @@ -505,6 +505,7 @@ type RuleExtensionDao interface { GetRuleExtensionByRuleID(ruleID string) ([]*model.RuleExtension, error) DeleteRuleExtensionByRuleID(ruleID string) error DeleteByRuleIDs(ruleIDs []string) error + CreateOrUpdateRuleExtensionsInBatch(exts []*model.RuleExtension) error } // HTTPRuleDao - diff --git a/db/mysql/dao/gateway.go b/db/mysql/dao/gateway.go index ade6a0c27..beaf54054 100644 --- a/db/mysql/dao/gateway.go +++ b/db/mysql/dao/gateway.go @@ -20,9 +20,9 @@ package dao import ( "fmt" - gormbulkups "github.com/atcdot/gorm-bulk-upsert" "reflect" + gormbulkups "github.com/atcdot/gorm-bulk-upsert" "github.com/goodrain/rainbond/api/util/bcode" "github.com/goodrain/rainbond/db/model" "github.com/jinzhu/gorm" @@ -149,6 +149,18 @@ func (c *RuleExtensionDaoImpl) DeleteByRuleIDs(ruleIDs []string) error { return nil } +// RuleExtensionDaoImpl creates or updates rule extensions in batch. +func (c *RuleExtensionDaoImpl) CreateOrUpdateRuleExtensionsInBatch(exts []*model.RuleExtension) error { + var objects []interface{} + for _, ext := range exts { + objects = append(objects, *ext) + } + if err := gormbulkups.BulkUpsert(c.DB, objects, 2000); err != nil { + return errors.Wrap(err, "create or update rule extensions in batch") + } + return nil +} + //HTTPRuleDaoImpl http rule type HTTPRuleDaoImpl struct { DB *gorm.DB @@ -276,7 +288,7 @@ func (h *HTTPRuleDaoImpl) ListByCertID(certID string) ([]*model.HTTPRule, error) } //DeleteByComponentIDs delete http rule by component ids -func (h *HTTPRuleDaoImpl) DeleteByComponentIDs(componentIDs []string) error{ +func (h *HTTPRuleDaoImpl) DeleteByComponentIDs(componentIDs []string) error { return h.DB.Where("service_id in (?) ", componentIDs).Delete(&model.HTTPRule{}).Error } @@ -407,7 +419,7 @@ func (t *TCPRuleDaoTmpl) ListByServiceID(serviceID string) ([]*model.TCPRule, er } //DeleteByComponentIDs delete tcp rule by component ids -func (t *TCPRuleDaoTmpl) DeleteByComponentIDs(componentIDs []string) error{ +func (t *TCPRuleDaoTmpl) DeleteByComponentIDs(componentIDs []string) error { return t.DB.Where("service_id in (?) ", componentIDs).Delete(&model.TCPRule{}).Error } From 10d5ccd97ab14fe01d43dc89192dc1d779ba1a26 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Fri, 30 Jul 2021 17:53:45 +0800 Subject: [PATCH 06/43] sync rule configs and rule extensions --- api/handler/application_handler.go | 3 ++ api/handler/gateway_action.go | 31 ++++++++++++ api/handler/gateway_handler.go | 1 + api/model/component.go | 4 +- api/model/gateway_model.go | 77 +++++++++++++++++++++++++++++- db/dao/dao.go | 2 + db/mysql/dao/gateway.go | 23 ++++++++- 7 files changed, 138 insertions(+), 3 deletions(-) diff --git a/api/handler/application_handler.go b/api/handler/application_handler.go index 72d21e0b1..6e6423517 100644 --- a/api/handler/application_handler.go +++ b/api/handler/application_handler.go @@ -572,6 +572,9 @@ func (a *ApplicationAction) SyncComponents(app *dbmodel.Application, components if err := GetGatewayHandler().SyncHTTPRules(tx, components); err != nil { return err } + if err := GetGatewayHandler().SyncRuleConfigs(tx, components); err != nil { + return err + } if err := GetGatewayHandler().SyncTCPRules(tx, components); err != nil { return err } diff --git a/api/handler/gateway_action.go b/api/handler/gateway_action.go index 6ee9d9d56..7662a33c1 100644 --- a/api/handler/gateway_action.go +++ b/api/handler/gateway_action.go @@ -950,3 +950,34 @@ func (g *GatewayAction) SyncTCPRules(tx *gorm.DB, components []*apimodel.Compone } return db.GetManager().TCPRuleDaoTransactions(tx).CreateOrUpdateTCPRuleInBatch(tcpRules) } + +// SyncRuleConfigs - +func (g *GatewayAction) SyncRuleConfigs(tx *gorm.DB, components []*apimodel.Component) error { + var configs []*model.GwRuleConfig + var componentIDs []string + for _, component := range components { + componentIDs = append(componentIDs, component.ComponentBase.ComponentID) + if len(component.HTTPRuleConfigs) == 0 { + continue + } + + for _, httpRuleConfig := range component.HTTPRuleConfigs { + configs = append(configs, httpRuleConfig.DbModel()...) + } + } + + // http rule ids + rules, err := db.GetManager().HTTPRuleDao().ListByComponentIDs(componentIDs) + if err != nil { + return err + } + var ruleIDs []string + for _, rule := range rules { + ruleIDs = append(ruleIDs, rule.UUID) + } + + if err := db.GetManager().GwRuleConfigDaoTransactions(tx).DeleteByRuleIDs(ruleIDs); err != nil { + return err + } + return db.GetManager().GwRuleConfigDaoTransactions(tx).CreateOrUpdateGwRuleConfigsInBatch(configs) +} diff --git a/api/handler/gateway_handler.go b/api/handler/gateway_handler.go index 0be901145..7fd903568 100644 --- a/api/handler/gateway_handler.go +++ b/api/handler/gateway_handler.go @@ -61,4 +61,5 @@ type GatewayHandler interface { DeleteIngressRulesByComponentPort(tx *gorm.DB, componentID string, port int) error SyncHTTPRules(tx *gorm.DB, components []*apimodel.Component) error SyncTCPRules(tx *gorm.DB, components []*apimodel.Component) error + SyncRuleConfigs(tx *gorm.DB, components []*apimodel.Component) error } diff --git a/api/model/component.go b/api/model/component.go index 5a6a6e724..ec7e1e81d 100644 --- a/api/model/component.go +++ b/api/model/component.go @@ -2,8 +2,9 @@ package model import ( "fmt" - dbmodel "github.com/goodrain/rainbond/db/model" "time" + + dbmodel "github.com/goodrain/rainbond/db/model" ) // ComponentBase - @@ -239,6 +240,7 @@ type Component struct { ComponentBase ComponentBase `json:"component_base"` HTTPRules []AddHTTPRuleStruct `json:"http_rules"` TCPRules []AddTCPRuleStruct `json:"tcp_rules"` + HTTPRuleConfigs []HTTPRuleConfig `json:"http_rule_configs"` Monitors []AddServiceMonitorRequestStruct `json:"monitors"` Ports []TenantServicesPort `json:"ports"` Relations []TenantComponentRelation `json:"relations"` diff --git a/api/model/gateway_model.go b/api/model/gateway_model.go index 23362b3b0..eb308078f 100644 --- a/api/model/gateway_model.go +++ b/api/model/gateway_model.go @@ -19,8 +19,10 @@ package model import ( - dbmodel "github.com/goodrain/rainbond/db/model" + "strconv" "strings" + + dbmodel "github.com/goodrain/rainbond/db/model" ) //AddHTTPRuleStruct is used to add http rule, certificate and rule extensions @@ -171,6 +173,79 @@ type Body struct { ProxyBuffering string `json:"proxy_buffering,omitempty" validate:"proxy_buffering|required"` } +// HTTPRuleConfig - +type HTTPRuleConfig struct { + RuleID string `json:"rule_id,omitempty" validate:"rule_id|required"` + ProxyConnectTimeout int `json:"proxy_connect_timeout,omitempty" validate:"proxy_connect_timeout|required"` + ProxySendTimeout int `json:"proxy_send_timeout,omitempty" validate:"proxy_send_timeout|required"` + ProxyReadTimeout int `json:"proxy_read_timeout,omitempty" validate:"proxy_read_timeout|required"` + ProxyBodySize int `json:"proxy_body_size,omitempty" validate:"proxy_body_size|required"` + SetHeaders []*SetHeader `json:"set_headers,omitempty" ` + Rewrites []*Rewrite `json:"rewrite,omitempty"` + ProxyBufferSize int `json:"proxy_buffer_size,omitempty" validate:"proxy_buffer_size|numeric_between:1,65535"` + ProxyBufferNumbers int `json:"proxy_buffer_numbers,omitempty" validate:"proxy_buffer_size|numeric_between:1,65535"` + ProxyBuffering string `json:"proxy_buffering,omitempty" validate:"proxy_buffering|required"` +} + +// DbModel return database model +func (h *HTTPRuleConfig) DbModel() []*dbmodel.GwRuleConfig { + var configs []*dbmodel.GwRuleConfig + configs = append(configs, &dbmodel.GwRuleConfig{ + RuleID: h.RuleID, + Key: "proxy-connect-timeout", + Value: strconv.Itoa(h.ProxyConnectTimeout), + }) + configs = append(configs, &dbmodel.GwRuleConfig{ + RuleID: h.RuleID, + Key: "proxy-send-timeout", + Value: strconv.Itoa(h.ProxySendTimeout), + }) + configs = append(configs, &dbmodel.GwRuleConfig{ + RuleID: h.RuleID, + Key: "proxy-read-timeout", + Value: strconv.Itoa(h.ProxyReadTimeout), + }) + configs = append(configs, &dbmodel.GwRuleConfig{ + RuleID: h.RuleID, + Key: "proxy-body-size", + Value: strconv.Itoa(h.ProxyBodySize), + }) + configs = append(configs, &dbmodel.GwRuleConfig{ + RuleID: h.RuleID, + Key: "proxy-buffer-size", + Value: strconv.Itoa(h.ProxyBufferSize), + }) + configs = append(configs, &dbmodel.GwRuleConfig{ + RuleID: h.RuleID, + Key: "proxy-buffer-numbers", + Value: strconv.Itoa(h.ProxyBufferNumbers), + }) + configs = append(configs, &dbmodel.GwRuleConfig{ + RuleID: h.RuleID, + Key: "proxy-buffering", + Value: h.ProxyBuffering, + }) + setheaders := make(map[string]string) + for _, item := range h.SetHeaders { + if strings.TrimSpace(item.Key) == "" { + continue + } + if strings.TrimSpace(item.Value) == "" { + item.Value = "empty" + } + // filter same key + setheaders["set-header-"+item.Key] = item.Value + } + for k, v := range setheaders { + configs = append(configs, &dbmodel.GwRuleConfig{ + RuleID: h.RuleID, + Key: k, + Value: v, + }) + } + return configs +} + //SetHeader set header type SetHeader struct { Key string `json:"item_key"` diff --git a/db/dao/dao.go b/db/dao/dao.go index 2d5c09429..13f811075 100644 --- a/db/dao/dao.go +++ b/db/dao/dao.go @@ -522,6 +522,7 @@ type HTTPRuleDao interface { DeleteByComponentPort(componentID string, port int) error DeleteByComponentIDs(componentIDs []string) error CreateOrUpdateHTTPRuleInBatch(httpRules []*model.HTTPRule) error + ListByComponentIDs(componentIDs []string) ([]*model.HTTPRule, error) } // TCPRuleDao - @@ -567,6 +568,7 @@ type GwRuleConfigDao interface { DeleteByRuleID(rid string) error ListByRuleID(rid string) ([]*model.GwRuleConfig, error) DeleteByRuleIDs(ruleIDs []string) error + CreateOrUpdateGwRuleConfigsInBatch(ruleConfigs []*model.GwRuleConfig) error } // TenantServceAutoscalerRulesDao - diff --git a/db/mysql/dao/gateway.go b/db/mysql/dao/gateway.go index beaf54054..5aa3ac20b 100644 --- a/db/mysql/dao/gateway.go +++ b/db/mysql/dao/gateway.go @@ -149,7 +149,7 @@ func (c *RuleExtensionDaoImpl) DeleteByRuleIDs(ruleIDs []string) error { return nil } -// RuleExtensionDaoImpl creates or updates rule extensions in batch. +// CreateOrUpdateRuleExtensionsInBatch - func (c *RuleExtensionDaoImpl) CreateOrUpdateRuleExtensionsInBatch(exts []*model.RuleExtension) error { var objects []interface{} for _, ext := range exts { @@ -304,6 +304,15 @@ func (h *HTTPRuleDaoImpl) CreateOrUpdateHTTPRuleInBatch(httpRules []*model.HTTPR return nil } +// ListByComponentIDs - +func (h *HTTPRuleDaoImpl) ListByComponentIDs(componentIDs []string) ([]*model.HTTPRule, error) { + var rules []*model.HTTPRule + if err := h.DB.Where("service_id in (?) ", componentIDs).Find(&rules).Error; err != nil { + return nil, err + } + return rules, nil +} + // TCPRuleDaoTmpl is a implementation of TcpRuleDao type TCPRuleDaoTmpl struct { DB *gorm.DB @@ -482,3 +491,15 @@ func (t *GwRuleConfigDaoImpl) DeleteByRuleIDs(ruleIDs []string) error { } return nil } + +// CreateOrUpdateGwRuleConfigsInBatch creates or updates rule configs in batch. +func (t *GwRuleConfigDaoImpl) CreateOrUpdateGwRuleConfigsInBatch(ruleConfigs []*model.GwRuleConfig) error { + var objects []interface{} + for _, ruleConfig := range ruleConfigs { + objects = append(objects, *ruleConfig) + } + if err := gormbulkups.BulkUpsert(t.DB, objects, 2000); err != nil { + return errors.Wrap(err, "create or update rule configs in batch") + } + return nil +} From 983874d0f09fe0d90270bc17b7e8d2808cbbe4e9 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Sat, 31 Jul 2021 17:19:00 +0800 Subject: [PATCH 07/43] upgrade ingress from extensions to networking --- gateway/annotations/annotations.go | 4 +- gateway/annotations/cookie/cookie.go | 6 +- gateway/annotations/cookie/cookie_test.go | 6 +- gateway/annotations/header/header.go | 6 +- gateway/annotations/header/header_test.go | 6 +- gateway/annotations/l4/l4.go | 6 +- gateway/annotations/l4/l4_test.go | 6 +- gateway/annotations/lbtype/lbtype.go | 4 +- gateway/annotations/parser/parser.go | 15 ++- gateway/annotations/parser/parser_test.go | 6 +- gateway/annotations/proxy/proxy.go | 4 +- gateway/annotations/proxy/proxy_test.go | 6 +- gateway/annotations/rewrite/rewrite.go | 4 +- gateway/annotations/rewrite/rewrite_test.go | 6 +- gateway/annotations/upstreamhashby/main.go | 4 +- gateway/annotations/wight/weight.go | 4 +- gateway/store/secret_ingress_map.go | 4 +- gateway/store/store.go | 56 ++++++----- gateway/store/store_test.go | 6 +- gateway/test/http/http_test.go | 96 +++++++++++-------- gateway/test/https/https_test.go | 33 ++++--- gateway/test/tcp/tcp_test.go | 23 ++--- go.mod | 1 + .../ingress/controller/store/ingress.go | 6 +- util/k8s/k8s.go | 6 ++ worker/appm/controller/start.go | 2 +- worker/appm/conversion/gateway.go | 71 +++++++------- worker/appm/f/function.go | 18 ++-- worker/appm/store/lister.go | 4 +- worker/appm/store/store.go | 12 +-- worker/appm/types/v1/v1.go | 34 +++---- 31 files changed, 252 insertions(+), 213 deletions(-) diff --git a/gateway/annotations/annotations.go b/gateway/annotations/annotations.go index f2e8754a5..57ff4edf2 100644 --- a/gateway/annotations/annotations.go +++ b/gateway/annotations/annotations.go @@ -32,7 +32,7 @@ import ( "github.com/goodrain/rainbond/util/ingress-nginx/ingress/errors" "github.com/imdario/mergo" "github.com/sirupsen/logrus" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -74,7 +74,7 @@ func NewAnnotationExtractor(cfg resolver.Resolver) Extractor { } // Extract extracts the annotations from an Ingress -func (e Extractor) Extract(ing *extensions.Ingress) *Ingress { +func (e Extractor) Extract(ing *networkingv1.Ingress) *Ingress { pia := &Ingress{ ObjectMeta: ing.ObjectMeta, } diff --git a/gateway/annotations/cookie/cookie.go b/gateway/annotations/cookie/cookie.go index 1e1d9bbd8..16b53d029 100644 --- a/gateway/annotations/cookie/cookie.go +++ b/gateway/annotations/cookie/cookie.go @@ -21,10 +21,11 @@ package cookie import ( "github.com/goodrain/rainbond/gateway/annotations/parser" "github.com/goodrain/rainbond/gateway/annotations/resolver" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" "strings" ) +// Config - type Config struct { Cookie map[string]string `json:"cookie"` } @@ -33,11 +34,12 @@ type cookie struct { r resolver.Resolver } +// NewParser - func NewParser(r resolver.Resolver) parser.IngressAnnotation { return cookie{r} } -func (c cookie) Parse(ing *extensions.Ingress) (interface{}, error) { +func (c cookie) Parse(ing *networkingv1.Ingress) (interface{}, error) { co, err := parser.GetStringAnnotation("cookie", ing) if err != nil { return nil, err diff --git a/gateway/annotations/cookie/cookie_test.go b/gateway/annotations/cookie/cookie_test.go index 8abfebbda..716ad5576 100644 --- a/gateway/annotations/cookie/cookie_test.go +++ b/gateway/annotations/cookie/cookie_test.go @@ -20,18 +20,18 @@ package cookie import ( api "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) -func buildIngress() *extensions.Ingress { +func buildIngress() *networkingv1.Ingress { defaultBackend := extensions.IngressBackend{ ServiceName: "default-backend", ServicePort: intstr.FromInt(80), } - return &extensions.Ingress{ + return &networkingv1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "foo", Namespace: api.NamespaceDefault, diff --git a/gateway/annotations/header/header.go b/gateway/annotations/header/header.go index 3af7126a4..be1077acd 100644 --- a/gateway/annotations/header/header.go +++ b/gateway/annotations/header/header.go @@ -21,10 +21,11 @@ package header import ( "github.com/goodrain/rainbond/gateway/annotations/parser" "github.com/goodrain/rainbond/gateway/annotations/resolver" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" "strings" ) +// Config - type Config struct { Header map[string]string `json:"header"` } @@ -33,11 +34,12 @@ type header struct { r resolver.Resolver } +// NewParser - func NewParser(r resolver.Resolver) parser.IngressAnnotation { return header{r} } -func (h header) Parse(ing *extensions.Ingress) (interface{}, error) { +func (h header) Parse(ing *networkingv1.Ingress) (interface{}, error) { hr, err := parser.GetStringAnnotation("header", ing) if err != nil { return nil, err diff --git a/gateway/annotations/header/header_test.go b/gateway/annotations/header/header_test.go index a412eec53..bcd09819e 100644 --- a/gateway/annotations/header/header_test.go +++ b/gateway/annotations/header/header_test.go @@ -20,18 +20,18 @@ package header import ( api "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) -func buildIngress() *extensions.Ingress { +func buildIngress() *networkingv1.Ingress { defaultBackend := extensions.IngressBackend{ ServiceName: "default-backend", ServicePort: intstr.FromInt(80), } - return &extensions.Ingress{ + return &networkingv1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "foo", Namespace: api.NamespaceDefault, diff --git a/gateway/annotations/l4/l4.go b/gateway/annotations/l4/l4.go index b671dbd81..8bb6ed8e1 100644 --- a/gateway/annotations/l4/l4.go +++ b/gateway/annotations/l4/l4.go @@ -22,9 +22,10 @@ import ( "fmt" "github.com/goodrain/rainbond/gateway/annotations/parser" "github.com/goodrain/rainbond/gateway/annotations/resolver" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" ) +// Config - type Config struct { L4Enable bool L4Host string @@ -35,11 +36,12 @@ type l4 struct { r resolver.Resolver } +// NewParser - func NewParser(r resolver.Resolver) parser.IngressAnnotation { return l4{r} } -func (l l4) Parse(ing *extensions.Ingress) (interface{}, error) { +func (l l4) Parse(ing *networkingv1.Ingress) (interface{}, error) { l4Enable, _ := parser.GetBoolAnnotation("l4-enable", ing) l4Host, _ := parser.GetStringAnnotation("l4-host", ing) if l4Host == "" { diff --git a/gateway/annotations/l4/l4_test.go b/gateway/annotations/l4/l4_test.go index fc6f084d5..8c0b5f127 100644 --- a/gateway/annotations/l4/l4_test.go +++ b/gateway/annotations/l4/l4_test.go @@ -20,18 +20,18 @@ package l4 import ( api "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) -func buildIngress() *extensions.Ingress { +func buildIngress() *networkingv1.Ingress { defaultBackend := extensions.IngressBackend{ ServiceName: "default-backend", ServicePort: intstr.FromInt(80), } - return &extensions.Ingress{ + return &networkingv1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "foo", Namespace: api.NamespaceDefault, diff --git a/gateway/annotations/lbtype/lbtype.go b/gateway/annotations/lbtype/lbtype.go index ec71edebc..5980105f6 100644 --- a/gateway/annotations/lbtype/lbtype.go +++ b/gateway/annotations/lbtype/lbtype.go @@ -21,7 +21,7 @@ package lbtype import ( "github.com/goodrain/rainbond/gateway/annotations/parser" "github.com/goodrain/rainbond/gateway/annotations/resolver" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" ) type lbtype struct { @@ -36,6 +36,6 @@ func NewParser(r resolver.Resolver) parser.IngressAnnotation { // Parse parses the annotations contained in the ingress rule // used to indicate if the location/s contains a fragment of // configuration to be included inside the paths of the rules -func (a lbtype) Parse(ing *extensions.Ingress) (interface{}, error) { +func (a lbtype) Parse(ing *networkingv1.Ingress) (interface{}, error) { return parser.GetStringAnnotation("lb-type", ing) } diff --git a/gateway/annotations/parser/parser.go b/gateway/annotations/parser/parser.go index ff01eafba..9208799e2 100644 --- a/gateway/annotations/parser/parser.go +++ b/gateway/annotations/parser/parser.go @@ -22,8 +22,7 @@ import ( "strings" "github.com/goodrain/rainbond/util/ingress-nginx/ingress/errors" - - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" ) var ( @@ -33,7 +32,7 @@ var ( // IngressAnnotation has a method to parse annotations located in Ingress type IngressAnnotation interface { - Parse(ing *extensions.Ingress) (interface{}, error) + Parse(ing *networkingv1.Ingress) (interface{}, error) } type ingAnnotations map[string]string @@ -70,7 +69,7 @@ func (a ingAnnotations) parseInt(name string) (int, error) { return 0, errors.ErrMissingAnnotations } -func checkAnnotation(name string, ing *extensions.Ingress) error { +func checkAnnotation(name string, ing *networkingv1.Ingress) error { if ing == nil || len(ing.GetAnnotations()) == 0 { return errors.ErrMissingAnnotations } @@ -82,7 +81,7 @@ func checkAnnotation(name string, ing *extensions.Ingress) error { } // GetBoolAnnotation extracts a boolean from an Ingress annotation -func GetBoolAnnotation(name string, ing *extensions.Ingress) (bool, error) { +func GetBoolAnnotation(name string, ing *networkingv1.Ingress) (bool, error) { v := GetAnnotationWithPrefix(name) err := checkAnnotation(v, ing) if err != nil { @@ -92,7 +91,7 @@ func GetBoolAnnotation(name string, ing *extensions.Ingress) (bool, error) { } // GetStringAnnotation extracts a string from an Ingress annotation -func GetStringAnnotation(name string, ing *extensions.Ingress) (string, error) { +func GetStringAnnotation(name string, ing *networkingv1.Ingress) (string, error) { v := GetAnnotationWithPrefix(name) err := checkAnnotation(v, ing) if err != nil { @@ -102,7 +101,7 @@ func GetStringAnnotation(name string, ing *extensions.Ingress) (string, error) { } // GetIntAnnotation extracts an int from an Ingress annotation -func GetIntAnnotation(name string, ing *extensions.Ingress) (int, error) { +func GetIntAnnotation(name string, ing *networkingv1.Ingress) (int, error) { v := GetAnnotationWithPrefix(name) err := checkAnnotation(v, ing) if err != nil { @@ -113,7 +112,7 @@ func GetIntAnnotation(name string, ing *extensions.Ingress) (int, error) { // GetStringAnnotationWithPrefix extracts an string from an Ingress annotation // based on the annotation prefix -func GetStringAnnotationWithPrefix(prefix string, ing *extensions.Ingress) (map[string]string, error) { +func GetStringAnnotationWithPrefix(prefix string, ing *networkingv1.Ingress) (map[string]string, error) { v := GetAnnotationWithPrefix(prefix) err := checkAnnotation(v, ing) if err != nil { diff --git a/gateway/annotations/parser/parser_test.go b/gateway/annotations/parser/parser_test.go index 474785f5e..418b612bc 100644 --- a/gateway/annotations/parser/parser_test.go +++ b/gateway/annotations/parser/parser_test.go @@ -20,12 +20,12 @@ import ( "testing" api "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -func buildIngress() *extensions.Ingress { - return &extensions.Ingress{ +func buildIngress() *networkingv1.Ingress { + return &networkingv1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "foo", Namespace: api.NamespaceDefault, diff --git a/gateway/annotations/proxy/proxy.go b/gateway/annotations/proxy/proxy.go index f276d8501..4574a9f25 100644 --- a/gateway/annotations/proxy/proxy.go +++ b/gateway/annotations/proxy/proxy.go @@ -26,7 +26,7 @@ import ( "github.com/goodrain/rainbond/gateway/controller/config" "github.com/sirupsen/logrus" "golang.org/x/net/http/httpguts" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" ) // Config returns the proxy timeout to use in the upstream server/s @@ -191,7 +191,7 @@ func NewParser(r resolver.Resolver) parser.IngressAnnotation { // ParseAnnotations parses the annotations contained in the ingress // rule used to configure upstream check parameters -func (a proxy) Parse(ing *extensions.Ingress) (interface{}, error) { +func (a proxy) Parse(ing *networkingv1.Ingress) (interface{}, error) { defBackend := a.r.GetDefaultBackend() config := &Config{} diff --git a/gateway/annotations/proxy/proxy_test.go b/gateway/annotations/proxy/proxy_test.go index 06cb36ad7..fbe1bc7cd 100644 --- a/gateway/annotations/proxy/proxy_test.go +++ b/gateway/annotations/proxy/proxy_test.go @@ -20,7 +20,7 @@ import ( "testing" api "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" @@ -29,13 +29,13 @@ import ( "github.com/goodrain/rainbond/gateway/defaults" ) -func buildIngress() *extensions.Ingress { +func buildIngress() *networkingv1.Ingress { defaultBackend := extensions.IngressBackend{ ServiceName: "default-backend", ServicePort: intstr.FromInt(80), } - return &extensions.Ingress{ + return &networkingv1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "foo", Namespace: api.NamespaceDefault, diff --git a/gateway/annotations/rewrite/rewrite.go b/gateway/annotations/rewrite/rewrite.go index e2d83a963..63331cbaf 100644 --- a/gateway/annotations/rewrite/rewrite.go +++ b/gateway/annotations/rewrite/rewrite.go @@ -22,7 +22,7 @@ import ( "github.com/goodrain/rainbond/gateway/annotations/parser" "github.com/goodrain/rainbond/gateway/annotations/resolver" "github.com/sirupsen/logrus" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" ) // Config describes the per location redirect config @@ -85,7 +85,7 @@ func NewParser(r resolver.Resolver) parser.IngressAnnotation { // ParseAnnotations parses the annotations contained in the ingress // rule used to rewrite the defined paths -func (a rewrite) Parse(ing *extensions.Ingress) (interface{}, error) { +func (a rewrite) Parse(ing *networkingv1.Ingress) (interface{}, error) { var err error config := &Config{} diff --git a/gateway/annotations/rewrite/rewrite_test.go b/gateway/annotations/rewrite/rewrite_test.go index 089e1dcca..3ac4b707c 100644 --- a/gateway/annotations/rewrite/rewrite_test.go +++ b/gateway/annotations/rewrite/rewrite_test.go @@ -23,7 +23,7 @@ import ( "testing" api "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -32,13 +32,13 @@ const ( defRoute = "/demo" ) -func buildIngress() *extensions.Ingress { +func buildIngress() *networkingv1.Ingress { defaultBackend := extensions.IngressBackend{ ServiceName: "default-backend", ServicePort: intstr.FromInt(80), } - return &extensions.Ingress{ + return &networkingv1.Ingress{ ObjectMeta: meta_v1.ObjectMeta{ Name: "foo", Namespace: api.NamespaceDefault, diff --git a/gateway/annotations/upstreamhashby/main.go b/gateway/annotations/upstreamhashby/main.go index 72ef4a768..2d3934d0e 100644 --- a/gateway/annotations/upstreamhashby/main.go +++ b/gateway/annotations/upstreamhashby/main.go @@ -19,7 +19,7 @@ package upstreamhashby import ( "github.com/goodrain/rainbond/gateway/annotations/parser" "github.com/goodrain/rainbond/gateway/annotations/resolver" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" ) type upstreamhashby struct { @@ -34,6 +34,6 @@ func NewParser(r resolver.Resolver) parser.IngressAnnotation { // Parse parses the annotations contained in the ingress rule // used to indicate if the location/s contains a fragment of // configuration to be included inside the paths of the rules -func (a upstreamhashby) Parse(ing *extensions.Ingress) (interface{}, error) { +func (a upstreamhashby) Parse(ing *networkingv1.Ingress) (interface{}, error) { return parser.GetStringAnnotation("upstream-hash-by", ing) } diff --git a/gateway/annotations/wight/weight.go b/gateway/annotations/wight/weight.go index ad1f3cc8a..00658e0c5 100644 --- a/gateway/annotations/wight/weight.go +++ b/gateway/annotations/wight/weight.go @@ -22,7 +22,7 @@ import ( "github.com/goodrain/rainbond/gateway/annotations/parser" "github.com/goodrain/rainbond/gateway/annotations/resolver" "github.com/sirupsen/logrus" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" "strconv" ) @@ -40,7 +40,7 @@ func NewParser(r resolver.Resolver) parser.IngressAnnotation { return weight{r} } -func (c weight) Parse(ing *extensions.Ingress) (interface{}, error) { +func (c weight) Parse(ing *networkingv1.Ingress) (interface{}, error) { wstr, err := parser.GetStringAnnotation("weight", ing) var w int if err != nil || wstr == "" { diff --git a/gateway/store/secret_ingress_map.go b/gateway/store/secret_ingress_map.go index 8f546e1dc..0ea939183 100644 --- a/gateway/store/secret_ingress_map.go +++ b/gateway/store/secret_ingress_map.go @@ -22,14 +22,14 @@ import ( "fmt" "github.com/goodrain/rainbond/util/ingress-nginx/k8s" - "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" ) type secretIngressMap struct { v map[string][]string } -func (m *secretIngressMap) update(ing *v1beta1.Ingress) { +func (m *secretIngressMap) update(ing *networkingv1.Ingress) { ingKey := k8s.MetaNamespaceKey(ing) for _, tls := range ing.Spec.TLS { secretKey := fmt.Sprintf("%s/%s", ing.Namespace, tls.SecretName) diff --git a/gateway/store/store.go b/gateway/store/store.go index 4f0bdbc0a..665ee2a38 100644 --- a/gateway/store/store.go +++ b/gateway/store/store.go @@ -31,13 +31,12 @@ import ( "strings" "sync" - "github.com/goodrain/rainbond/gateway/cluster" - "github.com/eapache/channels" "github.com/goodrain/rainbond/cmd/gateway/option" "github.com/goodrain/rainbond/gateway/annotations" "github.com/goodrain/rainbond/gateway/annotations/l4" "github.com/goodrain/rainbond/gateway/annotations/rewrite" + "github.com/goodrain/rainbond/gateway/cluster" "github.com/goodrain/rainbond/gateway/controller/config" "github.com/goodrain/rainbond/gateway/defaults" "github.com/goodrain/rainbond/gateway/util" @@ -47,8 +46,7 @@ import ( ik8s "github.com/goodrain/rainbond/util/ingress-nginx/k8s" "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" - "k8s.io/api/extensions/v1beta1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" @@ -89,7 +87,7 @@ type Storer interface { // list virtual service ListVirtualService() ([]*v1.VirtualService, []*v1.VirtualService) - ListIngresses() []*extensions.Ingress + ListIngresses() []*networkingv1.Ingress GetIngressAnnotations(key string) (*annotations.Ingress, error) @@ -177,7 +175,7 @@ func New(client kubernetes.Interface, options.LabelSelector = "creator=Rainbond" }) - store.informers.Ingress = store.sharedInformer.Extensions().V1beta1().Ingresses().Informer() + store.informers.Ingress = store.sharedInformer.Networking().V1().Ingresses().Informer() store.listers.Ingress.Store = store.informers.Ingress.GetStore() store.informers.Service = store.sharedInformer.Core().V1().Services().Informer() @@ -191,7 +189,7 @@ func New(client kubernetes.Interface, ingEventHandler := cache.ResourceEventHandlerFuncs{ AddFunc: func(obj interface{}) { - ing := obj.(*extensions.Ingress) + ing := obj.(*networkingv1.Ingress) // updating annotations information for ingress store.extractAnnotations(ing) @@ -212,8 +210,8 @@ func New(client kubernetes.Interface, } }, UpdateFunc: func(old, cur interface{}) { - oldIng := old.(*extensions.Ingress) - curIng := cur.(*extensions.Ingress) + oldIng := old.(*networkingv1.Ingress) + curIng := cur.(*networkingv1.Ingress) // ignore the same secret as the old one if oldIng.ResourceVersion == curIng.ResourceVersion || reflect.DeepEqual(oldIng, curIng) { return @@ -344,7 +342,7 @@ func New(client kubernetes.Interface, } // checkIngress checks whether the given ing is valid. -func (s *k8sStore) checkIngress(ing *extensions.Ingress) bool { +func (s *k8sStore) checkIngress(ing *networkingv1.Ingress) bool { i, err := l4.NewParser(s).Parse(ing) if err != nil { logrus.Warningf("Uxpected error with ingress: %v", err) @@ -367,7 +365,7 @@ func (s *k8sStore) checkIngress(ing *extensions.Ingress) bool { // extractAnnotations parses ingress annotations converting the value of the // annotation to a go struct and also information about the referenced secrets -func (s *k8sStore) extractAnnotations(ing *extensions.Ingress) { +func (s *k8sStore) extractAnnotations(ing *networkingv1.Ingress) { key := ik8s.MetaNamespaceKey(ing) logrus.Debugf("updating annotations information for ingress %v", key) @@ -466,7 +464,7 @@ func (s *k8sStore) ListVirtualService() (l7vs []*v1.VirtualService, l4vs []*v1.V // ServerName-LocationPath -> location srvLocMap := make(map[string]*v1.Location) for _, item := range s.listers.Ingress.List() { - ing := item.(*extensions.Ingress) + ing := item.(*networkingv1.Ingress) if !s.ingressIsValid(ing) { continue } @@ -493,8 +491,8 @@ func (s *k8sStore) ListVirtualService() (l7vs []*v1.VirtualService, l4vs []*v1.V continue } } - svcKey := fmt.Sprintf("%v/%v", ing.Namespace, ing.Spec.Backend.ServiceName) - protocol := s.GetServiceProtocol(svcKey, ing.Spec.Backend.ServicePort.IntVal) + svcKey := fmt.Sprintf("%v/%v", ing.Namespace, ing.Spec.DefaultBackend.Service.Name) + protocol := s.GetServiceProtocol(svcKey, ing.Spec.DefaultBackend.Service.Port.Number) listening := fmt.Sprintf("%s:%v", host, anns.L4.L4Port) if string(protocol) == string(v1.ProtocolUDP) { listening = fmt.Sprintf("%s %s", listening, "udp") @@ -524,11 +522,11 @@ func (s *k8sStore) ListVirtualService() (l7vs []*v1.VirtualService, l4vs []*v1.V } vs.Namespace = anns.Namespace vs.ServiceID = anns.Labels["service_id"] - l4PoolMap[ing.Spec.Backend.ServiceName] = struct{}{} + l4PoolMap[ing.Spec.DefaultBackend.Service.Name] = struct{}{} l4vsMap[listening] = vs l4vs = append(l4vs, vs) backend := backend{name: backendName, weight: anns.Weight.Weight} - l4PoolBackendMap[ing.Spec.Backend.ServiceName] = append(l4PoolBackendMap[ing.Spec.Backend.ServiceName], backend) + l4PoolBackendMap[ing.Spec.DefaultBackend.Service.Name] = append(l4PoolBackendMap[ing.Spec.DefaultBackend.Service.Name], backend) // endregion } else { // region l7 @@ -593,7 +591,7 @@ func (s *k8sStore) ListVirtualService() (l7vs []*v1.VirtualService, l4vs []*v1.V for _, path := range rule.IngressRuleValue.HTTP.Paths { locKey := fmt.Sprintf("%s_%s", virSrvName, path.Path) location := srvLocMap[locKey] - l7PoolMap[path.Backend.ServiceName] = struct{}{} + l7PoolMap[path.Backend.Service.Name] = struct{}{} // if location do not exists, then creates a new one if location == nil { location = &v1.Location{ @@ -631,7 +629,7 @@ func (s *k8sStore) ListVirtualService() (l7vs []*v1.VirtualService, l4vs []*v1.V if anns.UpstreamHashBy != "" { backend.hashBy = anns.UpstreamHashBy } - l7PoolBackendMap[path.Backend.ServiceName] = append(l7PoolBackendMap[path.Backend.ServiceName], backend) + l7PoolBackendMap[path.Backend.Service.Name] = append(l7PoolBackendMap[path.Backend.Service.Name], backend) } } // endregion @@ -639,7 +637,7 @@ func (s *k8sStore) ListVirtualService() (l7vs []*v1.VirtualService, l4vs []*v1.V } for _, item := range s.listers.Ingress.List() { - ing := item.(*extensions.Ingress) + ing := item.(*networkingv1.Ingress) if !s.ingressIsValid(ing) { continue } @@ -701,15 +699,15 @@ func (s *k8sStore) ListVirtualService() (l7vs []*v1.VirtualService, l4vs []*v1.V } // ingressIsValid checks if the specified ingress is valid -func (s *k8sStore) ingressIsValid(ing *extensions.Ingress) bool { +func (s *k8sStore) ingressIsValid(ing *networkingv1.Ingress) bool { var endpointKey string - if ing.Spec.Backend != nil { // stream - endpointKey = fmt.Sprintf("%s/%s", ing.Namespace, ing.Spec.Backend.ServiceName) + if ing.Spec.DefaultBackend != nil { // stream + endpointKey = fmt.Sprintf("%s/%s", ing.Namespace, ing.Spec.DefaultBackend.Service.Name) } else { // http Loop: for _, rule := range ing.Spec.Rules { for _, path := range rule.IngressRuleValue.HTTP.Paths { - endpointKey = fmt.Sprintf("%s/%s", ing.Namespace, path.Backend.ServiceName) + endpointKey = fmt.Sprintf("%s/%s", ing.Namespace, path.Backend.Service.Name) if endpointKey != "" { break Loop } @@ -752,16 +750,16 @@ func hasReadyAddresses(endpoints *corev1.Endpoints) bool { } // GetIngress returns the Ingress matching key. -func (s *k8sStore) GetIngress(key string) (*extensions.Ingress, error) { +func (s *k8sStore) GetIngress(key string) (*networkingv1.Ingress, error) { return s.listers.Ingress.ByKey(key) } // ListIngresses returns the list of Ingresses -func (s *k8sStore) ListIngresses() []*extensions.Ingress { +func (s *k8sStore) ListIngresses() []*networkingv1.Ingress { // filter ingress rules - var ingresses []*extensions.Ingress + var ingresses []*networkingv1.Ingress for _, item := range s.listers.Ingress.List() { - ing := item.(*extensions.Ingress) + ing := item.(*networkingv1.Ingress) ingresses = append(ingresses, ing) } @@ -803,7 +801,7 @@ func (s *k8sStore) Run(stopCh chan struct{}) { // syncSecrets synchronizes data from all Secrets referenced by the given // Ingress with the local store and file system. -func (s *k8sStore) syncSecrets(ing *extensions.Ingress) { +func (s *k8sStore) syncSecrets(ing *networkingv1.Ingress) { key := ik8s.MetaNamespaceKey(ing) for _, secrKey := range s.secretIngressMap.getSecretKeys(key) { s.syncSecret(secrKey) @@ -895,7 +893,7 @@ func (s *k8sStore) loopUpdateIngress() { for ipevent := range s.node.IPManager().NeedUpdateGatewayPolicy() { ingress := s.listers.Ingress.List() for i := range ingress { - curIng, ok := ingress[i].(*v1beta1.Ingress) + curIng, ok := ingress[i].(*networkingv1.Ingress) if ok && curIng != nil && s.annotations.Extract(curIng).L4.L4Host == ipevent.IP.String() { s.extractAnnotations(curIng) s.secretIngressMap.update(curIng) diff --git a/gateway/store/store_test.go b/gateway/store/store_test.go index 0fad64b3d..d136d4fff 100644 --- a/gateway/store/store_test.go +++ b/gateway/store/store_test.go @@ -7,7 +7,7 @@ import ( "github.com/goodrain/rainbond/gateway/annotations/parser" api "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -60,8 +60,8 @@ func TestRbdStore_checkIngress(t *testing.T) { } } -func buildIngress() *extensions.Ingress { - return &extensions.Ingress{ +func buildIngress() *networkingv1.Ingress { + return &networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "foobar", Namespace: api.NamespaceDefault, diff --git a/gateway/test/http/http_test.go b/gateway/test/http/http_test.go index 47397ef24..7ed15f092 100644 --- a/gateway/test/http/http_test.go +++ b/gateway/test/http/http_test.go @@ -25,7 +25,7 @@ import ( "github.com/goodrain/rainbond/gateway/controller" corev1 "k8s.io/api/core/v1" "k8s.io/api/extensions/v1beta1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" k8sErrors "k8s.io/apimachinery/pkg/api/errors" api_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -126,23 +126,27 @@ func TestHttpDefault(t *testing.T) { _ = ensureService(service, clientSet, t) time.Sleep(3 * time.Second) - ingress := &extensions.Ingress{ + ingress := &networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "default-ing", Namespace: ns.Name, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networkingv1.IngressSpec{ + Rules: []networkingv1.IngressRule{ { Host: "www.http-router.com", - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networkingv1.IngressRuleValue{ + HTTP: &networkingv1.HTTPIngressRuleValue{ + Paths: []networkingv1.HTTPIngressPath{ { Path: "/http-router", - Backend: extensions.IngressBackend{ - ServiceName: "default-svc", - ServicePort: intstr.FromInt(80), + Backend: networkingv1.IngressBackend{ + Service: &networkingv1.IngressServiceBackend{ + Name: "default-svc", + Port: networkingv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, }, @@ -229,7 +233,7 @@ func TestHttpCookie(t *testing.T) { time.Sleep(3 * time.Second) - ingress := &extensions.Ingress{ + ingress := &networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "router-cookie-ing", Namespace: ns.Name, @@ -237,18 +241,22 @@ func TestHttpCookie(t *testing.T) { parser.GetAnnotationWithPrefix("cookie"): "ck1:cv1;ck2:cv2;", }, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networkingv1.IngressSpec{ + Rules: []networkingv1.IngressRule{ { Host: "www.http-router.com", - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networkingv1.IngressRuleValue{ + HTTP: &networkingv1.HTTPIngressRuleValue{ + Paths: []networkingv1.HTTPIngressPath{ { Path: "/http-router", - Backend: extensions.IngressBackend{ - ServiceName: "router-cookie-svc", - ServicePort: intstr.FromInt(80), + Backend: networkingv1.IngressBackend{ + Service: &networkingv1.IngressServiceBackend{ + Name: "router-cookie-svc", + Port: networkingv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, }, @@ -338,7 +346,7 @@ func TestHttpHeader(t *testing.T) { time.Sleep(3 * time.Second) - ingress := &extensions.Ingress{ + ingress := &networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "router-header-ing", Namespace: ns.Name, @@ -346,18 +354,22 @@ func TestHttpHeader(t *testing.T) { parser.GetAnnotationWithPrefix("header"): "hk1:hv1;hk2:hv2;", }, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networkingv1.IngressSpec{ + Rules: []networkingv1.IngressRule{ { Host: "www.http-router.com", - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networkingv1.IngressRuleValue{ + HTTP: &networkingv1.HTTPIngressRuleValue{ + Paths: []networkingv1.HTTPIngressPath{ { Path: "/http-router", - Backend: extensions.IngressBackend{ - ServiceName: "router-header-svc", - ServicePort: intstr.FromInt(80), + Backend: networkingv1.IngressBackend{ + Service: &networkingv1.IngressServiceBackend{ + Name: "router-header-svc", + Port: networkingv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, }, @@ -459,7 +471,7 @@ func TestHttpUpstreamHashBy(t *testing.T) { time.Sleep(3 * time.Second) - ingress := &extensions.Ingress{ + ingress := &networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "upstreamhashby-ing", Namespace: ns.Name, @@ -467,18 +479,22 @@ func TestHttpUpstreamHashBy(t *testing.T) { parser.GetAnnotationWithPrefix("upstream-hash-by"): "$request_uri", }, }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networkingv1.IngressSpec{ + Rules: []networkingv1.IngressRule{ { Host: "www.http-upstreamhashby.com", - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networkingv1.IngressRuleValue{ + HTTP: &networkingv1.HTTPIngressRuleValue{ + Paths: []networkingv1.HTTPIngressPath{ { Path: "/", - Backend: extensions.IngressBackend{ - ServiceName: "upstreamhashby-svc", - ServicePort: intstr.FromInt(80), + Backend: networkingv1.IngressBackend{ + Service: &networkingv1.IngressServiceBackend{ + Name: "upstreamhashby-svc", + Port: networkingv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, }, @@ -555,15 +571,15 @@ func ensureService(service *corev1.Service, clientSet kubernetes.Interface, t *t } -func ensureIngress(ingress *extensions.Ingress, clientSet kubernetes.Interface, t *testing.T) *extensions.Ingress { +func ensureIngress(ingress *networkingv1.Ingress, clientSet kubernetes.Interface, t *testing.T) *networkingv1.Ingress { t.Helper() - ing, err := clientSet.ExtensionsV1beta1().Ingresses(ingress.Namespace).Update(context.TODO(), ingress, metav1.UpdateOptions{}) + ing, err := clientSet.NetworkingV1().Ingresses(ingress.Namespace).Update(context.TODO(), ingress, metav1.UpdateOptions{}) if err != nil { if k8sErrors.IsNotFound(err) { t.Logf("Ingress %v not found, creating", ingress) - ing, err = clientSet.ExtensionsV1beta1().Ingresses(ingress.Namespace).Create(context.TODO(), ingress, metav1.CreateOptions{}) + ing, err = clientSet.NetworkingV1().Ingresses(ingress.Namespace).Create(context.TODO(), ingress, metav1.CreateOptions{}) if err != nil { t.Fatalf("error creating ingress %+v: %v", ingress, err) } diff --git a/gateway/test/https/https_test.go b/gateway/test/https/https_test.go index 5a1df6a9e..6adaa205f 100644 --- a/gateway/test/https/https_test.go +++ b/gateway/test/https/https_test.go @@ -27,11 +27,10 @@ import ( "github.com/goodrain/rainbond/gateway/controller" corev1 "k8s.io/api/core/v1" "k8s.io/api/extensions/v1beta1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" k8sErrors "k8s.io/apimachinery/pkg/api/errors" api_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/kubernetes" ) @@ -174,7 +173,7 @@ func TestHttps(t *testing.T) { Type: corev1.SecretTypeOpaque, }, clientSet, t) - ingress := &extensions.Ingress{ + ingress := &networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "https-ing", Namespace: ns.Name, @@ -182,24 +181,28 @@ func TestHttps(t *testing.T) { parser.GetAnnotationWithPrefix("force-ssl-redirect"): "true", }, }, - Spec: extensions.IngressSpec{ - TLS: []v1beta1.IngressTLS{ + Spec: networkingv1.IngressSpec{ + TLS: []networkingv1.IngressTLS{ { Hosts: []string{"www.https.com"}, SecretName: secr.Name, }, }, - Rules: []extensions.IngressRule{ + Rules: []networkingv1.IngressRule{ { Host: "www.https.com", - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networkingv1.IngressRuleValue{ + HTTP: &networkingv1.HTTPIngressRuleValue{ + Paths: []networkingv1.HTTPIngressPath{ { Path: "/https", - Backend: extensions.IngressBackend{ - ServiceName: "default-svc", - ServicePort: intstr.FromInt(80), + Backend: networkingv1.IngressBackend{ + Service: &networkingv1.IngressServiceBackend{ + Name: "default-svc", + Port: networkingv1.ServiceBackendPort{ + Number: 80, + }, + }, }, }, }, @@ -276,15 +279,15 @@ func ensureService(service *corev1.Service, clientSet kubernetes.Interface, t *t } -func ensureIngress(ingress *extensions.Ingress, clientSet kubernetes.Interface, t *testing.T) *extensions.Ingress { +func ensureIngress(ingress *networkingv1.Ingress, clientSet kubernetes.Interface, t *testing.T) *networkingv1.Ingress { t.Helper() - ing, err := clientSet.ExtensionsV1beta1().Ingresses(ingress.Namespace).Update(context.TODO(), ingress, metav1.UpdateOptions{}) + ing, err := clientSet.NetworkingV1().Ingresses(ingress.Namespace).Update(context.TODO(), ingress, metav1.UpdateOptions{}) if err != nil { if k8sErrors.IsNotFound(err) { t.Logf("Ingress %v not found, creating", ingress) - ing, err = clientSet.ExtensionsV1beta1().Ingresses(ingress.Namespace).Create(context.TODO(), ingress, metav1.CreateOptions{}) + ing, err = clientSet.NetworkingV1().Ingresses(ingress.Namespace).Create(context.TODO(), ingress, metav1.CreateOptions{}) if err != nil { t.Fatalf("error creating ingress %+v: %v", ingress, err) } diff --git a/gateway/test/tcp/tcp_test.go b/gateway/test/tcp/tcp_test.go index 7f432d4c1..dfb7e1290 100644 --- a/gateway/test/tcp/tcp_test.go +++ b/gateway/test/tcp/tcp_test.go @@ -27,11 +27,10 @@ import ( "github.com/goodrain/rainbond/gateway/controller" corev1 "k8s.io/api/core/v1" "k8s.io/api/extensions/v1beta1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" k8sErrors "k8s.io/apimachinery/pkg/api/errors" api_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/kubernetes" ) @@ -108,7 +107,7 @@ func TestTcp(t *testing.T) { _ = ensureService(service, clientSet, t) time.Sleep(3 * time.Second) - ingress := &extensions.Ingress{ + ingress := &networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "tcp-ing", Namespace: ns.Name, @@ -118,11 +117,13 @@ func TestTcp(t *testing.T) { parser.GetAnnotationWithPrefix("l4-port"): "32145", }, }, - Spec: v1beta1.IngressSpec{ - Backend: &v1beta1.IngressBackend{ - ServiceName: "default-svc", - ServicePort: intstr.IntOrString{ - IntVal: 30000, + Spec: networkingv1.IngressSpec{ + DefaultBackend: &networkingv1.IngressBackend{ + Service: &networkingv1.IngressServiceBackend{ + Name: "default-svc", + Port: networkingv1.ServiceBackendPort{ + Number: 30000, + }, }, }, }, @@ -193,15 +194,15 @@ func ensureService(service *corev1.Service, clientSet kubernetes.Interface, t *t return svc } -func ensureIngress(ingress *extensions.Ingress, clientSet kubernetes.Interface, t *testing.T) *extensions.Ingress { +func ensureIngress(ingress *networkingv1.Ingress, clientSet kubernetes.Interface, t *testing.T) *networkingv1.Ingress { t.Helper() - ing, err := clientSet.ExtensionsV1beta1().Ingresses(ingress.Namespace).Update(context.TODO(), ingress, metav1.UpdateOptions{}) + ing, err := clientSet.NetworkingV1().Ingresses(ingress.Namespace).Update(context.TODO(), ingress, metav1.UpdateOptions{}) if err != nil { if k8sErrors.IsNotFound(err) { t.Logf("Ingress %v not found, creating", ingress) - ing, err = clientSet.ExtensionsV1beta1().Ingresses(ingress.Namespace).Create(context.TODO(), ingress, metav1.CreateOptions{}) + ing, err = clientSet.NetworkingV1().Ingresses(ingress.Namespace).Create(context.TODO(), ingress, metav1.CreateOptions{}) if err != nil { t.Fatalf("error creating ingress %+v: %v", ingress, err) } diff --git a/go.mod b/go.mod index 54c6a930e..e6ef3a744 100644 --- a/go.mod +++ b/go.mod @@ -99,6 +99,7 @@ require ( google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e // indirect google.golang.org/grpc v1.33.2 + google.golang.org/protobuf v1.25.0 gopkg.in/alecthomas/kingpin.v2 v2.2.6 gopkg.in/src-d/go-git.v4 v4.13.1 gopkg.in/yaml.v2 v2.4.0 diff --git a/util/ingress-nginx/ingress/controller/store/ingress.go b/util/ingress-nginx/ingress/controller/store/ingress.go index df889de1c..f8b2cc7d7 100644 --- a/util/ingress-nginx/ingress/controller/store/ingress.go +++ b/util/ingress-nginx/ingress/controller/store/ingress.go @@ -17,7 +17,7 @@ limitations under the License. package store import ( - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" "k8s.io/client-go/tools/cache" ) @@ -27,7 +27,7 @@ type IngressLister struct { } // ByKey returns the Ingress matching key in the local Ingress store. -func (il IngressLister) ByKey(key string) (*extensions.Ingress, error) { +func (il IngressLister) ByKey(key string) (*networkingv1.Ingress, error) { i, exists, err := il.GetByKey(key) if err != nil { return nil, err @@ -35,5 +35,5 @@ func (il IngressLister) ByKey(key string) (*extensions.Ingress, error) { if !exists { return nil, NotExistsError(key) } - return i.(*extensions.Ingress), nil + return i.(*networkingv1.Ingress), nil } diff --git a/util/k8s/k8s.go b/util/k8s/k8s.go index 840a27669..ecbb252ad 100644 --- a/util/k8s/k8s.go +++ b/util/k8s/k8s.go @@ -2,6 +2,7 @@ package k8s import ( "encoding/json" + networkingv1 "k8s.io/api/networking/v1" "net" "os" @@ -119,3 +120,8 @@ func CreatePatch(o, n, datastruct interface{}) ([]byte, error) { } return strategicpatch.CreateTwoWayMergePatch(oldData, newData, datastruct) } + +// IngressPathType - +func IngressPathType(pathType networkingv1.PathType) *networkingv1.PathType { + return &pathType +} diff --git a/worker/appm/controller/start.go b/worker/appm/controller/start.go index b45c2ad65..091e13ca4 100644 --- a/worker/appm/controller/start.go +++ b/worker/appm/controller/start.go @@ -162,7 +162,7 @@ func (s *startController) startOne(app v1.AppService) error { if ingresses := app.GetIngress(true); ingresses != nil { for _, ingress := range ingresses { if len(ingress.ResourceVersion) == 0 { - _, err := s.manager.client.ExtensionsV1beta1().Ingresses(app.TenantID).Create(s.ctx, ingress, metav1.CreateOptions{}) + _, err := s.manager.client.NetworkingV1().Ingresses(app.TenantID).Create(s.ctx, ingress, metav1.CreateOptions{}) if err != nil && !errors.IsAlreadyExists(err) { return fmt.Errorf("create ingress failure:%s", err.Error()) } diff --git a/worker/appm/conversion/gateway.go b/worker/appm/conversion/gateway.go index 52e07769e..a9de31424 100644 --- a/worker/appm/conversion/gateway.go +++ b/worker/appm/conversion/gateway.go @@ -23,15 +23,15 @@ import ( "os" "strconv" "strings" - + + "github.com/goodrain/rainbond/util/k8s" "github.com/goodrain/rainbond/db" "github.com/goodrain/rainbond/db/model" - "github.com/goodrain/rainbond/event" "github.com/goodrain/rainbond/gateway/annotations/parser" v1 "github.com/goodrain/rainbond/worker/appm/types/v1" "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -89,7 +89,6 @@ type AppServiceBuild struct { appService *v1.AppService replicationType string dbmanager db.Manager - logger event.Logger } //AppServiceBuilder returns a AppServiceBuild @@ -144,7 +143,7 @@ func (a *AppServiceBuild) Build() (*v1.K8sResources, error) { } var services []*corev1.Service - var ingresses []*extensions.Ingress + var ingresses []*networkingv1.Ingress var secrets []*corev1.Secret if len(ports) > 0 { for i := range ports { @@ -194,8 +193,8 @@ func (a *AppServiceBuild) Build() (*v1.K8sResources, error) { // ApplyRules applies http rules and tcp rules func (a AppServiceBuild) ApplyRules(serviceID string, containerPort, pluginContainerPort int, - service *corev1.Service) ([]*extensions.Ingress, []*corev1.Secret, error) { - var ingresses []*extensions.Ingress + service *corev1.Service) ([]*networkingv1.Ingress, []*corev1.Secret, error) { + var ingresses []*networkingv1.Ingress var secrets []*corev1.Secret httpRules, err := a.dbmanager.HTTPRuleDao().GetHTTPRuleByServiceIDAndContainerPort(serviceID, containerPort) if err != nil { @@ -203,7 +202,7 @@ func (a AppServiceBuild) ApplyRules(serviceID string, containerPort, pluginConta } // create http ingresses logrus.Debugf("find %d count http rule", len(httpRules)) - if httpRules != nil && len(httpRules) > 0 { + if len(httpRules) > 0 { for _, httpRule := range httpRules { ing, sec, err := a.applyHTTPRule(httpRule, containerPort, pluginContainerPort, service) if err != nil { @@ -222,7 +221,7 @@ func (a AppServiceBuild) ApplyRules(serviceID string, containerPort, pluginConta if err != nil { logrus.Infof("Can't get TCPRule corresponding to ServiceID(%s): %v", serviceID, err) } - if tcpRules != nil && len(tcpRules) > 0 { + if len(tcpRules) > 0 { for _, tcpRule := range tcpRules { ing, err := a.applyTCPRule(tcpRule, service, a.tenant.UUID) if err != nil { @@ -239,7 +238,7 @@ func (a AppServiceBuild) ApplyRules(serviceID string, containerPort, pluginConta // applyTCPRule applies stream rule into ingress func (a *AppServiceBuild) applyHTTPRule(rule *model.HTTPRule, containerPort, pluginContainerPort int, - service *corev1.Service) (ing *extensions.Ingress, sec *corev1.Secret, err error) { + service *corev1.Service) (ing *networkingv1.Ingress, sec *corev1.Secret, err error) { // deal with empty path and domain path := strings.Replace(rule.Path, " ", "", -1) if path == "" { @@ -251,24 +250,29 @@ func (a *AppServiceBuild) applyHTTPRule(rule *model.HTTPRule, containerPort, plu } // create ingress - ing = &extensions.Ingress{ + ing = &networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: rule.UUID, Namespace: a.tenant.UUID, Labels: a.appService.GetCommonLabels(), }, - Spec: extensions.IngressSpec{ - Rules: []extensions.IngressRule{ + Spec: networkingv1.IngressSpec{ + Rules: []networkingv1.IngressRule{ { Host: domain, - IngressRuleValue: extensions.IngressRuleValue{ - HTTP: &extensions.HTTPIngressRuleValue{ - Paths: []extensions.HTTPIngressPath{ + IngressRuleValue: networkingv1.IngressRuleValue{ + HTTP: &networkingv1.HTTPIngressRuleValue{ + Paths: []networkingv1.HTTPIngressPath{ { - Path: path, - Backend: extensions.IngressBackend{ - ServiceName: service.Name, - ServicePort: intstr.FromInt(pluginContainerPort), + Path: path, + PathType: k8s.IngressPathType(networkingv1.PathTypeExact), + Backend: networkingv1.IngressBackend{ + Service: &networkingv1.IngressServiceBackend{ + Name: service.Name, + Port: networkingv1.ServiceBackendPort{ + Number: int32(pluginContainerPort), + }, + }, }, }, }, @@ -297,10 +301,10 @@ func (a *AppServiceBuild) applyHTTPRule(rule *model.HTTPRule, containerPort, plu if rule.CertificateID != "" { cert, err := a.dbmanager.CertificateDao().GetCertificateByID(rule.CertificateID) if err != nil { - return nil, nil, fmt.Errorf("Cant not get certificate by id(%s): %v", rule.CertificateID, err) + return nil, nil, fmt.Errorf("cant not get certificate by id(%s): %v", rule.CertificateID, err) } if cert == nil || strings.TrimSpace(cert.Certificate) == "" || strings.TrimSpace(cert.PrivateKey) == "" { - return nil, nil, fmt.Errorf("Rule id: %s; certificate not found", rule.UUID) + return nil, nil, fmt.Errorf("rule id: %s; certificate not found", rule.UUID) } // create secret sec = &corev1.Secret{ @@ -315,7 +319,7 @@ func (a *AppServiceBuild) applyHTTPRule(rule *model.HTTPRule, containerPort, plu }, Type: corev1.SecretTypeOpaque, } - ing.Spec.TLS = []extensions.IngressTLS{ + ing.Spec.TLS = []networkingv1.IngressTLS{ { Hosts: []string{domain}, SecretName: sec.Name, @@ -356,7 +360,7 @@ func (a *AppServiceBuild) applyHTTPRule(rule *model.HTTPRule, containerPort, plu if err != nil { return nil, nil, err } - if configs != nil && len(configs) > 0 { + if len(configs) > 0 { for _, cfg := range configs { annos[parser.GetAnnotationWithPrefix(cfg.Key)] = cfg.Value } @@ -367,18 +371,22 @@ func (a *AppServiceBuild) applyHTTPRule(rule *model.HTTPRule, containerPort, plu } // applyTCPRule applies stream rule into ingress -func (a *AppServiceBuild) applyTCPRule(rule *model.TCPRule, service *corev1.Service, namespace string) (ing *extensions.Ingress, err error) { +func (a *AppServiceBuild) applyTCPRule(rule *model.TCPRule, service *corev1.Service, namespace string) (ing *networkingv1.Ingress, err error) { // create ingress - ing = &extensions.Ingress{ + ing = &networkingv1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: rule.UUID, Namespace: namespace, Labels: a.appService.GetCommonLabels(), }, - Spec: extensions.IngressSpec{ - Backend: &extensions.IngressBackend{ - ServiceName: service.Name, - ServicePort: intstr.FromInt(int(service.Spec.Ports[0].Port)), + Spec: networkingv1.IngressSpec{ + DefaultBackend: &networkingv1.IngressBackend{ + Service: &networkingv1.IngressServiceBackend{ + Name: service.Name, + Port: networkingv1.ServiceBackendPort{ + Number: int32(service.Spec.Ports[0].Port), + }, + }, }, }, } @@ -526,8 +534,7 @@ func (a *AppServiceBuild) createOuterService(port *model.TenantServicesPort) *co servicePort.Name = fmt.Sprintf("%s-%d", strings.ToLower(string(servicePort.Protocol)), port.ContainerPort) servicePort.Port = int32(port.ContainerPort) - var portType corev1.ServiceType - portType = corev1.ServiceTypeClusterIP + portType := corev1.ServiceTypeClusterIP spec := corev1.ServiceSpec{ Ports: []corev1.ServicePort{servicePort}, Type: portType, diff --git a/worker/appm/f/function.go b/worker/appm/f/function.go index 3502405f8..47c789d75 100644 --- a/worker/appm/f/function.go +++ b/worker/appm/f/function.go @@ -31,7 +31,7 @@ import ( "github.com/sirupsen/logrus" autoscalingv2 "k8s.io/api/autoscaling/v2beta2" corev1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" k8sErrors "k8s.io/apimachinery/pkg/api/errors" @@ -189,11 +189,11 @@ func persistUpdate(service *corev1.Service, clientSet kubernetes.Interface) erro return err } -func ensureIngress(ingress *extensions.Ingress, clientSet kubernetes.Interface) { - _, err := clientSet.ExtensionsV1beta1().Ingresses(ingress.Namespace).Update(context.Background(), ingress, metav1.UpdateOptions{}) +func ensureIngress(ingress *networkingv1.Ingress, clientSet kubernetes.Interface) { + _, err := clientSet.NetworkingV1().Ingresses(ingress.Namespace).Update(context.Background(), ingress, metav1.UpdateOptions{}) if err != nil { if k8sErrors.IsNotFound(err) { - _, err := clientSet.ExtensionsV1beta1().Ingresses(ingress.Namespace).Create(context.Background(), ingress, metav1.CreateOptions{}) + _, err := clientSet.NetworkingV1().Ingresses(ingress.Namespace).Create(context.Background(), ingress, metav1.CreateOptions{}) if err != nil && !k8sErrors.IsAlreadyExists(err) { logrus.Errorf("error creating ingress %+v: %v", ingress, err) } @@ -297,12 +297,12 @@ func EnsureHPA(new *autoscalingv2.HorizontalPodAutoscaler, clientSet kubernetes. } } -// UpgradeIngress is used to update *extensions.Ingress. +// UpgradeIngress is used to update *networkingv1.Ingress. func UpgradeIngress(clientset kubernetes.Interface, as *v1.AppService, - old, new []*extensions.Ingress, + old, new []*networkingv1.Ingress, handleErr func(msg string, err error) error) error { - var oldMap = make(map[string]*extensions.Ingress, len(old)) + var oldMap = make(map[string]*networkingv1.Ingress, len(old)) for i, item := range old { oldMap[item.Name] = old[i] } @@ -310,7 +310,7 @@ func UpgradeIngress(clientset kubernetes.Interface, if o, ok := oldMap[n.Name]; ok { n.UID = o.UID n.ResourceVersion = o.ResourceVersion - ing, err := clientset.ExtensionsV1beta1().Ingresses(n.Namespace).Update(context.Background(), n, metav1.UpdateOptions{}) + ing, err := clientset.NetworkingV1().Ingresses(n.Namespace).Update(context.Background(), n, metav1.UpdateOptions{}) if err != nil { if err := handleErr(fmt.Sprintf("error updating ingress: %+v: err: %v", ing, err), err); err != nil { @@ -323,7 +323,7 @@ func UpgradeIngress(clientset kubernetes.Interface, logrus.Debugf("ServiceID: %s; successfully update ingress: %s", as.ServiceID, ing.Name) } else { logrus.Debugf("ingress: %+v", n) - ing, err := clientset.ExtensionsV1beta1().Ingresses(n.Namespace).Create(context.Background(), n, metav1.CreateOptions{}) + ing, err := clientset.NetworkingV1().Ingresses(n.Namespace).Create(context.Background(), n, metav1.CreateOptions{}) if err != nil { if err := handleErr(fmt.Sprintf("error creating ingress: %+v: err: %v", ing, err), err); err != nil { diff --git a/worker/appm/store/lister.go b/worker/appm/store/lister.go index bceefd519..19fc384ba 100644 --- a/worker/appm/store/lister.go +++ b/worker/appm/store/lister.go @@ -24,13 +24,13 @@ import ( appsv1 "k8s.io/client-go/listers/apps/v1" autoscalingv2 "k8s.io/client-go/listers/autoscaling/v2beta2" corev1 "k8s.io/client-go/listers/core/v1" - "k8s.io/client-go/listers/extensions/v1beta1" + networkingv1 "k8s.io/client-go/listers/networking/v1" storagev1 "k8s.io/client-go/listers/storage/v1" ) //Lister kube-api client cache type Lister struct { - Ingress v1beta1.IngressLister + Ingress networkingv1.IngressLister Service corev1.ServiceLister Secret corev1.SecretLister StatefulSet appsv1.StatefulSetLister diff --git a/worker/appm/store/store.go b/worker/appm/store/store.go index 04bf3ac53..5975f4c90 100644 --- a/worker/appm/store/store.go +++ b/worker/appm/store/store.go @@ -49,7 +49,7 @@ import ( appsv1 "k8s.io/api/apps/v1" autoscalingv2 "k8s.io/api/autoscaling/v2beta2" corev1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" storagev1 "k8s.io/api/storage/v1" apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" internalclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" @@ -222,7 +222,7 @@ func NewStore( store.listers.ConfigMap = infFactory.Core().V1().ConfigMaps().Lister() store.informers.Ingress = infFactory.Extensions().V1beta1().Ingresses().Informer() - store.listers.Ingress = infFactory.Extensions().V1beta1().Ingresses().Lister() + store.listers.Ingress = infFactory.Networking().V1().Ingresses().Lister() store.informers.ReplicaSet = infFactory.Apps().V1().ReplicaSets().Informer() store.listers.ReplicaSets = infFactory.Apps().V1().ReplicaSets().Lister() @@ -609,7 +609,7 @@ func (a *appRuntimeStore) OnAdd(obj interface{}) { } } } - if ingress, ok := obj.(*extensions.Ingress); ok { + if ingress, ok := obj.(*networkingv1.Ingress); ok { serviceID := ingress.Labels["service_id"] version := ingress.Labels["version"] createrID := ingress.Labels["creater_id"] @@ -722,8 +722,8 @@ func (a *appRuntimeStore) getAppService(serviceID, version, createrID string, cr } func (a *appRuntimeStore) OnUpdate(oldObj, newObj interface{}) { // ingress update maybe change owner component - if ingress, ok := newObj.(*extensions.Ingress); ok { - oldIngress := oldObj.(*extensions.Ingress) + if ingress, ok := newObj.(*networkingv1.Ingress); ok { + oldIngress := oldObj.(*networkingv1.Ingress) if oldIngress.Labels["service_id"] != ingress.Labels["service_id"] { logrus.Infof("ingress %s change owner component", oldIngress.Name) serviceID := oldIngress.Labels["service_id"] @@ -832,7 +832,7 @@ func (a *appRuntimeStore) OnDeletes(objs ...interface{}) { } } } - if ingress, ok := obj.(*extensions.Ingress); ok { + if ingress, ok := obj.(*networkingv1.Ingress); ok { serviceID := ingress.Labels["service_id"] version := ingress.Labels["version"] createrID := ingress.Labels["creater_id"] diff --git a/worker/appm/types/v1/v1.go b/worker/appm/types/v1/v1.go index 6e65638a0..a98795570 100644 --- a/worker/appm/types/v1/v1.go +++ b/worker/appm/types/v1/v1.go @@ -24,20 +24,19 @@ import ( "strconv" "strings" + "github.com/goodrain/rainbond/builder" + "github.com/goodrain/rainbond/db/model" dbmodel "github.com/goodrain/rainbond/db/model" + "github.com/goodrain/rainbond/event" monitorv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" "github.com/sirupsen/logrus" v1 "k8s.io/api/apps/v1" autoscalingv2 "k8s.io/api/autoscaling/v2beta2" corev1 "k8s.io/api/core/v1" - extensions "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" storagev1 "k8s.io/api/storage/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - - "github.com/goodrain/rainbond/builder" - "github.com/goodrain/rainbond/db/model" - "github.com/goodrain/rainbond/event" ) // EventType type of event @@ -118,6 +117,7 @@ func (a AppServiceBase) GetComponentDefinitionName() string { return "" } +// IsCustomComponent - func (a AppServiceBase) IsCustomComponent() bool { if strings.HasPrefix(a.ServiceKind.String(), dbmodel.ServiceKindCustom.String()) { return true @@ -128,10 +128,12 @@ func (a AppServiceBase) IsCustomComponent() bool { return false } +// IsThirdComponent - func (a AppServiceBase) IsThirdComponent() bool { return a.ServiceKind.String() == dbmodel.ServiceKindThirdParty.String() } +// SetDiscoveryCfg - func (a *AppServiceBase) SetDiscoveryCfg(discoveryCfg *dbmodel.ThirdPartySvcDiscoveryCfg) { a.discoveryCfg = discoveryCfg } @@ -150,8 +152,8 @@ type AppService struct { delServices []*corev1.Service endpoints []*corev1.Endpoints configMaps []*corev1.ConfigMap - ingresses []*extensions.Ingress - delIngs []*extensions.Ingress // ingresses which need to be deleted + ingresses []*networkingv1.Ingress + delIngs []*networkingv1.Ingress // ingresses which need to be deleted secrets []*corev1.Secret delSecrets []*corev1.Secret // secrets which need to be deleted pods []*corev1.Pod @@ -406,9 +408,9 @@ func (a *AppService) DelEndpoints(ep *corev1.Endpoints) { } //GetIngress get ingress -func (a *AppService) GetIngress(canCopy bool) []*extensions.Ingress { +func (a *AppService) GetIngress(canCopy bool) []*networkingv1.Ingress { if canCopy { - cr := make([]*extensions.Ingress, len(a.ingresses)) + cr := make([]*networkingv1.Ingress, len(a.ingresses)) copy(cr, a.ingresses[0:]) return cr } @@ -416,12 +418,12 @@ func (a *AppService) GetIngress(canCopy bool) []*extensions.Ingress { } //GetDelIngs gets delIngs which need to be deleted -func (a *AppService) GetDelIngs() []*extensions.Ingress { +func (a *AppService) GetDelIngs() []*networkingv1.Ingress { return a.delIngs } //SetIngress set kubernetes ingress model -func (a *AppService) SetIngress(d *extensions.Ingress) { +func (a *AppService) SetIngress(d *networkingv1.Ingress) { if len(a.ingresses) > 0 { for i, ingress := range a.ingresses { if ingress.GetName() == d.GetName() { @@ -434,12 +436,12 @@ func (a *AppService) SetIngress(d *extensions.Ingress) { } // SetIngresses sets k8s ingress list -func (a *AppService) SetIngresses(i []*extensions.Ingress) { +func (a *AppService) SetIngresses(i []*networkingv1.Ingress) { a.ingresses = i } //DeleteIngress delete kubernetes ingress model -func (a *AppService) DeleteIngress(d *extensions.Ingress) { +func (a *AppService) DeleteIngress(d *networkingv1.Ingress) { for i, c := range a.ingresses { if c.GetName() == d.GetName() { a.ingresses = append(a.ingresses[0:i], a.ingresses[i+1:]...) @@ -838,7 +840,7 @@ func (a *AppService) GetManifests() []*unstructured.Unstructured { return a.manifests } -//GetManifests get component custom manifest +//SetManifests get component custom manifest func (a *AppService) SetManifests(manifests []*unstructured.Unstructured) { a.manifests = manifests } @@ -876,7 +878,7 @@ func (a *AppService) String() string { a.statefulset, a.deployment, len(a.pods), - func(ing []*extensions.Ingress) string { + func(ing []*networkingv1.Ingress) string { result := "" for _, i := range ing { result += i.Name + "," @@ -911,7 +913,7 @@ type TenantResource struct { type K8sResources struct { Services []*corev1.Service Secrets []*corev1.Secret - Ingresses []*extensions.Ingress + Ingresses []*networkingv1.Ingress } //GetTCPMeshImageName get tcp mesh image name From 29f5da97d5dc5a347a4c1da04009ce8fe6e376d9 Mon Sep 17 00:00:00 2001 From: yangk Date: Mon, 2 Aug 2021 13:57:03 +0800 Subject: [PATCH 08/43] fix disk statistic error --- api/handler/tenant.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/handler/tenant.go b/api/handler/tenant.go index ba7341a09..0869b1f72 100644 --- a/api/handler/tenant.go +++ b/api/handler/tenant.go @@ -359,7 +359,7 @@ func (t *TenantAction) GetTenantsResources(ctx context.Context, tr *api_model.Te disk = int(mv.Sample.Value() / 1024) } if tenantID != "" { - result[tenantID]["disk"] = disk / 1024 + result[tenantID]["disk"] = disk } } return result, nil From 91328771d60077ee302bb1c28caf07d095f076cb Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Tue, 3 Aug 2021 10:02:18 +0800 Subject: [PATCH 09/43] component log --- api/api/api_interface.go | 1 + api/api_routers/version2/v2Routers.go | 2 + api/controller/service_action.go | 16 ++++- api/handler/handler.go | 2 +- api/handler/service.go | 92 +++++++++++++++++---------- api/handler/service_handler.go | 17 +++-- api/util/bcode/service.go | 3 + 7 files changed, 91 insertions(+), 42 deletions(-) diff --git a/api/api/api_interface.go b/api/api/api_interface.go index b9827688d..daf03bebc 100644 --- a/api/api/api_interface.go +++ b/api/api/api_interface.go @@ -53,6 +53,7 @@ type TenantInterface interface { LimitTenantMemory(w http.ResponseWriter, r *http.Request) TenantResourcesStatus(w http.ResponseWriter, r *http.Request) CheckResourceName(w http.ResponseWriter, r *http.Request) + Log(w http.ResponseWriter, r *http.Request) } //ServiceInterface ServiceInterface diff --git a/api/api_routers/version2/v2Routers.go b/api/api_routers/version2/v2Routers.go index b788ed561..6955a5358 100644 --- a/api/api_routers/version2/v2Routers.go +++ b/api/api_routers/version2/v2Routers.go @@ -305,6 +305,8 @@ func (v2 *V2) serviceRouter() chi.Router { r.Put("/service-monitors/{name}", middleware.WrapEL(controller.GetManager().UpdateServiceMonitors, dbmodel.TargetTypeService, "update-app-service-monitor", dbmodel.SYNEVENTTYPE)) r.Delete("/service-monitors/{name}", middleware.WrapEL(controller.GetManager().DeleteServiceMonitors, dbmodel.TargetTypeService, "delete-app-service-monitor", dbmodel.SYNEVENTTYPE)) + r.Get("/log", controller.GetManager().Log) + return r } diff --git a/api/controller/service_action.go b/api/controller/service_action.go index 2bd24e991..957faef43 100644 --- a/api/controller/service_action.go +++ b/api/controller/service_action.go @@ -24,8 +24,6 @@ import ( "net/http" "os" - validator "github.com/goodrain/rainbond/util/govalidator" - "github.com/go-chi/chi" "github.com/goodrain/rainbond/api/handler" api_model "github.com/goodrain/rainbond/api/model" @@ -33,6 +31,7 @@ import ( "github.com/goodrain/rainbond/db" dbmodel "github.com/goodrain/rainbond/db/model" "github.com/goodrain/rainbond/event" + validator "github.com/goodrain/rainbond/util/govalidator" httputil "github.com/goodrain/rainbond/util/http" "github.com/goodrain/rainbond/worker/discover/model" "github.com/jinzhu/gorm" @@ -773,3 +772,16 @@ func GetServiceDeployInfo(w http.ResponseWriter, r *http.Request) { } httputil.ReturnSuccess(r, w, info) } + +// Log - +func (t *TenantStruct) Log(w http.ResponseWriter, r *http.Request) { + component := r.Context().Value(ctxutil.ContextKey("service")).(*dbmodel.TenantServices) + podName := r.URL.Query().Get("podName") + containerName := r.URL.Query().Get("containerName") + + err := handler.GetServiceManager().Log(w, r, component, podName, containerName) + if err != nil { + httputil.ReturnBcodeError(r, w, err) + return + } +} diff --git a/api/handler/handler.go b/api/handler/handler.go index 14ae84379..1b30063c9 100644 --- a/api/handler/handler.go +++ b/api/handler/handler.go @@ -60,7 +60,7 @@ func InitHandle(conf option.Config, return err } dbmanager := db.GetManager() - defaultServieHandler = CreateManager(conf, mqClient, etcdcli, statusCli, prometheusCli, rainbondClient) + defaultServieHandler = CreateManager(conf, mqClient, etcdcli, statusCli, prometheusCli, rainbondClient, kubeClient) defaultPluginHandler = CreatePluginManager(mqClient) defaultAppHandler = CreateAppManager(mqClient) defaultTenantHandler = CreateTenManager(mqClient, statusCli, &conf, kubeClient, prometheusCli, k8sClient) diff --git a/api/handler/service.go b/api/handler/service.go index 392df0f08..5b7a5b725 100644 --- a/api/handler/service.go +++ b/api/handler/service.go @@ -22,6 +22,8 @@ import ( "context" "encoding/json" "fmt" + "io" + "net/http" "os" "strconv" "strings" @@ -29,14 +31,22 @@ import ( "github.com/coreos/etcd/clientv3" "github.com/goodrain/rainbond/api/client/prometheus" + api_model "github.com/goodrain/rainbond/api/model" "github.com/goodrain/rainbond/api/util" "github.com/goodrain/rainbond/api/util/bcode" "github.com/goodrain/rainbond/api/util/license" "github.com/goodrain/rainbond/builder/parser" "github.com/goodrain/rainbond/cmd/api/option" "github.com/goodrain/rainbond/db" + dberr "github.com/goodrain/rainbond/db/errors" + core_model "github.com/goodrain/rainbond/db/model" + dbmodel "github.com/goodrain/rainbond/db/model" "github.com/goodrain/rainbond/event" + eventutil "github.com/goodrain/rainbond/eventlog/util" + gclient "github.com/goodrain/rainbond/mq/client" "github.com/goodrain/rainbond/pkg/generated/clientset/versioned" + core_util "github.com/goodrain/rainbond/util" + typesv1 "github.com/goodrain/rainbond/worker/appm/types/v1" "github.com/goodrain/rainbond/worker/client" "github.com/goodrain/rainbond/worker/discover/model" "github.com/goodrain/rainbond/worker/server" @@ -46,17 +56,11 @@ import ( "github.com/pquerna/ffjson/ffjson" "github.com/sirupsen/logrus" "github.com/twinj/uuid" + corev1 "k8s.io/api/core/v1" k8sErrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - api_model "github.com/goodrain/rainbond/api/model" - dberr "github.com/goodrain/rainbond/db/errors" - core_model "github.com/goodrain/rainbond/db/model" - dbmodel "github.com/goodrain/rainbond/db/model" - eventutil "github.com/goodrain/rainbond/eventlog/util" - gclient "github.com/goodrain/rainbond/mq/client" - core_util "github.com/goodrain/rainbond/util" - typesv1 "github.com/goodrain/rainbond/worker/appm/types/v1" + "k8s.io/apiserver/pkg/util/flushwriter" + "k8s.io/client-go/kubernetes" ) // ErrServiceNotClosed - @@ -70,6 +74,7 @@ type ServiceAction struct { prometheusCli prometheus.Interface conf option.Config rainbondClient versioned.Interface + kubeClient kubernetes.Interface } type dCfg struct { @@ -86,7 +91,8 @@ func CreateManager(conf option.Config, etcdCli *clientv3.Client, statusCli *client.AppRuntimeSyncClient, prometheusCli prometheus.Interface, - rainbondClient versioned.Interface) *ServiceAction { + rainbondClient versioned.Interface, + kubeClient kubernetes.Interface) *ServiceAction { return &ServiceAction{ MQClient: mqClient, EtcdCli: etcdCli, @@ -94,6 +100,7 @@ func CreateManager(conf option.Config, conf: conf, prometheusCli: prometheusCli, rainbondClient: rainbondClient, + kubeClient: kubeClient, } } @@ -2902,6 +2909,49 @@ func (s *ServiceAction) SyncComponentEndpoints(tx *gorm.DB, components []*api_mo return db.GetManager().ThirdPartySvcDiscoveryCfgDaoTransactions(tx).CreateOrUpdate3rdSvcDiscoveryCfgInBatch(thirdPartySvcDiscoveryCfgs) } +// Log returns the logs reader for a container in a pod, a pod or a component. +func (s *ServiceAction) Log(w http.ResponseWriter, r *http.Request, component *dbmodel.TenantServices, podName, containerName string) error { + // If podName and containerName is missing, return the logs reader for the component + // If containerName is missing, return the logs reader for the pod. + if podName == "" || containerName == "" { + // Only support return the logs reader for a container now. + return errors.WithStack(bcode.NewBadRequest("the field 'podName' and 'containerName' is required")) + } + + request := s.kubeClient.CoreV1().Pods(component.TenantID).GetLogs(podName, &corev1.PodLogOptions{ + Container: containerName, + Follow: true, + }) + + out, err := request.Stream(context.TODO()) + if err != nil { + if k8sErrors.IsNotFound(err) { + return errors.Wrap(bcode.ErrPodNotFound, "get pod log") + } + return errors.Wrap(err, "get stream from request") + } + defer out.Close() + + w.Header().Set("Transfer-Encoding", "chunked") + w.WriteHeader(http.StatusOK) + + // Flush headers, if possible + if flusher, ok := w.(http.Flusher); ok { + flusher.Flush() + } + + writer := flushwriter.Wrap(w) + + _, err = io.Copy(writer, out) + if err != nil { + if strings.HasSuffix(err.Error(), "write: broken pipe") { + return nil + } + logrus.Warningf("write stream to response: %v", err) + } + return nil +} + //TransStatus trans service status func TransStatus(eStatus string) string { switch eStatus { @@ -2930,25 +2980,3 @@ func TransStatus(eStatus string) string { } return "" } - -//CheckLabel check label -func CheckLabel(serviceID string) bool { - //true for v2, false for v1 - serviceLabel, err := db.GetManager().TenantServiceLabelDao().GetTenantServiceLabel(serviceID) - if err != nil { - return false - } - if serviceLabel != nil && len(serviceLabel) > 0 { - return true - } - return false -} - -//CheckMapKey CheckMapKey -func CheckMapKey(rebody map[string]interface{}, key string, defaultValue interface{}) map[string]interface{} { - if _, ok := rebody[key]; ok { - return rebody - } - rebody[key] = defaultValue - return rebody -} diff --git a/api/handler/service_handler.go b/api/handler/service_handler.go index 01eb91012..da904ca32 100644 --- a/api/handler/service_handler.go +++ b/api/handler/service_handler.go @@ -20,7 +20,7 @@ package handler import ( "context" - "github.com/jinzhu/gorm" + "net/http" api_model "github.com/goodrain/rainbond/api/model" "github.com/goodrain/rainbond/api/util" @@ -28,6 +28,7 @@ import ( dbmodel "github.com/goodrain/rainbond/db/model" "github.com/goodrain/rainbond/worker/discover/model" "github.com/goodrain/rainbond/worker/server/pb" + "github.com/jinzhu/gorm" ) //ServiceHandler service handler @@ -90,16 +91,18 @@ type ServiceHandler interface { AddServiceMonitor(tenantID, serviceID string, add api_model.AddServiceMonitorRequestStruct) (*dbmodel.TenantServiceMonitor, error) SyncComponentBase(tx *gorm.DB, app *dbmodel.Application, components []*api_model.Component) error - SyncComponentMonitors(tx *gorm.DB,app *dbmodel.Application, components []*api_model.Component) error + SyncComponentMonitors(tx *gorm.DB, app *dbmodel.Application, components []*api_model.Component) error SyncComponentPorts(tx *gorm.DB, app *dbmodel.Application, components []*api_model.Component) error SyncComponentRelations(tx *gorm.DB, app *dbmodel.Application, components []*api_model.Component) error SyncComponentEnvs(tx *gorm.DB, app *dbmodel.Application, components []*api_model.Component) error SyncComponentVolumeRels(tx *gorm.DB, app *dbmodel.Application, components []*api_model.Component) error - SyncComponentVolumes(tx *gorm.DB, components []*api_model.Component) error - SyncComponentConfigFiles(tx *gorm.DB, components []*api_model.Component) error - SyncComponentProbes(tx *gorm.DB, components []*api_model.Component) error - SyncComponentLabels(tx *gorm.DB, components []*api_model.Component) error + SyncComponentVolumes(tx *gorm.DB, components []*api_model.Component) error + SyncComponentConfigFiles(tx *gorm.DB, components []*api_model.Component) error + SyncComponentProbes(tx *gorm.DB, components []*api_model.Component) error + SyncComponentLabels(tx *gorm.DB, components []*api_model.Component) error SyncComponentPlugins(tx *gorm.DB, app *dbmodel.Application, components []*api_model.Component) error - SyncComponentScaleRules(tx *gorm.DB, components []*api_model.Component) error + SyncComponentScaleRules(tx *gorm.DB, components []*api_model.Component) error SyncComponentEndpoints(tx *gorm.DB, components []*api_model.Component) error + + Log(w http.ResponseWriter, r *http.Request, component *dbmodel.TenantServices, podName, containerName string) error } diff --git a/api/util/bcode/service.go b/api/util/bcode/service.go index b2c7b5c44..25e3ddb8b 100644 --- a/api/util/bcode/service.go +++ b/api/util/bcode/service.go @@ -12,4 +12,7 @@ var ( ErrSyncOperation = newByMessage(409, 10103, "The asynchronous operation is executing") // ErrHorizontalDueToNoChange ErrHorizontalDueToNoChange = newByMessage(400, 10104, "The number of components has not changed, no need to scale") + ErrReadComponentLogs = newByMessage(400, 10105, "Failed to read the component log from reader") + ErrWriteComponentLogs = newByMessage(400, 10106, "Failed to write the component log to the streaming response") + ErrPodNotFound = newByMessage(404, 10107, "pod not found") ) From f551ee0b50997fb150f8670aca64be5a1cf6aa9c Mon Sep 17 00:00:00 2001 From: barnettZQG Date: Tue, 3 Aug 2021 15:44:45 +0800 Subject: [PATCH 10/43] change jar language spec --- builder/parser/code/specification.go | 5 ++++- builder/parser/source_code.go | 2 +- builder/parser/source_code_test.go | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/builder/parser/code/specification.go b/builder/parser/code/specification.go index 7d054316e..3c7b5e7ce 100644 --- a/builder/parser/code/specification.go +++ b/builder/parser/code/specification.go @@ -50,7 +50,10 @@ func init() { } //CheckCodeSpecification 检查语言规范 -func CheckCodeSpecification(buildPath string, lang Lang) Specification { +func CheckCodeSpecification(buildPath string, lang Lang, serverType string) Specification { + if serverType == "oss" && lang == JavaJar { + return common() + } if check, ok := specification[lang]; ok { return check(buildPath) } diff --git a/builder/parser/source_code.go b/builder/parser/source_code.go index d58c0d38c..3eef132e5 100644 --- a/builder/parser/source_code.go +++ b/builder/parser/source_code.go @@ -300,7 +300,7 @@ func (d *SourceCodeParse) Parse() ParseErrorList { return d.errors } //check code Specification - spec := code.CheckCodeSpecification(buildPath, lang) + spec := code.CheckCodeSpecification(buildPath, lang, csi.ServerType) if spec.Advice != nil { for k, v := range spec.Advice { d.errappend(ErrorAndSolve(NegligibleError, k, v)) diff --git a/builder/parser/source_code_test.go b/builder/parser/source_code_test.go index 232fb8037..419b4a85d 100644 --- a/builder/parser/source_code_test.go +++ b/builder/parser/source_code_test.go @@ -74,7 +74,7 @@ func TestSourceCode(t *testing.T) { func TestOSSCheck(t *testing.T) { sc := sources.CodeSourceInfo{ ServerType: "oss", - RepositoryURL: "http://8081.gr021644.64q1jlfb.17f4cc.grapps.cn/artifactory/dev/java-war-demo-master.tar.gz", + RepositoryURL: "http://8081.gr021644.64q1jlfb.17f4cc.grapps.cn/artifactory/dev/java-war-demo-master.tar", User: "demo", Password: "gr123465!", } From 8f5f040b79c0fad3ba5aed65fd03f7adf77ecfbe Mon Sep 17 00:00:00 2001 From: barnettZQG Date: Tue, 3 Aug 2021 15:45:57 +0800 Subject: [PATCH 11/43] change version --- .github/workflows/release-ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-ci-build.yml b/.github/workflows/release-ci-build.yml index be4f9db48..2a8c9ce0e 100644 --- a/.github/workflows/release-ci-build.yml +++ b/.github/workflows/release-ci-build.yml @@ -24,4 +24,4 @@ jobs: DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} DOMESTIC_DOCKER_PASSWORD: ${{ secrets.DOMESTIC_DOCKER_PASSWORD }} DOMESTIC_DOCKER_USERNAME: ${{ secrets.DOMESTIC_DOCKER_USERNAME }} - run: VERSION=v5.3.2-release ./release.sh all push + run: VERSION=v5.3.3-release ./release.sh all push From 93c18b18219d45a9f99d338519f75d39d8ef7c79 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Wed, 4 Aug 2021 10:13:06 +0800 Subject: [PATCH 12/43] sync component with volume mode --- api/model/component.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/model/component.go b/api/model/component.go index 5a6a6e724..b8b2619b4 100644 --- a/api/model/component.go +++ b/api/model/component.go @@ -168,6 +168,7 @@ type ComponentVolume struct { ReclaimPolicy string `json:"reclaim_policy"` AllowExpansion bool `json:"allow_expansion"` VolumeProviderName string `json:"volume_provider_name"` + Mode *int32 `json:"mode"` } // Key returns the key of ComponentVolume. @@ -192,6 +193,7 @@ func (v *ComponentVolume) DbModel(componentID string) *dbmodel.TenantServiceVolu ReclaimPolicy: v.ReclaimPolicy, AllowExpansion: v.AllowExpansion, VolumeProviderName: v.VolumeProviderName, + Mode: v.Mode, } } From 1b385744e7b95760a56181f89c46cf08f1711282 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Wed, 4 Aug 2021 11:52:59 +0800 Subject: [PATCH 13/43] delete builder cache --- builder/exector/export_app.go | 1 + builder/exector/groupapp_restore.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/builder/exector/export_app.go b/builder/exector/export_app.go index a6787a872..418f8c625 100644 --- a/builder/exector/export_app.go +++ b/builder/exector/export_app.go @@ -70,6 +70,7 @@ func NewExportApp(in []byte, m *exectorManager) (TaskWorker, error) { //Run Run func (i *ExportApp) Run(timeout time.Duration) error { + defer os.RemoveAll(i.SourceDir) // disable Md5 checksum // if ok := i.isLatest(); ok { // i.updateStatus("success") diff --git a/builder/exector/groupapp_restore.go b/builder/exector/groupapp_restore.go index 5821e2741..b98e63626 100644 --- a/builder/exector/groupapp_restore.go +++ b/builder/exector/groupapp_restore.go @@ -118,6 +118,9 @@ func (b *BackupAPPRestore) Run(timeout time.Duration) error { if err := util.CheckAndCreateDir(cacheDir); err != nil { return fmt.Errorf("create cache dir error %s", err.Error()) } + // delete the cache data + defer os.RemoveAll(cacheDir) + b.cacheDir = cacheDir switch backup.BackupMode { case "full-online": From 0a529f8d066a08565ad88fd3fa48e957e6c388f6 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Wed, 4 Aug 2021 16:07:05 +0800 Subject: [PATCH 14/43] add option 'follow' --- api/controller/service_action.go | 4 +++- api/handler/service.go | 4 ++-- api/handler/service_handler.go | 2 +- api/util/bcode/service.go | 4 +--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/controller/service_action.go b/api/controller/service_action.go index 957faef43..6cda6cb62 100644 --- a/api/controller/service_action.go +++ b/api/controller/service_action.go @@ -23,6 +23,7 @@ import ( "io/ioutil" "net/http" "os" + "strconv" "github.com/go-chi/chi" "github.com/goodrain/rainbond/api/handler" @@ -778,8 +779,9 @@ func (t *TenantStruct) Log(w http.ResponseWriter, r *http.Request) { component := r.Context().Value(ctxutil.ContextKey("service")).(*dbmodel.TenantServices) podName := r.URL.Query().Get("podName") containerName := r.URL.Query().Get("containerName") + follow, _ := strconv.ParseBool(r.URL.Query().Get("follow")) - err := handler.GetServiceManager().Log(w, r, component, podName, containerName) + err := handler.GetServiceManager().Log(w, r, component, podName, containerName, follow) if err != nil { httputil.ReturnBcodeError(r, w, err) return diff --git a/api/handler/service.go b/api/handler/service.go index 5b7a5b725..519c0c0ea 100644 --- a/api/handler/service.go +++ b/api/handler/service.go @@ -2910,7 +2910,7 @@ func (s *ServiceAction) SyncComponentEndpoints(tx *gorm.DB, components []*api_mo } // Log returns the logs reader for a container in a pod, a pod or a component. -func (s *ServiceAction) Log(w http.ResponseWriter, r *http.Request, component *dbmodel.TenantServices, podName, containerName string) error { +func (s *ServiceAction) Log(w http.ResponseWriter, r *http.Request, component *dbmodel.TenantServices, podName, containerName string, follow bool) error { // If podName and containerName is missing, return the logs reader for the component // If containerName is missing, return the logs reader for the pod. if podName == "" || containerName == "" { @@ -2920,7 +2920,7 @@ func (s *ServiceAction) Log(w http.ResponseWriter, r *http.Request, component *d request := s.kubeClient.CoreV1().Pods(component.TenantID).GetLogs(podName, &corev1.PodLogOptions{ Container: containerName, - Follow: true, + Follow: follow, }) out, err := request.Stream(context.TODO()) diff --git a/api/handler/service_handler.go b/api/handler/service_handler.go index da904ca32..98a771a51 100644 --- a/api/handler/service_handler.go +++ b/api/handler/service_handler.go @@ -104,5 +104,5 @@ type ServiceHandler interface { SyncComponentScaleRules(tx *gorm.DB, components []*api_model.Component) error SyncComponentEndpoints(tx *gorm.DB, components []*api_model.Component) error - Log(w http.ResponseWriter, r *http.Request, component *dbmodel.TenantServices, podName, containerName string) error + Log(w http.ResponseWriter, r *http.Request, component *dbmodel.TenantServices, podName, containerName string, follow bool) error } diff --git a/api/util/bcode/service.go b/api/util/bcode/service.go index 25e3ddb8b..4cccee5ed 100644 --- a/api/util/bcode/service.go +++ b/api/util/bcode/service.go @@ -12,7 +12,5 @@ var ( ErrSyncOperation = newByMessage(409, 10103, "The asynchronous operation is executing") // ErrHorizontalDueToNoChange ErrHorizontalDueToNoChange = newByMessage(400, 10104, "The number of components has not changed, no need to scale") - ErrReadComponentLogs = newByMessage(400, 10105, "Failed to read the component log from reader") - ErrWriteComponentLogs = newByMessage(400, 10106, "Failed to write the component log to the streaming response") - ErrPodNotFound = newByMessage(404, 10107, "pod not found") + ErrPodNotFound = newByMessage(404, 10105, "pod not found") ) From b1fbc171ae7d945df71633c73de6dde67a07f15d Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Wed, 4 Aug 2021 20:24:55 +0800 Subject: [PATCH 15/43] create thirdcomponent with static endpoints --- db/model/third_party_service.go | 10 ++++ pkg/apis/rainbond/v1alpha1/third_component.go | 16 ++++++- util/comman.go | 1 + .../component_properties.go | 14 +++++- .../componentdefinition.go | 46 +++++++++++++++++-- .../thirdcomponentdefinition.go | 14 ++++-- worker/appm/conversion/conversion.go | 3 -- worker/appm/types/v1/v1.go | 4 +- 8 files changed, 92 insertions(+), 16 deletions(-) diff --git a/db/model/third_party_service.go b/db/model/third_party_service.go index 7ab8c23ba..ed460233b 100644 --- a/db/model/third_party_service.go +++ b/db/model/third_party_service.go @@ -18,6 +18,8 @@ package model +import "fmt" + // Endpoint is a persistent object for table 3rd_party_svc_endpoints. type Endpoint struct { Model @@ -34,6 +36,14 @@ func (Endpoint) TableName() string { return "tenant_service_3rd_party_endpoints" } +// Address - +func (e *Endpoint) Address() string { + if e.Port == 0 { + return e.IP + } + return fmt.Sprintf("%s:%d", e.IP, e.Port) +} + // DiscorveryType type of service discovery center. type DiscorveryType string diff --git a/pkg/apis/rainbond/v1alpha1/third_component.go b/pkg/apis/rainbond/v1alpha1/third_component.go index 463d3213f..bcaa1b1dc 100644 --- a/pkg/apis/rainbond/v1alpha1/third_component.go +++ b/pkg/apis/rainbond/v1alpha1/third_component.go @@ -35,7 +35,7 @@ func init() { // +genclient // +kubebuilder:object:root=true -// HelmApp - +// ThirdComponent - // +kubebuilder:subresource:status // +kubebuilder:resource:path=thirdcomponents,scope=Namespaced type ThirdComponent struct { @@ -55,6 +55,7 @@ type ThirdComponentList struct { Items []ThirdComponent `json:"items"` } +// ThirdComponentSpec - type ThirdComponentSpec struct { // health check probe // +optional @@ -65,6 +66,7 @@ type ThirdComponentSpec struct { EndpointSource ThirdComponentEndpointSource `json:"endpointSource"` } +// ThirdComponentEndpointSource - type ThirdComponentEndpointSource struct { StaticEndpoints []*ThirdComponentEndpoint `json:"endpoints,omitempty"` KubernetesService *KubernetesServiceSource `json:"kubernetesService,omitempty"` @@ -75,6 +77,7 @@ type ThirdComponentEndpointSource struct { // CustomAPISource } +// ThirdComponentEndpoint - type ThirdComponentEndpoint struct { // The address including the port number. Address string `json:"address"` @@ -83,9 +86,10 @@ type ThirdComponentEndpoint struct { Protocol string `json:"protocol,omitempty"` // Specify a private certificate when the protocol is HTTPS // +optional - ClentSecret string `json:"clientSecret,omitempty"` + ClientSecret string `json:"clientSecret,omitempty"` } +// KubernetesServiceSource - type KubernetesServiceSource struct { // If not specified, the namespace is the namespace of the current resource // +optional @@ -93,6 +97,7 @@ type KubernetesServiceSource struct { Name string `json:"name"` } +// HealthProbe - type HealthProbe struct { // HTTPGet specifies the http request to perform. // +optional @@ -134,6 +139,7 @@ type HTTPHeader struct { Value string `json:"value"` } +// ComponentPhase - type ComponentPhase string // These are the valid statuses of pods. @@ -147,12 +153,14 @@ const ( ComponentFailed ComponentPhase = "Failed" ) +// ThirdComponentStatus - type ThirdComponentStatus struct { Phase ComponentPhase `json:"phase"` Reason string `json:"reason,omitempty"` Endpoints []*ThirdComponentEndpointStatus `json:"endpoints"` } +// EndpointStatus - type EndpointStatus string const ( @@ -162,8 +170,10 @@ const ( EndpointNotReady EndpointStatus = "NotReady" ) +// EndpointAddress - type EndpointAddress string +// GetIP - func (e EndpointAddress) GetIP() string { info := strings.Split(string(e), ":") if len(info) == 2 { @@ -172,6 +182,7 @@ func (e EndpointAddress) GetIP() string { return "" } +// GetPort - func (e EndpointAddress) GetPort() int { info := strings.Split(string(e), ":") if len(info) == 2 { @@ -181,6 +192,7 @@ func (e EndpointAddress) GetPort() int { return 0 } +// NewEndpointAddress - func NewEndpointAddress(host string, port int) *EndpointAddress { if net.ParseIP(host) == nil { return nil diff --git a/util/comman.go b/util/comman.go index e0127e61f..a2798b357 100644 --- a/util/comman.go +++ b/util/comman.go @@ -527,6 +527,7 @@ func Zip(source, target string) error { return err } +// UnTar - func UnTar(archive, target string, zip bool) error { parameter := "-x" if zip { diff --git a/worker/appm/componentdefinition/component_properties.go b/worker/appm/componentdefinition/component_properties.go index e4eafc836..c8becaeb2 100644 --- a/worker/appm/componentdefinition/component_properties.go +++ b/worker/appm/componentdefinition/component_properties.go @@ -20,10 +20,12 @@ package componentdefinition //ThirdComponentProperties third component properties type ThirdComponentProperties struct { - Kubernetes ThirdComponentKubernetes `json:"kubernetes"` - Port []*ThirdComponentPort `json:"port"` + Kubernetes *ThirdComponentKubernetes `json:"kubernetes,omitempty"` + Endpoints []*ThirdComponentEndpoint `json:"endpoints,omitempty"` + Port []*ThirdComponentPort `json:"port"` } +// ThirdComponentPort - type ThirdComponentPort struct { Name string `json:"name"` Port int `json:"port"` @@ -31,7 +33,15 @@ type ThirdComponentPort struct { OpenOuter bool `json:"openOuter"` } +// ThirdComponentKubernetes - type ThirdComponentKubernetes struct { Name string `json:"name"` Namespace string `json:"namespace"` } + +// ThirdComponentEndpoint - +type ThirdComponentEndpoint struct { + Address string `json:"address"` + Protocol string `json:"protocol,omitempty"` + ClientSecret string `json:"clientSecret,omitempty"` +} diff --git a/worker/appm/componentdefinition/componentdefinition.go b/worker/appm/componentdefinition/componentdefinition.go index a36269652..687c1ed04 100644 --- a/worker/appm/componentdefinition/componentdefinition.go +++ b/worker/appm/componentdefinition/componentdefinition.go @@ -33,10 +33,14 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +// ErrNotSupport - var ErrNotSupport = fmt.Errorf("not support component definition") +// ErrOnlyCUESupport - var ErrOnlyCUESupport = fmt.Errorf("component definition only support cue template") +// ComponentDefinitionBuilder - type ComponentDefinitionBuilder struct { + logger *logrus.Entry definitions map[string]*v1alpha1.ComponentDefinition namespace string lock sync.Mutex @@ -44,18 +48,22 @@ type ComponentDefinitionBuilder struct { var componentDefinitionBuilder *ComponentDefinitionBuilder +// NewComponentDefinitionBuilder - func NewComponentDefinitionBuilder(namespace string) *ComponentDefinitionBuilder { componentDefinitionBuilder = &ComponentDefinitionBuilder{ + logger: logrus.WithField("WHO", "ComponentDefinitionBuilder"), definitions: make(map[string]*v1alpha1.ComponentDefinition), namespace: namespace, } return componentDefinitionBuilder } +// GetComponentDefinitionBuilder - func GetComponentDefinitionBuilder() *ComponentDefinitionBuilder { return componentDefinitionBuilder } +// OnAdd - func (c *ComponentDefinitionBuilder) OnAdd(obj interface{}) { c.lock.Lock() defer c.lock.Unlock() @@ -65,6 +73,8 @@ func (c *ComponentDefinitionBuilder) OnAdd(obj interface{}) { c.definitions[cd.Name] = cd } } + +// OnUpdate - func (c *ComponentDefinitionBuilder) OnUpdate(oldObj, newObj interface{}) { c.lock.Lock() defer c.lock.Unlock() @@ -74,6 +84,8 @@ func (c *ComponentDefinitionBuilder) OnUpdate(oldObj, newObj interface{}) { c.definitions[cd.Name] = cd } } + +// OnDelete - func (c *ComponentDefinitionBuilder) OnDelete(obj interface{}) { c.lock.Lock() defer c.lock.Unlock() @@ -84,16 +96,18 @@ func (c *ComponentDefinitionBuilder) OnDelete(obj interface{}) { } } +// GetComponentDefinition - func (c *ComponentDefinitionBuilder) GetComponentDefinition(name string) *v1alpha1.ComponentDefinition { c.lock.Lock() defer c.lock.Unlock() return c.definitions[name] } +// GetComponentProperties - func (c *ComponentDefinitionBuilder) GetComponentProperties(as *v1.AppService, dbm db.Manager, cd *v1alpha1.ComponentDefinition) interface{} { //TODO: support custom component properties switch cd.Name { - case thirdComponetDefineName: + case thirdComponentDefineName: properties := &ThirdComponentProperties{} tpsd, err := dbm.ThirdPartySvcDiscoveryCfgDao().GetByServiceID(as.ServiceID) if err != nil { @@ -102,17 +116,24 @@ func (c *ComponentDefinitionBuilder) GetComponentProperties(as *v1.AppService, d if tpsd != nil { // support other source type if tpsd.Type == dbmodel.DiscorveryTypeKubernetes.String() { - properties.Kubernetes = ThirdComponentKubernetes{ + properties.Kubernetes = &ThirdComponentKubernetes{ Name: tpsd.ServiceName, Namespace: tpsd.Namespace, } } } + + // static endpoints + endpoints, err := c.listStaticEndpoints(as.ServiceID) + if err != nil { + c.logger.Errorf("component id: %s; list static endpoints: %v", as.ServiceID, err) + } + properties.Endpoints = endpoints + ports, err := dbm.TenantServicesPortDao().GetPortsByServiceID(as.ServiceID) if err != nil { logrus.Errorf("query component %s ports failure %s", as.ServiceID, err.Error()) } - for _, port := range ports { properties.Port = append(properties.Port, &ThirdComponentPort{ Port: port.ContainerPort, @@ -124,12 +145,29 @@ func (c *ComponentDefinitionBuilder) GetComponentProperties(as *v1.AppService, d if properties.Port == nil { properties.Port = []*ThirdComponentPort{} } + return properties default: return nil } } +func (c *ComponentDefinitionBuilder) listStaticEndpoints(componentID string) ([]*ThirdComponentEndpoint, error) { + endpoints, err := db.GetManager().EndpointsDao().List(componentID) + if err != nil { + return nil, err + } + + var res []*ThirdComponentEndpoint + for _, ep := range endpoints { + res = append(res, &ThirdComponentEndpoint{ + Address: ep.Address(), + }) + } + return res, nil +} + +// BuildWorkloadResource - func (c *ComponentDefinitionBuilder) BuildWorkloadResource(as *v1.AppService, dbm db.Manager) error { cd := c.GetComponentDefinition(as.GetComponentDefinitionName()) if cd == nil { @@ -154,7 +192,7 @@ func (c *ComponentDefinitionBuilder) BuildWorkloadResource(as *v1.AppService, db //InitCoreComponentDefinition init the built-in component type definition. //Should be called after the store is initialized. func (c *ComponentDefinitionBuilder) InitCoreComponentDefinition(rainbondClient rainbondversioned.Interface) { - coreComponentDefinition := []*v1alpha1.ComponentDefinition{&thirdComponetDefine} + coreComponentDefinition := []*v1alpha1.ComponentDefinition{&thirdComponentDefine} for _, ccd := range coreComponentDefinition { if c.GetComponentDefinition(ccd.Name) == nil { logrus.Infof("create core componentdefinition %s", ccd.Name) diff --git a/worker/appm/componentdefinition/thirdcomponentdefinition.go b/worker/appm/componentdefinition/thirdcomponentdefinition.go index db622b43c..f99569daa 100644 --- a/worker/appm/componentdefinition/thirdcomponentdefinition.go +++ b/worker/appm/componentdefinition/thirdcomponentdefinition.go @@ -40,6 +40,9 @@ output: { name: parameter["kubernetes"]["name"] } } + if parameter["endpoints"] != _|_ { + endpoints: parameter["endpoints"] + } } if parameter["port"] != _|_ { ports: parameter["port"] @@ -52,6 +55,11 @@ parameter: { namespace?: string name: string } + endpoints?: [...{ + address: string + protocol?: string + clientSecret?: string + }] port?: [...{ name: string port: >0 & <=65533 @@ -60,14 +68,14 @@ parameter: { }] } ` -var thirdComponetDefineName = "core-thirdcomponent" -var thirdComponetDefine = v1alpha1.ComponentDefinition{ +var thirdComponentDefineName = "core-thirdcomponent" +var thirdComponentDefine = v1alpha1.ComponentDefinition{ TypeMeta: v1.TypeMeta{ Kind: "ComponentDefinition", APIVersion: "rainbond.io/v1alpha1", }, ObjectMeta: v1.ObjectMeta{ - Name: thirdComponetDefineName, + Name: thirdComponentDefineName, Annotations: map[string]string{ "definition.oam.dev/description": "Rainbond built-in component type that defines third-party service components.", }, diff --git a/worker/appm/conversion/conversion.go b/worker/appm/conversion/conversion.go index bd95bc1d6..106f1a4fc 100644 --- a/worker/appm/conversion/conversion.go +++ b/worker/appm/conversion/conversion.go @@ -101,9 +101,6 @@ func InitAppService(dbmanager db.Manager, serviceID string, configs map[string]s } return appService, nil } - if appService.IsThirdComponent() { - return appService, nil - } for _, c := range conversionList { if len(enableConversionList) == 0 || util.StringArrayContains(enableConversionList, c.Name) { if err := c.Conversion(appService, dbmanager); err != nil { diff --git a/worker/appm/types/v1/v1.go b/worker/appm/types/v1/v1.go index a98795570..540fc6c58 100644 --- a/worker/appm/types/v1/v1.go +++ b/worker/appm/types/v1/v1.go @@ -111,7 +111,7 @@ func (a AppServiceBase) GetComponentDefinitionName() string { if strings.HasPrefix(a.ServiceKind.String(), dbmodel.ServiceKindCustom.String()) { return strings.Replace(a.ServiceKind.String(), dbmodel.ServiceKindCustom.String(), "", 1) } - if a.discoveryCfg != nil && a.discoveryCfg.Type == dbmodel.DiscorveryTypeKubernetes.String() { + if a.ServiceKind == model.ServiceKindThirdParty { return "core-thirdcomponent" } return "" @@ -122,7 +122,7 @@ func (a AppServiceBase) IsCustomComponent() bool { if strings.HasPrefix(a.ServiceKind.String(), dbmodel.ServiceKindCustom.String()) { return true } - if a.discoveryCfg != nil && a.discoveryCfg.Type == dbmodel.DiscorveryTypeKubernetes.String() { + if a.ServiceKind == model.ServiceKindThirdParty { return true } return false From 19fec5d0b042ff42a96e8bb7c05308c1c24c30f5 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Thu, 5 Aug 2021 11:48:31 +0800 Subject: [PATCH 16/43] static endpoints discover --- config/crd/rainbond.io_thirdcomponents.yaml | 24 +++------- db/model/third_party_service.go | 8 ++-- pkg/apis/rainbond/v1alpha1/third_component.go | 9 +++- .../v1alpha1/zz_generated.deepcopy.go | 10 +--- .../component_properties.go | 9 +--- .../componentdefinition.go | 22 ++++----- .../thirdcomponentdefinition.go | 6 +-- .../controller/thirdcomponent/controller.go | 20 ++++++-- .../thirdcomponent/{ => discover}/discover.go | 13 +++++- .../thirdcomponent/discover/staticendpoint.go | 46 +++++++++++++++++++ .../thirdcomponent/discover_pool.go | 9 ++-- 11 files changed, 110 insertions(+), 66 deletions(-) rename worker/master/controller/thirdcomponent/{ => discover}/discover.go (91%) create mode 100644 worker/master/controller/thirdcomponent/discover/staticendpoint.go diff --git a/config/crd/rainbond.io_thirdcomponents.yaml b/config/crd/rainbond.io_thirdcomponents.yaml index ad28f100f..bdf217389 100644 --- a/config/crd/rainbond.io_thirdcomponents.yaml +++ b/config/crd/rainbond.io_thirdcomponents.yaml @@ -19,7 +19,7 @@ spec: status: {} validation: openAPIV3Schema: - description: HelmApp - + description: ThirdComponent - properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -34,29 +34,15 @@ spec: metadata: type: object spec: + description: ThirdComponentSpec - properties: endpointSource: description: endpoint source config properties: endpoints: - items: - properties: - address: - description: The address including the port number. - type: string - clientSecret: - description: Specify a private certificate when the protocol - is HTTPS - type: string - protocol: - description: 'Address protocols, including: HTTP, TCP, UDP, - HTTPS' - type: string - required: - - address - type: object - type: array + type: boolean kubernetesService: + description: KubernetesServiceSource - properties: name: type: string @@ -127,6 +113,7 @@ spec: - ports type: object status: + description: ThirdComponentStatus - properties: endpoints: items: @@ -187,6 +174,7 @@ spec: type: object type: array phase: + description: ComponentPhase - type: string reason: type: string diff --git a/db/model/third_party_service.go b/db/model/third_party_service.go index ed460233b..f379f1208 100644 --- a/db/model/third_party_service.go +++ b/db/model/third_party_service.go @@ -18,7 +18,9 @@ package model -import "fmt" +import ( + "fmt" +) // Endpoint is a persistent object for table 3rd_party_svc_endpoints. type Endpoint struct { @@ -36,8 +38,8 @@ func (Endpoint) TableName() string { return "tenant_service_3rd_party_endpoints" } -// Address - -func (e *Endpoint) Address() string { +// GetAddress - +func (e *Endpoint) GetAddress() string { if e.Port == 0 { return e.IP } diff --git a/pkg/apis/rainbond/v1alpha1/third_component.go b/pkg/apis/rainbond/v1alpha1/third_component.go index bcaa1b1dc..082bb9fb6 100644 --- a/pkg/apis/rainbond/v1alpha1/third_component.go +++ b/pkg/apis/rainbond/v1alpha1/third_component.go @@ -46,6 +46,11 @@ type ThirdComponent struct { Status ThirdComponentStatus `json:"status,omitempty"` } +// GetComponentID - +func (in *ThirdComponent) GetComponentID() string { + return in.Name +} + // +kubebuilder:object:root=true // ThirdComponentList contains a list of ThirdComponent @@ -68,8 +73,8 @@ type ThirdComponentSpec struct { // ThirdComponentEndpointSource - type ThirdComponentEndpointSource struct { - StaticEndpoints []*ThirdComponentEndpoint `json:"endpoints,omitempty"` - KubernetesService *KubernetesServiceSource `json:"kubernetesService,omitempty"` + StaticEndpoints *bool `json:"endpoints,omitempty"` + KubernetesService *KubernetesServiceSource `json:"kubernetesService,omitempty"` //other source // NacosSource // EurekaSource diff --git a/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go index 3beafa6dc..06b7c0e96 100644 --- a/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go @@ -460,14 +460,8 @@ func (in *ThirdComponentEndpointSource) DeepCopyInto(out *ThirdComponentEndpoint *out = *in if in.StaticEndpoints != nil { in, out := &in.StaticEndpoints, &out.StaticEndpoints - *out = make([]*ThirdComponentEndpoint, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(ThirdComponentEndpoint) - **out = **in - } - } + *out = new(bool) + **out = **in } if in.KubernetesService != nil { in, out := &in.KubernetesService, &out.KubernetesService diff --git a/worker/appm/componentdefinition/component_properties.go b/worker/appm/componentdefinition/component_properties.go index c8becaeb2..11b6c8b74 100644 --- a/worker/appm/componentdefinition/component_properties.go +++ b/worker/appm/componentdefinition/component_properties.go @@ -21,7 +21,7 @@ package componentdefinition //ThirdComponentProperties third component properties type ThirdComponentProperties struct { Kubernetes *ThirdComponentKubernetes `json:"kubernetes,omitempty"` - Endpoints []*ThirdComponentEndpoint `json:"endpoints,omitempty"` + Endpoints *bool `json:"endpoints,omitempty"` Port []*ThirdComponentPort `json:"port"` } @@ -38,10 +38,3 @@ type ThirdComponentKubernetes struct { Name string `json:"name"` Namespace string `json:"namespace"` } - -// ThirdComponentEndpoint - -type ThirdComponentEndpoint struct { - Address string `json:"address"` - Protocol string `json:"protocol,omitempty"` - ClientSecret string `json:"clientSecret,omitempty"` -} diff --git a/worker/appm/componentdefinition/componentdefinition.go b/worker/appm/componentdefinition/componentdefinition.go index 687c1ed04..d2f8d3ef6 100644 --- a/worker/appm/componentdefinition/componentdefinition.go +++ b/worker/appm/componentdefinition/componentdefinition.go @@ -28,13 +28,16 @@ import ( dbmodel "github.com/goodrain/rainbond/db/model" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" rainbondversioned "github.com/goodrain/rainbond/pkg/generated/clientset/versioned" + "github.com/goodrain/rainbond/util/commonutil" v1 "github.com/goodrain/rainbond/worker/appm/types/v1" "github.com/sirupsen/logrus" + k8sErrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // ErrNotSupport - var ErrNotSupport = fmt.Errorf("not support component definition") + // ErrOnlyCUESupport - var ErrOnlyCUESupport = fmt.Errorf("component definition only support cue template") @@ -124,11 +127,11 @@ func (c *ComponentDefinitionBuilder) GetComponentProperties(as *v1.AppService, d } // static endpoints - endpoints, err := c.listStaticEndpoints(as.ServiceID) + containsEndpoints, err := c.containsEndpoints(as.ServiceID) if err != nil { c.logger.Errorf("component id: %s; list static endpoints: %v", as.ServiceID, err) } - properties.Endpoints = endpoints + properties.Endpoints = commonutil.Bool(containsEndpoints) ports, err := dbm.TenantServicesPortDao().GetPortsByServiceID(as.ServiceID) if err != nil { @@ -152,19 +155,12 @@ func (c *ComponentDefinitionBuilder) GetComponentProperties(as *v1.AppService, d } } -func (c *ComponentDefinitionBuilder) listStaticEndpoints(componentID string) ([]*ThirdComponentEndpoint, error) { +func (c *ComponentDefinitionBuilder) containsEndpoints(componentID string) (bool, error) { endpoints, err := db.GetManager().EndpointsDao().List(componentID) if err != nil { - return nil, err + return false, err } - - var res []*ThirdComponentEndpoint - for _, ep := range endpoints { - res = append(res, &ThirdComponentEndpoint{ - Address: ep.Address(), - }) - } - return res, nil + return len(endpoints) > 0, nil } // BuildWorkloadResource - @@ -196,7 +192,7 @@ func (c *ComponentDefinitionBuilder) InitCoreComponentDefinition(rainbondClient for _, ccd := range coreComponentDefinition { if c.GetComponentDefinition(ccd.Name) == nil { logrus.Infof("create core componentdefinition %s", ccd.Name) - if _, err := rainbondClient.RainbondV1alpha1().ComponentDefinitions(c.namespace).Create(context.Background(), ccd, metav1.CreateOptions{}); err != nil { + if _, err := rainbondClient.RainbondV1alpha1().ComponentDefinitions(c.namespace).Create(context.Background(), ccd, metav1.CreateOptions{}); err != nil && !k8sErrors.IsNotFound(err) { logrus.Errorf("create core componentdefinition %s failire %s", ccd.Name, err.Error()) } } diff --git a/worker/appm/componentdefinition/thirdcomponentdefinition.go b/worker/appm/componentdefinition/thirdcomponentdefinition.go index f99569daa..cf9ded35b 100644 --- a/worker/appm/componentdefinition/thirdcomponentdefinition.go +++ b/worker/appm/componentdefinition/thirdcomponentdefinition.go @@ -55,11 +55,7 @@ parameter: { namespace?: string name: string } - endpoints?: [...{ - address: string - protocol?: string - clientSecret?: string - }] + endpoints?: bool port?: [...{ name: string port: >0 & <=65533 diff --git a/worker/master/controller/thirdcomponent/controller.go b/worker/master/controller/thirdcomponent/controller.go index 84bbcb60d..78ecb22e5 100644 --- a/worker/master/controller/thirdcomponent/controller.go +++ b/worker/master/controller/thirdcomponent/controller.go @@ -24,7 +24,10 @@ import ( "time" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" + rainbondlistersv1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1" + dis "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/discover" "github.com/oam-dev/kubevela/pkg/utils/apply" + "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" @@ -34,8 +37,10 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/rest" + "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/retry" ctrl "sigs.k8s.io/controller-runtime" + runtimecache "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" @@ -52,6 +57,9 @@ type Reconciler struct { applyer apply.Applicator discoverPool *DiscoverPool discoverNum prometheus.Gauge + + informer runtimecache.Informer + lister rainbondlistersv1alpha1.ThirdComponentLister } // Reconcile is the main logic of appDeployment controller @@ -82,7 +90,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e return ctrl.Result{}, nil } logrus.Debugf("start to reconcile component %s/%s", component.Namespace, component.Name) - discover, err := NewDiscover(component, r.restConfig) + discover, err := dis.NewDiscover(component, r.restConfig, r.lister) if err != nil { component.Status.Phase = v1alpha1.ComponentFailed component.Status.Reason = err.Error() @@ -283,17 +291,23 @@ func (r *Reconciler) Collect(ch chan<- prometheus.Metric) { // Setup adds a controller that reconciles AppDeployment. func Setup(ctx context.Context, mgr ctrl.Manager) (*Reconciler, error) { - applyer := apply.NewAPIApplicator(mgr.GetClient()) + informer, err := mgr.GetCache().GetInformerForKind(ctx, v1alpha1.SchemeGroupVersion.WithKind("ThirdComponent")) + if err != nil { + return nil, errors.WithMessage(err, "get informer for thirdcomponent") + } + lister := rainbondlistersv1alpha1.NewThirdComponentLister(informer.(cache.SharedIndexInformer).GetIndexer()) + r := &Reconciler{ Client: mgr.GetClient(), restConfig: mgr.GetConfig(), Scheme: mgr.GetScheme(), - applyer: applyer, + applyer: apply.NewAPIApplicator(mgr.GetClient()), discoverNum: prometheus.NewGauge(prometheus.GaugeOpts{ Namespace: "controller", Name: "third_component_discover_number", Help: "Number of running endpoint discover worker of third component.", }), + lister: lister, } dp := NewDiscoverPool(ctx, r) r.discoverPool = dp diff --git a/worker/master/controller/thirdcomponent/discover.go b/worker/master/controller/thirdcomponent/discover/discover.go similarity index 91% rename from worker/master/controller/thirdcomponent/discover.go rename to worker/master/controller/thirdcomponent/discover/discover.go index 80b36b1d1..37cbfc85f 100644 --- a/worker/master/controller/thirdcomponent/discover.go +++ b/worker/master/controller/thirdcomponent/discover/discover.go @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -package thirdcomponent +package discover import ( "context" @@ -24,6 +24,8 @@ import ( "time" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" + rainbondlistersv1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1" + "github.com/goodrain/rainbond/util/commonutil" "github.com/sirupsen/logrus" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -38,7 +40,7 @@ type Discover interface { Discover(ctx context.Context, update chan *v1alpha1.ThirdComponent) ([]*v1alpha1.ThirdComponentEndpointStatus, error) } -func NewDiscover(component *v1alpha1.ThirdComponent, restConfig *rest.Config) (Discover, error) { +func NewDiscover(component *v1alpha1.ThirdComponent, restConfig *rest.Config, lister rainbondlistersv1alpha1.ThirdComponentLister) (Discover, error) { if component.Spec.EndpointSource.KubernetesService != nil { clientset, err := kubernetes.NewForConfig(restConfig) if err != nil { @@ -50,6 +52,12 @@ func NewDiscover(component *v1alpha1.ThirdComponent, restConfig *rest.Config) (D client: clientset, }, nil } + if commonutil.BoolValue(component.Spec.EndpointSource.StaticEndpoints) { + return &staticEndpoint{ + component: component, + lister: lister, + }, nil + } return nil, fmt.Errorf("not support source type") } @@ -86,6 +94,7 @@ func (k *kubernetesDiscover) Discover(ctx context.Context, update chan *v1alpha1 case <-ctx.Done(): return nil, nil case <-re.ResultChan(): + logrus.Infof("endpoint(%s/%s) changed", namespace, service.Name) func() { ctx, cancel := context.WithTimeout(ctx, time.Second*10) defer cancel() diff --git a/worker/master/controller/thirdcomponent/discover/staticendpoint.go b/worker/master/controller/thirdcomponent/discover/staticendpoint.go new file mode 100644 index 000000000..af12ab7be --- /dev/null +++ b/worker/master/controller/thirdcomponent/discover/staticendpoint.go @@ -0,0 +1,46 @@ +package discover + +import ( + "context" + + "github.com/goodrain/rainbond/db" + "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" + rainbondlistersv1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1" + "github.com/pkg/errors" +) + +type staticEndpoint struct { + lister rainbondlistersv1alpha1.ThirdComponentLister + component *v1alpha1.ThirdComponent +} + +func (s *staticEndpoint) GetComponent() *v1alpha1.ThirdComponent { + return s.component +} + +func (s *staticEndpoint) Discover(ctx context.Context, update chan *v1alpha1.ThirdComponent) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { + return nil, nil +} + +func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { + // Optimization: reduce the press of database if necessary. + endpoints, err := db.GetManager().EndpointsDao().ListIsOnline(s.component.GetComponentID()) + if err != nil { + return nil, errors.WithMessage(err, "list online static endpoints") + } + + var res []*v1alpha1.ThirdComponentEndpointStatus + for _, ep := range endpoints { + ed := v1alpha1.NewEndpointAddress(ep.IP, ep.Port) + if ed == nil { + continue + } + res = append(res, &v1alpha1.ThirdComponentEndpointStatus{ + ServicePort: ep.Port, + Address: v1alpha1.EndpointAddress(ep.GetAddress()), + Status: v1alpha1.EndpointReady, + }) + } + + return res, nil +} diff --git a/worker/master/controller/thirdcomponent/discover_pool.go b/worker/master/controller/thirdcomponent/discover_pool.go index 33c2a0391..8ada251e4 100644 --- a/worker/master/controller/thirdcomponent/discover_pool.go +++ b/worker/master/controller/thirdcomponent/discover_pool.go @@ -25,6 +25,7 @@ import ( "time" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" + dis "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/discover" "github.com/sirupsen/logrus" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" @@ -86,7 +87,7 @@ func (d *DiscoverPool) Start() { } type Worker struct { - discover Discover + discover dis.Discover cancel context.CancelFunc ctx context.Context updateChan chan *v1alpha1.ThirdComponent @@ -110,7 +111,7 @@ func (w *Worker) Start() { } } -func (w *Worker) UpdateDiscover(discover Discover) { +func (w *Worker) UpdateDiscover(discover dis.Discover) { w.discover = discover } @@ -122,7 +123,7 @@ func (w *Worker) IsStop() bool { return w.stoped } -func (d *DiscoverPool) newWorker(dis Discover) *Worker { +func (d *DiscoverPool) newWorker(dis dis.Discover) *Worker { ctx, cancel := context.WithCancel(d.ctx) return &Worker{ ctx: ctx, @@ -132,7 +133,7 @@ func (d *DiscoverPool) newWorker(dis Discover) *Worker { } } -func (d *DiscoverPool) AddDiscover(dis Discover) { +func (d *DiscoverPool) AddDiscover(dis dis.Discover) { d.lock.Lock() defer d.lock.Unlock() component := dis.GetComponent() From cc4f3d5c49e6dc416e8bea23efe956d83202f420 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Thu, 5 Aug 2021 13:35:22 +0800 Subject: [PATCH 17/43] delete deprecated thirdcomponent --- cmd/worker/server/server.go | 12 +- worker/appm/appm.go | 73 ---- worker/appm/prober/prober.go | 294 ------------- worker/appm/prober/prober_test.go | 8 - worker/appm/store/store.go | 145 +------ worker/appm/thirdparty/thirdparty.go | 606 --------------------------- worker/discover/manager.go | 6 +- worker/handle/manager.go | 40 +- 8 files changed, 9 insertions(+), 1175 deletions(-) delete mode 100644 worker/appm/appm.go delete mode 100644 worker/appm/prober/prober.go delete mode 100644 worker/appm/prober/prober_test.go delete mode 100644 worker/appm/thirdparty/thirdparty.go diff --git a/cmd/worker/server/server.go b/cmd/worker/server/server.go index b67481150..d77db8988 100644 --- a/cmd/worker/server/server.go +++ b/cmd/worker/server/server.go @@ -32,7 +32,6 @@ import ( "github.com/goodrain/rainbond/pkg/generated/clientset/versioned" etcdutil "github.com/goodrain/rainbond/util/etcd" k8sutil "github.com/goodrain/rainbond/util/k8s" - "github.com/goodrain/rainbond/worker/appm" "github.com/goodrain/rainbond/worker/appm/componentdefinition" "github.com/goodrain/rainbond/worker/appm/controller" "github.com/goodrain/rainbond/worker/appm/store" @@ -98,15 +97,8 @@ func Run(s *option.Worker) error { componentdefinition.NewComponentDefinitionBuilder(s.Config.RBDNamespace) //step 4: create component resource store - startCh := channels.NewRingChannel(1024) updateCh := channels.NewRingChannel(1024) - probeCh := channels.NewRingChannel(1024) - cachestore := store.NewStore(restConfig, clientset, rainbondClient, db.GetManager(), s.Config, startCh, probeCh) - appmController := appm.NewAPPMController(clientset, cachestore, startCh, updateCh, probeCh) - if err := appmController.Start(); err != nil { - logrus.Errorf("error starting appm controller: %v", err) - } - defer appmController.Stop() + cachestore := store.NewStore(restConfig, clientset, rainbondClient, db.GetManager(), s.Config) if err := cachestore.Start(); err != nil { logrus.Error("start kube cache store error", err) return err @@ -128,7 +120,7 @@ func Run(s *option.Worker) error { //step 7 : create discover module garbageCollector := gc.NewGarbageCollector(clientset) - taskManager := discover.NewTaskManager(s.Config, cachestore, controllerManager, garbageCollector, startCh) + taskManager := discover.NewTaskManager(s.Config, cachestore, controllerManager, garbageCollector) if err := taskManager.Start(); err != nil { return err } diff --git a/worker/appm/appm.go b/worker/appm/appm.go deleted file mode 100644 index 3f9525009..000000000 --- a/worker/appm/appm.go +++ /dev/null @@ -1,73 +0,0 @@ -// RAINBOND, Application Management Platform -// Copyright (C) 2014-2017 Goodrain Co., Ltd. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. For any non-GPL usage of Rainbond, -// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd. -// must be obtained first. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -package appm - -import ( - "github.com/eapache/channels" - "github.com/goodrain/rainbond/worker/appm/prober" - "github.com/goodrain/rainbond/worker/appm/store" - "github.com/goodrain/rainbond/worker/appm/thirdparty" - "github.com/sirupsen/logrus" - "k8s.io/client-go/kubernetes" -) - -// NewAPPMController creates a new appm controller. -func NewAPPMController(clientset kubernetes.Interface, - store store.Storer, - startCh *channels.RingChannel, - updateCh *channels.RingChannel, - probeCh *channels.RingChannel) *Controller { - c := &Controller{ - store: store, - updateCh: updateCh, - startCh: startCh, - probeCh: probeCh, - stopCh: make(chan struct{}), - } - // create prober first, then thirdparty - c.prober = prober.NewProber(c.store, c.probeCh, c.updateCh) - c.thirdparty = thirdparty.NewThirdPartier(clientset, c.store, c.startCh, c.updateCh, c.stopCh, c.prober) - return c -} - -// Controller describes a new appm controller. -type Controller struct { - store store.Storer - thirdparty thirdparty.ThirdPartier - prober prober.Prober - - startCh *channels.RingChannel - updateCh *channels.RingChannel - probeCh *channels.RingChannel - stopCh chan struct{} -} - -// Start starts appm controller -func (c *Controller) Start() error { - c.thirdparty.Start() - c.prober.Start() - logrus.Debugf("start thirdparty appm manager success") - return nil -} - -// Stop stops appm controller. -func (c *Controller) Stop() { - close(c.stopCh) - c.prober.Stop() -} diff --git a/worker/appm/prober/prober.go b/worker/appm/prober/prober.go deleted file mode 100644 index 7d38eee2d..000000000 --- a/worker/appm/prober/prober.go +++ /dev/null @@ -1,294 +0,0 @@ -// RAINBOND, Application Management Platform -// Copyright (C) 2014-2017 Goodrain Co., Ltd. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. For any non-GPL usage of Rainbond, -// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd. -// must be obtained first. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -package prober - -import ( - "context" - "fmt" - "net" - "strings" - "sync" - "time" - - "github.com/eapache/channels" - "github.com/goodrain/rainbond/db" - "github.com/goodrain/rainbond/db/model" - uitlprober "github.com/goodrain/rainbond/util/prober" - v1 "github.com/goodrain/rainbond/util/prober/types/v1" - "github.com/goodrain/rainbond/worker/appm/store" - "github.com/goodrain/rainbond/worker/appm/thirdparty/discovery" - appmv1 "github.com/goodrain/rainbond/worker/appm/types/v1" - "github.com/sirupsen/logrus" - corev1 "k8s.io/api/core/v1" -) - -// Prober is the interface that wraps the required methods to maintain status -// about upstream servers(Endpoints) associated with a third-party service. -type Prober interface { - Start() - Stop() - UpdateProbes(info []*store.ProbeInfo) - StopProbe(uuids []string) - IsUsedProbe(sid string) bool -} - -// NewProber creates a new third-party service prober. -func NewProber(store store.Storer, - probeCh *channels.RingChannel, - updateCh *channels.RingChannel) Prober { - ctx, cancel := context.WithCancel(context.Background()) - return &tpProbe{ - utilprober: uitlprober.NewProber(ctx, cancel), - dbm: db.GetManager(), - store: store, - - updateCh: updateCh, - probeCh: probeCh, - watcher: make(map[string]map[string]uitlprober.Watcher), - ctx: ctx, - cancel: cancel, - } -} - -// third-party service probe -type tpProbe struct { - utilprober uitlprober.Prober - dbm db.Manager - store store.Storer - probeCh *channels.RingChannel - updateCh *channels.RingChannel - ctx context.Context - cancel context.CancelFunc - watcher map[string]map[string]uitlprober.Watcher - lock sync.Mutex -} - -func createService(probe *model.TenantServiceProbe) *v1.Service { - return &v1.Service{ - Disable: probe.IsUsed == nil || *probe.IsUsed != 1, - ServiceHealth: &v1.Health{ - Model: probe.Scheme, - TimeInterval: probe.PeriodSecond, - MaxErrorsNum: probe.FailureThreshold, - MaxTimeoutSecond: probe.TimeoutSecond, - }, - } -} - -func (t *tpProbe) Start() { - t.utilprober.Start() - - go func() { - for { - select { - case event := <-t.probeCh.Out(): - if event == nil { - return - } - evt := event.(store.Event) - switch evt.Type { - case store.CreateEvent: - infos := evt.Obj.([]*store.ProbeInfo) - t.UpdateProbes(infos) - case store.UpdateEvent: - infos := evt.Obj.([]*store.ProbeInfo) - t.UpdateProbes(infos) - case store.DeleteEvent: - uuids := evt.Obj.([]string) - t.StopProbe(uuids) - } - case <-t.ctx.Done(): - return - } - } - }() -} - -// Stop stops prober. -func (t *tpProbe) Stop() { - t.cancel() -} - -func (t *tpProbe) UpdateProbes(infos []*store.ProbeInfo) { - t.lock.Lock() - defer t.lock.Unlock() - var services []*v1.Service - for _, info := range infos { - service, probeInfo := t.createServices(info) - if service == nil { - t.utilprober.StopProbes([]string{info.UUID}) - continue - } - services = append(services, service) - // watch - if swatchers, exist := t.watcher[service.Sid]; exist && swatchers != nil { - if watcher, exist := swatchers[service.Name]; exist && watcher != nil { - continue - } - } else { - t.watcher[service.Sid] = make(map[string]uitlprober.Watcher) - } - logrus.Infof("create probe[sid: %s, address: %s, port: %d]", service.Sid, service.ServiceHealth.Address, service.ServiceHealth.Port) - watcher := t.utilprober.WatchServiceHealthy(service.Name) - t.utilprober.EnableWatcher(watcher.GetServiceName(), watcher.GetID()) - t.watcher[service.Sid][service.Name] = watcher - go func(watcher uitlprober.Watcher, info *store.ProbeInfo) { - defer watcher.Close() - defer t.utilprober.DisableWatcher(watcher.GetServiceName(), watcher.GetID()) - defer delete(t.watcher[service.Sid], service.Name) - for { - select { - case event, ok := <-watcher.Watch(): - if !ok { - return - } - if event == nil { - logrus.Errorf("get nil event from prober status chan, will retry") - time.Sleep(time.Second * 3) - } - switch event.Status { - case v1.StatHealthy: - obj := &appmv1.RbdEndpoint{ - UUID: info.UUID, - IP: info.IP, - Port: int(info.Port), - Sid: info.Sid, - } - t.updateCh.In() <- discovery.Event{ - Type: discovery.HealthEvent, - Obj: obj, - } - case v1.StatDeath, v1.StatUnhealthy: - if event.ErrorNumber > service.ServiceHealth.MaxErrorsNum { - if probeInfo.Mode == model.OfflineFailureAction.String() { - obj := &appmv1.RbdEndpoint{ - UUID: info.UUID, - IP: info.IP, - Port: int(info.Port), - Sid: info.Sid, - } - t.updateCh.In() <- discovery.Event{ - Type: discovery.UnhealthyEvent, - Obj: obj, - } - } - } - } - case <-t.ctx.Done(): - // TODO: should stop for one service, not all services. - logrus.Infof("third app %s probe watcher exist", service.Name) - return - } - } - }(watcher, info) - } - //Method internally to determine if the configuration has changed - //remove old address probe - t.utilprober.UpdateServicesProbe(services) -} - -func (t *tpProbe) StopProbe(uuids []string) { - for _, name := range uuids { - t.utilprober.StopProbes([]string{name}) - } -} - -// GetProbeInfo returns probe info associated with sid. -// If there is a probe in the database, return directly -// If there is no probe in the database, return a default probe -func (t *tpProbe) GetProbeInfo(sid string) (*model.TenantServiceProbe, error) { - probes, err := t.dbm.ServiceProbeDao().GetServiceProbes(sid) - if err != nil || probes == nil || len(probes) == 0 || *(probes[0].IsUsed) == 0 { - if err != nil { - logrus.Warningf("ServiceID: %s; error getting probes: %v", sid, err) - } - return nil, nil - } - return probes[0], nil -} - -func (t *tpProbe) IsUsedProbe(sid string) bool { - if p, _ := t.GetProbeInfo(sid); p != nil { - return true - } - return false -} - -func (t *tpProbe) createServices(probeInfo *store.ProbeInfo) (*v1.Service, *model.TenantServiceProbe) { - if probeInfo.IP == "1.1.1.1" { - app := t.store.GetAppService(probeInfo.Sid) - if len(app.GetServices(true)) >= 1 { - appService := app.GetServices(true)[0] - if appService.Annotations != nil && appService.Annotations["domain"] != "" { - probeInfo.IP = appService.Annotations["domain"] - logrus.Debugf("domain address is : %s", probeInfo.IP) - } - } - if probeInfo.IP == "1.1.1.1" { - logrus.Warningf("serviceID: %s, is a domain thirdpart endpoint, but do not found domain info", probeInfo.Sid) - return nil, nil - } - } - tsp, err := t.GetProbeInfo(probeInfo.Sid) - if err != nil { - logrus.Warningf("ServiceID: %s; Unexpected error occurred, ignore the creation of "+ - "probes: %s", probeInfo.Sid, err.Error()) - return nil, nil - } - if tsp == nil { - return nil, nil - } - if tsp.Mode == "liveness" { - tsp.Mode = model.IgnoreFailureAction.String() - } - service := createService(tsp) - service.Sid = probeInfo.Sid - service.Name = probeInfo.UUID - service.ServiceHealth.Port = int(probeInfo.Port) - service.ServiceHealth.Name = service.Name - address := fmt.Sprintf("%s:%d", probeInfo.IP, probeInfo.Port) - if service.ServiceHealth.Model == "tcp" { - address = parseTCPHostAddress(probeInfo.IP, probeInfo.Port) - } - service.ServiceHealth.Address = address - return service, tsp -} - -func (t *tpProbe) createServiceNames(ep *corev1.Endpoints) string { - return ep.GetLabels()["uuid"] -} - -func parseTCPHostAddress(address string, port int32) string { - if strings.HasPrefix(address, "https://") { - address = strings.Split(address, "https://")[1] - } - if strings.HasPrefix(address, "http://") { - address = strings.Split(address, "http://")[1] - } - if strings.Contains(address, ":") { - address = strings.Split(address, ":")[0] - } - ns, err := net.LookupHost(address) - if err != nil || len(ns) == 0 { - return address - } - address = ns[0] - address = fmt.Sprintf("%s:%d", address, port) - return address -} diff --git a/worker/appm/prober/prober_test.go b/worker/appm/prober/prober_test.go deleted file mode 100644 index 26212a14b..000000000 --- a/worker/appm/prober/prober_test.go +++ /dev/null @@ -1,8 +0,0 @@ -package prober - -import "testing" - -func TestParseTCPHostAddress(t *testing.T) { - re := parseTCPHostAddress("rm-2ze0xlsi14xz6q6sz.mysql.rds.aliyuncs.com", 3306) - t.Log(re) -} diff --git a/worker/appm/store/store.go b/worker/appm/store/store.go index 5975f4c90..7f1e71371 100644 --- a/worker/appm/store/store.go +++ b/worker/appm/store/store.go @@ -25,7 +25,6 @@ import ( "sync" "time" - "github.com/eapache/channels" "github.com/goodrain/rainbond/api/util/bcode" "github.com/goodrain/rainbond/cmd/worker/option" "github.com/goodrain/rainbond/db" @@ -37,7 +36,6 @@ import ( k8sutil "github.com/goodrain/rainbond/util/k8s" "github.com/goodrain/rainbond/worker/appm/componentdefinition" "github.com/goodrain/rainbond/worker/appm/conversion" - "github.com/goodrain/rainbond/worker/appm/f" v1 "github.com/goodrain/rainbond/worker/appm/types/v1" "github.com/goodrain/rainbond/worker/server/pb" workerutil "github.com/goodrain/rainbond/worker/util" @@ -92,7 +90,6 @@ type Storer interface { UnRegistPodUpdateListener(string) RegisterVolumeTypeListener(string, chan<- *model.TenantServiceVolumeType) UnRegisterVolumeTypeListener(string) - InitOneThirdPartService(service *model.TenantServices) error GetCrds() ([]*apiextensions.CustomResourceDefinition, error) GetCrd(name string) (*apiextensions.CustomResourceDefinition, error) GetServiceMonitorClient() (*versioned.Clientset, error) @@ -125,14 +122,6 @@ type Event struct { Obj interface{} } -// ProbeInfo holds the context of a probe. -type ProbeInfo struct { - Sid string `json:"sid"` - UUID string `json:"uuid"` - IP string `json:"ip"` - Port int32 `json:"port"` -} - //appRuntimeStore app runtime store //cache all kubernetes object and appservice type appRuntimeStore struct { @@ -150,7 +139,6 @@ type appRuntimeStore struct { appCount int32 dbmanager db.Manager conf option.Config - startCh *channels.RingChannel stopch chan struct{} podUpdateListeners map[string]chan<- *corev1.Pod podUpdateListenerLock sync.Mutex @@ -165,9 +153,7 @@ func NewStore( clientset kubernetes.Interface, rainbondClient rainbondversioned.Interface, dbmanager db.Manager, - conf option.Config, - startCh *channels.RingChannel, - probeCh *channels.RingChannel) Storer { + conf option.Config) Storer { ctx, cancel := context.WithCancel(context.Background()) store := &appRuntimeStore{ kubeconfig: kubeconfig, @@ -181,7 +167,6 @@ func NewStore( conf: conf, dbmanager: dbmanager, crClients: make(map[string]interface{}), - startCh: startCh, resourceCache: NewResourceCache(), podUpdateListeners: make(map[string]chan<- *corev1.Pod, 1), volumeTypeListeners: make(map[string]chan<- *model.TenantServiceVolumeType, 1), @@ -255,9 +240,6 @@ func NewStore( store.informers.ComponentDefinition = rainbondInformer.Rainbond().V1alpha1().ComponentDefinitions().Informer() store.informers.ComponentDefinition.AddEventHandlerWithResyncPeriod(componentdefinition.GetComponentDefinitionBuilder(), time.Second*300) - isThirdParty := func(ep *corev1.Endpoints) bool { - return ep.Labels["service-kind"] == model.ServiceKindThirdParty.String() - } // Endpoint Event Handler epEventHandler := cache.ResourceEventHandlerFuncs{ AddFunc: func(obj interface{}) { @@ -273,15 +255,6 @@ func NewStore( } if appservice != nil { appservice.AddEndpoints(ep) - if isThirdParty(ep) && ep.Subsets != nil && len(ep.Subsets) > 0 { - logrus.Debugf("received add endpoints: %+v", ep) - probeInfos := listProbeInfos(ep, serviceID) - probeCh.In() <- Event{ - Type: CreateEvent, - Obj: probeInfos, - } - } - return } } }, @@ -298,17 +271,6 @@ func NewStore( logrus.Debugf("ServiceID: %s; Action: DeleteFunc;service is closed", serviceID) store.DeleteAppService(appservice) } - if isThirdParty(ep) { - logrus.Debugf("received delete endpoints: %+v", ep) - var uuids []string - for _, item := range ep.Subsets { - uuids = append(uuids, item.Ports[0].Name) - } - probeCh.In() <- Event{ - Type: DeleteEvent, - Obj: uuids, - } - } } } }, @@ -325,13 +287,6 @@ func NewStore( } if appservice != nil { appservice.AddEndpoints(cep) - if isThirdParty(cep) { - curInfos := listProbeInfos(cep, serviceID) - probeCh.In() <- Event{ - Type: UpdateEvent, - Obj: curInfos, - } - } } } }, @@ -365,51 +320,6 @@ func (a *appRuntimeStore) Lister() *Lister { return a.listers } -func listProbeInfos(ep *corev1.Endpoints, sid string) []*ProbeInfo { - var probeInfos []*ProbeInfo - addProbe := func(pi *ProbeInfo) { - for _, c := range probeInfos { - if c.IP == pi.IP && c.Port == pi.Port { - return - } - } - probeInfos = append(probeInfos, pi) - } - for _, subset := range ep.Subsets { - for _, port := range subset.Ports { - if ep.Annotations != nil { - if domain, ok := ep.Annotations["domain"]; ok && domain != "" { - logrus.Debugf("thirdpart service[sid: %s] add domain endpoint[domain: %s] probe", sid, domain) - probeInfos = []*ProbeInfo{{ - Sid: sid, - UUID: fmt.Sprintf("%s_%d", domain, port.Port), - IP: domain, - Port: port.Port, - }} - return probeInfos - } - } - for _, address := range subset.NotReadyAddresses { - addProbe(&ProbeInfo{ - Sid: sid, - UUID: fmt.Sprintf("%s_%d", address.IP, port.Port), - IP: address.IP, - Port: port.Port, - }) - } - for _, address := range subset.Addresses { - addProbe(&ProbeInfo{ - Sid: sid, - UUID: fmt.Sprintf("%s_%d", address.IP, port.Port), - IP: address.IP, - Port: port.Port, - }) - } - } - } - return probeInfos -} - func (a *appRuntimeStore) init() error { //init leader namespace leaderNamespace := a.conf.LeaderElectionNamespace @@ -442,64 +352,11 @@ func (a *appRuntimeStore) Start() error { // init core componentdefinition componentdefinition.GetComponentDefinitionBuilder().InitCoreComponentDefinition(a.rainbondClient) go func() { - a.initThirdPartyService() a.initCustomResourceInformer(stopch) }() return nil } -func (a *appRuntimeStore) initThirdPartyService() error { - logrus.Debugf("begin initializing third-party services.") - // TODO: list third party services that have open ports directly. - svcs, err := a.dbmanager.TenantServiceDao().ListThirdPartyServices() - if err != nil { - logrus.Errorf("error listing third-party services: %v", err) - return err - } - for _, svc := range svcs { - disCfg, _ := a.dbmanager.ThirdPartySvcDiscoveryCfgDao().GetByServiceID(svc.ServiceID) - if disCfg != nil && disCfg.Type == "kubernetes" { - continue - } - if err = a.InitOneThirdPartService(svc); err != nil { - logrus.Errorf("init thridpart service error: %v", err) - return err - } - - a.startCh.In() <- &v1.Event{ - Type: v1.StartEvent, // TODO: no need to distinguish between event types. - Sid: svc.ServiceID, - } - } - logrus.Infof("initializing third-party services success") - return nil -} - -// InitOneThirdPartService init one thridpart service -func (a *appRuntimeStore) InitOneThirdPartService(service *model.TenantServices) error { - // ignore service without open port. - if !a.dbmanager.TenantServicesPortDao().HasOpenPort(service.ServiceID) { - return nil - } - - appService, err := conversion.InitCacheAppService(a.dbmanager, service.ServiceID, "Rainbond") - if err != nil { - logrus.Errorf("error initializing cache app service: %v", err) - return err - } - if appService.IsCustomComponent() { - return nil - } - a.RegistAppService(appService) - err = f.ApplyOne(context.Background(), nil, a.clientset, appService) - if err != nil { - logrus.Errorf("error applying rule: %v", err) - return err - } - logrus.Infof("init third app %s kubernetes resource", appService.ServiceAlias) - return nil -} - //Ready if all kube informers is syncd, store is ready func (a *appRuntimeStore) Ready() bool { return a.informers.Ready() diff --git a/worker/appm/thirdparty/thirdparty.go b/worker/appm/thirdparty/thirdparty.go deleted file mode 100644 index 61c540508..000000000 --- a/worker/appm/thirdparty/thirdparty.go +++ /dev/null @@ -1,606 +0,0 @@ -// RAINBOND, Application Management Platform -// Copyright (C) 2014-2017 Goodrain Co., Ltd. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. For any non-GPL usage of Rainbond, -// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd. -// must be obtained first. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -package thirdparty - -import ( - "context" - "fmt" - - "github.com/eapache/channels" - "github.com/goodrain/rainbond/db" - "github.com/goodrain/rainbond/db/model" - validation "github.com/goodrain/rainbond/util/endpoint" - "github.com/goodrain/rainbond/worker/appm/f" - "github.com/goodrain/rainbond/worker/appm/prober" - "github.com/goodrain/rainbond/worker/appm/store" - "github.com/goodrain/rainbond/worker/appm/thirdparty/discovery" - v1 "github.com/goodrain/rainbond/worker/appm/types/v1" - "github.com/sirupsen/logrus" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/kubernetes" -) - -// ThirdPartier is the interface that wraps the required methods to update status -// about upstream servers(Endpoints) associated with a third-party service. -type ThirdPartier interface { - Start() -} - -// NewThirdPartier creates a new ThirdPartier. -func NewThirdPartier(clientset kubernetes.Interface, - store store.Storer, - startCh *channels.RingChannel, - updateCh *channels.RingChannel, - stopCh chan struct{}, - prober prober.Prober) ThirdPartier { - t := &thirdparty{ - clientset: clientset, - store: store, - svcStopCh: make(map[string]chan struct{}), - startCh: startCh, - updateCh: updateCh, - stopCh: stopCh, - prober: prober, - } - return t -} - -type thirdparty struct { - clientset kubernetes.Interface - store store.Storer - prober prober.Prober - // a collection of stop channel for every service. - svcStopCh map[string]chan struct{} - - startCh *channels.RingChannel - updateCh *channels.RingChannel - stopCh chan struct{} -} - -// Start starts receiving event that update k8s endpoints status from start channel(startCh). -func (t *thirdparty) Start() { - go func() { - for { - select { - case event := <-t.updateCh.Out(): - devent, ok := event.(discovery.Event) - if !ok { - logrus.Warningf("Unexpected event received %+v", event) - continue - } - t.runUpdate(devent) - case <-t.stopCh: - for _, stopCh := range t.svcStopCh { - close(stopCh) - } - return - } - } - }() - go func() { - for { - select { - case event := <-t.startCh.Out(): - evt, ok := event.(*v1.Event) - if !ok { - logrus.Warningf("Unexpected event received %+v", event) - continue - } - logrus.Debugf("Received event: %+v", evt) - if evt.Type == v1.StartEvent { // no need to distinguish between event types - needWatch := false - stopCh := t.svcStopCh[evt.Sid] - if stopCh == nil { - logrus.Debugf("ServiceID: %s; already started.", evt.Sid) - needWatch = true - t.svcStopCh[evt.Sid] = make(chan struct{}) - } - go t.runStart(evt.Sid, needWatch) - } - if evt.Type == v1.StopEvent { - stopCh := t.svcStopCh[evt.Sid] - if stopCh == nil { - logrus.Warningf("ServiceID: %s; The third-party service has not started yet, cant't be stoped", evt.Sid) - continue - } - t.runDelete(evt.Sid) - close(stopCh) - delete(t.svcStopCh, evt.Sid) - } - case <-t.stopCh: - for _, stopCh := range t.svcStopCh { - close(stopCh) - } - return - } - } - }() -} - -func (t *thirdparty) runStart(sid string, needWatch bool) { - as := t.store.GetAppService(sid) - if as == nil { - logrus.Warnf("get app service from store failure, sid=%s", sid) - return - } - var err error - for i := 3; i > 0; i-- { - rbdeps, ir := t.ListRbdEndpoints(sid) - if rbdeps == nil || len(rbdeps) == 0 { - logrus.Warningf("ServiceID: %s;Empty rbd endpoints, stop starting third-party service.", sid) - continue - } - var eps []*corev1.Endpoints - eps, err = t.k8sEndpoints(as, rbdeps) - if err != nil { - logrus.Warningf("ServiceID: %s; error creating k8s endpoints: %s", sid, err.Error()) - continue - } - for _, ep := range eps { - if err := f.EnsureEndpoints(ep, t.clientset); err != nil { - logrus.Errorf("create or update endpoint %s failure %s", ep.Name, err.Error()) - } - } - - for _, service := range as.GetServices(true) { - if err := f.EnsureService(service, t.clientset); err != nil { - logrus.Errorf("create or update service %s failure %s", service.Name, err.Error()) - } - } - - if needWatch && ir != nil { - ir.Watch() - } - logrus.Infof("ServiceID: %s; successfully running start task", sid) - return - } - logrus.Errorf("ServiceID: %s; error running start task: %v", sid, err) -} - -// ListRbdEndpoints lists all rbd endpoints, include static and dynamic. -func (t *thirdparty) ListRbdEndpoints(sid string) ([]*v1.RbdEndpoint, Interacter) { - var res []*v1.RbdEndpoint - // static - s := NewStaticInteracter(sid) - slist, err := s.List() - if err != nil { - logrus.Warningf("ServiceID: %s;error listing static rbd endpoints: %v", sid, err) - } - if slist != nil && len(slist) > 0 { - res = append(res, slist...) - } - d := NewDynamicInteracter(sid, t.updateCh, t.stopCh) - if d != nil { - dlist, err := d.List() - if err != nil { - logrus.Warningf("ServiceID: %s;error listing dynamic rbd endpoints: %v", sid, err) - } - if dlist != nil && len(dlist) > 0 { - res = append(res, dlist...) - } - } - return res, d -} - -func deleteSubset(as *v1.AppService, rbdep *v1.RbdEndpoint) { - eps := as.GetEndpoints(true) - for _, ep := range eps { - for idx, item := range ep.Subsets { - if item.Ports[0].Name == rbdep.UUID { - logrus.Debugf("UUID: %s; subset deleted", rbdep.UUID) - ep.Subsets[idx] = ep.Subsets[len(ep.Subsets)-1] - ep.Subsets = ep.Subsets[:len(ep.Subsets)-1] - } - isDomain := false - for _, addr := range item.Addresses { - if addr.IP == "1.1.1.1" { - isDomain = true - } - } - for _, addr := range item.NotReadyAddresses { - if addr.IP == "1.1.1.1" { - isDomain = true - } - } - if isDomain { - for _, service := range as.GetServices(true) { - if service.Annotations != nil { - if rbdep.IP == service.Annotations["domain"] { - delete(service.Annotations, "domain") - } - } - } - } - } - } -} - -func (t *thirdparty) k8sEndpoints(as *v1.AppService, epinfo []*v1.RbdEndpoint) ([]*corev1.Endpoints, error) { - ports, err := db.GetManager().TenantServicesPortDao().GetPortsByServiceID(as.ServiceID) - if err != nil { - return nil, err - } - // third-party service can only have one port - if len(ports) == 0 { - return nil, fmt.Errorf("port not found") - } - p := ports[0] - - var res []*corev1.Endpoints - if *p.IsInnerService { - ep := &corev1.Endpoints{} - ep.Namespace = as.TenantID - // inner or outer - if *p.IsInnerService { - ep.Name = fmt.Sprintf("service-%d-%d", p.ID, p.ContainerPort) - if p.K8sServiceName != "" { - ep.Name = p.K8sServiceName - } - ep.Labels = as.GetCommonLabels(map[string]string{ - "name": as.ServiceAlias + "Service", - "service-kind": model.ServiceKindThirdParty.String(), - }) - } - res = append(res, ep) - } - if *p.IsOuterService { - ep := &corev1.Endpoints{} - ep.Namespace = as.TenantID - // inner or outer - if *p.IsOuterService { - ep.Name = fmt.Sprintf("service-%d-%dout", p.ID, p.ContainerPort) - ep.Labels = as.GetCommonLabels(map[string]string{ - "name": as.ServiceAlias + "ServiceOUT", - "service-kind": model.ServiceKindThirdParty.String(), - }) - } - res = append(res, ep) - } - - var subsets []corev1.EndpointSubset - for _, epi := range epinfo { - logrus.Debugf("make endpoints[address: %s] subset", epi.IP) - subset := corev1.EndpointSubset{ - Ports: []corev1.EndpointPort{ - { - Name: epi.UUID, - Port: func(targetPort int, realPort int) int32 { - if realPort == 0 { - return int32(targetPort) - } - return int32(realPort) - }(p.ContainerPort, epi.Port), - Protocol: corev1.ProtocolTCP, - }, - }, - } - eaddressIP := epi.IP - address := validation.SplitEndpointAddress(epi.IP) - if validation.IsDomainNotIP(address) { - if len(as.GetServices(false)) > 0 { - annotations := as.GetServices(false)[0].Annotations - if annotations == nil { - annotations = make(map[string]string) - } - annotations["domain"] = epi.IP - as.GetServices(false)[0].Annotations = annotations - } - eaddressIP = "1.1.1.1" - } - eaddress := []corev1.EndpointAddress{ - { - IP: eaddressIP, - }, - } - useProbe := t.prober.IsUsedProbe(as.ServiceID) - if useProbe { - subset.NotReadyAddresses = eaddress - } else { - subset.Addresses = eaddress - } - subsets = append(subsets, subset) - } - //all endpoint for one third app is same - for _, item := range res { - item.Subsets = subsets - } - return res, nil -} - -func (t *thirdparty) createSubsetForAllEndpoint(as *v1.AppService, rbdep *v1.RbdEndpoint) error { - port, err := db.GetManager().TenantServicesPortDao().GetPortsByServiceID(as.ServiceID) - if err != nil { - return err - } - // third-party service can only have one port - if port == nil || len(port) == 0 { - return fmt.Errorf("Port not found") - } - ipAddress := rbdep.IP - address := validation.SplitEndpointAddress(rbdep.IP) - if validation.IsDomainNotIP(address) { - //domain endpoint set ip is 1.1.1.1 - ipAddress = "1.1.1.1" - if len(as.GetServices(false)) > 0 { - annotations := as.GetServices(false)[0].Annotations - if annotations == nil { - annotations = make(map[string]string) - } - annotations["domain"] = rbdep.IP - as.GetServices(false)[0].Annotations = annotations - } - } - - subset := corev1.EndpointSubset{ - Ports: []corev1.EndpointPort{ - { - Name: rbdep.UUID, - Port: func() int32 { - //if endpoint have port, will ues this port - //or use service port - if rbdep.Port != 0 { - return int32(rbdep.Port) - } - return int32(port[0].ContainerPort) - }(), - Protocol: corev1.ProtocolTCP, - }, - }, - } - eaddress := []corev1.EndpointAddress{ - { - IP: ipAddress, - }, - } - useProbe := t.prober.IsUsedProbe(as.ServiceID) - if useProbe { - subset.NotReadyAddresses = eaddress - } else { - subset.Addresses = eaddress - } - - for _, ep := range as.GetEndpoints(true) { - existPort := false - existAddress := false - for i, item := range ep.Subsets { - for _, port := range item.Ports { - if port.Port == int32(subset.Ports[0].Port) && len(item.Ports) < 2 { - for _, a := range item.Addresses { - if a.IP == ipAddress { - existAddress = true - break - } - } - for _, a := range item.NotReadyAddresses { - if a.IP == ipAddress { - existAddress = true - break - } - } - if !existAddress { - if useProbe { - ep.Subsets[i].NotReadyAddresses = append(ep.Subsets[i].NotReadyAddresses, subset.NotReadyAddresses...) - } else { - ep.Subsets[i].Addresses = append(ep.Subsets[i].NotReadyAddresses, subset.Addresses...) - } - } - existPort = true - } - } - } - if !existPort { - ep.Subsets = append(ep.Subsets, subset) - } - if err := f.EnsureEndpoints(ep, t.clientset); err != nil { - logrus.Errorf("update endpoint %s failure %s", ep.Name, err.Error()) - } - } - return nil -} - -func (t *thirdparty) runUpdate(event discovery.Event) { - - updateAddress := func(as *v1.AppService, rbdep *v1.RbdEndpoint, ready bool) { - ad := validation.SplitEndpointAddress(rbdep.IP) - for _, ep := range as.GetEndpoints(true) { - var needUpdate bool - for idx, subset := range ep.Subsets { - for _, port := range subset.Ports { - address := subset.Addresses - if ready { - address = subset.NotReadyAddresses - } - for i, addr := range address { - ipequal := fmt.Sprintf("%s_%d", addr.IP, port.Port) == fmt.Sprintf("%s_%d", rbdep.IP, rbdep.Port) - if (addr.IP == "1.1.1.1" && validation.IsDomainNotIP(ad)) || ipequal { - if validation.IsDomainNotIP(ad) { - rbdep.IP = "1.1.1.1" - } - ep.Subsets[idx] = updateSubsetAddress(ready, subset, address[i]) - needUpdate = true - break - } - } - logrus.Debugf("not found need update address by %s", fmt.Sprintf("%s_%d", rbdep.IP, rbdep.Port)) - } - } - if needUpdate { - if err := f.EnsureEndpoints(ep, t.clientset); err != nil { - logrus.Errorf("update endpoint %s failure %s", ep.Name, err.Error()) - } - } - } - } - // do not have multiple ports, multiple addresses - removeAddress := func(as *v1.AppService, rbdep *v1.RbdEndpoint) { - - ad := validation.SplitEndpointAddress(rbdep.IP) - for _, ep := range as.GetEndpoints(true) { - var needUpdate bool - var newSubsets []corev1.EndpointSubset - for idx, subset := range ep.Subsets { - var handleSubset bool - for i, port := range subset.Ports { - address := append(subset.Addresses, subset.NotReadyAddresses...) - for j, addr := range address { - ipequal := fmt.Sprintf("%s_%d", addr.IP, port.Port) == fmt.Sprintf("%s_%d", rbdep.IP, rbdep.Port) - if (addr.IP == "1.1.1.1" && validation.IsDomainNotIP(ad)) || ipequal { - //multiple port remove port, Instead remove the address - if len(subset.Ports) > 1 { - subset.Ports = append(subset.Ports[:i], subset.Ports[:i]...) - newSubsets = append(newSubsets, subset) - } else { - if validation.IsDomainNotIP(ad) { - rbdep.IP = "1.1.1.1" - } - newsub := removeSubsetAddress(ep.Subsets[idx], address[j]) - if len(newsub.Addresses) != 0 || len(newsub.NotReadyAddresses) != 0 { - newSubsets = append(newSubsets, newsub) - } - } - needUpdate = true - handleSubset = true - break - } - } - } - if !handleSubset { - newSubsets = append(newSubsets, subset) - } - } - ep.Subsets = newSubsets - if needUpdate { - if err := f.EnsureEndpoints(ep, t.clientset); err != nil { - logrus.Errorf("update endpoint %s failure %s", ep.Name, err.Error()) - } - } - } - } - - rbdep := event.Obj.(*v1.RbdEndpoint) - if rbdep == nil { - logrus.Warning("update event obj transfer to *v1.RbdEndpoint failure") - return - } - as := t.store.GetAppService(rbdep.Sid) - if as == nil { - logrus.Warnf("get app service from store failure, sid=%s", rbdep.Sid) - return - } - //rbdep.IP may be set "1.1.1.1" if it is domain - //so cache doamin address for show after handle complete - showEndpointIP := rbdep.IP - switch event.Type { - case discovery.UpdateEvent, discovery.CreateEvent: - err := t.createSubsetForAllEndpoint(as, rbdep) - if err != nil { - logrus.Warningf("ServiceID: %s; error adding subset: %s", - rbdep.Sid, err.Error()) - return - } - for _, service := range as.GetServices(true) { - if err := f.EnsureService(service, t.clientset); err != nil { - logrus.Errorf("create or update service %s failure %s", service.Name, err.Error()) - } - } - logrus.Debugf("upgrade endpoints and service for third app %s", as.ServiceAlias) - case discovery.DeleteEvent: - removeAddress(as, rbdep) - logrus.Debugf("third endpoint %s ip %s is deleted", rbdep.UUID, showEndpointIP) - case discovery.HealthEvent: - updateAddress(as, rbdep, true) - logrus.Debugf("third endpoint %s ip %s is onlined", rbdep.UUID, showEndpointIP) - case discovery.UnhealthyEvent: - logrus.Debugf("third endpoint %s ip %s is offlined", rbdep.UUID, showEndpointIP) - updateAddress(as, rbdep, false) - } -} - -func (t *thirdparty) runDelete(sid string) { - as := t.store.GetAppService(sid) // TODO: need to delete? - if eps := as.GetEndpoints(true); eps != nil { - for _, ep := range eps { - logrus.Debugf("Endpoints delete: %+v", ep) - err := t.clientset.CoreV1().Endpoints(as.TenantID).Delete(context.Background(), ep.Name, metav1.DeleteOptions{}) - if err != nil && !errors.IsNotFound(err) { - logrus.Warningf("error deleting endpoint empty old app endpoints: %v", err) - } - } - } -} - -func updateSubsetAddress(ready bool, subset corev1.EndpointSubset, address corev1.EndpointAddress) corev1.EndpointSubset { - if ready { - for i, a := range subset.NotReadyAddresses { - if a.IP == address.IP { - subset.NotReadyAddresses = append(subset.NotReadyAddresses[:i], subset.NotReadyAddresses[i+1:]...) - } - } - var exist bool - for _, a := range subset.Addresses { - if a.IP == address.IP { - exist = true - break - } - } - if !exist { - subset.Addresses = append(subset.Addresses, address) - } - } else { - for i, a := range subset.Addresses { - if a.IP == address.IP { - subset.Addresses = append(subset.Addresses[:i], subset.Addresses[i+1:]...) - } - } - var exist bool - for _, a := range subset.NotReadyAddresses { - if a.IP == address.IP { - exist = true - break - } - } - if !exist { - subset.NotReadyAddresses = append(subset.NotReadyAddresses, address) - } - } - return subset -} - -func removeSubsetAddress(subset corev1.EndpointSubset, address corev1.EndpointAddress) corev1.EndpointSubset { - for i, a := range subset.Addresses { - if a.IP == address.IP { - subset.Addresses = append(subset.Addresses[:i], subset.Addresses[i+1:]...) - } - } - for i, a := range subset.NotReadyAddresses { - if a.IP == address.IP { - subset.NotReadyAddresses = append(subset.NotReadyAddresses[:i], subset.NotReadyAddresses[i+1:]...) - } - } - return subset -} - -func isHealthy(subset corev1.EndpointSubset) bool { - if subset.Addresses != nil && len(subset.Addresses) > 0 { - return true - } - return false -} diff --git a/worker/discover/manager.go b/worker/discover/manager.go index 35640f0ff..a3f93e136 100644 --- a/worker/discover/manager.go +++ b/worker/discover/manager.go @@ -24,7 +24,6 @@ import ( "os" "time" - "github.com/eapache/channels" "github.com/goodrain/rainbond/cmd/worker/option" "github.com/goodrain/rainbond/mq/api/grpc/pb" "github.com/goodrain/rainbond/mq/client" @@ -59,11 +58,10 @@ type TaskManager struct { func NewTaskManager(cfg option.Config, store store.Storer, controllermanager *controller.Manager, - garbageCollector *gc.GarbageCollector, - startCh *channels.RingChannel) *TaskManager { + garbageCollector *gc.GarbageCollector) *TaskManager { ctx, cancel := context.WithCancel(context.Background()) - handleManager := handle.NewManager(ctx, cfg, store, controllermanager, garbageCollector, startCh) + handleManager := handle.NewManager(ctx, cfg, store, controllermanager, garbageCollector) healthStatus["status"] = "health" healthStatus["info"] = "worker service health" return &TaskManager{ diff --git a/worker/handle/manager.go b/worker/handle/manager.go index 1df8db36d..615e372dd 100644 --- a/worker/handle/manager.go +++ b/worker/handle/manager.go @@ -25,11 +25,6 @@ import ( "strings" "time" - "github.com/eapache/channels" - "github.com/sirupsen/logrus" - k8sErrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/goodrain/rainbond/cmd/worker/option" "github.com/goodrain/rainbond/db" dbmodel "github.com/goodrain/rainbond/db/model" @@ -41,6 +36,9 @@ import ( v1 "github.com/goodrain/rainbond/worker/appm/types/v1" "github.com/goodrain/rainbond/worker/discover/model" "github.com/goodrain/rainbond/worker/gc" + "github.com/sirupsen/logrus" + k8sErrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) //Manager manager @@ -51,8 +49,6 @@ type Manager struct { dbmanager db.Manager controllerManager *controller.Manager garbageCollector *gc.GarbageCollector - - startCh *channels.RingChannel } //NewManager now handle @@ -60,8 +56,7 @@ func NewManager(ctx context.Context, config option.Config, store store.Storer, controllerManager *controller.Manager, - garbageCollector *gc.GarbageCollector, - startCh *channels.RingChannel) *Manager { + garbageCollector *gc.GarbageCollector) *Manager { return &Manager{ ctx: ctx, @@ -70,7 +65,6 @@ func NewManager(ctx context.Context, store: store, controllerManager: controllerManager, garbageCollector: garbageCollector, - startCh: startCh, } } @@ -426,32 +420,6 @@ func (m *Manager) applyRuleExec(task *model.Task) error { return fmt.Errorf("component apply rule controller failure:%s", err.Error()) } - if svc.Kind == dbmodel.ServiceKindThirdParty.String() && strings.HasPrefix(body.Action, "port") { - if oldAppService == nil { - m.store.RegistAppService(newAppService) - } - if err = m.store.InitOneThirdPartService(svc); err != nil { - logrus.Errorf("application apply service resource failure: %s", err.Error()) - return fmt.Errorf("application apply service resource failure: %s", err.Error()) - } - if body.Action == "port-open" { - m.startCh.In() <- &v1.Event{ - Type: v1.StartEvent, - Sid: body.ServiceID, - Port: body.Port, - IsInner: body.IsInner, - } - } - if body.Action == "port-close" { - if !db.GetManager().TenantServicesPortDao().HasOpenPort(body.ServiceID) { - m.startCh.In() <- &v1.Event{ - Type: v1.StopEvent, - Sid: body.ServiceID, - } - } - } - } - return nil } From 8ef96b59e8500fb050b8192de67d4c44e0310e76 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Thu, 5 Aug 2021 16:10:24 +0800 Subject: [PATCH 18/43] create prober --- go.mod | 4 + go.sum | 1 + pkg/apis/rainbond/v1alpha1/third_component.go | 48 +++++- .../v1alpha1/zz_generated.deepcopy.go | 26 +++- .../thirdcomponent/discover/discover.go | 1 - .../thirdcomponent/prober/prober.go | 112 ++++++++++++++ .../thirdcomponent/prober/prober_test.go | 139 ++++++++++++++++++ 7 files changed, 322 insertions(+), 9 deletions(-) create mode 100644 worker/master/controller/thirdcomponent/prober/prober.go create mode 100644 worker/master/controller/thirdcomponent/prober/prober_test.go diff --git a/go.mod b/go.mod index 8848c9b44..e46cff56f 100644 --- a/go.mod +++ b/go.mod @@ -112,6 +112,10 @@ require ( k8s.io/cli-runtime v0.20.4 k8s.io/client-go v12.0.0+incompatible k8s.io/code-generator v0.20.4 + k8s.io/component-base v0.20.4 // indirect + k8s.io/klog/v2 v2.5.0 // indirect + k8s.io/kubernetes v1.13.0 + k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect sigs.k8s.io/controller-runtime v0.7.0 sigs.k8s.io/yaml v1.2.0 ) diff --git a/go.sum b/go.sum index 78a8ce5ad..3c448a4be 100644 --- a/go.sum +++ b/go.sum @@ -2172,6 +2172,7 @@ k8s.io/kubectl v0.18.5/go.mod h1:LAGxvYunNuwcZst0OAMXnInFIv81/IeoAz2N1Yh+AhU= k8s.io/kubectl v0.18.6/go.mod h1:3TLzFOrF9h4mlRPAvdNkDbs5NWspN4e0EnPnEB41CGo= k8s.io/kubectl v0.20.4 h1:Y1gUiigiZM+ulcrnWeqSHlTd0/7xWcQIXjuMnjtHyoo= k8s.io/kubectl v0.20.4/go.mod h1:yCC5lUQyXRmmtwyxfaakryh9ezzp/bT0O14LeoFLbGo= +k8s.io/kubernetes v1.13.0 h1:qTfB+u5M92k2fCCCVP2iuhgwwSOv1EkAkvQY1tQODD8= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/metrics v0.18.0/go.mod h1:8aYTW18koXqjLVKL7Ds05RPMX9ipJZI3mywYvBOxXd4= k8s.io/metrics v0.18.5/go.mod h1:pqn6YiCCxUt067ivZVo4KtvppvdykV6HHG5+7ygVkNg= diff --git a/pkg/apis/rainbond/v1alpha1/third_component.go b/pkg/apis/rainbond/v1alpha1/third_component.go index 082bb9fb6..bd576536d 100644 --- a/pkg/apis/rainbond/v1alpha1/third_component.go +++ b/pkg/apis/rainbond/v1alpha1/third_component.go @@ -24,6 +24,7 @@ import ( "strconv" "strings" + validation "github.com/goodrain/rainbond/util/endpoint" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -64,7 +65,7 @@ type ThirdComponentList struct { type ThirdComponentSpec struct { // health check probe // +optional - Probe *HealthProbe `json:"probe,omitempty"` + Probe *Probe `json:"probe,omitempty"` // component regist ports Ports []*ComponentPort `json:"ports"` // endpoint source config @@ -102,8 +103,31 @@ type KubernetesServiceSource struct { Name string `json:"name"` } -// HealthProbe - -type HealthProbe struct { +// Probe describes a health check to be performed against a container to determine whether it is +// alive or ready to receive traffic. +type Probe struct { + // The action taken to determine the health of a container + Handler `json:",inline" protobuf:"bytes,1,opt,name=handler"` + // Number of seconds after which the probe times out. + // Defaults to 1 second. Minimum value is 1. + // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + // +optional + TimeoutSeconds int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,3,opt,name=timeoutSeconds"` + // How often (in seconds) to perform the probe. + // Default to 10 seconds. Minimum value is 1. + // +optional + PeriodSeconds int32 `json:"periodSeconds,omitempty" protobuf:"varint,4,opt,name=periodSeconds"` + // Minimum consecutive successes for the probe to be considered successful after having failed. + // +optional + SuccessThreshold int32 `json:"successThreshold,omitempty" protobuf:"varint,5,opt,name=successThreshold"` + // Minimum consecutive failures for the probe to be considered failed after having succeeded. + // Defaults to 3. Minimum value is 1. + // +optional + FailureThreshold int32 `json:"failureThreshold,omitempty" protobuf:"varint,6,opt,name=failureThreshold"` +} + +// Handler defines a specific action that should be taken +type Handler struct { // HTTPGet specifies the http request to perform. // +optional HTTPGet *HTTPGetAction `json:"httpGet,omitempty"` @@ -136,6 +160,16 @@ type HTTPGetAction struct { HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"` } +// URIScheme identifies the scheme used for connection to a host for Get actions +type URIScheme string + +const ( + // URISchemeHTTP means that the scheme used will be http:// + URISchemeHTTP URIScheme = "HTTP" + // URISchemeHTTPS means that the scheme used will be https:// + URISchemeHTTPS URIScheme = "HTTPS" +) + // HTTPHeader describes a custom header to be used in HTTP probes type HTTPHeader struct { // The header field name @@ -180,6 +214,14 @@ type EndpointAddress string // GetIP - func (e EndpointAddress) GetIP() string { + ip := e.getIP() + if validation.IsDomainNotIP(ip) { + return "1.1.1.1" + } + return ip +} + +func (e EndpointAddress) getIP() string { info := strings.Split(string(e), ":") if len(info) == 2 { return info[0] diff --git a/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go index 06b7c0e96..e84c1ea5e 100644 --- a/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go @@ -197,7 +197,7 @@ func (in *HTTPHeader) DeepCopy() *HTTPHeader { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HealthProbe) DeepCopyInto(out *HealthProbe) { +func (in *Handler) DeepCopyInto(out *Handler) { *out = *in if in.HTTPGet != nil { in, out := &in.HTTPGet, &out.HTTPGet @@ -211,12 +211,12 @@ func (in *HealthProbe) DeepCopyInto(out *HealthProbe) { } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthProbe. -func (in *HealthProbe) DeepCopy() *HealthProbe { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Handler. +func (in *Handler) DeepCopy() *Handler { if in == nil { return nil } - out := new(HealthProbe) + out := new(Handler) in.DeepCopyInto(out) return out } @@ -378,6 +378,22 @@ func (in *KubernetesServiceSource) DeepCopy() *KubernetesServiceSource { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Probe) DeepCopyInto(out *Probe) { + *out = *in + in.Handler.DeepCopyInto(&out.Handler) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Probe. +func (in *Probe) DeepCopy() *Probe { + if in == nil { + return nil + } + out := new(Probe) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Schematic) DeepCopyInto(out *Schematic) { *out = *in @@ -537,7 +553,7 @@ func (in *ThirdComponentSpec) DeepCopyInto(out *ThirdComponentSpec) { *out = *in if in.Probe != nil { in, out := &in.Probe, &out.Probe - *out = new(HealthProbe) + *out = new(Probe) (*in).DeepCopyInto(*out) } if in.Ports != nil { diff --git a/worker/master/controller/thirdcomponent/discover/discover.go b/worker/master/controller/thirdcomponent/discover/discover.go index 37cbfc85f..2a92349b3 100644 --- a/worker/master/controller/thirdcomponent/discover/discover.go +++ b/worker/master/controller/thirdcomponent/discover/discover.go @@ -94,7 +94,6 @@ func (k *kubernetesDiscover) Discover(ctx context.Context, update chan *v1alpha1 case <-ctx.Done(): return nil, nil case <-re.ResultChan(): - logrus.Infof("endpoint(%s/%s) changed", namespace, service.Name) func() { ctx, cancel := context.WithTimeout(ctx, time.Second*10) defer cancel() diff --git a/worker/master/controller/thirdcomponent/prober/prober.go b/worker/master/controller/thirdcomponent/prober/prober.go new file mode 100644 index 000000000..80bbdfb87 --- /dev/null +++ b/worker/master/controller/thirdcomponent/prober/prober.go @@ -0,0 +1,112 @@ +package prober + +import ( + "fmt" + "net/http" + "net/url" + "time" + + "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" + "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober/results" + "github.com/sirupsen/logrus" + v1 "k8s.io/api/core/v1" + "k8s.io/client-go/tools/record" + "k8s.io/kubernetes/pkg/probe" + httpprobe "k8s.io/kubernetes/pkg/probe/http" + tcpprobe "k8s.io/kubernetes/pkg/probe/tcp" +) + +const maxProbeRetries = 3 + +// Prober helps to check the readiness of a endpoint. +type prober struct { + http httpprobe.Prober + tcp tcpprobe.Prober + + recorder record.EventRecorder +} + +// NewProber creates a Prober. +func newProber( + recorder record.EventRecorder) *prober { + return &prober{ + http: httpprobe.New(), + tcp: tcpprobe.New(), + recorder: recorder, + } +} + +// probe probes the endpoint address. +func (pb *prober) probe(thirdComponent *v1alpha1.ThirdComponent, endpointStatus *v1alpha1.ThirdComponentEndpointStatus, endpointID string) (results.Result, error) { + probeSpec := thirdComponent.Spec.Probe + + if probeSpec == nil { + logrus.Warningf("probe for %s is nil", endpointID) + return results.Success, nil + } + + result, output, err := pb.runProbeWithRetries(probeSpec, thirdComponent, endpointStatus, endpointID, maxProbeRetries) + if err != nil || (result != probe.Success) { + // Probe failed in one way or another. + if err != nil { + logrus.Infof("probe for %q errored: %v", endpointID, err) + pb.recordContainerEvent(thirdComponent, v1.EventTypeWarning, "EndpointUnhealthy", "probe errored: %v", err) + } else { // result != probe.Success + logrus.Infof("probe for %q failed (%v): %s", endpointID, result, output) + pb.recordContainerEvent(thirdComponent, v1.EventTypeWarning, "EndpointUnhealthy", "probe failed: %s", output) + } + return results.Failure, err + } + return results.Success, nil +} + +// runProbeWithRetries tries to probe the container in a finite loop, it returns the last result +// if it never succeeds. +func (pb *prober) runProbeWithRetries(p *v1alpha1.Probe, thirdComponent *v1alpha1.ThirdComponent, endpointStatus *v1alpha1.ThirdComponentEndpointStatus, endpointID string, retries int) (probe.Result, string, error) { + var err error + var result probe.Result + var output string + for i := 0; i < retries; i++ { + result, output, err = pb.runProbe(p, thirdComponent, endpointStatus, endpointID) + if err == nil { + return result, output, nil + } + } + return result, output, err +} + +func (pb *prober) runProbe(p *v1alpha1.Probe, thirdComponent *v1alpha1.ThirdComponent, endpointStatus *v1alpha1.ThirdComponentEndpointStatus, endpointID string) (probe.Result, string, error) { + timeout := time.Duration(p.TimeoutSeconds) * time.Second + + if p.HTTPGet != nil { + u, err := url.Parse(string(endpointStatus.Address)) + if err != nil { + return probe.Unknown, "", err + } + u.Path = p.HTTPGet.Path + headers := buildHeader(p.HTTPGet.HTTPHeaders) + return pb.http.Probe(u, headers, timeout) + } + + if p.TCPSocket != nil { + return pb.tcp.Probe(endpointStatus.Address.GetIP(), endpointStatus.Address.GetPort(), timeout) + } + + logrus.Warningf("Failed to find probe builder for endpoint address: %v", endpointID) + return probe.Unknown, "", fmt.Errorf("missing probe handler for %s/%s", thirdComponent.Namespace, thirdComponent.Name) +} + +// recordContainerEvent should be used by the prober for all endpoints related events. +func (pb *prober) recordContainerEvent(thirdComponent *v1alpha1.ThirdComponent, eventType, reason, message string, args ...interface{}) { + pb.recorder.Eventf(thirdComponent, eventType, reason, message, args...) +} + +// buildHeaderMap takes a list of HTTPHeader string +// pairs and returns a populated string->[]string http.Header map. +func buildHeader(headerList []v1alpha1.HTTPHeader) http.Header { + headers := make(http.Header) + for _, header := range headerList { + headers[header.Name] = append(headers[header.Name], header.Value) + } + return headers +} diff --git a/worker/master/controller/thirdcomponent/prober/prober_test.go b/worker/master/controller/thirdcomponent/prober/prober_test.go new file mode 100644 index 000000000..3071b6440 --- /dev/null +++ b/worker/master/controller/thirdcomponent/prober/prober_test.go @@ -0,0 +1,139 @@ +package prober + +import ( + "net/http" + "net/url" + "reflect" + "testing" + "time" + + "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" + "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober/results" + "github.com/pkg/errors" + v1 "k8s.io/api/core/v1" + "k8s.io/client-go/tools/record" + "k8s.io/kubernetes/pkg/probe" +) + +func TestHTTPHeaders(t *testing.T) { + testCases := []struct { + input []v1alpha1.HTTPHeader + output http.Header + }{ + {[]v1alpha1.HTTPHeader{}, http.Header{}}, + {[]v1alpha1.HTTPHeader{ + {Name: "X-Muffins-Or-Cupcakes", Value: "Muffins"}, + }, http.Header{"X-Muffins-Or-Cupcakes": {"Muffins"}}}, + {[]v1alpha1.HTTPHeader{ + {Name: "X-Muffins-Or-Cupcakes", Value: "Muffins"}, + {Name: "X-Muffins-Or-Plumcakes", Value: "Muffins!"}, + }, http.Header{"X-Muffins-Or-Cupcakes": {"Muffins"}, + "X-Muffins-Or-Plumcakes": {"Muffins!"}}}, + {[]v1alpha1.HTTPHeader{ + {Name: "X-Muffins-Or-Cupcakes", Value: "Muffins"}, + {Name: "X-Muffins-Or-Cupcakes", Value: "Cupcakes, too"}, + }, http.Header{"X-Muffins-Or-Cupcakes": {"Muffins", "Cupcakes, too"}}}, + } + for _, test := range testCases { + headers := buildHeader(test.input) + if !reflect.DeepEqual(test.output, headers) { + t.Errorf("Expected %#v, got %#v", test.output, headers) + } + } +} + +func TestProbe(t *testing.T) { + httpProbe := &v1alpha1.Probe{ + Handler: v1alpha1.Handler{ + HTTPGet: &v1alpha1.HTTPGetAction{}, + }, + } + + tests := []struct { + name string + probe *v1alpha1.Probe + env []v1.EnvVar + execError bool + expectError bool + execResult probe.Result + expectedResult results.Result + expectCommand []string + }{ + { + name: "No probe", + probe: nil, + expectedResult: results.Success, + }, + { + name: "No handler", + probe: &v1alpha1.Probe{}, + expectError: true, + expectedResult: results.Failure, + }, + { + name: "Probe fails", + probe: httpProbe, + execResult: probe.Failure, + expectedResult: results.Failure, + }, + { + name: "Probe succeeds", + probe: httpProbe, + execResult: probe.Success, + expectedResult: results.Success, + }, + { + name: "Probe result is unknown", + probe: httpProbe, + execResult: probe.Unknown, + expectedResult: results.Failure, + }, + { + name: "Probe has an error", + probe: httpProbe, + execError: true, + expectError: true, + execResult: probe.Unknown, + expectedResult: results.Failure, + }, + } + + for i := range tests { + test := tests[i] + _ = test + + prober := &prober{ + recorder: &record.FakeRecorder{}, + } + thirdComponent := &v1alpha1.ThirdComponent{ + Spec: v1alpha1.ThirdComponentSpec{ + Probe: test.probe, + }, + } + if test.execError { + prober.http = fakeHTTPProber{test.execResult, errors.New("exec error")} + } else { + prober.http = fakeHTTPProber{test.execResult, nil} + } + + result, err := prober.probe(thirdComponent, &v1alpha1.ThirdComponentEndpointStatus{}, "foobar") + if test.expectError && err == nil { + t.Errorf("[%s] Expected probe error but no error was returned.", test.name) + } + if !test.expectError && err != nil { + t.Errorf("[%s] Didn't expect probe error but got: %v", test.name, err) + } + if test.expectedResult != result { + t.Errorf("[%s] Expected result to be %v but was %v", test.name, test.expectedResult, result) + } + } +} + +type fakeHTTPProber struct { + result probe.Result + err error +} + +func (p fakeHTTPProber) Probe(url *url.URL, headers http.Header, timeout time.Duration) (probe.Result, string, error) { + return p.result, "", p.err +} From 6103b522faa1d20c899ff9e850b5d6445b6914ac Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Thu, 5 Aug 2021 16:38:27 +0800 Subject: [PATCH 19/43] create result manager --- .../thirdcomponent/discover/staticendpoint.go | 6 +- .../prober/results/results_manager.go | 91 +++++++++++++++++++ .../prober/results/results_manager_test.go | 26 ++++++ 3 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 worker/master/controller/thirdcomponent/prober/results/results_manager.go create mode 100644 worker/master/controller/thirdcomponent/prober/results/results_manager_test.go diff --git a/worker/master/controller/thirdcomponent/discover/staticendpoint.go b/worker/master/controller/thirdcomponent/discover/staticendpoint.go index af12ab7be..eec590d58 100644 --- a/worker/master/controller/thirdcomponent/discover/staticendpoint.go +++ b/worker/master/controller/thirdcomponent/discover/staticendpoint.go @@ -19,7 +19,11 @@ func (s *staticEndpoint) GetComponent() *v1alpha1.ThirdComponent { } func (s *staticEndpoint) Discover(ctx context.Context, update chan *v1alpha1.ThirdComponent) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { - return nil, nil + endpointStatues, err := s.DiscoverOne(ctx) + if err != nil { + return nil, err + } + return endpointStatues, nil } func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { diff --git a/worker/master/controller/thirdcomponent/prober/results/results_manager.go b/worker/master/controller/thirdcomponent/prober/results/results_manager.go new file mode 100644 index 000000000..80648e13b --- /dev/null +++ b/worker/master/controller/thirdcomponent/prober/results/results_manager.go @@ -0,0 +1,91 @@ +package results + +import ( + "sync" +) + +// Manager provides a probe results cache and channel of updates. +type Manager interface { + // Get returns the cached result for the endpoint. + Get(endpointID string) (Result, bool) + // Set sets the cached result for the endpoint. + Set(endpointID string, result Result) + // Remove clears the cached result for the endpoint. + Remove(endpointID string) +} + +// Result is the type for probe results. +type Result int + +const ( + // Unknown is encoded as -1 (type Result) + Unknown Result = iota - 1 + + // Success is encoded as 0 (type Result) + Success + + // Failure is encoded as 1 (type Result) + Failure +) + +func (r Result) String() string { + switch r { + case Success: + return "Success" + case Failure: + return "Failure" + default: + return "UNKNOWN" + } +} + +// ToPrometheusType translates a Result to a form which is better understood by prometheus. +func (r Result) ToPrometheusType() float64 { + switch r { + case Success: + return 0 + case Failure: + return 1 + default: + return -1 + } +} + +// Manager implementation. +type manager struct { + // guards the cache + sync.RWMutex + // map of endpoint ID -> probe Result + cache map[string]Result +} + +var _ Manager = &manager{} + +// NewManager creates and returns an empty results manager. +func NewManager() Manager { + return &manager{ + cache: make(map[string]Result), + } +} + +func (m *manager) Get(id string) (Result, bool) { + m.RLock() + defer m.RUnlock() + result, found := m.cache[id] + return result, found +} + +func (m *manager) Set(id string, result Result) { + m.Lock() + defer m.Unlock() + prev, exists := m.cache[id] + if !exists || prev != result { + m.cache[id] = result + } +} + +func (m *manager) Remove(id string) { + m.Lock() + defer m.Unlock() + delete(m.cache, id) +} diff --git a/worker/master/controller/thirdcomponent/prober/results/results_manager_test.go b/worker/master/controller/thirdcomponent/prober/results/results_manager_test.go new file mode 100644 index 000000000..aae88c19f --- /dev/null +++ b/worker/master/controller/thirdcomponent/prober/results/results_manager_test.go @@ -0,0 +1,26 @@ +package results + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestCacheOperations(t *testing.T) { + m := NewManager() + + unsetID := "unset" + setID := "set" + + _, found := m.Get(unsetID) + assert.False(t, found, "unset result found") + + m.Set(setID, Success) + result, found := m.Get(setID) + assert.True(t, result == Success, "set result") + assert.True(t, found, "set result found") + + m.Remove(setID) + _, found = m.Get(setID) + assert.False(t, found, "removed result found") +} From 8af5fe8bff4717e900002ec70865711856985069 Mon Sep 17 00:00:00 2001 From: yangk Date: Thu, 5 Aug 2021 17:34:34 +0800 Subject: [PATCH 20/43] set service cpu --- worker/appm/conversion/version.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/worker/appm/conversion/version.go b/worker/appm/conversion/version.go index 303b4f9f4..c425bf289 100644 --- a/worker/appm/conversion/version.go +++ b/worker/appm/conversion/version.go @@ -498,6 +498,10 @@ func createResources(as *v1.AppService) corev1.ResourceRequirements { cpuRequest = int64(requestint) } } + if as.ContainerCPU > 0 && cpuRequest == 0 && cpuLimit == 0{ + cpuLimit = int64(as.ContainerCPU) + cpuRequest = int64(as.ContainerCPU) + } rr := createResourcesByDefaultCPU(as.ContainerMemory, cpuRequest, cpuLimit) // support set gpu, support application of single GPU video memory. if as.ContainerGPU > 0 { From 2047e1d6ea68003c4e090f0c89794c4a2c0f19b2 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Thu, 5 Aug 2021 19:36:55 +0800 Subject: [PATCH 21/43] create prober manager --- go.mod | 5 +- pkg/apis/rainbond/v1alpha1/third_component.go | 97 +++++++++- .../controller/thirdcomponent/controller.go | 20 +- .../thirdcomponent/discover/discover.go | 10 +- .../thirdcomponent/discover/staticendpoint.go | 20 +- .../thirdcomponent/prober/prober_manager.go | 141 ++++++++++++++ .../thirdcomponent/prober/worker.go | 177 ++++++++++++++++++ 7 files changed, 450 insertions(+), 20 deletions(-) create mode 100644 worker/master/controller/thirdcomponent/prober/prober_manager.go create mode 100644 worker/master/controller/thirdcomponent/prober/worker.go diff --git a/go.mod b/go.mod index e46cff56f..e5d8cf222 100644 --- a/go.mod +++ b/go.mod @@ -21,6 +21,7 @@ require ( github.com/docker/cli v20.10.3+incompatible github.com/docker/distribution v2.7.1+incompatible github.com/docker/docker v20.10.2+incompatible + github.com/docker/go-metrics v0.0.0-20181218153428-b84716841b82 github.com/docker/go-units v0.4.0 github.com/docker/libcompose v0.4.1-0.20190808084053-143e0f3f1ab9 github.com/eapache/channels v1.1.0 @@ -112,10 +113,8 @@ require ( k8s.io/cli-runtime v0.20.4 k8s.io/client-go v12.0.0+incompatible k8s.io/code-generator v0.20.4 - k8s.io/component-base v0.20.4 // indirect - k8s.io/klog/v2 v2.5.0 // indirect + k8s.io/component-base v0.20.4 k8s.io/kubernetes v1.13.0 - k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect sigs.k8s.io/controller-runtime v0.7.0 sigs.k8s.io/yaml v1.2.0 ) diff --git a/pkg/apis/rainbond/v1alpha1/third_component.go b/pkg/apis/rainbond/v1alpha1/third_component.go index bd576536d..2b6f8a264 100644 --- a/pkg/apis/rainbond/v1alpha1/third_component.go +++ b/pkg/apis/rainbond/v1alpha1/third_component.go @@ -52,6 +52,16 @@ func (in *ThirdComponent) GetComponentID() string { return in.Name } +// GetEndpointID - +func (in *ThirdComponent) GetEndpointID(endpoint *ThirdComponentEndpointStatus) string { + return fmt.Sprintf("%s/%s/%s", in.Namespace, in.Name, string(endpoint.Address)) +} + +// GetNamespaceName - +func (in *ThirdComponent) GetNamespaceName() string { + return fmt.Sprintf("%s/%s", in.Namespace, in.Name) +} + // +kubebuilder:object:root=true // ThirdComponentList contains a list of ThirdComponent @@ -72,6 +82,17 @@ type ThirdComponentSpec struct { EndpointSource ThirdComponentEndpointSource `json:"endpointSource"` } +// NeedProbe - +func (in ThirdComponentSpec) NeedProbe() bool { + if in.Probe == nil { + return false + } + if in.EndpointSource.StaticEndpoints != nil && *in.EndpointSource.StaticEndpoints == true { + return true + } + return false +} + // ThirdComponentEndpointSource - type ThirdComponentEndpointSource struct { StaticEndpoints *bool `json:"endpoints,omitempty"` @@ -126,6 +147,24 @@ type Probe struct { FailureThreshold int32 `json:"failureThreshold,omitempty" protobuf:"varint,6,opt,name=failureThreshold"` } +// Equals - +func (in *Probe) Equals(target *Probe) bool { + if in.TimeoutSeconds != target.TimeoutSeconds { + return false + } + if in.PeriodSeconds != target.PeriodSeconds { + return false + } + if in.SuccessThreshold != target.SuccessThreshold { + return false + } + if in.FailureThreshold != target.FailureThreshold { + return false + } + + return in.Handler.Equals(&target.Handler) +} + // Handler defines a specific action that should be taken type Handler struct { // HTTPGet specifies the http request to perform. @@ -138,6 +177,21 @@ type Handler struct { TCPSocket *TCPSocketAction `json:"tcpSocket,omitempty"` } +// Equals - +func (in *Handler) Equals(target *Handler) bool { + if in == nil && target == nil { + return true + } + if in == nil || target == nil { + return false + } + + if !in.HTTPGet.Equals(target.HTTPGet) { + return false + } + return in.TCPSocket.Equals(target.TCPSocket) +} + //ComponentPort component port define type ComponentPort struct { Name string `json:"name"` @@ -150,6 +204,11 @@ type ComponentPort struct { type TCPSocketAction struct { } +// Equals - +func (in *TCPSocketAction) Equals(target *TCPSocketAction) bool { + return true +} + //HTTPGetAction enable http check type HTTPGetAction struct { // Path to access on the HTTP server. @@ -160,15 +219,37 @@ type HTTPGetAction struct { HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"` } -// URIScheme identifies the scheme used for connection to a host for Get actions -type URIScheme string +// Equals - +func (in *HTTPGetAction) Equals(target *HTTPGetAction) bool { + if in == nil && target == nil { + return true + } + if in == nil || target == nil { + return false + } -const ( - // URISchemeHTTP means that the scheme used will be http:// - URISchemeHTTP URIScheme = "HTTP" - // URISchemeHTTPS means that the scheme used will be https:// - URISchemeHTTPS URIScheme = "HTTPS" -) + if in.Path != target.Path { + return false + } + if len(in.HTTPHeaders) != len(target.HTTPHeaders) { + return false + } + + headers := make(map[string]string) + for _, header := range in.HTTPHeaders { + headers[header.Name] = header.Value + } + for _, header := range target.HTTPHeaders { + value, ok := headers[header.Name] + if !ok { + return false + } + if header.Value != value { + return false + } + } + return true +} // HTTPHeader describes a custom header to be used in HTTP probes type HTTPHeader struct { diff --git a/worker/master/controller/thirdcomponent/controller.go b/worker/master/controller/thirdcomponent/controller.go index 78ecb22e5..69947920c 100644 --- a/worker/master/controller/thirdcomponent/controller.go +++ b/worker/master/controller/thirdcomponent/controller.go @@ -26,6 +26,7 @@ import ( "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" rainbondlistersv1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1" dis "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/discover" + "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober" "github.com/oam-dev/kubevela/pkg/utils/apply" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" @@ -38,6 +39,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" + "k8s.io/client-go/tools/record" "k8s.io/client-go/util/retry" ctrl "sigs.k8s.io/controller-runtime" runtimecache "sigs.k8s.io/controller-runtime/pkg/cache" @@ -60,6 +62,9 @@ type Reconciler struct { informer runtimecache.Informer lister rainbondlistersv1alpha1.ThirdComponentLister + + recorder record.EventRecorder + proberManager prober.Manager } // Reconcile is the main logic of appDeployment controller @@ -87,10 +92,14 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e if component.DeletionTimestamp != nil { log.Infof("component %s will be deleted", req) r.discoverPool.RemoveDiscover(component) + r.proberManager.RemoveThirdComponent(component) return ctrl.Result{}, nil } + + r.proberManager.AddThirdComponent(component) + logrus.Debugf("start to reconcile component %s/%s", component.Namespace, component.Name) - discover, err := dis.NewDiscover(component, r.restConfig, r.lister) + discover, err := dis.NewDiscover(component, r.restConfig, r.lister, r.proberManager) if err != nil { component.Status.Phase = v1alpha1.ComponentFailed component.Status.Reason = err.Error() @@ -297,6 +306,10 @@ func Setup(ctx context.Context, mgr ctrl.Manager) (*Reconciler, error) { } lister := rainbondlistersv1alpha1.NewThirdComponentLister(informer.(cache.SharedIndexInformer).GetIndexer()) + recorder := mgr.GetEventRecorderFor("thirdcomponent-controller") + + proberManager := prober.NewManager(recorder) + r := &Reconciler{ Client: mgr.GetClient(), restConfig: mgr.GetConfig(), @@ -307,7 +320,10 @@ func Setup(ctx context.Context, mgr ctrl.Manager) (*Reconciler, error) { Name: "third_component_discover_number", Help: "Number of running endpoint discover worker of third component.", }), - lister: lister, + informer: informer, + lister: lister, + proberManager: proberManager, + recorder: recorder, } dp := NewDiscoverPool(ctx, r) r.discoverPool = dp diff --git a/worker/master/controller/thirdcomponent/discover/discover.go b/worker/master/controller/thirdcomponent/discover/discover.go index 2a92349b3..2f0772e6a 100644 --- a/worker/master/controller/thirdcomponent/discover/discover.go +++ b/worker/master/controller/thirdcomponent/discover/discover.go @@ -26,6 +26,7 @@ import ( "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" rainbondlistersv1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1" "github.com/goodrain/rainbond/util/commonutil" + "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober" "github.com/sirupsen/logrus" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -40,7 +41,9 @@ type Discover interface { Discover(ctx context.Context, update chan *v1alpha1.ThirdComponent) ([]*v1alpha1.ThirdComponentEndpointStatus, error) } -func NewDiscover(component *v1alpha1.ThirdComponent, restConfig *rest.Config, lister rainbondlistersv1alpha1.ThirdComponentLister) (Discover, error) { +func NewDiscover(component *v1alpha1.ThirdComponent, + restConfig *rest.Config, + lister rainbondlistersv1alpha1.ThirdComponentLister, proberManager prober.Manager) (Discover, error) { if component.Spec.EndpointSource.KubernetesService != nil { clientset, err := kubernetes.NewForConfig(restConfig) if err != nil { @@ -54,8 +57,9 @@ func NewDiscover(component *v1alpha1.ThirdComponent, restConfig *rest.Config, li } if commonutil.BoolValue(component.Spec.EndpointSource.StaticEndpoints) { return &staticEndpoint{ - component: component, - lister: lister, + component: component, + lister: lister, + proberManager: proberManager, }, nil } return nil, fmt.Errorf("not support source type") diff --git a/worker/master/controller/thirdcomponent/discover/staticendpoint.go b/worker/master/controller/thirdcomponent/discover/staticendpoint.go index eec590d58..9105162bd 100644 --- a/worker/master/controller/thirdcomponent/discover/staticendpoint.go +++ b/worker/master/controller/thirdcomponent/discover/staticendpoint.go @@ -6,12 +6,15 @@ import ( "github.com/goodrain/rainbond/db" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" rainbondlistersv1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1" + "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober" + "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober/results" "github.com/pkg/errors" ) type staticEndpoint struct { - lister rainbondlistersv1alpha1.ThirdComponentLister - component *v1alpha1.ThirdComponent + lister rainbondlistersv1alpha1.ThirdComponentLister + component *v1alpha1.ThirdComponent + proberManager prober.Manager } func (s *staticEndpoint) GetComponent() *v1alpha1.ThirdComponent { @@ -39,11 +42,20 @@ func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComp if ed == nil { continue } - res = append(res, &v1alpha1.ThirdComponentEndpointStatus{ + + es := &v1alpha1.ThirdComponentEndpointStatus{ ServicePort: ep.Port, Address: v1alpha1.EndpointAddress(ep.GetAddress()), Status: v1alpha1.EndpointReady, - }) + } + res = append(res, es) + + result, found := s.proberManager.GetResult(s.component.GetEndpointID(es)) + if found || result != results.Success { + es.Status = v1alpha1.EndpointNotReady + } + // not found means no need probe, set status to ready as default + es.Status = v1alpha1.EndpointReady } return res, nil diff --git a/worker/master/controller/thirdcomponent/prober/prober_manager.go b/worker/master/controller/thirdcomponent/prober/prober_manager.go new file mode 100644 index 000000000..29ad8001f --- /dev/null +++ b/worker/master/controller/thirdcomponent/prober/prober_manager.go @@ -0,0 +1,141 @@ +package prober + +import ( + "sync" + + "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" + "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober/results" + "k8s.io/client-go/tools/record" + "k8s.io/component-base/metrics" +) + +// ProberResults stores the cumulative number of a probe by result as prometheus metrics. +var ProberResults = metrics.NewCounterVec( + &metrics.CounterOpts{ + Subsystem: "prober", + Name: "probe_total", + Help: "Cumulative number of a readiness probe for a thirdcomponent endpoint by result.", + StabilityLevel: metrics.ALPHA, + }, + []string{"result", + "endpoint", + "thirdcomponent", + "namespace"}, +) + +// Manager manages thirdcomponent probing. It creates a probe "worker" for every endpoint address that specifies a +// probe (AddThirdComponent). The worker periodically probes its assigned endpoint address and caches the results. The +// manager use the cached probe results to set the appropriate Ready state in the ThirdComponentEndpointStatus when +// requested (ThirdComponentEndpointStatus). Updating probe parameters is not currently supported. +type Manager interface { + // AddThirdComponent creates new probe workers for every endpoint address probe. + AddThirdComponent(thirdComponent *v1alpha1.ThirdComponent) + + // RemoveThirdComponent handles cleaning up the removed thirdcomponent state, including terminating probe workers and + // deleting cached results. + RemoveThirdComponent(thirdComponent *v1alpha1.ThirdComponent) + + // GetResult returns the probe result based on the given ID. + GetResult(endpointID string) (results.Result, bool) +} + +type manager struct { + // Map of active workers for probes + workers map[string]map[string]*worker + // Lock for accessing & mutating workers + workerLock sync.RWMutex + + // readinessManager manages the results of readiness probes + readinessManager results.Manager + + // prober executes the probe actions. + prober *prober +} + +// NewManager creates a Manager for pod probing. +func NewManager( + recorder record.EventRecorder) Manager { + prober := newProber(recorder) + readinessManager := results.NewManager() + return &manager{ + prober: prober, + readinessManager: readinessManager, + workers: make(map[string]map[string]*worker), + } +} + +func (m *manager) AddThirdComponent(thirdComponent *v1alpha1.ThirdComponent) { + if !thirdComponent.Spec.NeedProbe() { + return + } + + m.workerLock.Lock() + defer m.workerLock.Unlock() + + workers, ok := m.workers[thirdComponent.GetNamespaceName()] + if !ok { + m.workers[thirdComponent.Name] = make(map[string]*worker) + } + + newWorkers := make(map[string]*worker) + for _, ep := range thirdComponent.Status.Endpoints { + key := string(ep.Address) + worker := newWorker(m, thirdComponent, *ep) + oldWorker, ok := workers[key] + if ok { + delete(workers, key) + if !worker.spec.Equals(oldWorker.spec) { + // update probe + oldWorker.spec = worker.spec + newWorkers[key] = oldWorker + } + continue + } + // run new worker + newWorkers[key] = worker + go worker.run() + } + + // stop unused workers + for _, worker := range workers { + worker.stop() + } + + m.workers[thirdComponent.GetNamespaceName()] = newWorkers +} + +func (m *manager) RemoveThirdComponent(thirdComponent *v1alpha1.ThirdComponent) { + if !thirdComponent.Spec.NeedProbe() { + return + } + + m.workerLock.Lock() + defer m.workerLock.Unlock() + + workers, ok := m.workers[thirdComponent.GetNamespaceName()] + if !ok { + return + } + + for _, ep := range thirdComponent.Status.Endpoints { + worker, ok := workers[string(ep.Address)] + if !ok { + continue + } + worker.stop() + } + + delete(m.workers, thirdComponent.GetNamespaceName()) +} + +func (m *manager) GetResult(endpointID string) (results.Result, bool) { + return m.readinessManager.Get(endpointID) +} + +// Called by the worker after exiting. +func (m *manager) removeWorker(thirdComponent *v1alpha1.ThirdComponent, endpoint *v1alpha1.ThirdComponentEndpointStatus) { + m.workerLock.Lock() + defer m.workerLock.Unlock() + workers := m.workers[thirdComponent.GetNamespaceName()] + delete(workers, string(endpoint.Address)) +} diff --git a/worker/master/controller/thirdcomponent/prober/worker.go b/worker/master/controller/thirdcomponent/prober/worker.go new file mode 100644 index 000000000..d3f42aeb4 --- /dev/null +++ b/worker/master/controller/thirdcomponent/prober/worker.go @@ -0,0 +1,177 @@ +package prober + +import ( + "math/rand" + "time" + + "github.com/docker/go-metrics" + "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" + "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober/results" + "k8s.io/apimachinery/pkg/util/runtime" +) + +const ( + probeResultSuccessful string = "successful" + probeResultFailed string = "failed" + probeResultUnknown string = "unknown" +) + +// worker handles the periodic probing of its assigned container. Each worker has a go-routine +// associated with it which runs the probe loop until the container permanently terminates, or the +// stop channel is closed. The worker uses the probe Manager's statusManager to get up-to-date +// container IDs. +type worker struct { + // Channel for stopping the probe. + stopCh chan struct{} + + // The pod containing this probe (read-only) + thirdComponent *v1alpha1.ThirdComponent + + // The endpoint to probe (read-only) + endpoint v1alpha1.ThirdComponentEndpointStatus + + // Describes the probe configuration (read-only) + spec *v1alpha1.Probe + + // The probe value during the initial delay. + initialValue results.Result + + // Where to store this workers results. + resultsManager results.Manager + probeManager *manager + + // The last probe result for this worker. + lastResult results.Result + // How many times in a row the probe has returned the same result. + resultRun int + + // proberResultsMetricLabels holds the labels attached to this worker + // for the ProberResults metric by result. + proberResultsSuccessfulMetricLabels metrics.Labels + proberResultsFailedMetricLabels metrics.Labels + proberResultsUnknownMetricLabels metrics.Labels +} + +// Creates and starts a new probe worker. +func newWorker( + m *manager, + thirdComponent *v1alpha1.ThirdComponent, + endpoint v1alpha1.ThirdComponentEndpointStatus) *worker { + + w := &worker{ + stopCh: make(chan struct{}, 1), // Buffer so stop() can be non-blocking. + probeManager: m, + thirdComponent: thirdComponent, + endpoint: endpoint, + } + + w.spec = thirdComponent.Spec.Probe + w.resultsManager = m.readinessManager + w.initialValue = results.Failure + + basicMetricLabels := metrics.Labels{ + "endpoint": string(w.endpoint.Address), + "pod": w.thirdComponent.Name, + "namespace": w.thirdComponent.Namespace, + } + + w.proberResultsSuccessfulMetricLabels = deepCopyPrometheusLabels(basicMetricLabels) + w.proberResultsSuccessfulMetricLabels["result"] = probeResultSuccessful + + w.proberResultsFailedMetricLabels = deepCopyPrometheusLabels(basicMetricLabels) + w.proberResultsFailedMetricLabels["result"] = probeResultFailed + + w.proberResultsUnknownMetricLabels = deepCopyPrometheusLabels(basicMetricLabels) + w.proberResultsUnknownMetricLabels["result"] = probeResultUnknown + + return w +} + +// run periodically probes the endpoint. +func (w *worker) run() { + probeTickerPeriod := time.Duration(w.spec.PeriodSeconds) * time.Second + + // If kubelet restarted the probes could be started in rapid succession. + // Let the worker wait for a random portion of tickerPeriod before probing. + time.Sleep(time.Duration(rand.Float64() * float64(probeTickerPeriod))) + + probeTicker := time.NewTicker(probeTickerPeriod) + + defer func() { + // Clean up. + probeTicker.Stop() + w.resultsManager.Remove(w.thirdComponent.GetEndpointID(&w.endpoint)) + + w.probeManager.removeWorker(w.thirdComponent, &w.endpoint) + ProberResults.Delete(w.proberResultsSuccessfulMetricLabels) + ProberResults.Delete(w.proberResultsFailedMetricLabels) + ProberResults.Delete(w.proberResultsUnknownMetricLabels) + }() + +probeLoop: + for w.doProbe() { + // Wait for next probe tick. + select { + case <-w.stopCh: + break probeLoop + case <-probeTicker.C: + // continue + } + } +} + +// stop stops the probe worker. The worker handles cleanup and removes itself from its manager. +// It is safe to call stop multiple times. +func (w *worker) stop() { + select { + case w.stopCh <- struct{}{}: + default: // Non-blocking. + } +} + +// doProbe probes the endpint once and records the result. +// Returns whether the worker should continue. +func (w *worker) doProbe() (keepGoing bool) { + defer func() { recover() }() // Actually eat panics (HandleCrash takes care of logging) + defer runtime.HandleCrash(func(_ interface{}) { keepGoing = true }) + + result, err := w.probeManager.prober.probe(w.thirdComponent, &w.endpoint, w.thirdComponent.GetEndpointID(&w.endpoint)) + if err != nil { + // Prober error, throw away the result. + return true + } + + switch result { + case results.Success: + ProberResults.With(w.proberResultsSuccessfulMetricLabels).Inc() + case results.Failure: + ProberResults.With(w.proberResultsFailedMetricLabels).Inc() + default: + ProberResults.With(w.proberResultsUnknownMetricLabels).Inc() + } + + if w.lastResult == result { + w.resultRun++ + } else { + w.lastResult = result + w.resultRun = 1 + } + + if (result == results.Failure && w.resultRun < int(w.spec.FailureThreshold)) || + (result == results.Success && w.resultRun < int(w.spec.SuccessThreshold)) { + // Success or failure is below threshold - leave the probe state unchanged. + return true + } + + w.resultsManager.Set(w.thirdComponent.GetEndpointID(&w.endpoint), result) + + return true +} + +func deepCopyPrometheusLabels(m metrics.Labels) metrics.Labels { + ret := make(metrics.Labels, len(m)) + for k, v := range m { + ret[k] = v + } + return ret +} From 1fcd12adac6b73338ab073e1ddae86b7f0ebd870 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Fri, 6 Aug 2021 10:31:58 +0800 Subject: [PATCH 22/43] add probe for thirdcomponent definition --- config/crd/rainbond.io_thirdcomponents.yaml | 21 ++++++ pkg/apis/rainbond/v1alpha1/third_component.go | 10 +++ .../component_properties.go | 3 + .../componentdefinition.go | 68 +++++++++++++++++++ .../thirdcomponentdefinition.go | 16 +++++ .../thirdcomponent/discover/staticendpoint.go | 18 +++-- .../thirdcomponent/discover_pool.go | 3 +- .../thirdcomponent/prober/prober.go | 13 ++-- 8 files changed, 139 insertions(+), 13 deletions(-) diff --git a/config/crd/rainbond.io_thirdcomponents.yaml b/config/crd/rainbond.io_thirdcomponents.yaml index bdf217389..f42833551 100644 --- a/config/crd/rainbond.io_thirdcomponents.yaml +++ b/config/crd/rainbond.io_thirdcomponents.yaml @@ -77,6 +77,12 @@ spec: probe: description: health check probe properties: + failureThreshold: + description: Minimum consecutive failures for the probe to be considered + failed after having succeeded. Defaults to 3. Minimum value is + 1. + format: int32 + type: integer httpGet: description: HTTPGet specifies the http request to perform. properties: @@ -102,11 +108,26 @@ spec: description: Path to access on the HTTP server. type: string type: object + periodSeconds: + description: How often (in seconds) to perform the probe. Default + to 10 seconds. Minimum value is 1. + format: int32 + type: integer + successThreshold: + description: Minimum consecutive successes for the probe to be considered + successful after having failed. + format: int32 + type: integer tcpSocket: description: 'TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported TODO: implement a realistic TCP lifecycle hook' type: object + timeoutSeconds: + description: 'Number of seconds after which the probe times out. + Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + format: int32 + type: integer type: object required: - endpointSource diff --git a/pkg/apis/rainbond/v1alpha1/third_component.go b/pkg/apis/rainbond/v1alpha1/third_component.go index 2b6f8a264..dfcf1d588 100644 --- a/pkg/apis/rainbond/v1alpha1/third_component.go +++ b/pkg/apis/rainbond/v1alpha1/third_component.go @@ -320,6 +320,16 @@ func (e EndpointAddress) GetPort() int { return 0 } +// EnsureScheme - +func (e EndpointAddress) EnsureScheme() string { + address := string(e) + if strings.HasPrefix(address, "http://") || strings.HasPrefix(address, "https://") { + return address + } + // The default scheme is http + return "http://" + address +} + // NewEndpointAddress - func NewEndpointAddress(host string, port int) *EndpointAddress { if net.ParseIP(host) == nil { diff --git a/worker/appm/componentdefinition/component_properties.go b/worker/appm/componentdefinition/component_properties.go index 11b6c8b74..00d6f3874 100644 --- a/worker/appm/componentdefinition/component_properties.go +++ b/worker/appm/componentdefinition/component_properties.go @@ -18,11 +18,14 @@ package componentdefinition +import "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" + //ThirdComponentProperties third component properties type ThirdComponentProperties struct { Kubernetes *ThirdComponentKubernetes `json:"kubernetes,omitempty"` Endpoints *bool `json:"endpoints,omitempty"` Port []*ThirdComponentPort `json:"port"` + Probe *v1alpha1.Probe `json:"probe,omitempty"` } // ThirdComponentPort - diff --git a/worker/appm/componentdefinition/componentdefinition.go b/worker/appm/componentdefinition/componentdefinition.go index d2f8d3ef6..e7497497e 100644 --- a/worker/appm/componentdefinition/componentdefinition.go +++ b/worker/appm/componentdefinition/componentdefinition.go @@ -20,6 +20,7 @@ package componentdefinition import ( "context" + "encoding/json" "fmt" "strings" "sync" @@ -149,6 +150,18 @@ func (c *ComponentDefinitionBuilder) GetComponentProperties(as *v1.AppService, d properties.Port = []*ThirdComponentPort{} } + // probe + probe, err := c.createProbe(as.ServiceID) + if err != nil { + c.logger.Warningf("create probe: %v", err) + } + properties.Probe = probe + + bytes, err := json.Marshal(properties) + if err == nil { + logrus.Infof("properties: %s", bytes) + } + return properties default: return nil @@ -199,3 +212,58 @@ func (c *ComponentDefinitionBuilder) InitCoreComponentDefinition(rainbondClient } logrus.Infof("success check core componentdefinition from cluster") } + +func (c *ComponentDefinitionBuilder) createProbe(componentID string) (*v1alpha1.Probe, error) { + probe, err := db.GetManager().ServiceProbeDao().GetServiceUsedProbe(componentID, "readiness") + if err != nil { + return nil, err + } + if probe == nil { + return nil, nil + } + + p := &v1alpha1.Probe{ + TimeoutSeconds: int32(probe.TimeoutSecond), + PeriodSeconds: int32(probe.PeriodSecond), + SuccessThreshold: int32(probe.SuccessThreshold), + FailureThreshold: int32(probe.FailureThreshold), + } + if probe.Scheme == "tcp" { + p.TCPSocket = c.createTCPGetAction(probe) + } else { + p.HTTPGet = c.createHTTPGetAction(probe) + } + + return p, nil +} + +func (c *ComponentDefinitionBuilder) createHTTPGetAction(probe *dbmodel.TenantServiceProbe) *v1alpha1.HTTPGetAction { + action := &v1alpha1.HTTPGetAction{Path: probe.Path} + if probe.HTTPHeader != "" { + hds := strings.Split(probe.HTTPHeader, ",") + var headers []v1alpha1.HTTPHeader + for _, hd := range hds { + kv := strings.Split(hd, "=") + if len(kv) == 1 { + header := v1alpha1.HTTPHeader{ + Name: kv[0], + Value: "", + } + headers = append(headers, header) + } else if len(kv) == 2 { + header := v1alpha1.HTTPHeader{ + Name: kv[0], + Value: kv[1], + } + headers = append(headers, header) + } + } + action.HTTPHeaders = headers + } + return action +} + +func (c *ComponentDefinitionBuilder) createTCPGetAction(probe *dbmodel.TenantServiceProbe) *v1alpha1.TCPSocketAction { + return &v1alpha1.TCPSocketAction{ + } +} diff --git a/worker/appm/componentdefinition/thirdcomponentdefinition.go b/worker/appm/componentdefinition/thirdcomponentdefinition.go index cf9ded35b..709b80a9f 100644 --- a/worker/appm/componentdefinition/thirdcomponentdefinition.go +++ b/worker/appm/componentdefinition/thirdcomponentdefinition.go @@ -47,6 +47,9 @@ output: { if parameter["port"] != _|_ { ports: parameter["port"] } + if parameter["probe"] != _|_ { + probe: parameter["probe"] + } } } @@ -62,6 +65,19 @@ parameter: { openInner: bool openOuter: bool }] + probe?: { + httpGet?: { + path?: string + httpHeaders?: [...{ + name?: string + vale?: string + }] + } + timeoutSeconds?: >0 & <=65533 + periodSeconds?: >0 & <=65533 + successThreshold?: >0 & <=65533 + failureThreshold?: >0 & <=65533 + } } ` var thirdComponentDefineName = "core-thirdcomponent" diff --git a/worker/master/controller/thirdcomponent/discover/staticendpoint.go b/worker/master/controller/thirdcomponent/discover/staticendpoint.go index 9105162bd..80b643cf5 100644 --- a/worker/master/controller/thirdcomponent/discover/staticendpoint.go +++ b/worker/master/controller/thirdcomponent/discover/staticendpoint.go @@ -2,6 +2,7 @@ package discover import ( "context" + "time" "github.com/goodrain/rainbond/db" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" @@ -22,11 +23,19 @@ func (s *staticEndpoint) GetComponent() *v1alpha1.ThirdComponent { } func (s *staticEndpoint) Discover(ctx context.Context, update chan *v1alpha1.ThirdComponent) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { - endpointStatues, err := s.DiscoverOne(ctx) + ctx, cancel := context.WithTimeout(ctx, 3*time.Second) + defer cancel() + + endpoints, err := s.DiscoverOne(ctx) if err != nil { return nil, err } - return endpointStatues, nil + + newComponent := s.component.DeepCopy() + newComponent.Status.Endpoints = endpoints + update <- newComponent + + return endpoints, nil } func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { @@ -51,11 +60,10 @@ func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComp res = append(res, es) result, found := s.proberManager.GetResult(s.component.GetEndpointID(es)) - if found || result != results.Success { + es.Status = v1alpha1.EndpointReady + if found && result != results.Success { es.Status = v1alpha1.EndpointNotReady } - // not found means no need probe, set status to ready as default - es.Status = v1alpha1.EndpointReady } return res, nil diff --git a/worker/master/controller/thirdcomponent/discover_pool.go b/worker/master/controller/thirdcomponent/discover_pool.go index 8ada251e4..7fb9c4af4 100644 --- a/worker/master/controller/thirdcomponent/discover_pool.go +++ b/worker/master/controller/thirdcomponent/discover_pool.go @@ -78,8 +78,6 @@ func (d *DiscoverPool) Start() { logrus.Errorf("update component status failure", err.Error()) } logrus.Infof("update component %s status success by discover pool", name) - } else { - logrus.Debugf("component %s status endpoints not change", name) } }() } @@ -101,6 +99,7 @@ func (w *Worker) Start() { }() w.stoped = false logrus.Infof("discover endpoint list worker %s/%s started", w.discover.GetComponent().Namespace, w.discover.GetComponent().Name) + // TODO: rate limit for { w.discover.Discover(w.ctx, w.updateChan) select { diff --git a/worker/master/controller/thirdcomponent/prober/prober.go b/worker/master/controller/thirdcomponent/prober/prober.go index 80bbdfb87..b3a26cf90 100644 --- a/worker/master/controller/thirdcomponent/prober/prober.go +++ b/worker/master/controller/thirdcomponent/prober/prober.go @@ -23,6 +23,7 @@ type prober struct { http httpprobe.Prober tcp tcpprobe.Prober + logger *logrus.Entry recorder record.EventRecorder } @@ -30,6 +31,7 @@ type prober struct { func newProber( recorder record.EventRecorder) *prober { return &prober{ + logger: logrus.WithField("WHO", "Thirdcomponent Prober"), http: httpprobe.New(), tcp: tcpprobe.New(), recorder: recorder, @@ -41,7 +43,7 @@ func (pb *prober) probe(thirdComponent *v1alpha1.ThirdComponent, endpointStatus probeSpec := thirdComponent.Spec.Probe if probeSpec == nil { - logrus.Warningf("probe for %s is nil", endpointID) + pb.logger.Warningf("probe for %s is nil", endpointID) return results.Success, nil } @@ -49,10 +51,10 @@ func (pb *prober) probe(thirdComponent *v1alpha1.ThirdComponent, endpointStatus if err != nil || (result != probe.Success) { // Probe failed in one way or another. if err != nil { - logrus.Infof("probe for %q errored: %v", endpointID, err) + pb.logger.Infof("probe for %q errored: %v", endpointID, err) pb.recordContainerEvent(thirdComponent, v1.EventTypeWarning, "EndpointUnhealthy", "probe errored: %v", err) } else { // result != probe.Success - logrus.Infof("probe for %q failed (%v): %s", endpointID, result, output) + pb.logger.Debugf("probe for %q failed (%v): %s", endpointID, result, output) pb.recordContainerEvent(thirdComponent, v1.EventTypeWarning, "EndpointUnhealthy", "probe failed: %s", output) } return results.Failure, err @@ -79,11 +81,10 @@ func (pb *prober) runProbe(p *v1alpha1.Probe, thirdComponent *v1alpha1.ThirdComp timeout := time.Duration(p.TimeoutSeconds) * time.Second if p.HTTPGet != nil { - u, err := url.Parse(string(endpointStatus.Address)) + u, err := url.Parse(endpointStatus.Address.EnsureScheme()) if err != nil { return probe.Unknown, "", err } - u.Path = p.HTTPGet.Path headers := buildHeader(p.HTTPGet.HTTPHeaders) return pb.http.Probe(u, headers, timeout) } @@ -92,7 +93,7 @@ func (pb *prober) runProbe(p *v1alpha1.Probe, thirdComponent *v1alpha1.ThirdComp return pb.tcp.Probe(endpointStatus.Address.GetIP(), endpointStatus.Address.GetPort(), timeout) } - logrus.Warningf("Failed to find probe builder for endpoint address: %v", endpointID) + pb.logger.Warningf("Failed to find probe builder for endpoint address: %v", endpointID) return probe.Unknown, "", fmt.Errorf("missing probe handler for %s/%s", thirdComponent.Namespace, thirdComponent.Name) } From 603a752d323d3ca16bb953011b63b03b35a6fd64 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Fri, 6 Aug 2021 11:38:30 +0800 Subject: [PATCH 23/43] change probe --- api/controller/service_action.go | 8 ++++--- api/handler/service_operation.go | 22 +++++++++---------- .../thirdcomponentdefinition.go | 2 ++ .../thirdcomponent/prober/prober_manager.go | 8 ++----- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/api/controller/service_action.go b/api/controller/service_action.go index 09302d9a2..445651d5e 100644 --- a/api/controller/service_action.go +++ b/api/controller/service_action.go @@ -559,9 +559,11 @@ func (t *TenantStruct) UpgradeService(w http.ResponseWriter, r *http.Request) { tenant := r.Context().Value(ctxutil.ContextKey("tenant")).(*dbmodel.Tenants) service := r.Context().Value(ctxutil.ContextKey("service")).(*dbmodel.TenantServices) - if err := handler.CheckTenantResource(r.Context(), tenant, service.Replicas*service.ContainerMemory); err != nil { - httputil.ReturnResNotEnough(r, w, upgradeRequest.EventID, err.Error()) - return + if service.Kind != "third_party" { + if err := handler.CheckTenantResource(r.Context(), tenant, service.Replicas*service.ContainerMemory); err != nil { + httputil.ReturnResNotEnough(r, w, upgradeRequest.EventID, err.Error()) + return + } } res, err := handler.GetOperationHandler().Upgrade(&upgradeRequest) diff --git a/api/handler/service_operation.go b/api/handler/service_operation.go index 4c85ab6ef..d87072b00 100644 --- a/api/handler/service_operation.go +++ b/api/handler/service_operation.go @@ -28,6 +28,7 @@ import ( gclient "github.com/goodrain/rainbond/mq/client" "github.com/goodrain/rainbond/util" dmodel "github.com/goodrain/rainbond/worker/discover/model" + "github.com/jinzhu/gorm" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -175,14 +176,11 @@ func (o *OperationHandler) upgrade(batchOpReq model.ComponentOpReq) error { if err != nil { return err } - if dbmodel.ServiceKind(component.Kind) == dbmodel.ServiceKindThirdParty { - return err - } batchOpReq.SetVersion(component.DeployVersion) version, err := db.GetManager().VersionInfoDao().GetVersionByDeployVersion(batchOpReq.GetVersion(), batchOpReq.GetComponentID()) - if err != nil { + if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return err } oldDeployVersion := component.DeployVersion @@ -191,13 +189,15 @@ func (o *OperationHandler) upgrade(batchOpReq model.ComponentOpReq) error { _ = db.GetManager().TenantServiceDao().UpdateModel(component) } - if version.FinalStatus != "success" { - logrus.Warnf("deploy version %s is not build success,can not change deploy version in this upgrade event", batchOpReq.GetVersion()) - } else { - component.DeployVersion = batchOpReq.GetVersion() - err = db.GetManager().TenantServiceDao().UpdateModel(component) - if err != nil { - return err + if version != nil { + if version.FinalStatus != "success" { + logrus.Warnf("deploy version %s is not build success,can not change deploy version in this upgrade event", batchOpReq.GetVersion()) + } else { + component.DeployVersion = batchOpReq.GetVersion() + err = db.GetManager().TenantServiceDao().UpdateModel(component) + if err != nil { + return err + } } } diff --git a/worker/appm/componentdefinition/thirdcomponentdefinition.go b/worker/appm/componentdefinition/thirdcomponentdefinition.go index 709b80a9f..887c4e446 100644 --- a/worker/appm/componentdefinition/thirdcomponentdefinition.go +++ b/worker/appm/componentdefinition/thirdcomponentdefinition.go @@ -73,6 +73,8 @@ parameter: { vale?: string }] } + tcpSocket?:{ + } timeoutSeconds?: >0 & <=65533 periodSeconds?: >0 & <=65533 successThreshold?: >0 & <=65533 diff --git a/worker/master/controller/thirdcomponent/prober/prober_manager.go b/worker/master/controller/thirdcomponent/prober/prober_manager.go index 29ad8001f..3e0ab31ff 100644 --- a/worker/master/controller/thirdcomponent/prober/prober_manager.go +++ b/worker/master/controller/thirdcomponent/prober/prober_manager.go @@ -82,13 +82,9 @@ func (m *manager) AddThirdComponent(thirdComponent *v1alpha1.ThirdComponent) { key := string(ep.Address) worker := newWorker(m, thirdComponent, *ep) oldWorker, ok := workers[key] - if ok { + if ok && worker.spec.Equals(oldWorker.spec) { + newWorkers[key] = oldWorker delete(workers, key) - if !worker.spec.Equals(oldWorker.spec) { - // update probe - oldWorker.spec = worker.spec - newWorkers[key] = oldWorker - } continue } // run new worker From 4cfd067f34a58a56eb48f54cc94394a50c329f6c Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Fri, 6 Aug 2021 14:51:51 +0800 Subject: [PATCH 24/43] set domain annotation --- api/controller/third_party_service.go | 5 +- pkg/apis/rainbond/v1alpha1/third_component.go | 48 ++++++++++++++----- .../controller/thirdcomponent/controller.go | 19 ++++++++ .../thirdcomponent/discover_pool.go | 2 +- 4 files changed, 58 insertions(+), 16 deletions(-) diff --git a/api/controller/third_party_service.go b/api/controller/third_party_service.go index 17eed0957..b1960cdf9 100644 --- a/api/controller/third_party_service.go +++ b/api/controller/third_party_service.go @@ -19,7 +19,6 @@ package controller import ( - "encoding/json" "net/http" "github.com/goodrain/rainbond/api/handler" @@ -137,9 +136,7 @@ func (t *ThirdPartyServiceController) listEndpoints(w http.ResponseWriter, r *ht httputil.ReturnError(r, w, 500, err.Error()) return } - b, _ := json.Marshal(res) - logrus.Debugf("response endpoints: %s", string(b)) - if res == nil || len(res) == 0 { + if len(res) == 0 { httputil.ReturnSuccess(r, w, []*model.EndpointResp{}) return } diff --git a/pkg/apis/rainbond/v1alpha1/third_component.go b/pkg/apis/rainbond/v1alpha1/third_component.go index dfcf1d588..dfa36ff48 100644 --- a/pkg/apis/rainbond/v1alpha1/third_component.go +++ b/pkg/apis/rainbond/v1alpha1/third_component.go @@ -21,10 +21,12 @@ package v1alpha1 import ( "fmt" "net" + "net/url" "strconv" "strings" validation "github.com/goodrain/rainbond/util/endpoint" + "github.com/sirupsen/logrus" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -87,7 +89,7 @@ func (in ThirdComponentSpec) NeedProbe() bool { if in.Probe == nil { return false } - if in.EndpointSource.StaticEndpoints != nil && *in.EndpointSource.StaticEndpoints == true { + if in.EndpointSource.StaticEndpoints != nil && *in.EndpointSource.StaticEndpoints { return true } return false @@ -312,12 +314,26 @@ func (e EndpointAddress) getIP() string { // GetPort - func (e EndpointAddress) GetPort() int { - info := strings.Split(string(e), ":") - if len(info) == 2 { - port, _ := strconv.Atoi(info[1]) - return port + if !validation.IsDomainNotIP(string(e)) { + info := strings.Split(string(e), ":") + if len(info) == 2 { + port, _ := strconv.Atoi(info[1]) + return port + } + return 0 } - return 0 + + u, err := url.Parse(e.EnsureScheme()) + if err != nil { + logrus.Errorf("parse address %s: %v", e.EnsureScheme(), err) + return 0 + } + logrus.Infof("url: %s; scheme: %s", e.EnsureScheme(), u.Scheme) + if u.Scheme == "https" { + return 443 + } + + return 80 } // EnsureScheme - @@ -332,13 +348,23 @@ func (e EndpointAddress) EnsureScheme() string { // NewEndpointAddress - func NewEndpointAddress(host string, port int) *EndpointAddress { - if net.ParseIP(host) == nil { + if !validation.IsDomainNotIP(host) { + if net.ParseIP(host) == nil { + return nil + } + if port < 0 || port > 65533 { + return nil + } + ea := EndpointAddress(fmt.Sprintf("%s:%d", host, port)) + return &ea + } + + u, err := url.Parse(host) + if err != nil { return nil } - if port < 0 || port > 65533 { - return nil - } - ea := EndpointAddress(fmt.Sprintf("%s:%d", host, port)) + u.Path = "" + ea := EndpointAddress(u.String()) return &ea } diff --git a/worker/master/controller/thirdcomponent/controller.go b/worker/master/controller/thirdcomponent/controller.go index 69947920c..25ec80a3e 100644 --- a/worker/master/controller/thirdcomponent/controller.go +++ b/worker/master/controller/thirdcomponent/controller.go @@ -25,6 +25,7 @@ import ( "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" rainbondlistersv1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1" + validation "github.com/goodrain/rainbond/util/endpoint" dis "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/discover" "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober" "github.com/oam-dev/kubevela/pkg/utils/apply" @@ -158,6 +159,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e } // create endpoint for component service for _, service := range services.Items { + service := service for _, port := range service.Spec.Ports { // if component port not exist in endpoint port list, ignore it. if sourceEndpoint, ok := portMap[int(port.Port)]; ok { @@ -175,6 +177,10 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e if err := r.applyer.Apply(ctx, &endpoint); err != nil { log.Errorf("apply endpoint for service %s failure %s", service.Name, err.Error()) } + service.Annotations = endpoint.Annotations + if err := r.applyer.Apply(ctx, &service); err != nil { + log.Errorf("apply service(%s) for updating annotation: %v", service.Name, err) + } log.Infof("apply endpoint for service %s success", service.Name) } } @@ -183,6 +189,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e } component.Status.Endpoints = endpoints component.Status.Phase = v1alpha1.ComponentRunning + component.Status.Reason = "" if err := r.updateStatus(ctx, component); err != nil { log.Errorf("update status failure %s", err.Error()) return commonResult, nil @@ -197,6 +204,8 @@ func createEndpoint(component *v1alpha1.ThirdComponent, service *corev1.Service, spep[endpoint.ServicePort] = endpoint.Address.GetPort() } } + + var domain string endpoints := corev1.Endpoints{ TypeMeta: metav1.TypeMeta{ Kind: "Endpoints", @@ -228,6 +237,9 @@ func createEndpoint(component *v1alpha1.ThirdComponent, service *corev1.Service, }(), Addresses: func() (re []corev1.EndpointAddress) { for _, se := range sourceEndpoint { + if validation.IsDomainNotIP(string(se.Address)) { + domain = string(se.Address) + } if se.Status == v1alpha1.EndpointReady { re = append(re, corev1.EndpointAddress{ IP: se.Address.GetIP(), @@ -266,6 +278,13 @@ func createEndpoint(component *v1alpha1.ThirdComponent, service *corev1.Service, } }(), } + + if domain != "" { + endpoints.Annotations = map[string]string{ + "domain": domain, + } + } + return endpoints } diff --git a/worker/master/controller/thirdcomponent/discover_pool.go b/worker/master/controller/thirdcomponent/discover_pool.go index 7fb9c4af4..fef03f9ee 100644 --- a/worker/master/controller/thirdcomponent/discover_pool.go +++ b/worker/master/controller/thirdcomponent/discover_pool.go @@ -75,7 +75,7 @@ func (d *DiscoverPool) Start() { d.RemoveDiscover(component) return } - logrus.Errorf("update component status failure", err.Error()) + logrus.Errorf("update component status failure: %s", err.Error()) } logrus.Infof("update component %s status success by discover pool", name) } From 07dc0719b4c0cda75f0e55a265c0d855a07a6b54 Mon Sep 17 00:00:00 2001 From: yangk Date: Fri, 6 Aug 2021 15:22:59 +0800 Subject: [PATCH 25/43] Fix the inconsistency between the console and cluster data after opening the plug-in for the component --- api/handler/service_plugin.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/api/handler/service_plugin.go b/api/handler/service_plugin.go index 940ed5f70..99981e84f 100644 --- a/api/handler/service_plugin.go +++ b/api/handler/service_plugin.go @@ -154,14 +154,22 @@ func (s *ServiceAction) SetTenantServicePluginRelation(tenantID, serviceID strin tx.Rollback() return nil, util.CreateAPIHandleErrorFromDBError("set service plugin env error ", err) } + tsprCPU := pluginversion.ContainerCPU + tsprMemory := pluginversion.ContainerMemory + if pss.Body.PluginCPU != 0 { + tsprCPU = pss.Body.PluginCPU + } + if pss.Body.PluginMemory != 0 { + tsprMemory = pss.Body.PluginMemory + } relation := &dbmodel.TenantServicePluginRelation{ VersionID: pss.Body.VersionID, ServiceID: serviceID, PluginID: pss.Body.PluginID, Switch: pss.Body.Switch, PluginModel: plugin.PluginModel, - ContainerCPU: pluginversion.ContainerCPU, - ContainerMemory: pluginversion.ContainerMemory, + ContainerCPU: tsprCPU, + ContainerMemory: tsprMemory, } if err := db.GetManager().TenantServicePluginRelationDaoTransactions(tx).AddModel(relation); err != nil { tx.Rollback() From 3f18d387a222828ea21f3852e886c16c2500d1b1 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Fri, 6 Aug 2021 15:28:16 +0800 Subject: [PATCH 26/43] go lint --- .../componentdefinition.go | 36 +++++++++---------- .../controller/thirdcomponent/controller.go | 2 ++ .../thirdcomponent/discover/discover.go | 2 ++ .../thirdcomponent/discover_pool.go | 14 ++++++++ 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/worker/appm/componentdefinition/componentdefinition.go b/worker/appm/componentdefinition/componentdefinition.go index e7497497e..3fc481329 100644 --- a/worker/appm/componentdefinition/componentdefinition.go +++ b/worker/appm/componentdefinition/componentdefinition.go @@ -42,20 +42,20 @@ var ErrNotSupport = fmt.Errorf("not support component definition") // ErrOnlyCUESupport - var ErrOnlyCUESupport = fmt.Errorf("component definition only support cue template") -// ComponentDefinitionBuilder - -type ComponentDefinitionBuilder struct { +// Builder - +type Builder struct { logger *logrus.Entry definitions map[string]*v1alpha1.ComponentDefinition namespace string lock sync.Mutex } -var componentDefinitionBuilder *ComponentDefinitionBuilder +var componentDefinitionBuilder *Builder // NewComponentDefinitionBuilder - -func NewComponentDefinitionBuilder(namespace string) *ComponentDefinitionBuilder { - componentDefinitionBuilder = &ComponentDefinitionBuilder{ - logger: logrus.WithField("WHO", "ComponentDefinitionBuilder"), +func NewComponentDefinitionBuilder(namespace string) *Builder { + componentDefinitionBuilder = &Builder{ + logger: logrus.WithField("WHO", "Builder"), definitions: make(map[string]*v1alpha1.ComponentDefinition), namespace: namespace, } @@ -63,12 +63,12 @@ func NewComponentDefinitionBuilder(namespace string) *ComponentDefinitionBuilder } // GetComponentDefinitionBuilder - -func GetComponentDefinitionBuilder() *ComponentDefinitionBuilder { +func GetComponentDefinitionBuilder() *Builder { return componentDefinitionBuilder } // OnAdd - -func (c *ComponentDefinitionBuilder) OnAdd(obj interface{}) { +func (c *Builder) OnAdd(obj interface{}) { c.lock.Lock() defer c.lock.Unlock() cd, ok := obj.(*v1alpha1.ComponentDefinition) @@ -79,7 +79,7 @@ func (c *ComponentDefinitionBuilder) OnAdd(obj interface{}) { } // OnUpdate - -func (c *ComponentDefinitionBuilder) OnUpdate(oldObj, newObj interface{}) { +func (c *Builder) OnUpdate(oldObj, newObj interface{}) { c.lock.Lock() defer c.lock.Unlock() cd, ok := newObj.(*v1alpha1.ComponentDefinition) @@ -90,7 +90,7 @@ func (c *ComponentDefinitionBuilder) OnUpdate(oldObj, newObj interface{}) { } // OnDelete - -func (c *ComponentDefinitionBuilder) OnDelete(obj interface{}) { +func (c *Builder) OnDelete(obj interface{}) { c.lock.Lock() defer c.lock.Unlock() cd, ok := obj.(*v1alpha1.ComponentDefinition) @@ -101,14 +101,14 @@ func (c *ComponentDefinitionBuilder) OnDelete(obj interface{}) { } // GetComponentDefinition - -func (c *ComponentDefinitionBuilder) GetComponentDefinition(name string) *v1alpha1.ComponentDefinition { +func (c *Builder) GetComponentDefinition(name string) *v1alpha1.ComponentDefinition { c.lock.Lock() defer c.lock.Unlock() return c.definitions[name] } // GetComponentProperties - -func (c *ComponentDefinitionBuilder) GetComponentProperties(as *v1.AppService, dbm db.Manager, cd *v1alpha1.ComponentDefinition) interface{} { +func (c *Builder) GetComponentProperties(as *v1.AppService, dbm db.Manager, cd *v1alpha1.ComponentDefinition) interface{} { //TODO: support custom component properties switch cd.Name { case thirdComponentDefineName: @@ -168,7 +168,7 @@ func (c *ComponentDefinitionBuilder) GetComponentProperties(as *v1.AppService, d } } -func (c *ComponentDefinitionBuilder) containsEndpoints(componentID string) (bool, error) { +func (c *Builder) containsEndpoints(componentID string) (bool, error) { endpoints, err := db.GetManager().EndpointsDao().List(componentID) if err != nil { return false, err @@ -177,7 +177,7 @@ func (c *ComponentDefinitionBuilder) containsEndpoints(componentID string) (bool } // BuildWorkloadResource - -func (c *ComponentDefinitionBuilder) BuildWorkloadResource(as *v1.AppService, dbm db.Manager) error { +func (c *Builder) BuildWorkloadResource(as *v1.AppService, dbm db.Manager) error { cd := c.GetComponentDefinition(as.GetComponentDefinitionName()) if cd == nil { return ErrNotSupport @@ -200,7 +200,7 @@ func (c *ComponentDefinitionBuilder) BuildWorkloadResource(as *v1.AppService, db //InitCoreComponentDefinition init the built-in component type definition. //Should be called after the store is initialized. -func (c *ComponentDefinitionBuilder) InitCoreComponentDefinition(rainbondClient rainbondversioned.Interface) { +func (c *Builder) InitCoreComponentDefinition(rainbondClient rainbondversioned.Interface) { coreComponentDefinition := []*v1alpha1.ComponentDefinition{&thirdComponentDefine} for _, ccd := range coreComponentDefinition { if c.GetComponentDefinition(ccd.Name) == nil { @@ -213,7 +213,7 @@ func (c *ComponentDefinitionBuilder) InitCoreComponentDefinition(rainbondClient logrus.Infof("success check core componentdefinition from cluster") } -func (c *ComponentDefinitionBuilder) createProbe(componentID string) (*v1alpha1.Probe, error) { +func (c *Builder) createProbe(componentID string) (*v1alpha1.Probe, error) { probe, err := db.GetManager().ServiceProbeDao().GetServiceUsedProbe(componentID, "readiness") if err != nil { return nil, err @@ -237,7 +237,7 @@ func (c *ComponentDefinitionBuilder) createProbe(componentID string) (*v1alpha1. return p, nil } -func (c *ComponentDefinitionBuilder) createHTTPGetAction(probe *dbmodel.TenantServiceProbe) *v1alpha1.HTTPGetAction { +func (c *Builder) createHTTPGetAction(probe *dbmodel.TenantServiceProbe) *v1alpha1.HTTPGetAction { action := &v1alpha1.HTTPGetAction{Path: probe.Path} if probe.HTTPHeader != "" { hds := strings.Split(probe.HTTPHeader, ",") @@ -263,7 +263,7 @@ func (c *ComponentDefinitionBuilder) createHTTPGetAction(probe *dbmodel.TenantSe return action } -func (c *ComponentDefinitionBuilder) createTCPGetAction(probe *dbmodel.TenantServiceProbe) *v1alpha1.TCPSocketAction { +func (c *Builder) createTCPGetAction(probe *dbmodel.TenantServiceProbe) *v1alpha1.TCPSocketAction { return &v1alpha1.TCPSocketAction{ } } diff --git a/worker/master/controller/thirdcomponent/controller.go b/worker/master/controller/thirdcomponent/controller.go index 25ec80a3e..9fca717b5 100644 --- a/worker/master/controller/thirdcomponent/controller.go +++ b/worker/master/controller/thirdcomponent/controller.go @@ -52,6 +52,7 @@ import ( const reconcileTimeOut = 60 * time.Second +// Reconciler - type Reconciler struct { Client client.Client restConfig *rest.Config @@ -313,6 +314,7 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { Complete(r) } +// Collect - func (r *Reconciler) Collect(ch chan<- prometheus.Metric) { ch <- prometheus.MustNewConstMetric(r.discoverNum.Desc(), prometheus.GaugeValue, r.discoverPool.GetSize()) } diff --git a/worker/master/controller/thirdcomponent/discover/discover.go b/worker/master/controller/thirdcomponent/discover/discover.go index 2f0772e6a..ecac502a0 100644 --- a/worker/master/controller/thirdcomponent/discover/discover.go +++ b/worker/master/controller/thirdcomponent/discover/discover.go @@ -35,12 +35,14 @@ import ( "k8s.io/client-go/rest" ) +// Discover - type Discover interface { GetComponent() *v1alpha1.ThirdComponent DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComponentEndpointStatus, error) Discover(ctx context.Context, update chan *v1alpha1.ThirdComponent) ([]*v1alpha1.ThirdComponentEndpointStatus, error) } +// NewDiscover - func NewDiscover(component *v1alpha1.ThirdComponent, restConfig *rest.Config, lister rainbondlistersv1alpha1.ThirdComponentLister, proberManager prober.Manager) (Discover, error) { diff --git a/worker/master/controller/thirdcomponent/discover_pool.go b/worker/master/controller/thirdcomponent/discover_pool.go index fef03f9ee..2e8f197a2 100644 --- a/worker/master/controller/thirdcomponent/discover_pool.go +++ b/worker/master/controller/thirdcomponent/discover_pool.go @@ -32,6 +32,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) +// DiscoverPool - type DiscoverPool struct { ctx context.Context lock sync.Mutex @@ -40,6 +41,7 @@ type DiscoverPool struct { reconciler *Reconciler } +// NewDiscoverPool - func NewDiscoverPool(ctx context.Context, reconciler *Reconciler) *DiscoverPool { dp := &DiscoverPool{ ctx: ctx, @@ -50,11 +52,15 @@ func NewDiscoverPool(ctx context.Context, reconciler *Reconciler) *DiscoverPool go dp.Start() return dp } + +// GetSize - func (d *DiscoverPool) GetSize() float64 { d.lock.Lock() defer d.lock.Unlock() return float64(len(d.discoverWorker)) } + +// Start - func (d *DiscoverPool) Start() { logrus.Infof("third component discover pool started") for { @@ -84,6 +90,7 @@ func (d *DiscoverPool) Start() { } } +// Worker - type Worker struct { discover dis.Discover cancel context.CancelFunc @@ -92,6 +99,7 @@ type Worker struct { stoped bool } +// Start - func (w *Worker) Start() { defer func() { logrus.Infof("discover endpoint list worker %s/%s stoed", w.discover.GetComponent().Namespace, w.discover.GetComponent().Name) @@ -110,14 +118,17 @@ func (w *Worker) Start() { } } +// UpdateDiscover - func (w *Worker) UpdateDiscover(discover dis.Discover) { w.discover = discover } +// Stop - func (w *Worker) Stop() { w.cancel() } +// IsStop - func (w *Worker) IsStop() bool { return w.stoped } @@ -132,6 +143,7 @@ func (d *DiscoverPool) newWorker(dis dis.Discover) *Worker { } } +// AddDiscover - func (d *DiscoverPool) AddDiscover(dis dis.Discover) { d.lock.Lock() defer d.lock.Unlock() @@ -153,6 +165,7 @@ func (d *DiscoverPool) AddDiscover(dis dis.Discover) { d.discoverWorker[key] = worker } +// RemoveDiscover - func (d *DiscoverPool) RemoveDiscover(component *v1alpha1.ThirdComponent) { d.lock.Lock() defer d.lock.Unlock() @@ -164,6 +177,7 @@ func (d *DiscoverPool) RemoveDiscover(component *v1alpha1.ThirdComponent) { } } +// RemoveDiscoverByName - func (d *DiscoverPool) RemoveDiscoverByName(req types.NamespacedName) { d.lock.Lock() defer d.lock.Unlock() From 58efe71bd36c61ceacf909533d8465195622e624 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Mon, 9 Aug 2021 14:40:05 +0800 Subject: [PATCH 27/43] restore static endpoints --- config/crd/rainbond.io_thirdcomponents.yaml | 19 ++++++++- pkg/apis/rainbond/v1alpha1/third_component.go | 19 +++++++-- .../v1alpha1/zz_generated.deepcopy.go | 10 ++++- .../component_properties.go | 8 ++-- .../componentdefinition.go | 18 +++++--- .../thirdcomponentdefinition.go | 6 ++- .../thirdcomponent/discover/discover.go | 3 +- .../thirdcomponent/discover/staticendpoint.go | 42 +++++++++++-------- 8 files changed, 87 insertions(+), 38 deletions(-) diff --git a/config/crd/rainbond.io_thirdcomponents.yaml b/config/crd/rainbond.io_thirdcomponents.yaml index f42833551..82cf8f969 100644 --- a/config/crd/rainbond.io_thirdcomponents.yaml +++ b/config/crd/rainbond.io_thirdcomponents.yaml @@ -40,7 +40,24 @@ spec: description: endpoint source config properties: endpoints: - type: boolean + items: + description: ThirdComponentEndpoint - + properties: + address: + description: The address including the port number. + type: string + clientSecret: + description: Specify a private certificate when the protocol + is HTTPS + type: string + protocol: + description: 'Address protocols, including: HTTP, TCP, UDP, + HTTPS' + type: string + required: + - address + type: object + type: array kubernetesService: description: KubernetesServiceSource - properties: diff --git a/pkg/apis/rainbond/v1alpha1/third_component.go b/pkg/apis/rainbond/v1alpha1/third_component.go index dfa36ff48..ca612e4ba 100644 --- a/pkg/apis/rainbond/v1alpha1/third_component.go +++ b/pkg/apis/rainbond/v1alpha1/third_component.go @@ -89,7 +89,7 @@ func (in ThirdComponentSpec) NeedProbe() bool { if in.Probe == nil { return false } - if in.EndpointSource.StaticEndpoints != nil && *in.EndpointSource.StaticEndpoints { + if len(in.EndpointSource.StaticEndpoints) > 0 { return true } return false @@ -97,8 +97,8 @@ func (in ThirdComponentSpec) NeedProbe() bool { // ThirdComponentEndpointSource - type ThirdComponentEndpointSource struct { - StaticEndpoints *bool `json:"endpoints,omitempty"` - KubernetesService *KubernetesServiceSource `json:"kubernetesService,omitempty"` + StaticEndpoints []*ThirdComponentEndpoint `json:"endpoints,omitempty"` + KubernetesService *KubernetesServiceSource `json:"kubernetesService,omitempty"` //other source // NacosSource // EurekaSource @@ -118,6 +118,17 @@ type ThirdComponentEndpoint struct { ClientSecret string `json:"clientSecret,omitempty"` } +// GetPort - +func (in *ThirdComponentEndpoint) GetPort() int { + arr := strings.Split(in.Address, ":") + if len(arr) != 2 { + return 0 + } + + port, _ := strconv.Atoi(arr[1]) + return port +} + // KubernetesServiceSource - type KubernetesServiceSource struct { // If not specified, the namespace is the namespace of the current resource @@ -314,7 +325,7 @@ func (e EndpointAddress) getIP() string { // GetPort - func (e EndpointAddress) GetPort() int { - if !validation.IsDomainNotIP(string(e)) { + if !validation.IsDomainNotIP(e.getIP()) { info := strings.Split(string(e), ":") if len(info) == 2 { port, _ := strconv.Atoi(info[1]) diff --git a/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go index e84c1ea5e..8d42aebd9 100644 --- a/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/rainbond/v1alpha1/zz_generated.deepcopy.go @@ -476,8 +476,14 @@ func (in *ThirdComponentEndpointSource) DeepCopyInto(out *ThirdComponentEndpoint *out = *in if in.StaticEndpoints != nil { in, out := &in.StaticEndpoints, &out.StaticEndpoints - *out = new(bool) - **out = **in + *out = make([]*ThirdComponentEndpoint, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ThirdComponentEndpoint) + **out = **in + } + } } if in.KubernetesService != nil { in, out := &in.KubernetesService, &out.KubernetesService diff --git a/worker/appm/componentdefinition/component_properties.go b/worker/appm/componentdefinition/component_properties.go index 00d6f3874..acce904c8 100644 --- a/worker/appm/componentdefinition/component_properties.go +++ b/worker/appm/componentdefinition/component_properties.go @@ -22,10 +22,10 @@ import "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" //ThirdComponentProperties third component properties type ThirdComponentProperties struct { - Kubernetes *ThirdComponentKubernetes `json:"kubernetes,omitempty"` - Endpoints *bool `json:"endpoints,omitempty"` - Port []*ThirdComponentPort `json:"port"` - Probe *v1alpha1.Probe `json:"probe,omitempty"` + Kubernetes *ThirdComponentKubernetes `json:"kubernetes,omitempty"` + Endpoints []*v1alpha1.ThirdComponentEndpoint `json:"endpoints,omitempty"` + Port []*ThirdComponentPort `json:"port"` + Probe *v1alpha1.Probe `json:"probe,omitempty"` } // ThirdComponentPort - diff --git a/worker/appm/componentdefinition/componentdefinition.go b/worker/appm/componentdefinition/componentdefinition.go index 3fc481329..2a3affbf4 100644 --- a/worker/appm/componentdefinition/componentdefinition.go +++ b/worker/appm/componentdefinition/componentdefinition.go @@ -29,7 +29,6 @@ import ( dbmodel "github.com/goodrain/rainbond/db/model" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" rainbondversioned "github.com/goodrain/rainbond/pkg/generated/clientset/versioned" - "github.com/goodrain/rainbond/util/commonutil" v1 "github.com/goodrain/rainbond/worker/appm/types/v1" "github.com/sirupsen/logrus" k8sErrors "k8s.io/apimachinery/pkg/api/errors" @@ -128,11 +127,11 @@ func (c *Builder) GetComponentProperties(as *v1.AppService, dbm db.Manager, cd * } // static endpoints - containsEndpoints, err := c.containsEndpoints(as.ServiceID) + endpoints, err := c.listStaticEndpoints(as.ServiceID) if err != nil { c.logger.Errorf("component id: %s; list static endpoints: %v", as.ServiceID, err) } - properties.Endpoints = commonutil.Bool(containsEndpoints) + properties.Endpoints = endpoints ports, err := dbm.TenantServicesPortDao().GetPortsByServiceID(as.ServiceID) if err != nil { @@ -168,12 +167,19 @@ func (c *Builder) GetComponentProperties(as *v1.AppService, dbm db.Manager, cd * } } -func (c *Builder) containsEndpoints(componentID string) (bool, error) { +func (c *Builder) listStaticEndpoints(componentID string) ([]*v1alpha1.ThirdComponentEndpoint, error) { endpoints, err := db.GetManager().EndpointsDao().List(componentID) if err != nil { - return false, err + return nil, err } - return len(endpoints) > 0, nil + + var res []*v1alpha1.ThirdComponentEndpoint + for _, ep := range endpoints { + res = append(res, &v1alpha1.ThirdComponentEndpoint{ + Address: ep.GetAddress(), + }) + } + return res, nil } // BuildWorkloadResource - diff --git a/worker/appm/componentdefinition/thirdcomponentdefinition.go b/worker/appm/componentdefinition/thirdcomponentdefinition.go index 887c4e446..e07d68c07 100644 --- a/worker/appm/componentdefinition/thirdcomponentdefinition.go +++ b/worker/appm/componentdefinition/thirdcomponentdefinition.go @@ -58,7 +58,11 @@ parameter: { namespace?: string name: string } - endpoints?: bool + endpoints?: [...{ + address: string + protocol?: string + clientSecret?: string + }] port?: [...{ name: string port: >0 & <=65533 diff --git a/worker/master/controller/thirdcomponent/discover/discover.go b/worker/master/controller/thirdcomponent/discover/discover.go index ecac502a0..1ec50cba3 100644 --- a/worker/master/controller/thirdcomponent/discover/discover.go +++ b/worker/master/controller/thirdcomponent/discover/discover.go @@ -25,7 +25,6 @@ import ( "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" rainbondlistersv1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1" - "github.com/goodrain/rainbond/util/commonutil" "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober" "github.com/sirupsen/logrus" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -57,7 +56,7 @@ func NewDiscover(component *v1alpha1.ThirdComponent, client: clientset, }, nil } - if commonutil.BoolValue(component.Spec.EndpointSource.StaticEndpoints) { + if len(component.Spec.EndpointSource.StaticEndpoints) > 0 { return &staticEndpoint{ component: component, lister: lister, diff --git a/worker/master/controller/thirdcomponent/discover/staticendpoint.go b/worker/master/controller/thirdcomponent/discover/staticendpoint.go index 80b643cf5..643892b8d 100644 --- a/worker/master/controller/thirdcomponent/discover/staticendpoint.go +++ b/worker/master/controller/thirdcomponent/discover/staticendpoint.go @@ -4,12 +4,10 @@ import ( "context" "time" - "github.com/goodrain/rainbond/db" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" rainbondlistersv1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1" "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober" "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober/results" - "github.com/pkg/errors" ) type staticEndpoint struct { @@ -39,30 +37,38 @@ func (s *staticEndpoint) Discover(ctx context.Context, update chan *v1alpha1.Thi } func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { - // Optimization: reduce the press of database if necessary. - endpoints, err := db.GetManager().EndpointsDao().ListIsOnline(s.component.GetComponentID()) + component, err := s.lister.ThirdComponents(s.component.Namespace).Get(s.component.Name) if err != nil { - return nil, errors.WithMessage(err, "list online static endpoints") + return nil, err } var res []*v1alpha1.ThirdComponentEndpointStatus - for _, ep := range endpoints { - ed := v1alpha1.NewEndpointAddress(ep.IP, ep.Port) - if ed == nil { + for _, ep := range component.Spec.EndpointSource.StaticEndpoints { + var addresses []*v1alpha1.EndpointAddress + if ep.GetPort() != 0 { + addresses = append(addresses, v1alpha1.NewEndpointAddress(ep.Address, ep.GetPort())) + } else { + for _, port := range component.Spec.Ports { + addresses = append(addresses, v1alpha1.NewEndpointAddress(ep.Address, port.Port)) + } + } + if len(addresses) == 0 { continue } - es := &v1alpha1.ThirdComponentEndpointStatus{ - ServicePort: ep.Port, - Address: v1alpha1.EndpointAddress(ep.GetAddress()), - Status: v1alpha1.EndpointReady, - } - res = append(res, es) + for _, address := range addresses { + address := address + es := &v1alpha1.ThirdComponentEndpointStatus{ + Address: *address, + Status: v1alpha1.EndpointReady, + } + res = append(res, es) - result, found := s.proberManager.GetResult(s.component.GetEndpointID(es)) - es.Status = v1alpha1.EndpointReady - if found && result != results.Success { - es.Status = v1alpha1.EndpointNotReady + result, found := s.proberManager.GetResult(s.component.GetEndpointID(es)) + es.Status = v1alpha1.EndpointReady + if found && result != results.Success { + es.Status = v1alpha1.EndpointNotReady + } } } From 22ad82155f58feb1f95c67fa0ce26a9670c53033 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Tue, 10 Aug 2021 10:08:30 +0800 Subject: [PATCH 28/43] do not get component again --- .../thirdcomponent/discover/staticendpoint.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/worker/master/controller/thirdcomponent/discover/staticendpoint.go b/worker/master/controller/thirdcomponent/discover/staticendpoint.go index 643892b8d..c8163d87a 100644 --- a/worker/master/controller/thirdcomponent/discover/staticendpoint.go +++ b/worker/master/controller/thirdcomponent/discover/staticendpoint.go @@ -2,6 +2,7 @@ package discover import ( "context" + "reflect" "time" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" @@ -31,24 +32,21 @@ func (s *staticEndpoint) Discover(ctx context.Context, update chan *v1alpha1.Thi newComponent := s.component.DeepCopy() newComponent.Status.Endpoints = endpoints - update <- newComponent + if !reflect.DeepEqual(endpoints, s.component.Status.Endpoints) { + update <- newComponent + } return endpoints, nil } func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { - component, err := s.lister.ThirdComponents(s.component.Namespace).Get(s.component.Name) - if err != nil { - return nil, err - } - var res []*v1alpha1.ThirdComponentEndpointStatus - for _, ep := range component.Spec.EndpointSource.StaticEndpoints { + for _, ep := range s.component.Spec.EndpointSource.StaticEndpoints { var addresses []*v1alpha1.EndpointAddress if ep.GetPort() != 0 { addresses = append(addresses, v1alpha1.NewEndpointAddress(ep.Address, ep.GetPort())) } else { - for _, port := range component.Spec.Ports { + for _, port := range s.component.Spec.Ports { addresses = append(addresses, v1alpha1.NewEndpointAddress(ep.Address, port.Port)) } } From 6892788feed563e77f5d7bf3290a20ea26035581 Mon Sep 17 00:00:00 2001 From: yangk Date: Tue, 10 Aug 2021 17:46:27 +0800 Subject: [PATCH 29/43] modified dependcy --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 8848c9b44..c87e38e6a 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/mock v1.4.4 github.com/golang/protobuf v1.4.3 - github.com/goodrain/rainbond-oam v0.0.0-20210721020036-158e1be667dc + github.com/goodrain/rainbond-oam v0.0.0-20210810094229-f1cd639c451a github.com/goodrain/rainbond-operator v1.3.1-0.20210401055914-f8fe4bf89a21 github.com/google/go-cmp v0.5.4 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect diff --git a/go.sum b/go.sum index 78a8ce5ad..06a02bcdc 100644 --- a/go.sum +++ b/go.sum @@ -696,6 +696,8 @@ github.com/goodrain/gorm-bulk-upsert v1.0.1-0.20210608013724-7e7870d16357 h1:kdS github.com/goodrain/gorm-bulk-upsert v1.0.1-0.20210608013724-7e7870d16357/go.mod h1:b7/GgeVNbf/SFw4FYIWslxNV5I10C9Mhf/++3jsDk3M= github.com/goodrain/rainbond-oam v0.0.0-20210721020036-158e1be667dc h1:hCtxb/Yy4G+wEc2n+yaXx3j4SF/s34zNI8XK5qkHqXk= github.com/goodrain/rainbond-oam v0.0.0-20210721020036-158e1be667dc/go.mod h1:/dRehR3e1pGexOaIDjA44AHBlVPbb7v+O7GWAVyo740= +github.com/goodrain/rainbond-oam v0.0.0-20210810094229-f1cd639c451a h1:a48En+OrB5PzoOJflEEc77eCzh6mODRHkCpx+4kB2/0= +github.com/goodrain/rainbond-oam v0.0.0-20210810094229-f1cd639c451a/go.mod h1:/dRehR3e1pGexOaIDjA44AHBlVPbb7v+O7GWAVyo740= github.com/goodrain/rainbond-operator v1.3.1-0.20210401055914-f8fe4bf89a21 h1:iCPI96slvJv88iPc1NJW8zhpkiza0kwB0jtsuZIJLRQ= github.com/goodrain/rainbond-operator v1.3.1-0.20210401055914-f8fe4bf89a21/go.mod h1:jcQfNoxO67nkLalCmgihYrdWF82TKyuPW032tgGdqVY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= From 820983a614d328161c0afb8faa97b987aa9c5a6b Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Tue, 10 Aug 2021 18:24:38 +0800 Subject: [PATCH 30/43] make prober manager component level --- pkg/apis/rainbond/v1alpha1/third_component.go | 10 +++ .../controller/thirdcomponent/controller.go | 23 +++---- .../thirdcomponent/discover/discover.go | 12 ++-- .../thirdcomponent/discover/staticendpoint.go | 60 +++++++++++------ .../thirdcomponent/discover_pool.go | 64 +++++-------------- .../thirdcomponent/prober/prober_manager.go | 47 ++++---------- .../thirdcomponent/prober/worker.go | 5 +- .../controller/thirdcomponent/worker.go | 58 +++++++++++++++++ 8 files changed, 155 insertions(+), 124 deletions(-) create mode 100644 worker/master/controller/thirdcomponent/worker.go diff --git a/pkg/apis/rainbond/v1alpha1/third_component.go b/pkg/apis/rainbond/v1alpha1/third_component.go index ca612e4ba..e07b95c17 100644 --- a/pkg/apis/rainbond/v1alpha1/third_component.go +++ b/pkg/apis/rainbond/v1alpha1/third_component.go @@ -129,6 +129,16 @@ func (in *ThirdComponentEndpoint) GetPort() int { return port } +// GetIP - +func (in *ThirdComponentEndpoint) GetIP() string { + arr := strings.Split(in.Address, ":") + if len(arr) != 2 { + return "" + } + + return arr[0] +} + // KubernetesServiceSource - type KubernetesServiceSource struct { // If not specified, the namespace is the namespace of the current resource diff --git a/worker/master/controller/thirdcomponent/controller.go b/worker/master/controller/thirdcomponent/controller.go index 9fca717b5..92f100a2f 100644 --- a/worker/master/controller/thirdcomponent/controller.go +++ b/worker/master/controller/thirdcomponent/controller.go @@ -27,7 +27,6 @@ import ( rainbondlistersv1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1" validation "github.com/goodrain/rainbond/util/endpoint" dis "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/discover" - "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober" "github.com/oam-dev/kubevela/pkg/utils/apply" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" @@ -65,8 +64,7 @@ type Reconciler struct { informer runtimecache.Informer lister rainbondlistersv1alpha1.ThirdComponentLister - recorder record.EventRecorder - proberManager prober.Manager + recorder record.EventRecorder } // Reconcile is the main logic of appDeployment controller @@ -94,14 +92,11 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e if component.DeletionTimestamp != nil { log.Infof("component %s will be deleted", req) r.discoverPool.RemoveDiscover(component) - r.proberManager.RemoveThirdComponent(component) return ctrl.Result{}, nil } - r.proberManager.AddThirdComponent(component) - logrus.Debugf("start to reconcile component %s/%s", component.Namespace, component.Name) - discover, err := dis.NewDiscover(component, r.restConfig, r.lister, r.proberManager) + discover, err := dis.NewDiscover(component, r.restConfig, r.lister) if err != nil { component.Status.Phase = v1alpha1.ComponentFailed component.Status.Reason = err.Error() @@ -114,6 +109,8 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e r.updateStatus(ctx, component) return ctrl.Result{}, nil } + r.discoverPool.AddDiscover(discover) + endpoints, err := discover.DiscoverOne(ctx) if err != nil { component.Status.Phase = v1alpha1.ComponentFailed @@ -121,7 +118,6 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e r.updateStatus(ctx, component) return ctrl.Result{}, nil } - r.discoverPool.AddDiscover(discover) if len(endpoints) == 0 { component.Status.Phase = v1alpha1.ComponentPending @@ -329,8 +325,6 @@ func Setup(ctx context.Context, mgr ctrl.Manager) (*Reconciler, error) { recorder := mgr.GetEventRecorderFor("thirdcomponent-controller") - proberManager := prober.NewManager(recorder) - r := &Reconciler{ Client: mgr.GetClient(), restConfig: mgr.GetConfig(), @@ -341,12 +335,11 @@ func Setup(ctx context.Context, mgr ctrl.Manager) (*Reconciler, error) { Name: "third_component_discover_number", Help: "Number of running endpoint discover worker of third component.", }), - informer: informer, - lister: lister, - proberManager: proberManager, - recorder: recorder, + informer: informer, + lister: lister, + recorder: recorder, } - dp := NewDiscoverPool(ctx, r) + dp := NewDiscoverPool(ctx, r, recorder) r.discoverPool = dp return r, r.SetupWithManager(mgr) } diff --git a/worker/master/controller/thirdcomponent/discover/discover.go b/worker/master/controller/thirdcomponent/discover/discover.go index 1ec50cba3..c480b99ef 100644 --- a/worker/master/controller/thirdcomponent/discover/discover.go +++ b/worker/master/controller/thirdcomponent/discover/discover.go @@ -39,12 +39,13 @@ type Discover interface { GetComponent() *v1alpha1.ThirdComponent DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComponentEndpointStatus, error) Discover(ctx context.Context, update chan *v1alpha1.ThirdComponent) ([]*v1alpha1.ThirdComponentEndpointStatus, error) + SetProberManager(proberManager prober.Manager) } // NewDiscover - func NewDiscover(component *v1alpha1.ThirdComponent, restConfig *rest.Config, - lister rainbondlistersv1alpha1.ThirdComponentLister, proberManager prober.Manager) (Discover, error) { + lister rainbondlistersv1alpha1.ThirdComponentLister) (Discover, error) { if component.Spec.EndpointSource.KubernetesService != nil { clientset, err := kubernetes.NewForConfig(restConfig) if err != nil { @@ -58,9 +59,8 @@ func NewDiscover(component *v1alpha1.ThirdComponent, } if len(component.Spec.EndpointSource.StaticEndpoints) > 0 { return &staticEndpoint{ - component: component, - lister: lister, - proberManager: proberManager, + component: component, + lister: lister, }, nil } return nil, fmt.Errorf("not support source type") @@ -167,3 +167,7 @@ func (k *kubernetesDiscover) DiscoverOne(ctx context.Context) ([]*v1alpha1.Third } return es, nil } + +func (k *kubernetesDiscover) SetProberManager(proberManager prober.Manager) { + +} diff --git a/worker/master/controller/thirdcomponent/discover/staticendpoint.go b/worker/master/controller/thirdcomponent/discover/staticendpoint.go index c8163d87a..0350f58f2 100644 --- a/worker/master/controller/thirdcomponent/discover/staticendpoint.go +++ b/worker/master/controller/thirdcomponent/discover/staticendpoint.go @@ -3,6 +3,7 @@ package discover import ( "context" "reflect" + "sync" "time" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" @@ -12,8 +13,10 @@ import ( ) type staticEndpoint struct { - lister rainbondlistersv1alpha1.ThirdComponentLister - component *v1alpha1.ThirdComponent + lister rainbondlistersv1alpha1.ThirdComponentLister + component *v1alpha1.ThirdComponent + + pmlock sync.Mutex proberManager prober.Manager } @@ -22,21 +25,21 @@ func (s *staticEndpoint) GetComponent() *v1alpha1.ThirdComponent { } func (s *staticEndpoint) Discover(ctx context.Context, update chan *v1alpha1.ThirdComponent) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { - ctx, cancel := context.WithTimeout(ctx, 3*time.Second) - defer cancel() - - endpoints, err := s.DiscoverOne(ctx) - if err != nil { - return nil, err + ticker := time.NewTicker(5 * time.Second) + for { + select { + case <-ctx.Done(): + return nil, nil + case <-ticker.C: + // The method DiscoverOne of staticEndpoint does not need context. + endpoints, _ := s.DiscoverOne(context.TODO()) + if !reflect.DeepEqual(endpoints, s.component.Status.Endpoints) { + newComponent := s.component.DeepCopy() + newComponent.Status.Endpoints = endpoints + update <- newComponent + } + } } - - newComponent := s.component.DeepCopy() - newComponent.Status.Endpoints = endpoints - if !reflect.DeepEqual(endpoints, s.component.Status.Endpoints) { - update <- newComponent - } - - return endpoints, nil } func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { @@ -44,10 +47,16 @@ func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComp for _, ep := range s.component.Spec.EndpointSource.StaticEndpoints { var addresses []*v1alpha1.EndpointAddress if ep.GetPort() != 0 { - addresses = append(addresses, v1alpha1.NewEndpointAddress(ep.Address, ep.GetPort())) + address := v1alpha1.NewEndpointAddress(ep.GetIP(), ep.GetPort()) + if address != nil { + addresses = append(addresses, address) + } } else { for _, port := range s.component.Spec.Ports { - addresses = append(addresses, v1alpha1.NewEndpointAddress(ep.Address, port.Port)) + address := v1alpha1.NewEndpointAddress(ep.Address, port.Port) + if address != nil { + addresses = append(addresses, address) + } } } if len(addresses) == 0 { @@ -62,13 +71,22 @@ func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComp } res = append(res, es) - result, found := s.proberManager.GetResult(s.component.GetEndpointID(es)) + // Make ready as the default status es.Status = v1alpha1.EndpointReady - if found && result != results.Success { - es.Status = v1alpha1.EndpointNotReady + if s.proberManager != nil { + result, found := s.proberManager.GetResult(s.component.GetEndpointID(es)) + if found && result != results.Success { + es.Status = v1alpha1.EndpointNotReady + } } } } return res, nil } + +func (s *staticEndpoint) SetProberManager(proberManager prober.Manager) { + s.pmlock.Lock() + defer s.pmlock.Unlock() + s.proberManager = proberManager +} diff --git a/worker/master/controller/thirdcomponent/discover_pool.go b/worker/master/controller/thirdcomponent/discover_pool.go index 2e8f197a2..dd415404f 100644 --- a/worker/master/controller/thirdcomponent/discover_pool.go +++ b/worker/master/controller/thirdcomponent/discover_pool.go @@ -26,9 +26,11 @@ import ( "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" dis "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/discover" + "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober" "github.com/sirupsen/logrus" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/tools/record" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -39,15 +41,20 @@ type DiscoverPool struct { discoverWorker map[string]*Worker updateChan chan *v1alpha1.ThirdComponent reconciler *Reconciler + + recorder record.EventRecorder } // NewDiscoverPool - -func NewDiscoverPool(ctx context.Context, reconciler *Reconciler) *DiscoverPool { +func NewDiscoverPool(ctx context.Context, + reconciler *Reconciler, + recorder record.EventRecorder) *DiscoverPool { dp := &DiscoverPool{ ctx: ctx, discoverWorker: make(map[string]*Worker), updateChan: make(chan *v1alpha1.ThirdComponent, 1024), reconciler: reconciler, + recorder: recorder, } go dp.Start() return dp @@ -90,56 +97,16 @@ func (d *DiscoverPool) Start() { } } -// Worker - -type Worker struct { - discover dis.Discover - cancel context.CancelFunc - ctx context.Context - updateChan chan *v1alpha1.ThirdComponent - stoped bool -} - -// Start - -func (w *Worker) Start() { - defer func() { - logrus.Infof("discover endpoint list worker %s/%s stoed", w.discover.GetComponent().Namespace, w.discover.GetComponent().Name) - w.stoped = true - }() - w.stoped = false - logrus.Infof("discover endpoint list worker %s/%s started", w.discover.GetComponent().Namespace, w.discover.GetComponent().Name) - // TODO: rate limit - for { - w.discover.Discover(w.ctx, w.updateChan) - select { - case <-w.ctx.Done(): - return - default: - } - } -} - -// UpdateDiscover - -func (w *Worker) UpdateDiscover(discover dis.Discover) { - w.discover = discover -} - -// Stop - -func (w *Worker) Stop() { - w.cancel() -} - -// IsStop - -func (w *Worker) IsStop() bool { - return w.stoped -} - func (d *DiscoverPool) newWorker(dis dis.Discover) *Worker { ctx, cancel := context.WithCancel(d.ctx) + proberManager := prober.NewManager(d.recorder) + dis.SetProberManager(proberManager) return &Worker{ - ctx: ctx, - discover: dis, - cancel: cancel, - updateChan: d.updateChan, + ctx: ctx, + discover: dis, + cancel: cancel, + updateChan: d.updateChan, + proberManager: proberManager, } } @@ -161,6 +128,7 @@ func (d *DiscoverPool) AddDiscover(dis dis.Discover) { return } worker := d.newWorker(dis) + worker.proberManager.AddThirdComponent(dis.GetComponent()) go worker.Start() d.discoverWorker[key] = worker } diff --git a/worker/master/controller/thirdcomponent/prober/prober_manager.go b/worker/master/controller/thirdcomponent/prober/prober_manager.go index 3e0ab31ff..f50ff7832 100644 --- a/worker/master/controller/thirdcomponent/prober/prober_manager.go +++ b/worker/master/controller/thirdcomponent/prober/prober_manager.go @@ -31,17 +31,15 @@ type Manager interface { // AddThirdComponent creates new probe workers for every endpoint address probe. AddThirdComponent(thirdComponent *v1alpha1.ThirdComponent) - // RemoveThirdComponent handles cleaning up the removed thirdcomponent state, including terminating probe workers and - // deleting cached results. - RemoveThirdComponent(thirdComponent *v1alpha1.ThirdComponent) - // GetResult returns the probe result based on the given ID. GetResult(endpointID string) (results.Result, bool) + + Stop() } type manager struct { // Map of active workers for probes - workers map[string]map[string]*worker + workers map[string]*worker // Lock for accessing & mutating workers workerLock sync.RWMutex @@ -60,7 +58,7 @@ func NewManager( return &manager{ prober: prober, readinessManager: readinessManager, - workers: make(map[string]map[string]*worker), + workers: make(map[string]*worker), } } @@ -72,19 +70,14 @@ func (m *manager) AddThirdComponent(thirdComponent *v1alpha1.ThirdComponent) { m.workerLock.Lock() defer m.workerLock.Unlock() - workers, ok := m.workers[thirdComponent.GetNamespaceName()] - if !ok { - m.workers[thirdComponent.Name] = make(map[string]*worker) - } - newWorkers := make(map[string]*worker) for _, ep := range thirdComponent.Status.Endpoints { key := string(ep.Address) worker := newWorker(m, thirdComponent, *ep) - oldWorker, ok := workers[key] + oldWorker, ok := m.workers[key] if ok && worker.spec.Equals(oldWorker.spec) { newWorkers[key] = oldWorker - delete(workers, key) + delete(m.workers, key) continue } // run new worker @@ -93,35 +86,20 @@ func (m *manager) AddThirdComponent(thirdComponent *v1alpha1.ThirdComponent) { } // stop unused workers - for _, worker := range workers { + for _, worker := range m.workers { worker.stop() } - m.workers[thirdComponent.GetNamespaceName()] = newWorkers + m.workers = newWorkers } -func (m *manager) RemoveThirdComponent(thirdComponent *v1alpha1.ThirdComponent) { - if !thirdComponent.Spec.NeedProbe() { - return - } - +func (m *manager) Stop() { m.workerLock.Lock() defer m.workerLock.Unlock() - workers, ok := m.workers[thirdComponent.GetNamespaceName()] - if !ok { - return - } - - for _, ep := range thirdComponent.Status.Endpoints { - worker, ok := workers[string(ep.Address)] - if !ok { - continue - } + for _, worker := range m.workers { worker.stop() } - - delete(m.workers, thirdComponent.GetNamespaceName()) } func (m *manager) GetResult(endpointID string) (results.Result, bool) { @@ -129,9 +107,8 @@ func (m *manager) GetResult(endpointID string) (results.Result, bool) { } // Called by the worker after exiting. -func (m *manager) removeWorker(thirdComponent *v1alpha1.ThirdComponent, endpoint *v1alpha1.ThirdComponentEndpointStatus) { +func (m *manager) removeWorker(endpoint *v1alpha1.ThirdComponentEndpointStatus) { m.workerLock.Lock() defer m.workerLock.Unlock() - workers := m.workers[thirdComponent.GetNamespaceName()] - delete(workers, string(endpoint.Address)) + delete(m.workers, string(endpoint.Address)) } diff --git a/worker/master/controller/thirdcomponent/prober/worker.go b/worker/master/controller/thirdcomponent/prober/worker.go index d3f42aeb4..7dd6aef4e 100644 --- a/worker/master/controller/thirdcomponent/prober/worker.go +++ b/worker/master/controller/thirdcomponent/prober/worker.go @@ -7,6 +7,7 @@ import ( "github.com/docker/go-metrics" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober/results" + "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/util/runtime" ) @@ -89,6 +90,8 @@ func newWorker( // run periodically probes the endpoint. func (w *worker) run() { + logrus.Infof("start prober worker %s", w.thirdComponent.GetEndpointID(&w.endpoint)) + probeTickerPeriod := time.Duration(w.spec.PeriodSeconds) * time.Second // If kubelet restarted the probes could be started in rapid succession. @@ -102,7 +105,7 @@ func (w *worker) run() { probeTicker.Stop() w.resultsManager.Remove(w.thirdComponent.GetEndpointID(&w.endpoint)) - w.probeManager.removeWorker(w.thirdComponent, &w.endpoint) + w.probeManager.removeWorker(&w.endpoint) ProberResults.Delete(w.proberResultsSuccessfulMetricLabels) ProberResults.Delete(w.proberResultsFailedMetricLabels) ProberResults.Delete(w.proberResultsUnknownMetricLabels) diff --git a/worker/master/controller/thirdcomponent/worker.go b/worker/master/controller/thirdcomponent/worker.go new file mode 100644 index 000000000..04b38b216 --- /dev/null +++ b/worker/master/controller/thirdcomponent/worker.go @@ -0,0 +1,58 @@ +package thirdcomponent + +import ( + "context" + + "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" + dis "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/discover" + "github.com/goodrain/rainbond/worker/master/controller/thirdcomponent/prober" + "github.com/sirupsen/logrus" +) + +// Worker - +type Worker struct { + discover dis.Discover + cancel context.CancelFunc + ctx context.Context + updateChan chan *v1alpha1.ThirdComponent + stoped bool + + proberManager prober.Manager +} + +// Start - +func (w *Worker) Start() { + defer func() { + logrus.Infof("discover endpoint list worker %s/%s stoed", w.discover.GetComponent().Namespace, w.discover.GetComponent().Name) + w.stoped = true + w.proberManager.Stop() + }() + w.stoped = false + logrus.Infof("discover endpoint list worker %s/%s started", w.discover.GetComponent().Namespace, w.discover.GetComponent().Name) + for { + w.discover.Discover(w.ctx, w.updateChan) + select { + case <-w.ctx.Done(): + return + default: + } + } +} + +// UpdateDiscover - +func (w *Worker) UpdateDiscover(discover dis.Discover) { + discover.SetProberManager(w.proberManager) + w.discover = discover + w.proberManager.AddThirdComponent(discover.GetComponent()) +} + +// Stop - +func (w *Worker) Stop() { + w.cancel() + w.proberManager.Stop() +} + +// IsStop - +func (w *Worker) IsStop() bool { + return w.stoped +} From 0e0f9d1c3159a9a2a1ffe892cdc53e64b10458e1 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Wed, 11 Aug 2021 00:14:56 +0800 Subject: [PATCH 31/43] update endpoints based on probe result --- .../componentdefinition.go | 6 ----- .../thirdcomponent/discover/staticendpoint.go | 26 ++++++++++++------- .../thirdcomponent/prober/prober_manager.go | 19 +++++++++++--- .../prober/results/results_manager.go | 21 +++++++++++++-- .../prober/results/results_manager_test.go | 2 +- 5 files changed, 53 insertions(+), 21 deletions(-) diff --git a/worker/appm/componentdefinition/componentdefinition.go b/worker/appm/componentdefinition/componentdefinition.go index 2a3affbf4..cea24d549 100644 --- a/worker/appm/componentdefinition/componentdefinition.go +++ b/worker/appm/componentdefinition/componentdefinition.go @@ -20,7 +20,6 @@ package componentdefinition import ( "context" - "encoding/json" "fmt" "strings" "sync" @@ -156,11 +155,6 @@ func (c *Builder) GetComponentProperties(as *v1.AppService, dbm db.Manager, cd * } properties.Probe = probe - bytes, err := json.Marshal(properties) - if err == nil { - logrus.Infof("properties: %s", bytes) - } - return properties default: return nil diff --git a/worker/master/controller/thirdcomponent/discover/staticendpoint.go b/worker/master/controller/thirdcomponent/discover/staticendpoint.go index 0350f58f2..fcb5b8bc7 100644 --- a/worker/master/controller/thirdcomponent/discover/staticendpoint.go +++ b/worker/master/controller/thirdcomponent/discover/staticendpoint.go @@ -31,20 +31,17 @@ func (s *staticEndpoint) Discover(ctx context.Context, update chan *v1alpha1.Thi case <-ctx.Done(): return nil, nil case <-ticker.C: - // The method DiscoverOne of staticEndpoint does not need context. - endpoints, _ := s.DiscoverOne(context.TODO()) - if !reflect.DeepEqual(endpoints, s.component.Status.Endpoints) { - newComponent := s.component.DeepCopy() - newComponent.Status.Endpoints = endpoints - update <- newComponent - } + s.discoverOne(update) + case <-s.proberManager.Updates(): + s.discoverOne(update) } } } func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { + component := s.component var res []*v1alpha1.ThirdComponentEndpointStatus - for _, ep := range s.component.Spec.EndpointSource.StaticEndpoints { + for _, ep := range component.Spec.EndpointSource.StaticEndpoints { var addresses []*v1alpha1.EndpointAddress if ep.GetPort() != 0 { address := v1alpha1.NewEndpointAddress(ep.GetIP(), ep.GetPort()) @@ -52,7 +49,7 @@ func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComp addresses = append(addresses, address) } } else { - for _, port := range s.component.Spec.Ports { + for _, port := range component.Spec.Ports { address := v1alpha1.NewEndpointAddress(ep.Address, port.Port) if address != nil { addresses = append(addresses, address) @@ -90,3 +87,14 @@ func (s *staticEndpoint) SetProberManager(proberManager prober.Manager) { defer s.pmlock.Unlock() s.proberManager = proberManager } + +func (s *staticEndpoint) discoverOne(update chan *v1alpha1.ThirdComponent) { + component := s.component + // The method DiscoverOne of staticEndpoint does not need context. + endpoints, _ := s.DiscoverOne(context.TODO()) + if !reflect.DeepEqual(endpoints, component.Status.Endpoints) { + newComponent := s.component.DeepCopy() + newComponent.Status.Endpoints = endpoints + update <- newComponent + } +} diff --git a/worker/master/controller/thirdcomponent/prober/prober_manager.go b/worker/master/controller/thirdcomponent/prober/prober_manager.go index f50ff7832..fc982616a 100644 --- a/worker/master/controller/thirdcomponent/prober/prober_manager.go +++ b/worker/master/controller/thirdcomponent/prober/prober_manager.go @@ -35,6 +35,11 @@ type Manager interface { GetResult(endpointID string) (results.Result, bool) Stop() + + // Updates creates a channel that receives an Update whenever its result changes (but not + // removed). + // NOTE: The current implementation only supports a single updates channel. + Updates() <-chan results.Update } type manager struct { @@ -48,17 +53,21 @@ type manager struct { // prober executes the probe actions. prober *prober + + // channel of updates + updates chan results.Update } // NewManager creates a Manager for pod probing. func NewManager( recorder record.EventRecorder) Manager { - prober := newProber(recorder) - readinessManager := results.NewManager() + updates := make(chan results.Update) + readinessManager := results.NewManager(updates) return &manager{ - prober: prober, + prober: newProber(recorder), readinessManager: readinessManager, workers: make(map[string]*worker), + updates: updates, } } @@ -112,3 +121,7 @@ func (m *manager) removeWorker(endpoint *v1alpha1.ThirdComponentEndpointStatus) defer m.workerLock.Unlock() delete(m.workers, string(endpoint.Address)) } + +func (m *manager) Updates() <-chan results.Update { + return m.updates +} diff --git a/worker/master/controller/thirdcomponent/prober/results/results_manager.go b/worker/master/controller/thirdcomponent/prober/results/results_manager.go index 80648e13b..06c95836d 100644 --- a/worker/master/controller/thirdcomponent/prober/results/results_manager.go +++ b/worker/master/controller/thirdcomponent/prober/results/results_manager.go @@ -51,20 +51,29 @@ func (r Result) ToPrometheusType() float64 { } } +// Update is an enum of the types of updates sent over the Updates channel. +type Update struct { + EndpointID string + Result Result +} + // Manager implementation. type manager struct { // guards the cache sync.RWMutex // map of endpoint ID -> probe Result cache map[string]Result + // channel of updates + updates chan Update } var _ Manager = &manager{} // NewManager creates and returns an empty results manager. -func NewManager() Manager { +func NewManager(updates chan Update) Manager { return &manager{ - cache: make(map[string]Result), + cache: make(map[string]Result), + updates: updates, } } @@ -76,12 +85,20 @@ func (m *manager) Get(id string) (Result, bool) { } func (m *manager) Set(id string, result Result) { + if m.setInternal(id, result) { + m.updates <- Update{EndpointID: id, Result: result} + } +} + +func (m *manager) setInternal(id string, result Result) bool { m.Lock() defer m.Unlock() prev, exists := m.cache[id] if !exists || prev != result { m.cache[id] = result + return true } + return false } func (m *manager) Remove(id string) { diff --git a/worker/master/controller/thirdcomponent/prober/results/results_manager_test.go b/worker/master/controller/thirdcomponent/prober/results/results_manager_test.go index aae88c19f..b5a4d1b67 100644 --- a/worker/master/controller/thirdcomponent/prober/results/results_manager_test.go +++ b/worker/master/controller/thirdcomponent/prober/results/results_manager_test.go @@ -7,7 +7,7 @@ import ( ) func TestCacheOperations(t *testing.T) { - m := NewManager() + m := NewManager(make(chan Update)) unsetID := "unset" setID := "set" From 16bbd36e2a5a32e10d2b0e1c22cfc80c4c61f22c Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Wed, 11 Aug 2021 10:11:39 +0800 Subject: [PATCH 32/43] delete ticker --- .../controller/thirdcomponent/discover/staticendpoint.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/worker/master/controller/thirdcomponent/discover/staticendpoint.go b/worker/master/controller/thirdcomponent/discover/staticendpoint.go index fcb5b8bc7..b97ad0212 100644 --- a/worker/master/controller/thirdcomponent/discover/staticendpoint.go +++ b/worker/master/controller/thirdcomponent/discover/staticendpoint.go @@ -4,7 +4,6 @@ import ( "context" "reflect" "sync" - "time" "github.com/goodrain/rainbond/pkg/apis/rainbond/v1alpha1" rainbondlistersv1alpha1 "github.com/goodrain/rainbond/pkg/generated/listers/rainbond/v1alpha1" @@ -25,13 +24,10 @@ func (s *staticEndpoint) GetComponent() *v1alpha1.ThirdComponent { } func (s *staticEndpoint) Discover(ctx context.Context, update chan *v1alpha1.ThirdComponent) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { - ticker := time.NewTicker(5 * time.Second) for { select { case <-ctx.Done(): return nil, nil - case <-ticker.C: - s.discoverOne(update) case <-s.proberManager.Updates(): s.discoverOne(update) } From 19e208ec6451c5e54c8072893e00cc269938e980 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Wed, 11 Aug 2021 11:05:18 +0800 Subject: [PATCH 33/43] prober manager only for static endpoints --- pkg/apis/rainbond/v1alpha1/third_component.go | 10 ++++--- .../thirdcomponent/discover_pool.go | 27 ++++++++++++------- .../controller/thirdcomponent/worker.go | 15 ++++++++--- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/pkg/apis/rainbond/v1alpha1/third_component.go b/pkg/apis/rainbond/v1alpha1/third_component.go index e07b95c17..0721bdc64 100644 --- a/pkg/apis/rainbond/v1alpha1/third_component.go +++ b/pkg/apis/rainbond/v1alpha1/third_component.go @@ -89,10 +89,12 @@ func (in ThirdComponentSpec) NeedProbe() bool { if in.Probe == nil { return false } - if len(in.EndpointSource.StaticEndpoints) > 0 { - return true - } - return false + return in.IsStaticEndpoints() +} + +// IsStaticEndpoints - +func (in ThirdComponentSpec) IsStaticEndpoints() bool { + return len(in.EndpointSource.StaticEndpoints) > 0 } // ThirdComponentEndpointSource - diff --git a/worker/master/controller/thirdcomponent/discover_pool.go b/worker/master/controller/thirdcomponent/discover_pool.go index dd415404f..316188f35 100644 --- a/worker/master/controller/thirdcomponent/discover_pool.go +++ b/worker/master/controller/thirdcomponent/discover_pool.go @@ -99,15 +99,22 @@ func (d *DiscoverPool) Start() { func (d *DiscoverPool) newWorker(dis dis.Discover) *Worker { ctx, cancel := context.WithCancel(d.ctx) - proberManager := prober.NewManager(d.recorder) - dis.SetProberManager(proberManager) - return &Worker{ - ctx: ctx, - discover: dis, - cancel: cancel, - updateChan: d.updateChan, - proberManager: proberManager, + + worker := &Worker{ + ctx: ctx, + discover: dis, + cancel: cancel, + updateChan: d.updateChan, } + + component := dis.GetComponent() + if component.Spec.IsStaticEndpoints() { + proberManager := prober.NewManager(d.recorder) + dis.SetProberManager(proberManager) + worker.proberManager = proberManager + } + + return worker } // AddDiscover - @@ -128,7 +135,9 @@ func (d *DiscoverPool) AddDiscover(dis dis.Discover) { return } worker := d.newWorker(dis) - worker.proberManager.AddThirdComponent(dis.GetComponent()) + if component.Spec.IsStaticEndpoints() { + worker.proberManager.AddThirdComponent(dis.GetComponent()) + } go worker.Start() d.discoverWorker[key] = worker } diff --git a/worker/master/controller/thirdcomponent/worker.go b/worker/master/controller/thirdcomponent/worker.go index 04b38b216..2d1214e51 100644 --- a/worker/master/controller/thirdcomponent/worker.go +++ b/worker/master/controller/thirdcomponent/worker.go @@ -25,7 +25,9 @@ func (w *Worker) Start() { defer func() { logrus.Infof("discover endpoint list worker %s/%s stoed", w.discover.GetComponent().Namespace, w.discover.GetComponent().Name) w.stoped = true - w.proberManager.Stop() + if w.proberManager != nil { + w.proberManager.Stop() + } }() w.stoped = false logrus.Infof("discover endpoint list worker %s/%s started", w.discover.GetComponent().Namespace, w.discover.GetComponent().Name) @@ -41,15 +43,20 @@ func (w *Worker) Start() { // UpdateDiscover - func (w *Worker) UpdateDiscover(discover dis.Discover) { - discover.SetProberManager(w.proberManager) + component := discover.GetComponent() + if component.Spec.IsStaticEndpoints() { + w.proberManager.AddThirdComponent(discover.GetComponent()) + discover.SetProberManager(w.proberManager) + } w.discover = discover - w.proberManager.AddThirdComponent(discover.GetComponent()) } // Stop - func (w *Worker) Stop() { w.cancel() - w.proberManager.Stop() + if w.proberManager != nil { + w.proberManager.Stop() + } } // IsStop - From ba1888fde50dd148022d64c3200c4eb37251afad Mon Sep 17 00:00:00 2001 From: yangk Date: Wed, 11 Aug 2021 18:41:07 +0800 Subject: [PATCH 34/43] Delete related etcd keys when deleting an application --- api/controller/application.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/controller/application.go b/api/controller/application.go index 902ed7ce4..fa0d22379 100644 --- a/api/controller/application.go +++ b/api/controller/application.go @@ -151,6 +151,11 @@ func (a *ApplicationController) ListComponents(w http.ResponseWriter, r *http.Re func (a *ApplicationController) DeleteApp(w http.ResponseWriter, r *http.Request) { app := r.Context().Value(ctxutil.ContextKey("application")).(*dbmodel.Application) + var req model.EtcdCleanReq + if httputil.ValidatorRequestStructAndErrorResponse(r, w, &req, nil) { + logrus.Debugf("delete app etcd keys : %+v", req.Keys) + handler.GetEtcdHandler().CleanAllServiceData(req.Keys) + } // Delete application err := handler.GetApplicationHandler().DeleteApp(r.Context(), app) if err != nil { From 05d689dbac03efc4a8e8bfd6c918aa3440bc412b Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Thu, 12 Aug 2021 20:01:29 +0800 Subject: [PATCH 35/43] delete is_online --- api/handler/service.go | 2 -- api/handler/service_batch_operation.go | 2 +- api/handler/third_party_service_handler.go | 10 +++----- api/middleware/middleware.go | 9 +++++++- api/model/third_party_srvice.go | 27 +++++++++++++++++----- api/util/events.go | 4 ++-- db/dao/dao.go | 1 - db/model/third_party_service.go | 2 -- db/mysql/dao/3rd_party.go | 12 ---------- worker/client/client.go | 18 +++++++-------- 10 files changed, 43 insertions(+), 44 deletions(-) diff --git a/api/handler/service.go b/api/handler/service.go index 392df0f08..4e8e70609 100644 --- a/api/handler/service.go +++ b/api/handler/service.go @@ -743,12 +743,10 @@ func (s *ServiceAction) ServiceCreate(sc *api_model.ServiceStruct) error { } } if sc.Endpoints.Static != nil { - trueValue := true for _, o := range sc.Endpoints.Static { ep := &dbmodel.Endpoint{ ServiceID: sc.ServiceID, UUID: core_util.NewUUID(), - IsOnline: &trueValue, } address := o port := 0 diff --git a/api/handler/service_batch_operation.go b/api/handler/service_batch_operation.go index b148bee5d..f1cf3d71a 100644 --- a/api/handler/service_batch_operation.go +++ b/api/handler/service_batch_operation.go @@ -248,7 +248,7 @@ func (b *BatchOperationHandler) checkEvents(batchOpReqs model.BatchOpRequesters) var batchOpResult model.BatchOpResult for _, req := range batchOpReqs { req := req - if apiutil.CanDoEvent("", dbmodel.SYNEVENTTYPE, "service", req.GetComponentID()) { + if apiutil.CanDoEvent("", dbmodel.SYNEVENTTYPE, "service", req.GetComponentID(), "") { validReqs = append(validReqs, req) continue } diff --git a/api/handler/third_party_service_handler.go b/api/handler/third_party_service_handler.go index dc7a7933f..ef6321cf1 100644 --- a/api/handler/third_party_service_handler.go +++ b/api/handler/third_party_service_handler.go @@ -20,6 +20,7 @@ package handler import ( "fmt" + "sort" "strconv" "strings" @@ -27,9 +28,8 @@ import ( "github.com/goodrain/rainbond/db" dbmodel "github.com/goodrain/rainbond/db/model" "github.com/goodrain/rainbond/util" - "github.com/sirupsen/logrus" - "github.com/goodrain/rainbond/worker/client" + "github.com/sirupsen/logrus" ) // ThirdPartyServiceHanlder handles business logic for all third-party services @@ -61,7 +61,6 @@ func (t *ThirdPartyServiceHanlder) AddEndpoints(sid string, d *model.AddEndpiont ServiceID: sid, IP: address, Port: port, - IsOnline: &d.IsOnline, } if err := t.dbmanager.EndpointsDao().AddModel(ep); err != nil { return err @@ -84,7 +83,6 @@ func (t *ThirdPartyServiceHanlder) UpdEndpoints(d *model.UpdEndpiontsReq) error ep.IP = address ep.Port = port } - ep.IsOnline = &d.IsOnline if err := t.dbmanager.EndpointsDao().UpdateModel(ep); err != nil { return err } @@ -148,7 +146,6 @@ func (t *ThirdPartyServiceHanlder) ListEndpoints(sid string) ([]*model.EndpointR return ip }(item.IP, item.Port), Status: "-", - IsOnline: false, IsStatic: true, } m[ep.Address] = ep @@ -162,7 +159,6 @@ func (t *ThirdPartyServiceHanlder) ListEndpoints(sid string) ([]*model.EndpointR for _, item := range thirdPartyEndpoints.Obj { ep := m[fmt.Sprintf("%s:%d", item.Ip, item.Port)] if ep != nil { - ep.IsOnline = true ep.Status = item.Status continue } @@ -170,7 +166,6 @@ func (t *ThirdPartyServiceHanlder) ListEndpoints(sid string) ([]*model.EndpointR EpID: item.Uuid, Address: item.Ip, Status: item.Status, - IsOnline: true, IsStatic: false, } m[rep.Address] = rep @@ -180,5 +175,6 @@ func (t *ThirdPartyServiceHanlder) ListEndpoints(sid string) ([]*model.EndpointR for _, item := range m { res = append(res, item) } + sort.Sort(model.EndpointResps(res)) return res, nil } diff --git a/api/middleware/middleware.go b/api/middleware/middleware.go index fe2cd21b9..3cdcdd0ba 100644 --- a/api/middleware/middleware.go +++ b/api/middleware/middleware.go @@ -236,6 +236,13 @@ func (w *resWriter) WriteHeader(statusCode int) { // WrapEL wrap eventlog, handle event log before and after process func WrapEL(f http.HandlerFunc, target, optType string, synType int) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { + var serviceKind string + serviceObj := r.Context().Value(ctxutil.ContextKey("service")) + if serviceObj != nil { + service := serviceObj.(*dbmodel.TenantServices) + serviceKind = service.Kind + } + if r.Method != "GET" { body, err := ioutil.ReadAll(r.Body) if err != nil { @@ -261,7 +268,7 @@ func WrapEL(f http.HandlerFunc, target, optType string, synType int) http.Handle } //eventLog check the latest event - if !util.CanDoEvent(optType, synType, target, targetID) { + if !util.CanDoEvent(optType, synType, target, targetID, serviceKind) { logrus.Errorf("operation too frequently. uri: %s; target: %s; target id: %s", r.RequestURI, target, targetID) httputil.ReturnError(r, w, 409, "操作过于频繁,请稍后再试") // status code 409 conflict return diff --git a/api/model/third_party_srvice.go b/api/model/third_party_srvice.go index 4af9a3bbd..243888f6d 100644 --- a/api/model/third_party_srvice.go +++ b/api/model/third_party_srvice.go @@ -20,15 +20,13 @@ package model // AddEndpiontsReq is one of the Endpoints in the request to add the endpints. type AddEndpiontsReq struct { - Address string `json:"address" validate:"address|required"` - IsOnline bool `json:"is_online" validate:"required"` + Address string `json:"address" validate:"address|required"` } // UpdEndpiontsReq is one of the Endpoints in the request to update the endpints. type UpdEndpiontsReq struct { - EpID string `json:"ep_id" validate:"required|len:32"` - Address string `json:"address"` - IsOnline bool `json:"is_online" validate:"required"` + EpID string `json:"ep_id" validate:"required|len:32"` + Address string `json:"address"` } // DelEndpiontsReq is one of the Endpoints in the request to update the endpints. @@ -42,10 +40,27 @@ type EndpointResp struct { EpID string `json:"ep_id"` Address string `json:"address"` Status string `json:"status"` - IsOnline bool `json:"is_online"` IsStatic bool `json:"is_static"` } +// EndpointResps - +type EndpointResps []*EndpointResp + +// Len is part of sort.Interface. +func (e EndpointResps) Len() int { + return len(e) +} + +// Swap is part of sort.Interface. +func (e EndpointResps) Swap(i, j int) { + e[i], e[j] = e[j], e[i] +} + +// Less is part of sort.Interface. It is implemented by calling the "by" closure in the sorter. +func (e EndpointResps) Less(i, j int) bool { + return e[i].Address < e[j].Address +} + // ThridPartyServiceProbe is the json obejct in the request // to update or fetch the ThridPartyServiceProbe. type ThridPartyServiceProbe struct { diff --git a/api/util/events.go b/api/util/events.go index 37201e5e5..4e15253af 100644 --- a/api/util/events.go +++ b/api/util/events.go @@ -29,8 +29,8 @@ import ( ) // CanDoEvent check can do event or not -func CanDoEvent(optType string, synType int, target, targetID string) bool { - if synType == dbmodel.SYNEVENTTYPE { +func CanDoEvent(optType string, synType int, target, targetID string, componentKind string) bool { + if synType == dbmodel.SYNEVENTTYPE || componentKind == "third_party" { return true } event, err := db.GetManager().ServiceEventDao().GetLastASyncEvent(target, targetID) diff --git a/db/dao/dao.go b/db/dao/dao.go index 5bfffedbc..ea4d0bad4 100644 --- a/db/dao/dao.go +++ b/db/dao/dao.go @@ -545,7 +545,6 @@ type EndpointsDao interface { GetByUUID(uuid string) (*model.Endpoint, error) DelByUUID(uuid string) error List(sid string) ([]*model.Endpoint, error) - ListIsOnline(sid string) ([]*model.Endpoint, error) DeleteByServiceID(sid string) error } diff --git a/db/model/third_party_service.go b/db/model/third_party_service.go index f379f1208..504274195 100644 --- a/db/model/third_party_service.go +++ b/db/model/third_party_service.go @@ -29,8 +29,6 @@ type Endpoint struct { ServiceID string `gorm:"column:service_id;size:32;not null" json:"service_id"` IP string `gorm:"column:ip;not null" json:"ip"` Port int `gorm:"column:port;size:65535" json:"port"` - //use pointer type, zero values won't be saved into database - IsOnline *bool `gorm:"column:is_online;default:true" json:"is_online"` } // TableName returns table name of Endpoint. diff --git a/db/mysql/dao/3rd_party.go b/db/mysql/dao/3rd_party.go index 539d8d834..fd04539cb 100644 --- a/db/mysql/dao/3rd_party.go +++ b/db/mysql/dao/3rd_party.go @@ -85,18 +85,6 @@ func (e *EndpointDaoImpl) List(sid string) ([]*model.Endpoint, error) { return eps, nil } -// ListIsOnline lists *model.Endpoint according to sid, and filter out the ones that are not online. -func (e *EndpointDaoImpl) ListIsOnline(sid string) ([]*model.Endpoint, error) { - var eps []*model.Endpoint - if err := e.DB.Where("service_id=? and is_online=1", sid).Find(&eps).Error; err != nil { - if err == gorm.ErrRecordNotFound { - return nil, nil - } - return nil, err - } - return eps, nil -} - // DelByUUID deletes endpoints matching uuid. func (e *EndpointDaoImpl) DelByUUID(uuid string) error { if err := e.DB.Where("uuid=?", uuid).Delete(&model.Endpoint{}).Error; err != nil { diff --git a/worker/client/client.go b/worker/client/client.go index 94b77ec5a..1c428c4bb 100644 --- a/worker/client/client.go +++ b/worker/client/client.go @@ -204,11 +204,10 @@ func (a *AppRuntimeSyncClient) AddThirdPartyEndpoint(req *model.Endpoint) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() _, _ = a.AppRuntimeSyncClient.AddThirdPartyEndpoint(ctx, &pb.AddThirdPartyEndpointsReq{ - Uuid: req.UUID, - Sid: req.ServiceID, - Ip: req.IP, - Port: int32(req.Port), - IsOnline: *req.IsOnline, + Uuid: req.UUID, + Sid: req.ServiceID, + Ip: req.IP, + Port: int32(req.Port), }) } @@ -217,11 +216,10 @@ func (a *AppRuntimeSyncClient) UpdThirdPartyEndpoint(req *model.Endpoint) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() _, _ = a.AppRuntimeSyncClient.UpdThirdPartyEndpoint(ctx, &pb.UpdThirdPartyEndpointsReq{ - Uuid: req.UUID, - Sid: req.ServiceID, - Ip: req.IP, - Port: int32(req.Port), - IsOnline: *req.IsOnline, + Uuid: req.UUID, + Sid: req.ServiceID, + Ip: req.IP, + Port: int32(req.Port), }) } From 78df4345b29032e8c46c89673902837a55f02f34 Mon Sep 17 00:00:00 2001 From: yangk Date: Thu, 12 Aug 2021 23:24:32 +0800 Subject: [PATCH 36/43] support set cpu value is zero --- api/handler/plugin.go | 4 ++-- api/handler/service_plugin.go | 8 ++++---- db/model/plugin.go | 8 ++++---- db/model/tenant.go | 6 ++++-- worker/appm/conversion/resource.go | 18 +++++++++++------- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/api/handler/plugin.go b/api/handler/plugin.go index 071c57115..5d13da170 100644 --- a/api/handler/plugin.go +++ b/api/handler/plugin.go @@ -328,10 +328,10 @@ func (p *PluginAction) buildPlugin(b *api_model.BuildPluginStruct, plugin *dbmod Info: b.Body.Info, Status: "building", } - if b.Body.PluginCPU == 0 { + if b.Body.PluginCPU < 0 { pbv.ContainerCPU = 125 } - if b.Body.PluginMemory == 0 { + if b.Body.PluginMemory < 0 { pbv.ContainerMemory = 50 } if err := db.GetManager().TenantPluginBuildVersionDao().AddModel(pbv); err != nil { diff --git a/api/handler/service_plugin.go b/api/handler/service_plugin.go index 99981e84f..066d507e6 100644 --- a/api/handler/service_plugin.go +++ b/api/handler/service_plugin.go @@ -156,10 +156,10 @@ func (s *ServiceAction) SetTenantServicePluginRelation(tenantID, serviceID strin } tsprCPU := pluginversion.ContainerCPU tsprMemory := pluginversion.ContainerMemory - if pss.Body.PluginCPU != 0 { + if pss.Body.PluginCPU >= 0 { tsprCPU = pss.Body.PluginCPU } - if pss.Body.PluginMemory != 0 { + if pss.Body.PluginMemory >= 0 { tsprMemory = pss.Body.PluginMemory } relation := &dbmodel.TenantServicePluginRelation{ @@ -190,10 +190,10 @@ func (s *ServiceAction) UpdateTenantServicePluginRelation(serviceID string, pss } relation.VersionID = pss.Body.VersionID relation.Switch = pss.Body.Switch - if pss.Body.PluginCPU != 0 { + if pss.Body.PluginCPU >= 0 { relation.ContainerCPU = pss.Body.PluginCPU } - if pss.Body.PluginMemory != 0 { + if pss.Body.PluginMemory >= 0 { relation.ContainerMemory = pss.Body.PluginMemory } err = db.GetManager().TenantServicePluginRelationDao().UpdateModel(relation) diff --git a/db/model/plugin.go b/db/model/plugin.go index 80be0b4c5..1008c2d91 100644 --- a/db/model/plugin.go +++ b/db/model/plugin.go @@ -89,9 +89,9 @@ type TenantPluginBuildVersion struct { Info string `gorm:"column:info" json:"info"` Status string `gorm:"column:status;size:24" json:"status"` // container default cpu - ContainerCPU int `gorm:"column:container_cpu;default:125" json:"container_cpu"` + ContainerCPU int `gorm:"column:container_cpu;default:0" json:"container_cpu"` // container default memory - ContainerMemory int `gorm:"column:container_memory;default:64" json:"container_memory"` + ContainerMemory int `gorm:"column:container_memory;default:0" json:"container_memory"` // container args ContainerCMD string `gorm:"column:container_cmd;size:2048" json:"container_cmd"` } @@ -155,9 +155,9 @@ type TenantServicePluginRelation struct { ServiceID string `gorm:"column:service_id;size:32" json:"service_id"` PluginModel string `gorm:"column:plugin_model;size:24" json:"plugin_model"` // container default cpu v3.5.1 add - ContainerCPU int `gorm:"column:container_cpu;default:125" json:"container_cpu"` + ContainerCPU int `gorm:"column:container_cpu;default:0" json:"container_cpu"` // container default memory v3.5.1 add - ContainerMemory int `gorm:"column:container_memory;default:64" json:"container_memory"` + ContainerMemory int `gorm:"column:container_memory;default:0" json:"container_memory"` Switch bool `gorm:"column:switch;default:0" json:"switch"` } diff --git a/db/model/tenant.go b/db/model/tenant.go index 66f13facf..31d29aa55 100644 --- a/db/model/tenant.go +++ b/db/model/tenant.go @@ -165,9 +165,11 @@ type TenantServices struct { // 服务描述 Comment string `gorm:"column:comment" json:"comment"` // 容器CPU权重 - ContainerCPU int `gorm:"column:container_cpu;default:500" json:"container_cpu"` + // default is 0, This means that CPU resources are not limited + ContainerCPU int `gorm:"column:container_cpu;default:0" json:"container_cpu"` // 容器最大内存 - ContainerMemory int `gorm:"column:container_memory;default:128" json:"container_memory"` + // default is 0, This means that Memory resources are not limited + ContainerMemory int `gorm:"column:container_memory;default:0" json:"container_memory"` // container GPU, The amount of video memory applied for GPU. The unit is MiB // default is 0, That means no GPU is required ContainerGPU int `gorm:"column:container_gpu;default:0" json:"container_gpu"` diff --git a/worker/appm/conversion/resource.go b/worker/appm/conversion/resource.go index 4f9bc59ef..7b361ed33 100644 --- a/worker/appm/conversion/resource.go +++ b/worker/appm/conversion/resource.go @@ -30,17 +30,21 @@ func createResourcesByDefaultCPU(memory int, setCPURequest, setCPULimit int64) c if base <= 0 { base = 1 } - if memory < 512 { - cpuRequest, cpuLimit = base*30, base*80 - } else if memory <= 1024 { - cpuRequest, cpuLimit = base*30, base*160 + if memory > 0 { + if memory < 512 { + cpuRequest, cpuLimit = base*30, base*80 + } else if memory <= 1024 { + cpuRequest, cpuLimit = base*30, base*160 + } else { + cpuRequest, cpuLimit = base*30, (int64(memory)-1024)/1024*500+1280 + } } else { - cpuRequest, cpuLimit = base*30, ((int64(memory)-1024)/1024*500 + 1280) + memory = 0 } - if setCPULimit > 0 { + if setCPULimit >= 0 { cpuLimit = setCPULimit } - if setCPURequest > 0 { + if setCPURequest >= 0 { cpuRequest = setCPURequest } From 37e9a2957dcd305d0c99f0280e5d9d0874c2bbd5 Mon Sep 17 00:00:00 2001 From: yangk Date: Fri, 13 Aug 2021 11:38:10 +0800 Subject: [PATCH 37/43] Refactoring the method of setting resources --- worker/appm/conversion/plugin.go | 6 ++-- worker/appm/conversion/resource.go | 51 ++++++++++++------------------ worker/appm/conversion/version.go | 12 +------ 3 files changed, 25 insertions(+), 44 deletions(-) diff --git a/worker/appm/conversion/plugin.go b/worker/appm/conversion/plugin.go index d756e4c68..8b9f1d4e8 100644 --- a/worker/appm/conversion/plugin.go +++ b/worker/appm/conversion/plugin.go @@ -440,7 +440,7 @@ func createPluginEnvs(pluginID, tenantID, serviceAlias string, mainEnvs []v1.Env } func createPluginResources(memory int, cpu int) v1.ResourceRequirements { - return createResourcesByDefaultCPU(memory, int64(cpu), int64(cpu)) + return createResourcesBySetting(memory, int64(cpu), int64(cpu), 0) } func createTCPUDPMeshRecources(as *typesv1.AppService) v1.ResourceRequirements { @@ -458,12 +458,12 @@ func createTCPUDPMeshRecources(as *typesv1.AppService) v1.ResourceRequirements { memory = requestint } } - return createResourcesByDefaultCPU(memory, cpu, func() int64 { + return createResourcesBySetting(memory, cpu, func() int64 { if cpu < 120 { return 120 } return cpu - }()) + }(), 0) } func xdsHostIPEnv(xdsHost string) corev1.EnvVar { diff --git a/worker/appm/conversion/resource.go b/worker/appm/conversion/resource.go index 7b361ed33..aee80334b 100644 --- a/worker/appm/conversion/resource.go +++ b/worker/appm/conversion/resource.go @@ -19,43 +19,34 @@ package conversion import ( + "fmt" + "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" ) -//Allocate the CPU at the ratio of 4g memory to 1 core CPU -func createResourcesByDefaultCPU(memory int, setCPURequest, setCPULimit int64) corev1.ResourceRequirements { - var cpuRequest, cpuLimit int64 - base := int64(memory) / 128 - if base <= 0 { - base = 1 - } - if memory > 0 { - if memory < 512 { - cpuRequest, cpuLimit = base*30, base*80 - } else if memory <= 1024 { - cpuRequest, cpuLimit = base*30, base*160 - } else { - cpuRequest, cpuLimit = base*30, (int64(memory)-1024)/1024*500+1280 - } - } else { - memory = 0 - } - if setCPULimit >= 0 { - cpuLimit = setCPULimit - } - if setCPURequest >= 0 { - cpuRequest = setCPURequest - } - +func createResourcesBySetting(memory int, setCPURequest, setCPULimit, setGPULimit int64) corev1.ResourceRequirements { limits := corev1.ResourceList{} - limits[corev1.ResourceCPU] = *resource.NewMilliQuantity(cpuLimit, resource.DecimalSI) - limits[corev1.ResourceMemory] = *resource.NewQuantity(int64(memory*1024*1024), resource.BinarySI) - request := corev1.ResourceList{} - request[corev1.ResourceCPU] = *resource.NewMilliQuantity(cpuRequest, resource.DecimalSI) - request[corev1.ResourceMemory] = *resource.NewQuantity(int64(memory*1024*1024), resource.BinarySI) + if memory > 0 { + limits[corev1.ResourceMemory] = *resource.NewQuantity(int64(memory*1024*1024), resource.BinarySI) + } + if setCPULimit > 0 { + limits[corev1.ResourceCPU] = *resource.NewMilliQuantity(setCPULimit, resource.DecimalSI) + } + if setGPULimit > 0 { + gpuLimit, err := resource.ParseQuantity(fmt.Sprintf("%d", setGPULimit)) + if err != nil { + logrus.Errorf("gpu request is invalid") + } else { + limits[getGPULableKey()] = gpuLimit + } + } + + if setCPURequest > 0 { + request[corev1.ResourceCPU] = *resource.NewMilliQuantity(setCPURequest, resource.DecimalSI) + } return corev1.ResourceRequirements{ Limits: limits, Requests: request, diff --git a/worker/appm/conversion/version.go b/worker/appm/conversion/version.go index c425bf289..2db5af9bd 100644 --- a/worker/appm/conversion/version.go +++ b/worker/appm/conversion/version.go @@ -38,7 +38,6 @@ import ( "github.com/jinzhu/gorm" "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -502,16 +501,7 @@ func createResources(as *v1.AppService) corev1.ResourceRequirements { cpuLimit = int64(as.ContainerCPU) cpuRequest = int64(as.ContainerCPU) } - rr := createResourcesByDefaultCPU(as.ContainerMemory, cpuRequest, cpuLimit) - // support set gpu, support application of single GPU video memory. - if as.ContainerGPU > 0 { - gpuLimit, err := resource.ParseQuantity(fmt.Sprintf("%d", as.ContainerGPU)) - if err != nil { - logrus.Errorf("gpu request is invalid") - } else { - rr.Limits[getGPULableKey()] = gpuLimit - } - } + rr := createResourcesBySetting(as.ContainerMemory, cpuRequest, cpuLimit, int64(as.ContainerGPU)) return rr } From e052dcc37bf0433d950720d943123f7b3c9b296e Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Fri, 13 Aug 2021 13:33:27 +0800 Subject: [PATCH 38/43] different ports --- .../controller/thirdcomponent/controller.go | 143 ++++++++++++++---- 1 file changed, 111 insertions(+), 32 deletions(-) diff --git a/worker/master/controller/thirdcomponent/controller.go b/worker/master/controller/thirdcomponent/controller.go index 92f100a2f..c51c09ad9 100644 --- a/worker/master/controller/thirdcomponent/controller.go +++ b/worker/master/controller/thirdcomponent/controller.go @@ -129,15 +129,10 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e // create endpoints for service if len(component.Spec.Ports) > 0 && len(component.Status.Endpoints) > 0 { var services corev1.ServiceList - selector, err := labels.Parse(labels.FormatLabels(map[string]string{ + selector, _ := labels.Parse(labels.FormatLabels(map[string]string{ "service_id": component.Labels["service_id"], })) - if err != nil { - logrus.Errorf("create selector failure %s", err.Error()) - return ctrl.Result{}, err - } - err = r.Client.List(ctx, &services, &client.ListOptions{LabelSelector: selector}) - if err != nil { + if err = r.Client.List(ctx, &services, &client.ListOptions{LabelSelector: selector}); err != nil { return commonResult, nil } log.Infof("list component service success, size:%d", len(services.Items)) @@ -145,6 +140,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e log.Warning("component service is empty") return commonResult, nil } + // init component port var portMap = make(map[int][]*v1alpha1.ThirdComponentEndpointStatus) for _, end := range component.Status.Endpoints { @@ -154,32 +150,27 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e } portMap[port] = append(portMap[end.Address.GetPort()], end) } + // create endpoint for component service - for _, service := range services.Items { - service := service - for _, port := range service.Spec.Ports { - // if component port not exist in endpoint port list, ignore it. - if sourceEndpoint, ok := portMap[int(port.Port)]; ok { - endpoint := createEndpoint(component, &service, sourceEndpoint, int(port.Port)) + if len(component.Spec.Ports) == 1 && len(component.Spec.EndpointSource.StaticEndpoints) != 0 { + svc := services.Items[0] + ep := createEndpointsOnlyOnePort(component, svc, component.Status.Endpoints) + if ep != nil { + controllerutil.SetControllerReference(component, ep, r.Scheme) + r.applyEndpointService(ctx, log, &svc, ep) + } + } else { + for _, service := range services.Items { + service := service + for _, port := range service.Spec.Ports { + // if component port not exist in endpoint port list, ignore it. + sourceEndpoint, ok := portMap[int(port.Port)] + if !ok { + continue + } + endpoint := createEndpoint(component, &service, sourceEndpoint) controllerutil.SetControllerReference(component, &endpoint, r.Scheme) - var old corev1.Endpoints - var apply = true - if err := r.Client.Get(ctx, types.NamespacedName{Namespace: endpoint.Namespace, Name: endpoint.Name}, &old); err == nil { - // no change not apply - if reflect.DeepEqual(old.Subsets, endpoint.Subsets) { - apply = false - } - } - if apply { - if err := r.applyer.Apply(ctx, &endpoint); err != nil { - log.Errorf("apply endpoint for service %s failure %s", service.Name, err.Error()) - } - service.Annotations = endpoint.Annotations - if err := r.applyer.Apply(ctx, &service); err != nil { - log.Errorf("apply service(%s) for updating annotation: %v", service.Name, err) - } - log.Infof("apply endpoint for service %s success", service.Name) - } + r.applyEndpointService(ctx, log, &service, &endpoint) } } } @@ -194,7 +185,95 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res reconcile.Result, retErr e return reconcile.Result{}, nil } -func createEndpoint(component *v1alpha1.ThirdComponent, service *corev1.Service, sourceEndpoint []*v1alpha1.ThirdComponentEndpointStatus, port int) corev1.Endpoints { +func (r *Reconciler) applyEndpointService(ctx context.Context, log *logrus.Entry, svc *corev1.Service, ep *corev1.Endpoints) { + var old corev1.Endpoints + if err := r.Client.Get(ctx, types.NamespacedName{Namespace: ep.Namespace, Name: ep.Name}, &old); err == nil { + // no change not apply + if reflect.DeepEqual(old.Subsets, ep.Subsets) { + return + } + } + if err := r.applyer.Apply(ctx, ep); err != nil { + log.Errorf("apply endpoint for service %s failure %s", svc.Name, err.Error()) + } + + svc.Annotations = ep.Annotations + if err := r.applyer.Apply(ctx, svc); err != nil { + log.Errorf("apply service(%s) for updating annotation: %v", svc.Name, err) + } + log.Infof("apply endpoint for service %s success", svc.Name) +} + +func createEndpointsOnlyOnePort(thirdComponent *v1alpha1.ThirdComponent, service corev1.Service, sourceEndpoints []*v1alpha1.ThirdComponentEndpointStatus) *corev1.Endpoints { + if len(thirdComponent.Spec.EndpointSource.StaticEndpoints) == 0 { + // support static endpoints only for now + return nil + } + if len(thirdComponent.Spec.Ports) != 1 { + return nil + } + logrus.Debugf("create endpoints with one port") + + sourceEndpointPE := make(map[int][]*v1alpha1.ThirdComponentEndpointStatus) + for _, ep := range sourceEndpoints { + eps := sourceEndpointPE[ep.Address.GetPort()] + sourceEndpointPE[ep.Address.GetPort()] = append(eps, ep) + } + + endpoints := &corev1.Endpoints{ + TypeMeta: metav1.TypeMeta{ + Kind: "Endpoints", + APIVersion: "v1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: service.Name, + Namespace: service.Namespace, + Labels: service.Labels, + }, + } + + servicePort := service.Spec.Ports[0] + var subsets []corev1.EndpointSubset + var domain string + for port, eps := range sourceEndpointPE { + subset := corev1.EndpointSubset{ + Ports: []corev1.EndpointPort{ + { + Name: servicePort.Name, + Port: int32(port), + Protocol: servicePort.Protocol, + AppProtocol: servicePort.AppProtocol, + }, + }, + } + for _, ep := range eps { + if validation.IsDomainNotIP(string(ep.Address)) { + domain = string(ep.Address) + } + + address := corev1.EndpointAddress{ + IP: ep.Address.GetIP(), + } + if ep.Status == v1alpha1.EndpointReady { + subset.Addresses = append(subset.Addresses, address) + } else { + subset.NotReadyAddresses = append(subset.NotReadyAddresses, address) + } + } + subsets = append(subsets, subset) + } + endpoints.Subsets = subsets + + if domain != "" { + endpoints.Annotations = map[string]string{ + "domain": domain, + } + } + + return endpoints +} + +func createEndpoint(component *v1alpha1.ThirdComponent, service *corev1.Service, sourceEndpoint []*v1alpha1.ThirdComponentEndpointStatus) corev1.Endpoints { spep := make(map[int]int, len(sourceEndpoint)) for _, endpoint := range sourceEndpoint { if endpoint.ServicePort != 0 { From 345af7621b35e36a3d219fc81e1686be5cc003b3 Mon Sep 17 00:00:00 2001 From: GLYASAI Date: Sun, 15 Aug 2021 14:41:33 +0800 Subject: [PATCH 39/43] list third endpoints --- api/controller/third_party_service.go | 2 +- api/handler/third_party_service_handler.go | 112 +- api/model/third_party_srvice.go | 14 +- config/crd/rainbond.io_thirdcomponents.yaml | 6 + pkg/apis/rainbond/v1alpha1/third_component.go | 15 +- .../componentdefinition.go | 1 + .../thirdcomponentdefinition.go | 5 +- .../controller/thirdcomponent/controller.go | 3 +- .../thirdcomponent/discover/staticendpoint.go | 32 +- worker/server/pb/app_runtime_server.pb.go | 5338 ++++++----------- worker/server/pb/app_runtime_server.proto | 12 +- worker/server/server.go | 96 +- 12 files changed, 2122 insertions(+), 3514 deletions(-) diff --git a/api/controller/third_party_service.go b/api/controller/third_party_service.go index b1960cdf9..9faab12ab 100644 --- a/api/controller/third_party_service.go +++ b/api/controller/third_party_service.go @@ -137,7 +137,7 @@ func (t *ThirdPartyServiceController) listEndpoints(w http.ResponseWriter, r *ht return } if len(res) == 0 { - httputil.ReturnSuccess(r, w, []*model.EndpointResp{}) + httputil.ReturnSuccess(r, w, []*model.ThirdEndpoint{}) return } httputil.ReturnSuccess(r, w, res) diff --git a/api/handler/third_party_service_handler.go b/api/handler/third_party_service_handler.go index ef6321cf1..89d6b0620 100644 --- a/api/handler/third_party_service_handler.go +++ b/api/handler/third_party_service_handler.go @@ -29,11 +29,13 @@ import ( dbmodel "github.com/goodrain/rainbond/db/model" "github.com/goodrain/rainbond/util" "github.com/goodrain/rainbond/worker/client" + "github.com/pkg/errors" "github.com/sirupsen/logrus" ) // ThirdPartyServiceHanlder handles business logic for all third-party services type ThirdPartyServiceHanlder struct { + logger *logrus.Entry dbmanager db.Manager statusCli *client.AppRuntimeSyncClient } @@ -41,6 +43,7 @@ type ThirdPartyServiceHanlder struct { // Create3rdPartySvcHandler creates a new *ThirdPartyServiceHanlder. func Create3rdPartySvcHandler(dbmanager db.Manager, statusCli *client.AppRuntimeSyncClient) *ThirdPartyServiceHanlder { return &ThirdPartyServiceHanlder{ + logger: logrus.WithField("WHO", "ThirdPartyServiceHanlder"), dbmanager: dbmanager, statusCli: statusCli, } @@ -130,51 +133,78 @@ func (t *ThirdPartyServiceHanlder) DelEndpoints(epid, sid string) error { } // ListEndpoints lists third-party service endpoints. -func (t *ThirdPartyServiceHanlder) ListEndpoints(sid string) ([]*model.EndpointResp, error) { - endpoints, err := t.dbmanager.EndpointsDao().List(sid) +func (t *ThirdPartyServiceHanlder) ListEndpoints(componentID string) ([]*model.ThirdEndpoint, error) { + logger := t.logger.WithField("Method", "ListEndpoints"). + WithField("ComponentID", componentID) + + runtimeEndpoints, err := t.listRuntimeEndpoints(componentID) if err != nil { - logrus.Warningf("ServiceID: %s; error listing endpoints from db; %v", sid, err) + logger.Warning(err.Error()) } - m := make(map[string]*model.EndpointResp) - for _, item := range endpoints { - ep := &model.EndpointResp{ - EpID: item.UUID, - Address: func(ip string, p int) string { - if p != 0 { - return fmt.Sprintf("%s:%d", ip, p) - } - return ip - }(item.IP, item.Port), + + staticEndpoints, err := t.listStaticEndpoints(componentID) + if err != nil { + staticEndpoints = map[string]*model.ThirdEndpoint{} + logger.Warning(err.Error()) + } + + // Merge runtimeEndpoints with staticEndpoints + for _, ep := range runtimeEndpoints { + sep, ok := staticEndpoints[ep.EpID] + if !ok { + continue + } + ep.IsStatic = sep.IsStatic + ep.Address = sep.Address + delete(staticEndpoints, ep.EpID) + } + + // Add offline static endpoints + for _, ep := range staticEndpoints { + runtimeEndpoints = append(runtimeEndpoints, ep) + } + + sort.Sort(model.ThirdEndpoints(runtimeEndpoints)) + return runtimeEndpoints, nil +} + +func (t *ThirdPartyServiceHanlder) listRuntimeEndpoints(componentID string) ([]*model.ThirdEndpoint, error) { + runtimeEndpoints, err := t.statusCli.ListThirdPartyEndpoints(componentID) + if err != nil { + return nil, errors.Wrap(err, "list runtime third endpoints") + } + + var endpoints []*model.ThirdEndpoint + for _, item := range runtimeEndpoints.Items { + endpoints = append(endpoints, &model.ThirdEndpoint{ + EpID: item.Name, + Address: item.Address, + Status: item.Status, + }) + } + return endpoints, nil +} + +func (t *ThirdPartyServiceHanlder) listStaticEndpoints(componentID string) (map[string]*model.ThirdEndpoint, error) { + staticEndpoints, err := t.dbmanager.EndpointsDao().List(componentID) + if err != nil { + return nil, errors.Wrap(err, "list static endpoints") + } + + endpoints := make(map[string]*model.ThirdEndpoint) + for _, item := range staticEndpoints { + address := func(ip string, p int) string { + if p != 0 { + return fmt.Sprintf("%s:%d", ip, p) + } + return ip + }(item.IP, item.Port) + endpoints[item.UUID] = &model.ThirdEndpoint{ + EpID: item.UUID, + Address: address, Status: "-", IsStatic: true, } - m[ep.Address] = ep } - thirdPartyEndpoints, err := t.statusCli.ListThirdPartyEndpoints(sid) - if err != nil { - logrus.Warningf("ServiceID: %s; grpc; error listing third-party endpoints: %v", sid, err) - return nil, err - } - if thirdPartyEndpoints != nil && thirdPartyEndpoints.Obj != nil { - for _, item := range thirdPartyEndpoints.Obj { - ep := m[fmt.Sprintf("%s:%d", item.Ip, item.Port)] - if ep != nil { - ep.Status = item.Status - continue - } - rep := &model.EndpointResp{ - EpID: item.Uuid, - Address: item.Ip, - Status: item.Status, - IsStatic: false, - } - m[rep.Address] = rep - } - } - var res []*model.EndpointResp - for _, item := range m { - res = append(res, item) - } - sort.Sort(model.EndpointResps(res)) - return res, nil + return endpoints, nil } diff --git a/api/model/third_party_srvice.go b/api/model/third_party_srvice.go index 243888f6d..7fd3934fd 100644 --- a/api/model/third_party_srvice.go +++ b/api/model/third_party_srvice.go @@ -34,30 +34,30 @@ type DelEndpiontsReq struct { EpID string `json:"ep_id" validate:"required|len:32"` } -// EndpointResp is one of the Endpoints list in the response to list, add, +// ThirdEndpoint is one of the Endpoints list in the response to list, add, // update or delete the endpints. -type EndpointResp struct { +type ThirdEndpoint struct { EpID string `json:"ep_id"` Address string `json:"address"` Status string `json:"status"` IsStatic bool `json:"is_static"` } -// EndpointResps - -type EndpointResps []*EndpointResp +// ThirdEndpoints - +type ThirdEndpoints []*ThirdEndpoint // Len is part of sort.Interface. -func (e EndpointResps) Len() int { +func (e ThirdEndpoints) Len() int { return len(e) } // Swap is part of sort.Interface. -func (e EndpointResps) Swap(i, j int) { +func (e ThirdEndpoints) Swap(i, j int) { e[i], e[j] = e[j], e[i] } // Less is part of sort.Interface. It is implemented by calling the "by" closure in the sorter. -func (e EndpointResps) Less(i, j int) bool { +func (e ThirdEndpoints) Less(i, j int) bool { return e[i].Address < e[j].Address } diff --git a/config/crd/rainbond.io_thirdcomponents.yaml b/config/crd/rainbond.io_thirdcomponents.yaml index 82cf8f969..625a2c4ee 100644 --- a/config/crd/rainbond.io_thirdcomponents.yaml +++ b/config/crd/rainbond.io_thirdcomponents.yaml @@ -50,6 +50,9 @@ spec: description: Specify a private certificate when the protocol is HTTPS type: string + name: + description: Then Name of the Endpoint. + type: string protocol: description: 'Address protocols, including: HTTP, TCP, UDP, HTTPS' @@ -160,6 +163,9 @@ spec: address: description: The address including the port number. type: string + name: + description: Then Name of the Endpoint. + type: string reason: description: Reason probe not passed reason type: string diff --git a/pkg/apis/rainbond/v1alpha1/third_component.go b/pkg/apis/rainbond/v1alpha1/third_component.go index 0721bdc64..ef8d1f7bc 100644 --- a/pkg/apis/rainbond/v1alpha1/third_component.go +++ b/pkg/apis/rainbond/v1alpha1/third_component.go @@ -112,6 +112,9 @@ type ThirdComponentEndpointSource struct { type ThirdComponentEndpoint struct { // The address including the port number. Address string `json:"address"` + // Then Name of the Endpoint. + // +optional + Name string `json:"name"` // Address protocols, including: HTTP, TCP, UDP, HTTPS // +optional Protocol string `json:"protocol,omitempty"` @@ -362,6 +365,10 @@ func (e EndpointAddress) GetPort() int { // EnsureScheme - func (e EndpointAddress) EnsureScheme() string { address := string(e) + return ensureScheme(address) +} + +func ensureScheme(address string) string { if strings.HasPrefix(address, "http://") || strings.HasPrefix(address, "https://") { return address } @@ -382,12 +389,11 @@ func NewEndpointAddress(host string, port int) *EndpointAddress { return &ea } - u, err := url.Parse(host) + _, err := url.Parse(ensureScheme(host)) if err != nil { return nil } - u.Path = "" - ea := EndpointAddress(u.String()) + ea := EndpointAddress(host) return &ea } @@ -395,6 +401,9 @@ func NewEndpointAddress(host string, port int) *EndpointAddress { type ThirdComponentEndpointStatus struct { // The address including the port number. Address EndpointAddress `json:"address"` + // Then Name of the Endpoint. + // +optional + Name string `json:"name"` // Reference to object providing the endpoint. // +optional TargetRef *v1.ObjectReference `json:"targetRef,omitempty" protobuf:"bytes,2,opt,name=targetRef"` diff --git a/worker/appm/componentdefinition/componentdefinition.go b/worker/appm/componentdefinition/componentdefinition.go index cea24d549..e0cc119fa 100644 --- a/worker/appm/componentdefinition/componentdefinition.go +++ b/worker/appm/componentdefinition/componentdefinition.go @@ -171,6 +171,7 @@ func (c *Builder) listStaticEndpoints(componentID string) ([]*v1alpha1.ThirdComp for _, ep := range endpoints { res = append(res, &v1alpha1.ThirdComponentEndpoint{ Address: ep.GetAddress(), + Name: ep.UUID, }) } return res, nil diff --git a/worker/appm/componentdefinition/thirdcomponentdefinition.go b/worker/appm/componentdefinition/thirdcomponentdefinition.go index e07d68c07..5c04e55ef 100644 --- a/worker/appm/componentdefinition/thirdcomponentdefinition.go +++ b/worker/appm/componentdefinition/thirdcomponentdefinition.go @@ -59,8 +59,9 @@ parameter: { name: string } endpoints?: [...{ - address: string - protocol?: string + address: string + name?: string + protocol?: string clientSecret?: string }] port?: [...{ diff --git a/worker/master/controller/thirdcomponent/controller.go b/worker/master/controller/thirdcomponent/controller.go index c51c09ad9..252a6a109 100644 --- a/worker/master/controller/thirdcomponent/controller.go +++ b/worker/master/controller/thirdcomponent/controller.go @@ -189,7 +189,8 @@ func (r *Reconciler) applyEndpointService(ctx context.Context, log *logrus.Entry var old corev1.Endpoints if err := r.Client.Get(ctx, types.NamespacedName{Namespace: ep.Namespace, Name: ep.Name}, &old); err == nil { // no change not apply - if reflect.DeepEqual(old.Subsets, ep.Subsets) { + if reflect.DeepEqual(old.Subsets, ep.Subsets) && + reflect.DeepEqual(old.Annotations, ep.Annotations) { return } } diff --git a/worker/master/controller/thirdcomponent/discover/staticendpoint.go b/worker/master/controller/thirdcomponent/discover/staticendpoint.go index b97ad0212..90105104a 100644 --- a/worker/master/controller/thirdcomponent/discover/staticendpoint.go +++ b/worker/master/controller/thirdcomponent/discover/staticendpoint.go @@ -36,46 +36,44 @@ func (s *staticEndpoint) Discover(ctx context.Context, update chan *v1alpha1.Thi func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComponentEndpointStatus, error) { component := s.component - var res []*v1alpha1.ThirdComponentEndpointStatus + var endpoints []*v1alpha1.ThirdComponentEndpointStatus for _, ep := range component.Spec.EndpointSource.StaticEndpoints { - var addresses []*v1alpha1.EndpointAddress if ep.GetPort() != 0 { address := v1alpha1.NewEndpointAddress(ep.GetIP(), ep.GetPort()) if address != nil { - addresses = append(addresses, address) + endpoints = append(endpoints, &v1alpha1.ThirdComponentEndpointStatus{ + Address: *address, + Name: ep.Name, + }) } } else { for _, port := range component.Spec.Ports { address := v1alpha1.NewEndpointAddress(ep.Address, port.Port) if address != nil { - addresses = append(addresses, address) + endpoints = append(endpoints, &v1alpha1.ThirdComponentEndpointStatus{ + Address: *address, + Name: ep.Name, + }) } } } - if len(addresses) == 0 { + if len(endpoints) == 0 { continue } - for _, address := range addresses { - address := address - es := &v1alpha1.ThirdComponentEndpointStatus{ - Address: *address, - Status: v1alpha1.EndpointReady, - } - res = append(res, es) - + for _, ep := range endpoints { // Make ready as the default status - es.Status = v1alpha1.EndpointReady + ep.Status = v1alpha1.EndpointReady if s.proberManager != nil { - result, found := s.proberManager.GetResult(s.component.GetEndpointID(es)) + result, found := s.proberManager.GetResult(s.component.GetEndpointID(ep)) if found && result != results.Success { - es.Status = v1alpha1.EndpointNotReady + ep.Status = v1alpha1.EndpointNotReady } } } } - return res, nil + return endpoints, nil } func (s *staticEndpoint) SetProberManager(proberManager prober.Manager) { diff --git a/worker/server/pb/app_runtime_server.pb.go b/worker/server/pb/app_runtime_server.pb.go index bf945ca5f..70981887c 100644 --- a/worker/server/pb/app_runtime_server.pb.go +++ b/worker/server/pb/app_runtime_server.pb.go @@ -1,28 +1,26 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc v3.15.5 -// source: worker/server/pb/app_runtime_server.proto +// source: app_runtime_server.proto package pb import ( context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + math "math" ) -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) -) +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type ServiceVolumeStatus int32 @@ -31,43 +29,22 @@ const ( ServiceVolumeStatus_NOT_READY ServiceVolumeStatus = 1 ) -// Enum value maps for ServiceVolumeStatus. -var ( - ServiceVolumeStatus_name = map[int32]string{ - 0: "READY", - 1: "NOT_READY", - } - ServiceVolumeStatus_value = map[string]int32{ - "READY": 0, - "NOT_READY": 1, - } -) +var ServiceVolumeStatus_name = map[int32]string{ + 0: "READY", + 1: "NOT_READY", +} -func (x ServiceVolumeStatus) Enum() *ServiceVolumeStatus { - p := new(ServiceVolumeStatus) - *p = x - return p +var ServiceVolumeStatus_value = map[string]int32{ + "READY": 0, + "NOT_READY": 1, } func (x ServiceVolumeStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) + return proto.EnumName(ServiceVolumeStatus_name, int32(x)) } -func (ServiceVolumeStatus) Descriptor() protoreflect.EnumDescriptor { - return file_worker_server_pb_app_runtime_server_proto_enumTypes[0].Descriptor() -} - -func (ServiceVolumeStatus) Type() protoreflect.EnumType { - return &file_worker_server_pb_app_runtime_server_proto_enumTypes[0] -} - -func (x ServiceVolumeStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ServiceVolumeStatus.Descriptor instead. func (ServiceVolumeStatus) EnumDescriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{0} + return fileDescriptor_f94cf1a886c479d6, []int{0} } type PodStatus_Type int32 @@ -97,61 +74,40 @@ const ( PodStatus_UNHEALTHY PodStatus_Type = 10 ) -// Enum value maps for PodStatus_Type. -var ( - PodStatus_Type_name = map[int32]string{ - 0: "PENDING", - 1: "RUNNING", - 2: "SUCCEEDED", - 3: "FAILED", - 4: "UNKNOWN", - 5: "TEMINATING", - 6: "ABNORMAL", - 7: "INITIATING", - 8: "SCHEDULING", - 9: "NOTREADY", - 10: "UNHEALTHY", - } - PodStatus_Type_value = map[string]int32{ - "PENDING": 0, - "RUNNING": 1, - "SUCCEEDED": 2, - "FAILED": 3, - "UNKNOWN": 4, - "TEMINATING": 5, - "ABNORMAL": 6, - "INITIATING": 7, - "SCHEDULING": 8, - "NOTREADY": 9, - "UNHEALTHY": 10, - } -) +var PodStatus_Type_name = map[int32]string{ + 0: "PENDING", + 1: "RUNNING", + 2: "SUCCEEDED", + 3: "FAILED", + 4: "UNKNOWN", + 5: "TEMINATING", + 6: "ABNORMAL", + 7: "INITIATING", + 8: "SCHEDULING", + 9: "NOTREADY", + 10: "UNHEALTHY", +} -func (x PodStatus_Type) Enum() *PodStatus_Type { - p := new(PodStatus_Type) - *p = x - return p +var PodStatus_Type_value = map[string]int32{ + "PENDING": 0, + "RUNNING": 1, + "SUCCEEDED": 2, + "FAILED": 3, + "UNKNOWN": 4, + "TEMINATING": 5, + "ABNORMAL": 6, + "INITIATING": 7, + "SCHEDULING": 8, + "NOTREADY": 9, + "UNHEALTHY": 10, } func (x PodStatus_Type) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) + return proto.EnumName(PodStatus_Type_name, int32(x)) } -func (PodStatus_Type) Descriptor() protoreflect.EnumDescriptor { - return file_worker_server_pb_app_runtime_server_proto_enumTypes[1].Descriptor() -} - -func (PodStatus_Type) Type() protoreflect.EnumType { - return &file_worker_server_pb_app_runtime_server_proto_enumTypes[1] -} - -func (x PodStatus_Type) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PodStatus_Type.Descriptor instead. func (PodStatus_Type) EnumDescriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{24, 0} + return fileDescriptor_f94cf1a886c479d6, []int{24, 0} } type AppStatus_Status int32 @@ -165,1893 +121,1629 @@ const ( AppStatus_STOPPING AppStatus_Status = 5 ) -// Enum value maps for AppStatus_Status. -var ( - AppStatus_Status_name = map[int32]string{ - 0: "NIL", - 1: "RUNNING", - 2: "CLOSED", - 3: "ABNORMAL", - 4: "STARTING", - 5: "STOPPING", - } - AppStatus_Status_value = map[string]int32{ - "NIL": 0, - "RUNNING": 1, - "CLOSED": 2, - "ABNORMAL": 3, - "STARTING": 4, - "STOPPING": 5, - } -) +var AppStatus_Status_name = map[int32]string{ + 0: "NIL", + 1: "RUNNING", + 2: "CLOSED", + 3: "ABNORMAL", + 4: "STARTING", + 5: "STOPPING", +} -func (x AppStatus_Status) Enum() *AppStatus_Status { - p := new(AppStatus_Status) - *p = x - return p +var AppStatus_Status_value = map[string]int32{ + "NIL": 0, + "RUNNING": 1, + "CLOSED": 2, + "ABNORMAL": 3, + "STARTING": 4, + "STOPPING": 5, } func (x AppStatus_Status) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) + return proto.EnumName(AppStatus_Status_name, int32(x)) } -func (AppStatus_Status) Descriptor() protoreflect.EnumDescriptor { - return file_worker_server_pb_app_runtime_server_proto_enumTypes[2].Descriptor() -} - -func (AppStatus_Status) Type() protoreflect.EnumType { - return &file_worker_server_pb_app_runtime_server_proto_enumTypes[2] -} - -func (x AppStatus_Status) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use AppStatus_Status.Descriptor instead. func (AppStatus_Status) EnumDescriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{32, 0} + return fileDescriptor_f94cf1a886c479d6, []int{32, 0} } type Empty struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *Empty) Reset() { - *x = Empty{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Empty) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Empty) ProtoMessage() {} - -func (x *Empty) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_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 Empty.ProtoReflect.Descriptor instead. +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{0} + return fileDescriptor_f94cf1a886c479d6, []int{0} } +func (m *Empty) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Empty.Unmarshal(m, b) +} +func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Empty.Marshal(b, m, deterministic) +} +func (m *Empty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Empty.Merge(m, src) +} +func (m *Empty) XXX_Size() int { + return xxx_messageInfo_Empty.Size(m) +} +func (m *Empty) XXX_DiscardUnknown() { + xxx_messageInfo_Empty.DiscardUnknown(m) +} + +var xxx_messageInfo_Empty proto.InternalMessageInfo + type AppReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` + AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *AppReq) Reset() { - *x = AppReq{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AppReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppReq) ProtoMessage() {} - -func (x *AppReq) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_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 AppReq.ProtoReflect.Descriptor instead. +func (m *AppReq) Reset() { *m = AppReq{} } +func (m *AppReq) String() string { return proto.CompactTextString(m) } +func (*AppReq) ProtoMessage() {} func (*AppReq) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{1} + return fileDescriptor_f94cf1a886c479d6, []int{1} } -func (x *AppReq) GetAppId() string { - if x != nil { - return x.AppId +func (m *AppReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppReq.Unmarshal(m, b) +} +func (m *AppReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppReq.Marshal(b, m, deterministic) +} +func (m *AppReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppReq.Merge(m, src) +} +func (m *AppReq) XXX_Size() int { + return xxx_messageInfo_AppReq.Size(m) +} +func (m *AppReq) XXX_DiscardUnknown() { + xxx_messageInfo_AppReq.DiscardUnknown(m) +} + +var xxx_messageInfo_AppReq proto.InternalMessageInfo + +func (m *AppReq) GetAppId() string { + if m != nil { + return m.AppId } return "" } type AppStatusReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` + AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *AppStatusReq) Reset() { - *x = AppStatusReq{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AppStatusReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppStatusReq) ProtoMessage() {} - -func (x *AppStatusReq) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_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 AppStatusReq.ProtoReflect.Descriptor instead. +func (m *AppStatusReq) Reset() { *m = AppStatusReq{} } +func (m *AppStatusReq) String() string { return proto.CompactTextString(m) } +func (*AppStatusReq) ProtoMessage() {} func (*AppStatusReq) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{2} + return fileDescriptor_f94cf1a886c479d6, []int{2} } -func (x *AppStatusReq) GetAppId() string { - if x != nil { - return x.AppId +func (m *AppStatusReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppStatusReq.Unmarshal(m, b) +} +func (m *AppStatusReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppStatusReq.Marshal(b, m, deterministic) +} +func (m *AppStatusReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppStatusReq.Merge(m, src) +} +func (m *AppStatusReq) XXX_Size() int { + return xxx_messageInfo_AppStatusReq.Size(m) +} +func (m *AppStatusReq) XXX_DiscardUnknown() { + xxx_messageInfo_AppStatusReq.DiscardUnknown(m) +} + +var xxx_messageInfo_AppStatusReq proto.InternalMessageInfo + +func (m *AppStatusReq) GetAppId() string { + if m != nil { + return m.AppId } return "" } type ServiceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *ServiceRequest) Reset() { - *x = ServiceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServiceRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServiceRequest) ProtoMessage() {} - -func (x *ServiceRequest) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_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 ServiceRequest.ProtoReflect.Descriptor instead. +func (m *ServiceRequest) Reset() { *m = ServiceRequest{} } +func (m *ServiceRequest) String() string { return proto.CompactTextString(m) } +func (*ServiceRequest) ProtoMessage() {} func (*ServiceRequest) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{3} + return fileDescriptor_f94cf1a886c479d6, []int{3} } -func (x *ServiceRequest) GetServiceId() string { - if x != nil { - return x.ServiceId +func (m *ServiceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceRequest.Unmarshal(m, b) +} +func (m *ServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceRequest.Marshal(b, m, deterministic) +} +func (m *ServiceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceRequest.Merge(m, src) +} +func (m *ServiceRequest) XXX_Size() int { + return xxx_messageInfo_ServiceRequest.Size(m) +} +func (m *ServiceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceRequest proto.InternalMessageInfo + +func (m *ServiceRequest) GetServiceId() string { + if m != nil { + return m.ServiceId } return "" } type ServicesRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ServiceIds string `protobuf:"bytes,1,opt,name=service_ids,json=serviceIds,proto3" json:"service_ids,omitempty"` + ServiceIds string `protobuf:"bytes,1,opt,name=service_ids,json=serviceIds,proto3" json:"service_ids,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *ServicesRequest) Reset() { - *x = ServicesRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServicesRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServicesRequest) ProtoMessage() {} - -func (x *ServicesRequest) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_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 ServicesRequest.ProtoReflect.Descriptor instead. +func (m *ServicesRequest) Reset() { *m = ServicesRequest{} } +func (m *ServicesRequest) String() string { return proto.CompactTextString(m) } +func (*ServicesRequest) ProtoMessage() {} func (*ServicesRequest) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{4} + return fileDescriptor_f94cf1a886c479d6, []int{4} } -func (x *ServicesRequest) GetServiceIds() string { - if x != nil { - return x.ServiceIds +func (m *ServicesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServicesRequest.Unmarshal(m, b) +} +func (m *ServicesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServicesRequest.Marshal(b, m, deterministic) +} +func (m *ServicesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServicesRequest.Merge(m, src) +} +func (m *ServicesRequest) XXX_Size() int { + return xxx_messageInfo_ServicesRequest.Size(m) +} +func (m *ServicesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ServicesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ServicesRequest proto.InternalMessageInfo + +func (m *ServicesRequest) GetServiceIds() string { + if m != nil { + return m.ServiceIds } return "" } type TenantRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TenantId string `protobuf:"bytes,1,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty"` + TenantId string `protobuf:"bytes,1,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *TenantRequest) Reset() { - *x = TenantRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TenantRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TenantRequest) ProtoMessage() {} - -func (x *TenantRequest) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_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 TenantRequest.ProtoReflect.Descriptor instead. +func (m *TenantRequest) Reset() { *m = TenantRequest{} } +func (m *TenantRequest) String() string { return proto.CompactTextString(m) } +func (*TenantRequest) ProtoMessage() {} func (*TenantRequest) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{5} + return fileDescriptor_f94cf1a886c479d6, []int{5} } -func (x *TenantRequest) GetTenantId() string { - if x != nil { - return x.TenantId +func (m *TenantRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TenantRequest.Unmarshal(m, b) +} +func (m *TenantRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TenantRequest.Marshal(b, m, deterministic) +} +func (m *TenantRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TenantRequest.Merge(m, src) +} +func (m *TenantRequest) XXX_Size() int { + return xxx_messageInfo_TenantRequest.Size(m) +} +func (m *TenantRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TenantRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TenantRequest proto.InternalMessageInfo + +func (m *TenantRequest) GetTenantId() string { + if m != nil { + return m.TenantId } return "" } type StatusMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status map[string]string `protobuf:"bytes,1,rep,name=status,proto3" json:"status,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Status map[string]string `protobuf:"bytes,1,rep,name=status,proto3" json:"status,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *StatusMessage) Reset() { - *x = StatusMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StatusMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StatusMessage) ProtoMessage() {} - -func (x *StatusMessage) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_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 StatusMessage.ProtoReflect.Descriptor instead. +func (m *StatusMessage) Reset() { *m = StatusMessage{} } +func (m *StatusMessage) String() string { return proto.CompactTextString(m) } +func (*StatusMessage) ProtoMessage() {} func (*StatusMessage) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{6} + return fileDescriptor_f94cf1a886c479d6, []int{6} } -func (x *StatusMessage) GetStatus() map[string]string { - if x != nil { - return x.Status +func (m *StatusMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StatusMessage.Unmarshal(m, b) +} +func (m *StatusMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StatusMessage.Marshal(b, m, deterministic) +} +func (m *StatusMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_StatusMessage.Merge(m, src) +} +func (m *StatusMessage) XXX_Size() int { + return xxx_messageInfo_StatusMessage.Size(m) +} +func (m *StatusMessage) XXX_DiscardUnknown() { + xxx_messageInfo_StatusMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_StatusMessage proto.InternalMessageInfo + +func (m *StatusMessage) GetStatus() map[string]string { + if m != nil { + return m.Status } return nil } type DiskMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Disks map[string]float64 `protobuf:"bytes,1,rep,name=disks,proto3" json:"disks,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` + Disks map[string]float64 `protobuf:"bytes,1,rep,name=disks,proto3" json:"disks,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *DiskMessage) Reset() { - *x = DiskMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DiskMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DiskMessage) ProtoMessage() {} - -func (x *DiskMessage) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[7] - 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 DiskMessage.ProtoReflect.Descriptor instead. +func (m *DiskMessage) Reset() { *m = DiskMessage{} } +func (m *DiskMessage) String() string { return proto.CompactTextString(m) } +func (*DiskMessage) ProtoMessage() {} func (*DiskMessage) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{7} + return fileDescriptor_f94cf1a886c479d6, []int{7} } -func (x *DiskMessage) GetDisks() map[string]float64 { - if x != nil { - return x.Disks +func (m *DiskMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DiskMessage.Unmarshal(m, b) +} +func (m *DiskMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DiskMessage.Marshal(b, m, deterministic) +} +func (m *DiskMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_DiskMessage.Merge(m, src) +} +func (m *DiskMessage) XXX_Size() int { + return xxx_messageInfo_DiskMessage.Size(m) +} +func (m *DiskMessage) XXX_DiscardUnknown() { + xxx_messageInfo_DiskMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_DiskMessage proto.InternalMessageInfo + +func (m *DiskMessage) GetDisks() map[string]float64 { + if m != nil { + return m.Disks } return nil } type ServiceAppPodList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - OldPods []*ServiceAppPod `protobuf:"bytes,1,rep,name=oldPods,proto3" json:"oldPods,omitempty"` - NewPods []*ServiceAppPod `protobuf:"bytes,2,rep,name=newPods,proto3" json:"newPods,omitempty"` + OldPods []*ServiceAppPod `protobuf:"bytes,1,rep,name=oldPods,proto3" json:"oldPods,omitempty"` + NewPods []*ServiceAppPod `protobuf:"bytes,2,rep,name=newPods,proto3" json:"newPods,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *ServiceAppPodList) Reset() { - *x = ServiceAppPodList{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServiceAppPodList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServiceAppPodList) ProtoMessage() {} - -func (x *ServiceAppPodList) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[8] - 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 ServiceAppPodList.ProtoReflect.Descriptor instead. +func (m *ServiceAppPodList) Reset() { *m = ServiceAppPodList{} } +func (m *ServiceAppPodList) String() string { return proto.CompactTextString(m) } +func (*ServiceAppPodList) ProtoMessage() {} func (*ServiceAppPodList) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{8} + return fileDescriptor_f94cf1a886c479d6, []int{8} } -func (x *ServiceAppPodList) GetOldPods() []*ServiceAppPod { - if x != nil { - return x.OldPods +func (m *ServiceAppPodList) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceAppPodList.Unmarshal(m, b) +} +func (m *ServiceAppPodList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceAppPodList.Marshal(b, m, deterministic) +} +func (m *ServiceAppPodList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceAppPodList.Merge(m, src) +} +func (m *ServiceAppPodList) XXX_Size() int { + return xxx_messageInfo_ServiceAppPodList.Size(m) +} +func (m *ServiceAppPodList) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceAppPodList.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceAppPodList proto.InternalMessageInfo + +func (m *ServiceAppPodList) GetOldPods() []*ServiceAppPod { + if m != nil { + return m.OldPods } return nil } -func (x *ServiceAppPodList) GetNewPods() []*ServiceAppPod { - if x != nil { - return x.NewPods +func (m *ServiceAppPodList) GetNewPods() []*ServiceAppPod { + if m != nil { + return m.NewPods } return nil } type MultiServiceAppPodList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ServicePods map[string]*ServiceAppPodList `protobuf:"bytes,1,rep,name=servicePods,proto3" json:"servicePods,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + ServicePods map[string]*ServiceAppPodList `protobuf:"bytes,1,rep,name=servicePods,proto3" json:"servicePods,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *MultiServiceAppPodList) Reset() { - *x = MultiServiceAppPodList{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MultiServiceAppPodList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MultiServiceAppPodList) ProtoMessage() {} - -func (x *MultiServiceAppPodList) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[9] - 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 MultiServiceAppPodList.ProtoReflect.Descriptor instead. +func (m *MultiServiceAppPodList) Reset() { *m = MultiServiceAppPodList{} } +func (m *MultiServiceAppPodList) String() string { return proto.CompactTextString(m) } +func (*MultiServiceAppPodList) ProtoMessage() {} func (*MultiServiceAppPodList) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{9} + return fileDescriptor_f94cf1a886c479d6, []int{9} } -func (x *MultiServiceAppPodList) GetServicePods() map[string]*ServiceAppPodList { - if x != nil { - return x.ServicePods +func (m *MultiServiceAppPodList) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MultiServiceAppPodList.Unmarshal(m, b) +} +func (m *MultiServiceAppPodList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MultiServiceAppPodList.Marshal(b, m, deterministic) +} +func (m *MultiServiceAppPodList) XXX_Merge(src proto.Message) { + xxx_messageInfo_MultiServiceAppPodList.Merge(m, src) +} +func (m *MultiServiceAppPodList) XXX_Size() int { + return xxx_messageInfo_MultiServiceAppPodList.Size(m) +} +func (m *MultiServiceAppPodList) XXX_DiscardUnknown() { + xxx_messageInfo_MultiServiceAppPodList.DiscardUnknown(m) +} + +var xxx_messageInfo_MultiServiceAppPodList proto.InternalMessageInfo + +func (m *MultiServiceAppPodList) GetServicePods() map[string]*ServiceAppPodList { + if m != nil { + return m.ServicePods } return nil } type ComponentPodNums struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PodNums map[string]int32 `protobuf:"bytes,1,rep,name=podNums,proto3" json:"podNums,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + PodNums map[string]int32 `protobuf:"bytes,1,rep,name=podNums,proto3" json:"podNums,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *ComponentPodNums) Reset() { - *x = ComponentPodNums{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ComponentPodNums) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ComponentPodNums) ProtoMessage() {} - -func (x *ComponentPodNums) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[10] - 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 ComponentPodNums.ProtoReflect.Descriptor instead. +func (m *ComponentPodNums) Reset() { *m = ComponentPodNums{} } +func (m *ComponentPodNums) String() string { return proto.CompactTextString(m) } +func (*ComponentPodNums) ProtoMessage() {} func (*ComponentPodNums) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{10} + return fileDescriptor_f94cf1a886c479d6, []int{10} } -func (x *ComponentPodNums) GetPodNums() map[string]int32 { - if x != nil { - return x.PodNums +func (m *ComponentPodNums) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ComponentPodNums.Unmarshal(m, b) +} +func (m *ComponentPodNums) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ComponentPodNums.Marshal(b, m, deterministic) +} +func (m *ComponentPodNums) XXX_Merge(src proto.Message) { + xxx_messageInfo_ComponentPodNums.Merge(m, src) +} +func (m *ComponentPodNums) XXX_Size() int { + return xxx_messageInfo_ComponentPodNums.Size(m) +} +func (m *ComponentPodNums) XXX_DiscardUnknown() { + xxx_messageInfo_ComponentPodNums.DiscardUnknown(m) +} + +var xxx_messageInfo_ComponentPodNums proto.InternalMessageInfo + +func (m *ComponentPodNums) GetPodNums() map[string]int32 { + if m != nil { + return m.PodNums } return nil } type ServiceAppPod struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` - DeployId string `protobuf:"bytes,2,opt,name=deploy_id,json=deployId,proto3" json:"deploy_id,omitempty"` - DeployType string `protobuf:"bytes,3,opt,name=deploy_type,json=deployType,proto3" json:"deploy_type,omitempty"` - PodName string `protobuf:"bytes,4,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` - PodIp string `protobuf:"bytes,5,opt,name=pod_ip,json=podIp,proto3" json:"pod_ip,omitempty"` - PodStatus string `protobuf:"bytes,6,opt,name=pod_status,json=podStatus,proto3" json:"pod_status,omitempty"` - Containers map[string]*Container `protobuf:"bytes,7,rep,name=containers,proto3" json:"containers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - PodVolumes []string `protobuf:"bytes,8,rep,name=pod_volumes,json=podVolumes,proto3" json:"pod_volumes,omitempty"` + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + DeployId string `protobuf:"bytes,2,opt,name=deploy_id,json=deployId,proto3" json:"deploy_id,omitempty"` + DeployType string `protobuf:"bytes,3,opt,name=deploy_type,json=deployType,proto3" json:"deploy_type,omitempty"` + PodName string `protobuf:"bytes,4,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` + PodIp string `protobuf:"bytes,5,opt,name=pod_ip,json=podIp,proto3" json:"pod_ip,omitempty"` + PodStatus string `protobuf:"bytes,6,opt,name=pod_status,json=podStatus,proto3" json:"pod_status,omitempty"` + Containers map[string]*Container `protobuf:"bytes,7,rep,name=containers,proto3" json:"containers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + PodVolumes []string `protobuf:"bytes,8,rep,name=pod_volumes,json=podVolumes,proto3" json:"pod_volumes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *ServiceAppPod) Reset() { - *x = ServiceAppPod{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServiceAppPod) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServiceAppPod) ProtoMessage() {} - -func (x *ServiceAppPod) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[11] - 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 ServiceAppPod.ProtoReflect.Descriptor instead. +func (m *ServiceAppPod) Reset() { *m = ServiceAppPod{} } +func (m *ServiceAppPod) String() string { return proto.CompactTextString(m) } +func (*ServiceAppPod) ProtoMessage() {} func (*ServiceAppPod) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{11} + return fileDescriptor_f94cf1a886c479d6, []int{11} } -func (x *ServiceAppPod) GetServiceId() string { - if x != nil { - return x.ServiceId +func (m *ServiceAppPod) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceAppPod.Unmarshal(m, b) +} +func (m *ServiceAppPod) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceAppPod.Marshal(b, m, deterministic) +} +func (m *ServiceAppPod) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceAppPod.Merge(m, src) +} +func (m *ServiceAppPod) XXX_Size() int { + return xxx_messageInfo_ServiceAppPod.Size(m) +} +func (m *ServiceAppPod) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceAppPod.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceAppPod proto.InternalMessageInfo + +func (m *ServiceAppPod) GetServiceId() string { + if m != nil { + return m.ServiceId } return "" } -func (x *ServiceAppPod) GetDeployId() string { - if x != nil { - return x.DeployId +func (m *ServiceAppPod) GetDeployId() string { + if m != nil { + return m.DeployId } return "" } -func (x *ServiceAppPod) GetDeployType() string { - if x != nil { - return x.DeployType +func (m *ServiceAppPod) GetDeployType() string { + if m != nil { + return m.DeployType } return "" } -func (x *ServiceAppPod) GetPodName() string { - if x != nil { - return x.PodName +func (m *ServiceAppPod) GetPodName() string { + if m != nil { + return m.PodName } return "" } -func (x *ServiceAppPod) GetPodIp() string { - if x != nil { - return x.PodIp +func (m *ServiceAppPod) GetPodIp() string { + if m != nil { + return m.PodIp } return "" } -func (x *ServiceAppPod) GetPodStatus() string { - if x != nil { - return x.PodStatus +func (m *ServiceAppPod) GetPodStatus() string { + if m != nil { + return m.PodStatus } return "" } -func (x *ServiceAppPod) GetContainers() map[string]*Container { - if x != nil { - return x.Containers +func (m *ServiceAppPod) GetContainers() map[string]*Container { + if m != nil { + return m.Containers } return nil } -func (x *ServiceAppPod) GetPodVolumes() []string { - if x != nil { - return x.PodVolumes +func (m *ServiceAppPod) GetPodVolumes() []string { + if m != nil { + return m.PodVolumes } return nil } type Container struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ContainerName string `protobuf:"bytes,1,opt,name=container_name,json=containerName,proto3" json:"container_name,omitempty"` - MemoryLimit int64 `protobuf:"varint,2,opt,name=memory_limit,json=memoryLimit,proto3" json:"memory_limit,omitempty"` - CpuRequest int64 `protobuf:"varint,3,opt,name=cpu_request,json=cpuRequest,proto3" json:"cpu_request,omitempty"` + ContainerName string `protobuf:"bytes,1,opt,name=container_name,json=containerName,proto3" json:"container_name,omitempty"` + MemoryLimit int64 `protobuf:"varint,2,opt,name=memory_limit,json=memoryLimit,proto3" json:"memory_limit,omitempty"` + CpuRequest int64 `protobuf:"varint,3,opt,name=cpu_request,json=cpuRequest,proto3" json:"cpu_request,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *Container) Reset() { - *x = Container{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Container) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Container) ProtoMessage() {} - -func (x *Container) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[12] - 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 Container.ProtoReflect.Descriptor instead. +func (m *Container) Reset() { *m = Container{} } +func (m *Container) String() string { return proto.CompactTextString(m) } +func (*Container) ProtoMessage() {} func (*Container) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{12} + return fileDescriptor_f94cf1a886c479d6, []int{12} } -func (x *Container) GetContainerName() string { - if x != nil { - return x.ContainerName +func (m *Container) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Container.Unmarshal(m, b) +} +func (m *Container) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Container.Marshal(b, m, deterministic) +} +func (m *Container) XXX_Merge(src proto.Message) { + xxx_messageInfo_Container.Merge(m, src) +} +func (m *Container) XXX_Size() int { + return xxx_messageInfo_Container.Size(m) +} +func (m *Container) XXX_DiscardUnknown() { + xxx_messageInfo_Container.DiscardUnknown(m) +} + +var xxx_messageInfo_Container proto.InternalMessageInfo + +func (m *Container) GetContainerName() string { + if m != nil { + return m.ContainerName } return "" } -func (x *Container) GetMemoryLimit() int64 { - if x != nil { - return x.MemoryLimit +func (m *Container) GetMemoryLimit() int64 { + if m != nil { + return m.MemoryLimit } return 0 } -func (x *Container) GetCpuRequest() int64 { - if x != nil { - return x.CpuRequest +func (m *Container) GetCpuRequest() int64 { + if m != nil { + return m.CpuRequest } return 0 } type DeployInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` - Statefuleset string `protobuf:"bytes,2,opt,name=statefuleset,proto3" json:"statefuleset,omitempty"` - Deployment string `protobuf:"bytes,3,opt,name=deployment,proto3" json:"deployment,omitempty"` - StartTime string `protobuf:"bytes,4,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` - Pods map[string]string `protobuf:"bytes,5,rep,name=pods,proto3" json:"pods,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Services map[string]string `protobuf:"bytes,6,rep,name=services,proto3" json:"services,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Endpoints map[string]string `protobuf:"bytes,7,rep,name=endpoints,proto3" json:"endpoints,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Secrets map[string]string `protobuf:"bytes,8,rep,name=secrets,proto3" json:"secrets,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Ingresses map[string]string `protobuf:"bytes,9,rep,name=ingresses,proto3" json:"ingresses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Replicatset map[string]string `protobuf:"bytes,10,rep,name=replicatset,proto3" json:"replicatset,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Status string `protobuf:"bytes,11,opt,name=status,proto3" json:"status,omitempty"` + Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` + Statefuleset string `protobuf:"bytes,2,opt,name=statefuleset,proto3" json:"statefuleset,omitempty"` + Deployment string `protobuf:"bytes,3,opt,name=deployment,proto3" json:"deployment,omitempty"` + StartTime string `protobuf:"bytes,4,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + Pods map[string]string `protobuf:"bytes,5,rep,name=pods,proto3" json:"pods,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Services map[string]string `protobuf:"bytes,6,rep,name=services,proto3" json:"services,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Endpoints map[string]string `protobuf:"bytes,7,rep,name=endpoints,proto3" json:"endpoints,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Secrets map[string]string `protobuf:"bytes,8,rep,name=secrets,proto3" json:"secrets,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Ingresses map[string]string `protobuf:"bytes,9,rep,name=ingresses,proto3" json:"ingresses,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Replicatset map[string]string `protobuf:"bytes,10,rep,name=replicatset,proto3" json:"replicatset,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Status string `protobuf:"bytes,11,opt,name=status,proto3" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *DeployInfo) Reset() { - *x = DeployInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeployInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeployInfo) ProtoMessage() {} - -func (x *DeployInfo) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[13] - 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 DeployInfo.ProtoReflect.Descriptor instead. +func (m *DeployInfo) Reset() { *m = DeployInfo{} } +func (m *DeployInfo) String() string { return proto.CompactTextString(m) } +func (*DeployInfo) ProtoMessage() {} func (*DeployInfo) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{13} + return fileDescriptor_f94cf1a886c479d6, []int{13} } -func (x *DeployInfo) GetNamespace() string { - if x != nil { - return x.Namespace +func (m *DeployInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeployInfo.Unmarshal(m, b) +} +func (m *DeployInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeployInfo.Marshal(b, m, deterministic) +} +func (m *DeployInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeployInfo.Merge(m, src) +} +func (m *DeployInfo) XXX_Size() int { + return xxx_messageInfo_DeployInfo.Size(m) +} +func (m *DeployInfo) XXX_DiscardUnknown() { + xxx_messageInfo_DeployInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_DeployInfo proto.InternalMessageInfo + +func (m *DeployInfo) GetNamespace() string { + if m != nil { + return m.Namespace } return "" } -func (x *DeployInfo) GetStatefuleset() string { - if x != nil { - return x.Statefuleset +func (m *DeployInfo) GetStatefuleset() string { + if m != nil { + return m.Statefuleset } return "" } -func (x *DeployInfo) GetDeployment() string { - if x != nil { - return x.Deployment +func (m *DeployInfo) GetDeployment() string { + if m != nil { + return m.Deployment } return "" } -func (x *DeployInfo) GetStartTime() string { - if x != nil { - return x.StartTime +func (m *DeployInfo) GetStartTime() string { + if m != nil { + return m.StartTime } return "" } -func (x *DeployInfo) GetPods() map[string]string { - if x != nil { - return x.Pods +func (m *DeployInfo) GetPods() map[string]string { + if m != nil { + return m.Pods } return nil } -func (x *DeployInfo) GetServices() map[string]string { - if x != nil { - return x.Services +func (m *DeployInfo) GetServices() map[string]string { + if m != nil { + return m.Services } return nil } -func (x *DeployInfo) GetEndpoints() map[string]string { - if x != nil { - return x.Endpoints +func (m *DeployInfo) GetEndpoints() map[string]string { + if m != nil { + return m.Endpoints } return nil } -func (x *DeployInfo) GetSecrets() map[string]string { - if x != nil { - return x.Secrets +func (m *DeployInfo) GetSecrets() map[string]string { + if m != nil { + return m.Secrets } return nil } -func (x *DeployInfo) GetIngresses() map[string]string { - if x != nil { - return x.Ingresses +func (m *DeployInfo) GetIngresses() map[string]string { + if m != nil { + return m.Ingresses } return nil } -func (x *DeployInfo) GetReplicatset() map[string]string { - if x != nil { - return x.Replicatset +func (m *DeployInfo) GetReplicatset() map[string]string { + if m != nil { + return m.Replicatset } return nil } -func (x *DeployInfo) GetStatus() string { - if x != nil { - return x.Status +func (m *DeployInfo) GetStatus() string { + if m != nil { + return m.Status } return "" } type TenantResource struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CpuRequest int64 `protobuf:"varint,1,opt,name=cpu_request,json=cpuRequest,proto3" json:"cpu_request,omitempty"` - CpuLimit int64 `protobuf:"varint,2,opt,name=cpu_limit,json=cpuLimit,proto3" json:"cpu_limit,omitempty"` - MemoryRequest int64 `protobuf:"varint,3,opt,name=memory_request,json=memoryRequest,proto3" json:"memory_request,omitempty"` - MemoryLimit int64 `protobuf:"varint,4,opt,name=memory_limit,json=memoryLimit,proto3" json:"memory_limit,omitempty"` - RunningAppNum int64 `protobuf:"varint,5,opt,name=running_app_num,json=runningAppNum,proto3" json:"running_app_num,omitempty"` - RunningAppThirdNum int64 `protobuf:"varint,10,opt,name=running_app_third_num,json=runningAppThirdNum,proto3" json:"running_app_third_num,omitempty"` - RunningAppInternalNum int64 `protobuf:"varint,11,opt,name=running_app_internal_num,json=runningAppInternalNum,proto3" json:"running_app_internal_num,omitempty"` + CpuRequest int64 `protobuf:"varint,1,opt,name=cpu_request,json=cpuRequest,proto3" json:"cpu_request,omitempty"` + CpuLimit int64 `protobuf:"varint,2,opt,name=cpu_limit,json=cpuLimit,proto3" json:"cpu_limit,omitempty"` + MemoryRequest int64 `protobuf:"varint,3,opt,name=memory_request,json=memoryRequest,proto3" json:"memory_request,omitempty"` + MemoryLimit int64 `protobuf:"varint,4,opt,name=memory_limit,json=memoryLimit,proto3" json:"memory_limit,omitempty"` + RunningAppNum int64 `protobuf:"varint,5,opt,name=running_app_num,json=runningAppNum,proto3" json:"running_app_num,omitempty"` + RunningAppThirdNum int64 `protobuf:"varint,10,opt,name=running_app_third_num,json=runningAppThirdNum,proto3" json:"running_app_third_num,omitempty"` + RunningAppInternalNum int64 `protobuf:"varint,11,opt,name=running_app_internal_num,json=runningAppInternalNum,proto3" json:"running_app_internal_num,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *TenantResource) Reset() { - *x = TenantResource{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TenantResource) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TenantResource) ProtoMessage() {} - -func (x *TenantResource) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[14] - 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 TenantResource.ProtoReflect.Descriptor instead. +func (m *TenantResource) Reset() { *m = TenantResource{} } +func (m *TenantResource) String() string { return proto.CompactTextString(m) } +func (*TenantResource) ProtoMessage() {} func (*TenantResource) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{14} + return fileDescriptor_f94cf1a886c479d6, []int{14} } -func (x *TenantResource) GetCpuRequest() int64 { - if x != nil { - return x.CpuRequest +func (m *TenantResource) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TenantResource.Unmarshal(m, b) +} +func (m *TenantResource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TenantResource.Marshal(b, m, deterministic) +} +func (m *TenantResource) XXX_Merge(src proto.Message) { + xxx_messageInfo_TenantResource.Merge(m, src) +} +func (m *TenantResource) XXX_Size() int { + return xxx_messageInfo_TenantResource.Size(m) +} +func (m *TenantResource) XXX_DiscardUnknown() { + xxx_messageInfo_TenantResource.DiscardUnknown(m) +} + +var xxx_messageInfo_TenantResource proto.InternalMessageInfo + +func (m *TenantResource) GetCpuRequest() int64 { + if m != nil { + return m.CpuRequest } return 0 } -func (x *TenantResource) GetCpuLimit() int64 { - if x != nil { - return x.CpuLimit +func (m *TenantResource) GetCpuLimit() int64 { + if m != nil { + return m.CpuLimit } return 0 } -func (x *TenantResource) GetMemoryRequest() int64 { - if x != nil { - return x.MemoryRequest +func (m *TenantResource) GetMemoryRequest() int64 { + if m != nil { + return m.MemoryRequest } return 0 } -func (x *TenantResource) GetMemoryLimit() int64 { - if x != nil { - return x.MemoryLimit +func (m *TenantResource) GetMemoryLimit() int64 { + if m != nil { + return m.MemoryLimit } return 0 } -func (x *TenantResource) GetRunningAppNum() int64 { - if x != nil { - return x.RunningAppNum +func (m *TenantResource) GetRunningAppNum() int64 { + if m != nil { + return m.RunningAppNum } return 0 } -func (x *TenantResource) GetRunningAppThirdNum() int64 { - if x != nil { - return x.RunningAppThirdNum +func (m *TenantResource) GetRunningAppThirdNum() int64 { + if m != nil { + return m.RunningAppThirdNum } return 0 } -func (x *TenantResource) GetRunningAppInternalNum() int64 { - if x != nil { - return x.RunningAppInternalNum +func (m *TenantResource) GetRunningAppInternalNum() int64 { + if m != nil { + return m.RunningAppInternalNum } return 0 } type TenantResourceList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Resources map[string]*TenantResource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Resources map[string]*TenantResource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *TenantResourceList) Reset() { - *x = TenantResourceList{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TenantResourceList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TenantResourceList) ProtoMessage() {} - -func (x *TenantResourceList) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[15] - 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 TenantResourceList.ProtoReflect.Descriptor instead. +func (m *TenantResourceList) Reset() { *m = TenantResourceList{} } +func (m *TenantResourceList) String() string { return proto.CompactTextString(m) } +func (*TenantResourceList) ProtoMessage() {} func (*TenantResourceList) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{15} + return fileDescriptor_f94cf1a886c479d6, []int{15} } -func (x *TenantResourceList) GetResources() map[string]*TenantResource { - if x != nil { - return x.Resources +func (m *TenantResourceList) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TenantResourceList.Unmarshal(m, b) +} +func (m *TenantResourceList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TenantResourceList.Marshal(b, m, deterministic) +} +func (m *TenantResourceList) XXX_Merge(src proto.Message) { + xxx_messageInfo_TenantResourceList.Merge(m, src) +} +func (m *TenantResourceList) XXX_Size() int { + return xxx_messageInfo_TenantResourceList.Size(m) +} +func (m *TenantResourceList) XXX_DiscardUnknown() { + xxx_messageInfo_TenantResourceList.DiscardUnknown(m) +} + +var xxx_messageInfo_TenantResourceList proto.InternalMessageInfo + +func (m *TenantResourceList) GetResources() map[string]*TenantResource { + if m != nil { + return m.Resources } return nil } type AddThirdPartyEndpointsReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` - Sid string `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid,omitempty"` - Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` - Port int32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` - IsOnline bool `protobuf:"varint,5,opt,name=is_online,json=isOnline,proto3" json:"is_online,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + Sid string `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid,omitempty"` + Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` + Port int32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` + IsOnline bool `protobuf:"varint,5,opt,name=is_online,json=isOnline,proto3" json:"is_online,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *AddThirdPartyEndpointsReq) Reset() { - *x = AddThirdPartyEndpointsReq{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddThirdPartyEndpointsReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddThirdPartyEndpointsReq) ProtoMessage() {} - -func (x *AddThirdPartyEndpointsReq) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[16] - 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 AddThirdPartyEndpointsReq.ProtoReflect.Descriptor instead. +func (m *AddThirdPartyEndpointsReq) Reset() { *m = AddThirdPartyEndpointsReq{} } +func (m *AddThirdPartyEndpointsReq) String() string { return proto.CompactTextString(m) } +func (*AddThirdPartyEndpointsReq) ProtoMessage() {} func (*AddThirdPartyEndpointsReq) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{16} + return fileDescriptor_f94cf1a886c479d6, []int{16} } -func (x *AddThirdPartyEndpointsReq) GetUuid() string { - if x != nil { - return x.Uuid +func (m *AddThirdPartyEndpointsReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AddThirdPartyEndpointsReq.Unmarshal(m, b) +} +func (m *AddThirdPartyEndpointsReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AddThirdPartyEndpointsReq.Marshal(b, m, deterministic) +} +func (m *AddThirdPartyEndpointsReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddThirdPartyEndpointsReq.Merge(m, src) +} +func (m *AddThirdPartyEndpointsReq) XXX_Size() int { + return xxx_messageInfo_AddThirdPartyEndpointsReq.Size(m) +} +func (m *AddThirdPartyEndpointsReq) XXX_DiscardUnknown() { + xxx_messageInfo_AddThirdPartyEndpointsReq.DiscardUnknown(m) +} + +var xxx_messageInfo_AddThirdPartyEndpointsReq proto.InternalMessageInfo + +func (m *AddThirdPartyEndpointsReq) GetUuid() string { + if m != nil { + return m.Uuid } return "" } -func (x *AddThirdPartyEndpointsReq) GetSid() string { - if x != nil { - return x.Sid +func (m *AddThirdPartyEndpointsReq) GetSid() string { + if m != nil { + return m.Sid } return "" } -func (x *AddThirdPartyEndpointsReq) GetIp() string { - if x != nil { - return x.Ip +func (m *AddThirdPartyEndpointsReq) GetIp() string { + if m != nil { + return m.Ip } return "" } -func (x *AddThirdPartyEndpointsReq) GetPort() int32 { - if x != nil { - return x.Port +func (m *AddThirdPartyEndpointsReq) GetPort() int32 { + if m != nil { + return m.Port } return 0 } -func (x *AddThirdPartyEndpointsReq) GetIsOnline() bool { - if x != nil { - return x.IsOnline +func (m *AddThirdPartyEndpointsReq) GetIsOnline() bool { + if m != nil { + return m.IsOnline } return false } type UpdThirdPartyEndpointsReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` - Sid string `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid,omitempty"` - Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` - Port int32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` - IsOnline bool `protobuf:"varint,5,opt,name=is_online,json=isOnline,proto3" json:"is_online,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + Sid string `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid,omitempty"` + Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` + Port int32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` + IsOnline bool `protobuf:"varint,5,opt,name=is_online,json=isOnline,proto3" json:"is_online,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *UpdThirdPartyEndpointsReq) Reset() { - *x = UpdThirdPartyEndpointsReq{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdThirdPartyEndpointsReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdThirdPartyEndpointsReq) ProtoMessage() {} - -func (x *UpdThirdPartyEndpointsReq) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[17] - 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 UpdThirdPartyEndpointsReq.ProtoReflect.Descriptor instead. +func (m *UpdThirdPartyEndpointsReq) Reset() { *m = UpdThirdPartyEndpointsReq{} } +func (m *UpdThirdPartyEndpointsReq) String() string { return proto.CompactTextString(m) } +func (*UpdThirdPartyEndpointsReq) ProtoMessage() {} func (*UpdThirdPartyEndpointsReq) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{17} + return fileDescriptor_f94cf1a886c479d6, []int{17} } -func (x *UpdThirdPartyEndpointsReq) GetUuid() string { - if x != nil { - return x.Uuid +func (m *UpdThirdPartyEndpointsReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UpdThirdPartyEndpointsReq.Unmarshal(m, b) +} +func (m *UpdThirdPartyEndpointsReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UpdThirdPartyEndpointsReq.Marshal(b, m, deterministic) +} +func (m *UpdThirdPartyEndpointsReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdThirdPartyEndpointsReq.Merge(m, src) +} +func (m *UpdThirdPartyEndpointsReq) XXX_Size() int { + return xxx_messageInfo_UpdThirdPartyEndpointsReq.Size(m) +} +func (m *UpdThirdPartyEndpointsReq) XXX_DiscardUnknown() { + xxx_messageInfo_UpdThirdPartyEndpointsReq.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdThirdPartyEndpointsReq proto.InternalMessageInfo + +func (m *UpdThirdPartyEndpointsReq) GetUuid() string { + if m != nil { + return m.Uuid } return "" } -func (x *UpdThirdPartyEndpointsReq) GetSid() string { - if x != nil { - return x.Sid +func (m *UpdThirdPartyEndpointsReq) GetSid() string { + if m != nil { + return m.Sid } return "" } -func (x *UpdThirdPartyEndpointsReq) GetIp() string { - if x != nil { - return x.Ip +func (m *UpdThirdPartyEndpointsReq) GetIp() string { + if m != nil { + return m.Ip } return "" } -func (x *UpdThirdPartyEndpointsReq) GetPort() int32 { - if x != nil { - return x.Port +func (m *UpdThirdPartyEndpointsReq) GetPort() int32 { + if m != nil { + return m.Port } return 0 } -func (x *UpdThirdPartyEndpointsReq) GetIsOnline() bool { - if x != nil { - return x.IsOnline +func (m *UpdThirdPartyEndpointsReq) GetIsOnline() bool { + if m != nil { + return m.IsOnline } return false } type DelThirdPartyEndpointsReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` - Sid string `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid,omitempty"` - Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` - Port int32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + Sid string `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid,omitempty"` + Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` + Port int32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *DelThirdPartyEndpointsReq) Reset() { - *x = DelThirdPartyEndpointsReq{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DelThirdPartyEndpointsReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DelThirdPartyEndpointsReq) ProtoMessage() {} - -func (x *DelThirdPartyEndpointsReq) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[18] - 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 DelThirdPartyEndpointsReq.ProtoReflect.Descriptor instead. +func (m *DelThirdPartyEndpointsReq) Reset() { *m = DelThirdPartyEndpointsReq{} } +func (m *DelThirdPartyEndpointsReq) String() string { return proto.CompactTextString(m) } +func (*DelThirdPartyEndpointsReq) ProtoMessage() {} func (*DelThirdPartyEndpointsReq) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{18} + return fileDescriptor_f94cf1a886c479d6, []int{18} } -func (x *DelThirdPartyEndpointsReq) GetUuid() string { - if x != nil { - return x.Uuid +func (m *DelThirdPartyEndpointsReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DelThirdPartyEndpointsReq.Unmarshal(m, b) +} +func (m *DelThirdPartyEndpointsReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DelThirdPartyEndpointsReq.Marshal(b, m, deterministic) +} +func (m *DelThirdPartyEndpointsReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelThirdPartyEndpointsReq.Merge(m, src) +} +func (m *DelThirdPartyEndpointsReq) XXX_Size() int { + return xxx_messageInfo_DelThirdPartyEndpointsReq.Size(m) +} +func (m *DelThirdPartyEndpointsReq) XXX_DiscardUnknown() { + xxx_messageInfo_DelThirdPartyEndpointsReq.DiscardUnknown(m) +} + +var xxx_messageInfo_DelThirdPartyEndpointsReq proto.InternalMessageInfo + +func (m *DelThirdPartyEndpointsReq) GetUuid() string { + if m != nil { + return m.Uuid } return "" } -func (x *DelThirdPartyEndpointsReq) GetSid() string { - if x != nil { - return x.Sid +func (m *DelThirdPartyEndpointsReq) GetSid() string { + if m != nil { + return m.Sid } return "" } -func (x *DelThirdPartyEndpointsReq) GetIp() string { - if x != nil { - return x.Ip +func (m *DelThirdPartyEndpointsReq) GetIp() string { + if m != nil { + return m.Ip } return "" } -func (x *DelThirdPartyEndpointsReq) GetPort() int32 { - if x != nil { - return x.Port +func (m *DelThirdPartyEndpointsReq) GetPort() int32 { + if m != nil { + return m.Port } return 0 } type ThirdPartyEndpoint struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` - Sid string `protobuf:"bytes,2,opt,name=sid,proto3" json:"sid,omitempty"` - Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` - Port int32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` - Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` - IsOnline bool `protobuf:"varint,6,opt,name=is_online,json=isOnline,proto3" json:"is_online,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ComponentID string `protobuf:"bytes,2,opt,name=componentID,proto3" json:"componentID,omitempty"` + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *ThirdPartyEndpoint) Reset() { - *x = ThirdPartyEndpoint{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ThirdPartyEndpoint) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ThirdPartyEndpoint) ProtoMessage() {} - -func (x *ThirdPartyEndpoint) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[19] - 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 ThirdPartyEndpoint.ProtoReflect.Descriptor instead. +func (m *ThirdPartyEndpoint) Reset() { *m = ThirdPartyEndpoint{} } +func (m *ThirdPartyEndpoint) String() string { return proto.CompactTextString(m) } +func (*ThirdPartyEndpoint) ProtoMessage() {} func (*ThirdPartyEndpoint) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{19} + return fileDescriptor_f94cf1a886c479d6, []int{19} } -func (x *ThirdPartyEndpoint) GetUuid() string { - if x != nil { - return x.Uuid +func (m *ThirdPartyEndpoint) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ThirdPartyEndpoint.Unmarshal(m, b) +} +func (m *ThirdPartyEndpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ThirdPartyEndpoint.Marshal(b, m, deterministic) +} +func (m *ThirdPartyEndpoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_ThirdPartyEndpoint.Merge(m, src) +} +func (m *ThirdPartyEndpoint) XXX_Size() int { + return xxx_messageInfo_ThirdPartyEndpoint.Size(m) +} +func (m *ThirdPartyEndpoint) XXX_DiscardUnknown() { + xxx_messageInfo_ThirdPartyEndpoint.DiscardUnknown(m) +} + +var xxx_messageInfo_ThirdPartyEndpoint proto.InternalMessageInfo + +func (m *ThirdPartyEndpoint) GetName() string { + if m != nil { + return m.Name } return "" } -func (x *ThirdPartyEndpoint) GetSid() string { - if x != nil { - return x.Sid +func (m *ThirdPartyEndpoint) GetComponentID() string { + if m != nil { + return m.ComponentID } return "" } -func (x *ThirdPartyEndpoint) GetIp() string { - if x != nil { - return x.Ip +func (m *ThirdPartyEndpoint) GetAddress() string { + if m != nil { + return m.Address } return "" } -func (x *ThirdPartyEndpoint) GetPort() int32 { - if x != nil { - return x.Port - } - return 0 -} - -func (x *ThirdPartyEndpoint) GetStatus() string { - if x != nil { - return x.Status +func (m *ThirdPartyEndpoint) GetStatus() string { + if m != nil { + return m.Status } return "" } -func (x *ThirdPartyEndpoint) GetIsOnline() bool { - if x != nil { - return x.IsOnline - } - return false -} - type ThirdPartyEndpoints struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Obj []*ThirdPartyEndpoint `protobuf:"bytes,1,rep,name=obj,proto3" json:"obj,omitempty"` + Items []*ThirdPartyEndpoint `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *ThirdPartyEndpoints) Reset() { - *x = ThirdPartyEndpoints{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ThirdPartyEndpoints) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ThirdPartyEndpoints) ProtoMessage() {} - -func (x *ThirdPartyEndpoints) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[20] - 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 ThirdPartyEndpoints.ProtoReflect.Descriptor instead. +func (m *ThirdPartyEndpoints) Reset() { *m = ThirdPartyEndpoints{} } +func (m *ThirdPartyEndpoints) String() string { return proto.CompactTextString(m) } +func (*ThirdPartyEndpoints) ProtoMessage() {} func (*ThirdPartyEndpoints) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{20} + return fileDescriptor_f94cf1a886c479d6, []int{20} } -func (x *ThirdPartyEndpoints) GetObj() []*ThirdPartyEndpoint { - if x != nil { - return x.Obj +func (m *ThirdPartyEndpoints) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ThirdPartyEndpoints.Unmarshal(m, b) +} +func (m *ThirdPartyEndpoints) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ThirdPartyEndpoints.Marshal(b, m, deterministic) +} +func (m *ThirdPartyEndpoints) XXX_Merge(src proto.Message) { + xxx_messageInfo_ThirdPartyEndpoints.Merge(m, src) +} +func (m *ThirdPartyEndpoints) XXX_Size() int { + return xxx_messageInfo_ThirdPartyEndpoints.Size(m) +} +func (m *ThirdPartyEndpoints) XXX_DiscardUnknown() { + xxx_messageInfo_ThirdPartyEndpoints.DiscardUnknown(m) +} + +var xxx_messageInfo_ThirdPartyEndpoints proto.InternalMessageInfo + +func (m *ThirdPartyEndpoints) GetItems() []*ThirdPartyEndpoint { + if m != nil { + return m.Items } return nil } type ListPodsBySIDReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"` + Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *ListPodsBySIDReq) Reset() { - *x = ListPodsBySIDReq{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListPodsBySIDReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListPodsBySIDReq) ProtoMessage() {} - -func (x *ListPodsBySIDReq) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[21] - 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 ListPodsBySIDReq.ProtoReflect.Descriptor instead. +func (m *ListPodsBySIDReq) Reset() { *m = ListPodsBySIDReq{} } +func (m *ListPodsBySIDReq) String() string { return proto.CompactTextString(m) } +func (*ListPodsBySIDReq) ProtoMessage() {} func (*ListPodsBySIDReq) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{21} + return fileDescriptor_f94cf1a886c479d6, []int{21} } -func (x *ListPodsBySIDReq) GetSid() string { - if x != nil { - return x.Sid +func (m *ListPodsBySIDReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListPodsBySIDReq.Unmarshal(m, b) +} +func (m *ListPodsBySIDReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListPodsBySIDReq.Marshal(b, m, deterministic) +} +func (m *ListPodsBySIDReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListPodsBySIDReq.Merge(m, src) +} +func (m *ListPodsBySIDReq) XXX_Size() int { + return xxx_messageInfo_ListPodsBySIDReq.Size(m) +} +func (m *ListPodsBySIDReq) XXX_DiscardUnknown() { + xxx_messageInfo_ListPodsBySIDReq.DiscardUnknown(m) +} + +var xxx_messageInfo_ListPodsBySIDReq proto.InternalMessageInfo + +func (m *ListPodsBySIDReq) GetSid() string { + if m != nil { + return m.Sid } return "" } type GetPodDetailReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"` - PodName string `protobuf:"bytes,2,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` + Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"` + PodName string `protobuf:"bytes,2,opt,name=pod_name,json=podName,proto3" json:"pod_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *GetPodDetailReq) Reset() { - *x = GetPodDetailReq{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPodDetailReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPodDetailReq) ProtoMessage() {} - -func (x *GetPodDetailReq) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[22] - 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 GetPodDetailReq.ProtoReflect.Descriptor instead. +func (m *GetPodDetailReq) Reset() { *m = GetPodDetailReq{} } +func (m *GetPodDetailReq) String() string { return proto.CompactTextString(m) } +func (*GetPodDetailReq) ProtoMessage() {} func (*GetPodDetailReq) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{22} + return fileDescriptor_f94cf1a886c479d6, []int{22} } -func (x *GetPodDetailReq) GetSid() string { - if x != nil { - return x.Sid +func (m *GetPodDetailReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetPodDetailReq.Unmarshal(m, b) +} +func (m *GetPodDetailReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetPodDetailReq.Marshal(b, m, deterministic) +} +func (m *GetPodDetailReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetPodDetailReq.Merge(m, src) +} +func (m *GetPodDetailReq) XXX_Size() int { + return xxx_messageInfo_GetPodDetailReq.Size(m) +} +func (m *GetPodDetailReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetPodDetailReq.DiscardUnknown(m) +} + +var xxx_messageInfo_GetPodDetailReq proto.InternalMessageInfo + +func (m *GetPodDetailReq) GetSid() string { + if m != nil { + return m.Sid } return "" } -func (x *GetPodDetailReq) GetPodName() string { - if x != nil { - return x.PodName +func (m *GetPodDetailReq) GetPodName() string { + if m != nil { + return m.PodName } return "" } type PodEvent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` - Age string `protobuf:"bytes,3,opt,name=age,proto3" json:"age,omitempty"` - Message string `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` + Age string `protobuf:"bytes,3,opt,name=age,proto3" json:"age,omitempty"` + Message string `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *PodEvent) Reset() { - *x = PodEvent{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PodEvent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PodEvent) ProtoMessage() {} - -func (x *PodEvent) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[23] - 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 PodEvent.ProtoReflect.Descriptor instead. +func (m *PodEvent) Reset() { *m = PodEvent{} } +func (m *PodEvent) String() string { return proto.CompactTextString(m) } +func (*PodEvent) ProtoMessage() {} func (*PodEvent) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{23} + return fileDescriptor_f94cf1a886c479d6, []int{23} } -func (x *PodEvent) GetType() string { - if x != nil { - return x.Type +func (m *PodEvent) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PodEvent.Unmarshal(m, b) +} +func (m *PodEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PodEvent.Marshal(b, m, deterministic) +} +func (m *PodEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_PodEvent.Merge(m, src) +} +func (m *PodEvent) XXX_Size() int { + return xxx_messageInfo_PodEvent.Size(m) +} +func (m *PodEvent) XXX_DiscardUnknown() { + xxx_messageInfo_PodEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_PodEvent proto.InternalMessageInfo + +func (m *PodEvent) GetType() string { + if m != nil { + return m.Type } return "" } -func (x *PodEvent) GetReason() string { - if x != nil { - return x.Reason +func (m *PodEvent) GetReason() string { + if m != nil { + return m.Reason } return "" } -func (x *PodEvent) GetAge() string { - if x != nil { - return x.Age +func (m *PodEvent) GetAge() string { + if m != nil { + return m.Age } return "" } -func (x *PodEvent) GetMessage() string { - if x != nil { - return x.Message +func (m *PodEvent) GetMessage() string { + if m != nil { + return m.Message } return "" } type PodStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type PodStatus_Type `protobuf:"varint,1,opt,name=type,proto3,enum=pb.PodStatus_Type" json:"type,omitempty"` - Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` - Advice string `protobuf:"bytes,4,opt,name=advice,proto3" json:"advice,omitempty"` - TypeStr string `protobuf:"bytes,5,opt,name=type_str,json=typeStr,proto3" json:"type_str,omitempty"` + Type PodStatus_Type `protobuf:"varint,1,opt,name=type,proto3,enum=pb.PodStatus_Type" json:"type,omitempty"` + Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Advice string `protobuf:"bytes,4,opt,name=advice,proto3" json:"advice,omitempty"` + TypeStr string `protobuf:"bytes,5,opt,name=type_str,json=typeStr,proto3" json:"type_str,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *PodStatus) Reset() { - *x = PodStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PodStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PodStatus) ProtoMessage() {} - -func (x *PodStatus) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[24] - 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 PodStatus.ProtoReflect.Descriptor instead. +func (m *PodStatus) Reset() { *m = PodStatus{} } +func (m *PodStatus) String() string { return proto.CompactTextString(m) } +func (*PodStatus) ProtoMessage() {} func (*PodStatus) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{24} + return fileDescriptor_f94cf1a886c479d6, []int{24} } -func (x *PodStatus) GetType() PodStatus_Type { - if x != nil { - return x.Type +func (m *PodStatus) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PodStatus.Unmarshal(m, b) +} +func (m *PodStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PodStatus.Marshal(b, m, deterministic) +} +func (m *PodStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_PodStatus.Merge(m, src) +} +func (m *PodStatus) XXX_Size() int { + return xxx_messageInfo_PodStatus.Size(m) +} +func (m *PodStatus) XXX_DiscardUnknown() { + xxx_messageInfo_PodStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_PodStatus proto.InternalMessageInfo + +func (m *PodStatus) GetType() PodStatus_Type { + if m != nil { + return m.Type } return PodStatus_PENDING } -func (x *PodStatus) GetReason() string { - if x != nil { - return x.Reason +func (m *PodStatus) GetReason() string { + if m != nil { + return m.Reason } return "" } -func (x *PodStatus) GetMessage() string { - if x != nil { - return x.Message +func (m *PodStatus) GetMessage() string { + if m != nil { + return m.Message } return "" } -func (x *PodStatus) GetAdvice() string { - if x != nil { - return x.Advice +func (m *PodStatus) GetAdvice() string { + if m != nil { + return m.Advice } return "" } -func (x *PodStatus) GetTypeStr() string { - if x != nil { - return x.TypeStr +func (m *PodStatus) GetTypeStr() string { + if m != nil { + return m.TypeStr } return "" } type PodContainer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Image string `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` - State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` - Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"` - Started string `protobuf:"bytes,4,opt,name=started,proto3" json:"started,omitempty"` - LimitMemory string `protobuf:"bytes,5,opt,name=limit_memory,json=limitMemory,proto3" json:"limit_memory,omitempty"` - LimitCpu string `protobuf:"bytes,6,opt,name=limit_cpu,json=limitCpu,proto3" json:"limit_cpu,omitempty"` - RequestMemory string `protobuf:"bytes,7,opt,name=request_memory,json=requestMemory,proto3" json:"request_memory,omitempty"` - RequestCpu string `protobuf:"bytes,8,opt,name=request_cpu,json=requestCpu,proto3" json:"request_cpu,omitempty"` + Image string `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` + State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` + Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"` + Started string `protobuf:"bytes,4,opt,name=started,proto3" json:"started,omitempty"` + LimitMemory string `protobuf:"bytes,5,opt,name=limit_memory,json=limitMemory,proto3" json:"limit_memory,omitempty"` + LimitCpu string `protobuf:"bytes,6,opt,name=limit_cpu,json=limitCpu,proto3" json:"limit_cpu,omitempty"` + RequestMemory string `protobuf:"bytes,7,opt,name=request_memory,json=requestMemory,proto3" json:"request_memory,omitempty"` + RequestCpu string `protobuf:"bytes,8,opt,name=request_cpu,json=requestCpu,proto3" json:"request_cpu,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *PodContainer) Reset() { - *x = PodContainer{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PodContainer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PodContainer) ProtoMessage() {} - -func (x *PodContainer) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[25] - 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 PodContainer.ProtoReflect.Descriptor instead. +func (m *PodContainer) Reset() { *m = PodContainer{} } +func (m *PodContainer) String() string { return proto.CompactTextString(m) } +func (*PodContainer) ProtoMessage() {} func (*PodContainer) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{25} + return fileDescriptor_f94cf1a886c479d6, []int{25} } -func (x *PodContainer) GetImage() string { - if x != nil { - return x.Image +func (m *PodContainer) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PodContainer.Unmarshal(m, b) +} +func (m *PodContainer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PodContainer.Marshal(b, m, deterministic) +} +func (m *PodContainer) XXX_Merge(src proto.Message) { + xxx_messageInfo_PodContainer.Merge(m, src) +} +func (m *PodContainer) XXX_Size() int { + return xxx_messageInfo_PodContainer.Size(m) +} +func (m *PodContainer) XXX_DiscardUnknown() { + xxx_messageInfo_PodContainer.DiscardUnknown(m) +} + +var xxx_messageInfo_PodContainer proto.InternalMessageInfo + +func (m *PodContainer) GetImage() string { + if m != nil { + return m.Image } return "" } -func (x *PodContainer) GetState() string { - if x != nil { - return x.State +func (m *PodContainer) GetState() string { + if m != nil { + return m.State } return "" } -func (x *PodContainer) GetReason() string { - if x != nil { - return x.Reason +func (m *PodContainer) GetReason() string { + if m != nil { + return m.Reason } return "" } -func (x *PodContainer) GetStarted() string { - if x != nil { - return x.Started +func (m *PodContainer) GetStarted() string { + if m != nil { + return m.Started } return "" } -func (x *PodContainer) GetLimitMemory() string { - if x != nil { - return x.LimitMemory +func (m *PodContainer) GetLimitMemory() string { + if m != nil { + return m.LimitMemory } return "" } -func (x *PodContainer) GetLimitCpu() string { - if x != nil { - return x.LimitCpu +func (m *PodContainer) GetLimitCpu() string { + if m != nil { + return m.LimitCpu } return "" } -func (x *PodContainer) GetRequestMemory() string { - if x != nil { - return x.RequestMemory +func (m *PodContainer) GetRequestMemory() string { + if m != nil { + return m.RequestMemory } return "" } -func (x *PodContainer) GetRequestCpu() string { - if x != nil { - return x.RequestCpu +func (m *PodContainer) GetRequestCpu() string { + if m != nil { + return m.RequestCpu } return "" } type PodDetail struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Node string `protobuf:"bytes,2,opt,name=node,proto3" json:"node,omitempty"` - StartTime string `protobuf:"bytes,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` - Status *PodStatus `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` - Ip string `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"` - NodeIp string `protobuf:"bytes,6,opt,name=node_ip,json=nodeIp,proto3" json:"node_ip,omitempty"` - Version string `protobuf:"bytes,7,opt,name=version,proto3" json:"version,omitempty"` - InitContainers []*PodContainer `protobuf:"bytes,8,rep,name=init_containers,json=initContainers,proto3" json:"init_containers,omitempty"` - Containers []*PodContainer `protobuf:"bytes,9,rep,name=containers,proto3" json:"containers,omitempty"` - Events []*PodEvent `protobuf:"bytes,10,rep,name=events,proto3" json:"events,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Node string `protobuf:"bytes,2,opt,name=node,proto3" json:"node,omitempty"` + StartTime string `protobuf:"bytes,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + Status *PodStatus `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` + Ip string `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"` + NodeIp string `protobuf:"bytes,6,opt,name=node_ip,json=nodeIp,proto3" json:"node_ip,omitempty"` + Version string `protobuf:"bytes,7,opt,name=version,proto3" json:"version,omitempty"` + InitContainers []*PodContainer `protobuf:"bytes,8,rep,name=init_containers,json=initContainers,proto3" json:"init_containers,omitempty"` + Containers []*PodContainer `protobuf:"bytes,9,rep,name=containers,proto3" json:"containers,omitempty"` + Events []*PodEvent `protobuf:"bytes,10,rep,name=events,proto3" json:"events,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *PodDetail) Reset() { - *x = PodDetail{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PodDetail) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PodDetail) ProtoMessage() {} - -func (x *PodDetail) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[26] - 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 PodDetail.ProtoReflect.Descriptor instead. +func (m *PodDetail) Reset() { *m = PodDetail{} } +func (m *PodDetail) String() string { return proto.CompactTextString(m) } +func (*PodDetail) ProtoMessage() {} func (*PodDetail) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{26} + return fileDescriptor_f94cf1a886c479d6, []int{26} } -func (x *PodDetail) GetName() string { - if x != nil { - return x.Name +func (m *PodDetail) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PodDetail.Unmarshal(m, b) +} +func (m *PodDetail) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PodDetail.Marshal(b, m, deterministic) +} +func (m *PodDetail) XXX_Merge(src proto.Message) { + xxx_messageInfo_PodDetail.Merge(m, src) +} +func (m *PodDetail) XXX_Size() int { + return xxx_messageInfo_PodDetail.Size(m) +} +func (m *PodDetail) XXX_DiscardUnknown() { + xxx_messageInfo_PodDetail.DiscardUnknown(m) +} + +var xxx_messageInfo_PodDetail proto.InternalMessageInfo + +func (m *PodDetail) GetName() string { + if m != nil { + return m.Name } return "" } -func (x *PodDetail) GetNode() string { - if x != nil { - return x.Node +func (m *PodDetail) GetNode() string { + if m != nil { + return m.Node } return "" } -func (x *PodDetail) GetStartTime() string { - if x != nil { - return x.StartTime +func (m *PodDetail) GetStartTime() string { + if m != nil { + return m.StartTime } return "" } -func (x *PodDetail) GetStatus() *PodStatus { - if x != nil { - return x.Status +func (m *PodDetail) GetStatus() *PodStatus { + if m != nil { + return m.Status } return nil } -func (x *PodDetail) GetIp() string { - if x != nil { - return x.Ip +func (m *PodDetail) GetIp() string { + if m != nil { + return m.Ip } return "" } -func (x *PodDetail) GetNodeIp() string { - if x != nil { - return x.NodeIp +func (m *PodDetail) GetNodeIp() string { + if m != nil { + return m.NodeIp } return "" } -func (x *PodDetail) GetVersion() string { - if x != nil { - return x.Version +func (m *PodDetail) GetVersion() string { + if m != nil { + return m.Version } return "" } -func (x *PodDetail) GetInitContainers() []*PodContainer { - if x != nil { - return x.InitContainers +func (m *PodDetail) GetInitContainers() []*PodContainer { + if m != nil { + return m.InitContainers } return nil } -func (x *PodDetail) GetContainers() []*PodContainer { - if x != nil { - return x.Containers +func (m *PodDetail) GetContainers() []*PodContainer { + if m != nil { + return m.Containers } return nil } -func (x *PodDetail) GetEvents() []*PodEvent { - if x != nil { - return x.Events +func (m *PodDetail) GetEvents() []*PodEvent { + if m != nil { + return m.Events } return nil } type StorageClasses struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - List []*StorageClassDetail `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + List []*StorageClassDetail `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *StorageClasses) Reset() { - *x = StorageClasses{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StorageClasses) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StorageClasses) ProtoMessage() {} - -func (x *StorageClasses) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[27] - 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 StorageClasses.ProtoReflect.Descriptor instead. +func (m *StorageClasses) Reset() { *m = StorageClasses{} } +func (m *StorageClasses) String() string { return proto.CompactTextString(m) } +func (*StorageClasses) ProtoMessage() {} func (*StorageClasses) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{27} + return fileDescriptor_f94cf1a886c479d6, []int{27} } -func (x *StorageClasses) GetList() []*StorageClassDetail { - if x != nil { - return x.List +func (m *StorageClasses) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StorageClasses.Unmarshal(m, b) +} +func (m *StorageClasses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StorageClasses.Marshal(b, m, deterministic) +} +func (m *StorageClasses) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageClasses.Merge(m, src) +} +func (m *StorageClasses) XXX_Size() int { + return xxx_messageInfo_StorageClasses.Size(m) +} +func (m *StorageClasses) XXX_DiscardUnknown() { + xxx_messageInfo_StorageClasses.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageClasses proto.InternalMessageInfo + +func (m *StorageClasses) GetList() []*StorageClassDetail { + if m != nil { + return m.List } return nil } type StorageClassDetail struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Provisioner string `protobuf:"bytes,2,opt,name=provisioner,proto3" json:"provisioner,omitempty"` Parameters map[string]string `protobuf:"bytes,3,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` @@ -2059,2099 +1751,1044 @@ type StorageClassDetail struct { AllowVolumeExpansion bool `protobuf:"varint,5,opt,name=allow_volume_expansion,json=allowVolumeExpansion,proto3" json:"allow_volume_expansion,omitempty"` VolumeBindingMode string `protobuf:"bytes,6,opt,name=volume_binding_mode,json=volumeBindingMode,proto3" json:"volume_binding_mode,omitempty"` AllowedTopologies []*TopologySelectorTerm `protobuf:"bytes,7,rep,name=allowed_topologies,json=allowedTopologies,proto3" json:"allowed_topologies,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *StorageClassDetail) Reset() { - *x = StorageClassDetail{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StorageClassDetail) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StorageClassDetail) ProtoMessage() {} - -func (x *StorageClassDetail) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[28] - 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 StorageClassDetail.ProtoReflect.Descriptor instead. +func (m *StorageClassDetail) Reset() { *m = StorageClassDetail{} } +func (m *StorageClassDetail) String() string { return proto.CompactTextString(m) } +func (*StorageClassDetail) ProtoMessage() {} func (*StorageClassDetail) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{28} + return fileDescriptor_f94cf1a886c479d6, []int{28} } -func (x *StorageClassDetail) GetName() string { - if x != nil { - return x.Name +func (m *StorageClassDetail) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StorageClassDetail.Unmarshal(m, b) +} +func (m *StorageClassDetail) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StorageClassDetail.Marshal(b, m, deterministic) +} +func (m *StorageClassDetail) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageClassDetail.Merge(m, src) +} +func (m *StorageClassDetail) XXX_Size() int { + return xxx_messageInfo_StorageClassDetail.Size(m) +} +func (m *StorageClassDetail) XXX_DiscardUnknown() { + xxx_messageInfo_StorageClassDetail.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageClassDetail proto.InternalMessageInfo + +func (m *StorageClassDetail) GetName() string { + if m != nil { + return m.Name } return "" } -func (x *StorageClassDetail) GetProvisioner() string { - if x != nil { - return x.Provisioner +func (m *StorageClassDetail) GetProvisioner() string { + if m != nil { + return m.Provisioner } return "" } -func (x *StorageClassDetail) GetParameters() map[string]string { - if x != nil { - return x.Parameters +func (m *StorageClassDetail) GetParameters() map[string]string { + if m != nil { + return m.Parameters } return nil } -func (x *StorageClassDetail) GetReclaimPolicy() string { - if x != nil { - return x.ReclaimPolicy +func (m *StorageClassDetail) GetReclaimPolicy() string { + if m != nil { + return m.ReclaimPolicy } return "" } -func (x *StorageClassDetail) GetAllowVolumeExpansion() bool { - if x != nil { - return x.AllowVolumeExpansion +func (m *StorageClassDetail) GetAllowVolumeExpansion() bool { + if m != nil { + return m.AllowVolumeExpansion } return false } -func (x *StorageClassDetail) GetVolumeBindingMode() string { - if x != nil { - return x.VolumeBindingMode +func (m *StorageClassDetail) GetVolumeBindingMode() string { + if m != nil { + return m.VolumeBindingMode } return "" } -func (x *StorageClassDetail) GetAllowedTopologies() []*TopologySelectorTerm { - if x != nil { - return x.AllowedTopologies +func (m *StorageClassDetail) GetAllowedTopologies() []*TopologySelectorTerm { + if m != nil { + return m.AllowedTopologies } return nil } type TopologySelectorTerm struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - MatchLabelExpressions []*TopologySelectorLabelRequirement `protobuf:"bytes,1,rep,name=match_label_expressions,json=matchLabelExpressions,proto3" json:"match_label_expressions,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *TopologySelectorTerm) Reset() { - *x = TopologySelectorTerm{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TopologySelectorTerm) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TopologySelectorTerm) ProtoMessage() {} - -func (x *TopologySelectorTerm) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[29] - 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 TopologySelectorTerm.ProtoReflect.Descriptor instead. +func (m *TopologySelectorTerm) Reset() { *m = TopologySelectorTerm{} } +func (m *TopologySelectorTerm) String() string { return proto.CompactTextString(m) } +func (*TopologySelectorTerm) ProtoMessage() {} func (*TopologySelectorTerm) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{29} + return fileDescriptor_f94cf1a886c479d6, []int{29} } -func (x *TopologySelectorTerm) GetMatchLabelExpressions() []*TopologySelectorLabelRequirement { - if x != nil { - return x.MatchLabelExpressions +func (m *TopologySelectorTerm) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TopologySelectorTerm.Unmarshal(m, b) +} +func (m *TopologySelectorTerm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TopologySelectorTerm.Marshal(b, m, deterministic) +} +func (m *TopologySelectorTerm) XXX_Merge(src proto.Message) { + xxx_messageInfo_TopologySelectorTerm.Merge(m, src) +} +func (m *TopologySelectorTerm) XXX_Size() int { + return xxx_messageInfo_TopologySelectorTerm.Size(m) +} +func (m *TopologySelectorTerm) XXX_DiscardUnknown() { + xxx_messageInfo_TopologySelectorTerm.DiscardUnknown(m) +} + +var xxx_messageInfo_TopologySelectorTerm proto.InternalMessageInfo + +func (m *TopologySelectorTerm) GetMatchLabelExpressions() []*TopologySelectorLabelRequirement { + if m != nil { + return m.MatchLabelExpressions } return nil } type TopologySelectorLabelRequirement struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *TopologySelectorLabelRequirement) Reset() { - *x = TopologySelectorLabelRequirement{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TopologySelectorLabelRequirement) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TopologySelectorLabelRequirement) ProtoMessage() {} - -func (x *TopologySelectorLabelRequirement) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[30] - 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 TopologySelectorLabelRequirement.ProtoReflect.Descriptor instead. +func (m *TopologySelectorLabelRequirement) Reset() { *m = TopologySelectorLabelRequirement{} } +func (m *TopologySelectorLabelRequirement) String() string { return proto.CompactTextString(m) } +func (*TopologySelectorLabelRequirement) ProtoMessage() {} func (*TopologySelectorLabelRequirement) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{30} + return fileDescriptor_f94cf1a886c479d6, []int{30} } -func (x *TopologySelectorLabelRequirement) GetKey() string { - if x != nil { - return x.Key +func (m *TopologySelectorLabelRequirement) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TopologySelectorLabelRequirement.Unmarshal(m, b) +} +func (m *TopologySelectorLabelRequirement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TopologySelectorLabelRequirement.Marshal(b, m, deterministic) +} +func (m *TopologySelectorLabelRequirement) XXX_Merge(src proto.Message) { + xxx_messageInfo_TopologySelectorLabelRequirement.Merge(m, src) +} +func (m *TopologySelectorLabelRequirement) XXX_Size() int { + return xxx_messageInfo_TopologySelectorLabelRequirement.Size(m) +} +func (m *TopologySelectorLabelRequirement) XXX_DiscardUnknown() { + xxx_messageInfo_TopologySelectorLabelRequirement.DiscardUnknown(m) +} + +var xxx_messageInfo_TopologySelectorLabelRequirement proto.InternalMessageInfo + +func (m *TopologySelectorLabelRequirement) GetKey() string { + if m != nil { + return m.Key } return "" } -func (x *TopologySelectorLabelRequirement) GetValues() []string { - if x != nil { - return x.Values +func (m *TopologySelectorLabelRequirement) GetValues() []string { + if m != nil { + return m.Values } return nil } type ServiceVolumeStatusMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status map[string]ServiceVolumeStatus `protobuf:"bytes,1,rep,name=status,proto3" json:"status,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=pb.ServiceVolumeStatus"` + Status map[string]ServiceVolumeStatus `protobuf:"bytes,1,rep,name=status,proto3" json:"status,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=pb.ServiceVolumeStatus"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *ServiceVolumeStatusMessage) Reset() { - *x = ServiceVolumeStatusMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServiceVolumeStatusMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServiceVolumeStatusMessage) ProtoMessage() {} - -func (x *ServiceVolumeStatusMessage) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[31] - 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 ServiceVolumeStatusMessage.ProtoReflect.Descriptor instead. +func (m *ServiceVolumeStatusMessage) Reset() { *m = ServiceVolumeStatusMessage{} } +func (m *ServiceVolumeStatusMessage) String() string { return proto.CompactTextString(m) } +func (*ServiceVolumeStatusMessage) ProtoMessage() {} func (*ServiceVolumeStatusMessage) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{31} + return fileDescriptor_f94cf1a886c479d6, []int{31} } -func (x *ServiceVolumeStatusMessage) GetStatus() map[string]ServiceVolumeStatus { - if x != nil { - return x.Status +func (m *ServiceVolumeStatusMessage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceVolumeStatusMessage.Unmarshal(m, b) +} +func (m *ServiceVolumeStatusMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceVolumeStatusMessage.Marshal(b, m, deterministic) +} +func (m *ServiceVolumeStatusMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceVolumeStatusMessage.Merge(m, src) +} +func (m *ServiceVolumeStatusMessage) XXX_Size() int { + return xxx_messageInfo_ServiceVolumeStatusMessage.Size(m) +} +func (m *ServiceVolumeStatusMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceVolumeStatusMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceVolumeStatusMessage proto.InternalMessageInfo + +func (m *ServiceVolumeStatusMessage) GetStatus() map[string]ServiceVolumeStatus { + if m != nil { + return m.Status } return nil } type AppStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` - Cpu int64 `protobuf:"varint,2,opt,name=cpu,proto3" json:"cpu,omitempty"` - Memory int64 `protobuf:"varint,3,opt,name=memory,proto3" json:"memory,omitempty"` - SetCPU bool `protobuf:"varint,4,opt,name=setCPU,proto3" json:"setCPU,omitempty"` - SetMemory bool `protobuf:"varint,5,opt,name=setMemory,proto3" json:"setMemory,omitempty"` - Phase string `protobuf:"bytes,6,opt,name=phase,proto3" json:"phase,omitempty"` - Overrides []string `protobuf:"bytes,7,rep,name=overrides,proto3" json:"overrides,omitempty"` - Version string `protobuf:"bytes,8,opt,name=version,proto3" json:"version,omitempty"` - Conditions []*AppStatusCondition `protobuf:"bytes,9,rep,name=conditions,proto3" json:"conditions,omitempty"` - Gpu int64 `protobuf:"varint,10,opt,name=gpu,proto3" json:"gpu,omitempty"` - AppId string `protobuf:"bytes,11,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` - AppName string `protobuf:"bytes,12,opt,name=app_name,json=appName,proto3" json:"app_name,omitempty"` + Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + Cpu int64 `protobuf:"varint,2,opt,name=cpu,proto3" json:"cpu,omitempty"` + Memory int64 `protobuf:"varint,3,opt,name=memory,proto3" json:"memory,omitempty"` + SetCPU bool `protobuf:"varint,4,opt,name=setCPU,proto3" json:"setCPU,omitempty"` + SetMemory bool `protobuf:"varint,5,opt,name=setMemory,proto3" json:"setMemory,omitempty"` + Phase string `protobuf:"bytes,6,opt,name=phase,proto3" json:"phase,omitempty"` + Overrides []string `protobuf:"bytes,7,rep,name=overrides,proto3" json:"overrides,omitempty"` + Version string `protobuf:"bytes,8,opt,name=version,proto3" json:"version,omitempty"` + Conditions []*AppStatusCondition `protobuf:"bytes,9,rep,name=conditions,proto3" json:"conditions,omitempty"` + Gpu int64 `protobuf:"varint,10,opt,name=gpu,proto3" json:"gpu,omitempty"` + AppId string `protobuf:"bytes,11,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` + AppName string `protobuf:"bytes,12,opt,name=app_name,json=appName,proto3" json:"app_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *AppStatus) Reset() { - *x = AppStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AppStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppStatus) ProtoMessage() {} - -func (x *AppStatus) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[32] - 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 AppStatus.ProtoReflect.Descriptor instead. +func (m *AppStatus) Reset() { *m = AppStatus{} } +func (m *AppStatus) String() string { return proto.CompactTextString(m) } +func (*AppStatus) ProtoMessage() {} func (*AppStatus) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{32} + return fileDescriptor_f94cf1a886c479d6, []int{32} } -func (x *AppStatus) GetStatus() string { - if x != nil { - return x.Status +func (m *AppStatus) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppStatus.Unmarshal(m, b) +} +func (m *AppStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppStatus.Marshal(b, m, deterministic) +} +func (m *AppStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppStatus.Merge(m, src) +} +func (m *AppStatus) XXX_Size() int { + return xxx_messageInfo_AppStatus.Size(m) +} +func (m *AppStatus) XXX_DiscardUnknown() { + xxx_messageInfo_AppStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_AppStatus proto.InternalMessageInfo + +func (m *AppStatus) GetStatus() string { + if m != nil { + return m.Status } return "" } -func (x *AppStatus) GetCpu() int64 { - if x != nil { - return x.Cpu +func (m *AppStatus) GetCpu() int64 { + if m != nil { + return m.Cpu } return 0 } -func (x *AppStatus) GetMemory() int64 { - if x != nil { - return x.Memory +func (m *AppStatus) GetMemory() int64 { + if m != nil { + return m.Memory } return 0 } -func (x *AppStatus) GetSetCPU() bool { - if x != nil { - return x.SetCPU +func (m *AppStatus) GetSetCPU() bool { + if m != nil { + return m.SetCPU } return false } -func (x *AppStatus) GetSetMemory() bool { - if x != nil { - return x.SetMemory +func (m *AppStatus) GetSetMemory() bool { + if m != nil { + return m.SetMemory } return false } -func (x *AppStatus) GetPhase() string { - if x != nil { - return x.Phase +func (m *AppStatus) GetPhase() string { + if m != nil { + return m.Phase } return "" } -func (x *AppStatus) GetOverrides() []string { - if x != nil { - return x.Overrides +func (m *AppStatus) GetOverrides() []string { + if m != nil { + return m.Overrides } return nil } -func (x *AppStatus) GetVersion() string { - if x != nil { - return x.Version +func (m *AppStatus) GetVersion() string { + if m != nil { + return m.Version } return "" } -func (x *AppStatus) GetConditions() []*AppStatusCondition { - if x != nil { - return x.Conditions +func (m *AppStatus) GetConditions() []*AppStatusCondition { + if m != nil { + return m.Conditions } return nil } -func (x *AppStatus) GetGpu() int64 { - if x != nil { - return x.Gpu +func (m *AppStatus) GetGpu() int64 { + if m != nil { + return m.Gpu } return 0 } -func (x *AppStatus) GetAppId() string { - if x != nil { - return x.AppId +func (m *AppStatus) GetAppId() string { + if m != nil { + return m.AppId } return "" } -func (x *AppStatus) GetAppName() string { - if x != nil { - return x.AppName +func (m *AppStatus) GetAppName() string { + if m != nil { + return m.AppName } return "" } type AppStatusCondition struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` - Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"` - Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` + Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"` + Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *AppStatusCondition) Reset() { - *x = AppStatusCondition{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AppStatusCondition) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppStatusCondition) ProtoMessage() {} - -func (x *AppStatusCondition) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[33] - 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 AppStatusCondition.ProtoReflect.Descriptor instead. +func (m *AppStatusCondition) Reset() { *m = AppStatusCondition{} } +func (m *AppStatusCondition) String() string { return proto.CompactTextString(m) } +func (*AppStatusCondition) ProtoMessage() {} func (*AppStatusCondition) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{33} + return fileDescriptor_f94cf1a886c479d6, []int{33} } -func (x *AppStatusCondition) GetType() string { - if x != nil { - return x.Type +func (m *AppStatusCondition) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppStatusCondition.Unmarshal(m, b) +} +func (m *AppStatusCondition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppStatusCondition.Marshal(b, m, deterministic) +} +func (m *AppStatusCondition) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppStatusCondition.Merge(m, src) +} +func (m *AppStatusCondition) XXX_Size() int { + return xxx_messageInfo_AppStatusCondition.Size(m) +} +func (m *AppStatusCondition) XXX_DiscardUnknown() { + xxx_messageInfo_AppStatusCondition.DiscardUnknown(m) +} + +var xxx_messageInfo_AppStatusCondition proto.InternalMessageInfo + +func (m *AppStatusCondition) GetType() string { + if m != nil { + return m.Type } return "" } -func (x *AppStatusCondition) GetStatus() bool { - if x != nil { - return x.Status +func (m *AppStatusCondition) GetStatus() bool { + if m != nil { + return m.Status } return false } -func (x *AppStatusCondition) GetReason() string { - if x != nil { - return x.Reason +func (m *AppStatusCondition) GetReason() string { + if m != nil { + return m.Reason } return "" } -func (x *AppStatusCondition) GetMessage() string { - if x != nil { - return x.Message +func (m *AppStatusCondition) GetMessage() string { + if m != nil { + return m.Message } return "" } type AppService struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - Ports []*AppService_Port `protobuf:"bytes,3,rep,name=ports,proto3" json:"ports,omitempty"` - Pods []*AppService_Pod `protobuf:"bytes,4,rep,name=pods,proto3" json:"pods,omitempty"` - OldPods []*AppService_Pod `protobuf:"bytes,5,rep,name=oldPods,proto3" json:"oldPods,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + Ports []*AppService_Port `protobuf:"bytes,3,rep,name=ports,proto3" json:"ports,omitempty"` + Pods []*AppService_Pod `protobuf:"bytes,4,rep,name=pods,proto3" json:"pods,omitempty"` + OldPods []*AppService_Pod `protobuf:"bytes,5,rep,name=oldPods,proto3" json:"oldPods,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *AppService) Reset() { - *x = AppService{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AppService) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppService) ProtoMessage() {} - -func (x *AppService) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[34] - 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 AppService.ProtoReflect.Descriptor instead. +func (m *AppService) Reset() { *m = AppService{} } +func (m *AppService) String() string { return proto.CompactTextString(m) } +func (*AppService) ProtoMessage() {} func (*AppService) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{34} + return fileDescriptor_f94cf1a886c479d6, []int{34} } -func (x *AppService) GetName() string { - if x != nil { - return x.Name +func (m *AppService) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppService.Unmarshal(m, b) +} +func (m *AppService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppService.Marshal(b, m, deterministic) +} +func (m *AppService) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppService.Merge(m, src) +} +func (m *AppService) XXX_Size() int { + return xxx_messageInfo_AppService.Size(m) +} +func (m *AppService) XXX_DiscardUnknown() { + xxx_messageInfo_AppService.DiscardUnknown(m) +} + +var xxx_messageInfo_AppService proto.InternalMessageInfo + +func (m *AppService) GetName() string { + if m != nil { + return m.Name } return "" } -func (x *AppService) GetAddress() string { - if x != nil { - return x.Address +func (m *AppService) GetAddress() string { + if m != nil { + return m.Address } return "" } -func (x *AppService) GetPorts() []*AppService_Port { - if x != nil { - return x.Ports +func (m *AppService) GetPorts() []*AppService_Port { + if m != nil { + return m.Ports } return nil } -func (x *AppService) GetPods() []*AppService_Pod { - if x != nil { - return x.Pods +func (m *AppService) GetPods() []*AppService_Pod { + if m != nil { + return m.Pods } return nil } -func (x *AppService) GetOldPods() []*AppService_Pod { - if x != nil { - return x.OldPods - } - return nil -} - -type AppServices struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Services []*AppService `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` -} - -func (x *AppServices) Reset() { - *x = AppServices{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AppServices) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppServices) ProtoMessage() {} - -func (x *AppServices) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[35] - 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 AppServices.ProtoReflect.Descriptor instead. -func (*AppServices) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{35} -} - -func (x *AppServices) GetServices() []*AppService { - if x != nil { - return x.Services - } - return nil -} - -type HelmAppReleases struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - HelmAppRelease []*HelmAppRelease `protobuf:"bytes,1,rep,name=helmAppRelease,proto3" json:"helmAppRelease,omitempty"` -} - -func (x *HelmAppReleases) Reset() { - *x = HelmAppReleases{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HelmAppReleases) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HelmAppReleases) ProtoMessage() {} - -func (x *HelmAppReleases) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[36] - 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 HelmAppReleases.ProtoReflect.Descriptor instead. -func (*HelmAppReleases) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{36} -} - -func (x *HelmAppReleases) GetHelmAppRelease() []*HelmAppRelease { - if x != nil { - return x.HelmAppRelease - } - return nil -} - -type HelmAppRelease struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"` - Updated string `protobuf:"bytes,2,opt,name=updated,proto3" json:"updated,omitempty"` - Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` - Chart string `protobuf:"bytes,4,opt,name=chart,proto3" json:"chart,omitempty"` - AppVersion string `protobuf:"bytes,5,opt,name=appVersion,proto3" json:"appVersion,omitempty"` - Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` -} - -func (x *HelmAppRelease) Reset() { - *x = HelmAppRelease{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HelmAppRelease) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HelmAppRelease) ProtoMessage() {} - -func (x *HelmAppRelease) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[37] - 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 HelmAppRelease.ProtoReflect.Descriptor instead. -func (*HelmAppRelease) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{37} -} - -func (x *HelmAppRelease) GetRevision() int32 { - if x != nil { - return x.Revision - } - return 0 -} - -func (x *HelmAppRelease) GetUpdated() string { - if x != nil { - return x.Updated - } - return "" -} - -func (x *HelmAppRelease) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *HelmAppRelease) GetChart() string { - if x != nil { - return x.Chart - } - return "" -} - -func (x *HelmAppRelease) GetAppVersion() string { - if x != nil { - return x.AppVersion - } - return "" -} - -func (x *HelmAppRelease) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -type AppStatusesReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AppIds []string `protobuf:"bytes,1,rep,name=app_ids,json=appIds,proto3" json:"app_ids,omitempty"` -} - -func (x *AppStatusesReq) Reset() { - *x = AppStatusesReq{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AppStatusesReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppStatusesReq) ProtoMessage() {} - -func (x *AppStatusesReq) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[38] - 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 AppStatusesReq.ProtoReflect.Descriptor instead. -func (*AppStatusesReq) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{38} -} - -func (x *AppStatusesReq) GetAppIds() []string { - if x != nil { - return x.AppIds - } - return nil -} - -type AppStatuses struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AppStatuses []*AppStatus `protobuf:"bytes,1,rep,name=app_statuses,json=appStatuses,proto3" json:"app_statuses,omitempty"` -} - -func (x *AppStatuses) Reset() { - *x = AppStatuses{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AppStatuses) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppStatuses) ProtoMessage() {} - -func (x *AppStatuses) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[39] - 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 AppStatuses.ProtoReflect.Descriptor instead. -func (*AppStatuses) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{39} -} - -func (x *AppStatuses) GetAppStatuses() []*AppStatus { - if x != nil { - return x.AppStatuses +func (m *AppService) GetOldPods() []*AppService_Pod { + if m != nil { + return m.OldPods } return nil } type AppService_Pod struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *AppService_Pod) Reset() { - *x = AppService_Pod{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[54] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AppService_Pod) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppService_Pod) ProtoMessage() {} - -func (x *AppService_Pod) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[54] - 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 AppService_Pod.ProtoReflect.Descriptor instead. +func (m *AppService_Pod) Reset() { *m = AppService_Pod{} } +func (m *AppService_Pod) String() string { return proto.CompactTextString(m) } +func (*AppService_Pod) ProtoMessage() {} func (*AppService_Pod) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{34, 0} + return fileDescriptor_f94cf1a886c479d6, []int{34, 0} } -func (x *AppService_Pod) GetName() string { - if x != nil { - return x.Name +func (m *AppService_Pod) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppService_Pod.Unmarshal(m, b) +} +func (m *AppService_Pod) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppService_Pod.Marshal(b, m, deterministic) +} +func (m *AppService_Pod) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppService_Pod.Merge(m, src) +} +func (m *AppService_Pod) XXX_Size() int { + return xxx_messageInfo_AppService_Pod.Size(m) +} +func (m *AppService_Pod) XXX_DiscardUnknown() { + xxx_messageInfo_AppService_Pod.DiscardUnknown(m) +} + +var xxx_messageInfo_AppService_Pod proto.InternalMessageInfo + +func (m *AppService_Pod) GetName() string { + if m != nil { + return m.Name } return "" } -func (x *AppService_Pod) GetStatus() string { - if x != nil { - return x.Status +func (m *AppService_Pod) GetStatus() string { + if m != nil { + return m.Status } return "" } type AppService_Port struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Port int32 `protobuf:"varint,1,opt,name=port,proto3" json:"port,omitempty"` - Protocol string `protobuf:"bytes,2,opt,name=protocol,proto3" json:"protocol,omitempty"` + Port int32 `protobuf:"varint,1,opt,name=port,proto3" json:"port,omitempty"` + Protocol string `protobuf:"bytes,2,opt,name=protocol,proto3" json:"protocol,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *AppService_Port) Reset() { - *x = AppService_Port{} - if protoimpl.UnsafeEnabled { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[55] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AppService_Port) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppService_Port) ProtoMessage() {} - -func (x *AppService_Port) ProtoReflect() protoreflect.Message { - mi := &file_worker_server_pb_app_runtime_server_proto_msgTypes[55] - 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 AppService_Port.ProtoReflect.Descriptor instead. +func (m *AppService_Port) Reset() { *m = AppService_Port{} } +func (m *AppService_Port) String() string { return proto.CompactTextString(m) } +func (*AppService_Port) ProtoMessage() {} func (*AppService_Port) Descriptor() ([]byte, []int) { - return file_worker_server_pb_app_runtime_server_proto_rawDescGZIP(), []int{34, 1} + return fileDescriptor_f94cf1a886c479d6, []int{34, 1} } -func (x *AppService_Port) GetPort() int32 { - if x != nil { - return x.Port +func (m *AppService_Port) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppService_Port.Unmarshal(m, b) +} +func (m *AppService_Port) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppService_Port.Marshal(b, m, deterministic) +} +func (m *AppService_Port) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppService_Port.Merge(m, src) +} +func (m *AppService_Port) XXX_Size() int { + return xxx_messageInfo_AppService_Port.Size(m) +} +func (m *AppService_Port) XXX_DiscardUnknown() { + xxx_messageInfo_AppService_Port.DiscardUnknown(m) +} + +var xxx_messageInfo_AppService_Port proto.InternalMessageInfo + +func (m *AppService_Port) GetPort() int32 { + if m != nil { + return m.Port } return 0 } -func (x *AppService_Port) GetProtocol() string { - if x != nil { - return x.Protocol +func (m *AppService_Port) GetProtocol() string { + if m != nil { + return m.Protocol } return "" } -var File_worker_server_pb_app_runtime_server_proto protoreflect.FileDescriptor - -var file_worker_server_pb_app_runtime_server_proto_rawDesc = []byte{ - 0x0a, 0x29, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, - 0x70, 0x62, 0x2f, 0x61, 0x70, 0x70, 0x5f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, - 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1f, 0x0a, 0x06, 0x41, 0x70, 0x70, 0x52, - 0x65, 0x71, 0x12, 0x15, 0x0a, 0x06, 0x61, 0x70, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x22, 0x25, 0x0a, 0x0c, 0x41, 0x70, 0x70, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x12, 0x15, 0x0a, 0x06, 0x61, 0x70, 0x70, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, - 0x22, 0x2f, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, - 0x64, 0x22, 0x32, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, - 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x49, 0x64, 0x73, 0x22, 0x2c, 0x0a, 0x0d, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, - 0x74, 0x49, 0x64, 0x22, 0x81, 0x01, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, 0x39, 0x0a, 0x0b, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 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, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x79, 0x0a, 0x0b, 0x44, 0x69, 0x73, 0x6b, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x64, 0x69, 0x73, 0x6b, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x6b, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x05, 0x64, 0x69, 0x73, 0x6b, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x6b, - 0x73, 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, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0x6d, 0x0a, 0x11, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x70, 0x70, - 0x50, 0x6f, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x6f, 0x6c, 0x64, 0x50, 0x6f, - 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x70, 0x70, 0x50, 0x6f, 0x64, 0x52, 0x07, 0x6f, 0x6c, 0x64, - 0x50, 0x6f, 0x64, 0x73, 0x12, 0x2b, 0x0a, 0x07, 0x6e, 0x65, 0x77, 0x50, 0x6f, 0x64, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x41, 0x70, 0x70, 0x50, 0x6f, 0x64, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x50, 0x6f, 0x64, - 0x73, 0x22, 0xbe, 0x01, 0x0a, 0x16, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x41, 0x70, 0x70, 0x50, 0x6f, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x4d, 0x0a, 0x0b, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x2b, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x41, 0x70, 0x70, 0x50, 0x6f, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x64, 0x73, 0x1a, 0x55, 0x0a, 0x10, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x70, 0x70, - 0x50, 0x6f, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0x8b, 0x01, 0x0a, 0x10, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, - 0x50, 0x6f, 0x64, 0x4e, 0x75, 0x6d, 0x73, 0x12, 0x3b, 0x0a, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x75, - 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, - 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x64, 0x4e, 0x75, 0x6d, 0x73, 0x2e, 0x50, - 0x6f, 0x64, 0x4e, 0x75, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x70, 0x6f, 0x64, - 0x4e, 0x75, 0x6d, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x50, 0x6f, 0x64, 0x4e, 0x75, 0x6d, 0x73, 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x22, 0xef, 0x02, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x70, 0x70, 0x50, - 0x6f, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, - 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x64, 0x12, 0x1f, - 0x0a, 0x0b, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x70, 0x6f, - 0x64, 0x5f, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, 0x64, 0x49, - 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x6f, 0x64, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x6f, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x41, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x41, 0x70, 0x70, 0x50, 0x6f, 0x64, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x64, 0x5f, 0x76, 0x6f, 0x6c, 0x75, 0x6d, - 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x64, 0x56, 0x6f, 0x6c, - 0x75, 0x6d, 0x65, 0x73, 0x1a, 0x4c, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0x76, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, - 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, - 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6d, 0x65, - 0x6d, 0x6f, 0x72, 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x70, 0x75, - 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, - 0x63, 0x70, 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xef, 0x06, 0x0a, 0x0a, 0x44, - 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x65, - 0x66, 0x75, 0x6c, 0x65, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, - 0x74, 0x61, 0x74, 0x65, 0x66, 0x75, 0x6c, 0x65, 0x73, 0x65, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, - 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x70, 0x6f, - 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, - 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x6f, 0x64, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x04, 0x70, 0x6f, 0x64, 0x73, 0x12, 0x38, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x62, 0x2e, - 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, - 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, - 0x35, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, - 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, - 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x12, 0x3b, 0x0a, 0x09, 0x69, 0x6e, 0x67, 0x72, 0x65, 0x73, - 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x44, - 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x49, 0x6e, 0x67, 0x72, 0x65, 0x73, - 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x69, 0x6e, 0x67, 0x72, 0x65, 0x73, - 0x73, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x0b, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x73, - 0x65, 0x74, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, - 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x73, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x72, 0x65, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, 0x37, - 0x0a, 0x09, 0x50, 0x6f, 0x64, 0x73, 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, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 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, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3c, 0x0a, 0x0e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x73, 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, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x1a, 0x3a, 0x0a, 0x0c, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 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, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3c, - 0x0a, 0x0e, 0x49, 0x6e, 0x67, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 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, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, - 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x73, 0x65, 0x74, 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, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xac, 0x02, 0x0a, - 0x0e, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, - 0x1f, 0x0a, 0x0b, 0x63, 0x70, 0x75, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x70, 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x70, 0x75, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x70, 0x75, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x25, 0x0a, - 0x0e, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x6c, - 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, - 0x72, 0x79, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x72, 0x75, 0x6e, 0x6e, 0x69, - 0x6e, 0x67, 0x5f, 0x61, 0x70, 0x70, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0d, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x41, 0x70, 0x70, 0x4e, 0x75, 0x6d, 0x12, - 0x31, 0x0a, 0x15, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x70, 0x70, 0x5f, 0x74, - 0x68, 0x69, 0x72, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, - 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x41, 0x70, 0x70, 0x54, 0x68, 0x69, 0x72, 0x64, 0x4e, - 0x75, 0x6d, 0x12, 0x37, 0x0a, 0x18, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x70, - 0x70, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x41, 0x70, 0x70, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x22, 0xab, 0x01, 0x0a, 0x12, - 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x69, - 0x73, 0x74, 0x12, 0x43, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x65, 0x6e, 0x61, 0x6e, - 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x50, 0x0a, 0x0e, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, - 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x82, 0x01, 0x0a, 0x19, 0x41, 0x64, - 0x64, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x64, 0x70, 0x6f, - 0x69, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, - 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, - 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x82, - 0x01, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, - 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, - 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, - 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, - 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x6f, 0x6e, 0x6c, - 0x69, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x4f, 0x6e, 0x6c, - 0x69, 0x6e, 0x65, 0x22, 0x65, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, - 0x61, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, - 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x75, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x12, 0x54, - 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, - 0x22, 0x3f, 0x0a, 0x13, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x45, 0x6e, - 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x28, 0x0a, 0x03, 0x6f, 0x62, 0x6a, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, - 0x61, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x03, 0x6f, 0x62, - 0x6a, 0x22, 0x24, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x6f, 0x64, 0x73, 0x42, 0x79, 0x53, - 0x49, 0x44, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x22, 0x3e, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x6f, - 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, - 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x70, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x62, 0x0a, 0x08, 0x50, 0x6f, 0x64, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, - 0x10, 0x0a, 0x03, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x61, 0x67, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xbe, 0x02, 0x0a, 0x09, - 0x50, 0x6f, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x64, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x64, 0x76, 0x69, 0x63, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x74, - 0x79, 0x70, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, - 0x79, 0x70, 0x65, 0x53, 0x74, 0x72, 0x22, 0xa3, 0x01, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, - 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x55, 0x43, - 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, - 0x45, 0x44, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x45, 0x4d, 0x49, 0x4e, 0x41, 0x54, 0x49, 0x4e, 0x47, 0x10, - 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x42, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x06, 0x12, - 0x0e, 0x0a, 0x0a, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x49, 0x4e, 0x47, 0x10, 0x07, 0x12, - 0x0e, 0x0a, 0x0a, 0x53, 0x43, 0x48, 0x45, 0x44, 0x55, 0x4c, 0x49, 0x4e, 0x47, 0x10, 0x08, 0x12, - 0x0c, 0x0a, 0x08, 0x4e, 0x4f, 0x54, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x09, 0x12, 0x0d, 0x0a, - 0x09, 0x55, 0x4e, 0x48, 0x45, 0x41, 0x4c, 0x54, 0x48, 0x59, 0x10, 0x0a, 0x22, 0xf4, 0x01, 0x0a, - 0x0c, 0x50, 0x6f, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x14, 0x0a, - 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, - 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, - 0x73, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6c, - 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x1b, - 0x0a, 0x09, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x63, 0x70, 0x75, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x70, 0x75, 0x12, 0x25, 0x0a, 0x0e, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, - 0x72, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x70, - 0x75, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x43, 0x70, 0x75, 0x22, 0xcf, 0x02, 0x0a, 0x09, 0x50, 0x6f, 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6f, - 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, - 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, - 0x2e, 0x50, 0x6f, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x0e, 0x69, - 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x12, 0x30, 0x0a, - 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x12, - 0x24, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6f, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, - 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x3c, 0x0a, 0x0e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x04, 0x6c, - 0x69, 0x73, 0x74, 0x22, 0xa7, 0x03, 0x0a, 0x12, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, - 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, - 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x2e, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x6c, - 0x61, 0x69, 0x6d, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0d, 0x72, 0x65, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, - 0x34, 0x0a, 0x16, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, - 0x65, 0x78, 0x70, 0x61, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x14, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x45, 0x78, 0x70, 0x61, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x13, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, - 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x11, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, - 0x67, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x47, 0x0a, 0x12, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, - 0x5f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x53, - 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x54, 0x65, 0x72, 0x6d, 0x52, 0x11, 0x61, 0x6c, 0x6c, - 0x6f, 0x77, 0x65, 0x64, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x69, 0x65, 0x73, 0x1a, 0x3d, - 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 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, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x74, 0x0a, - 0x14, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x54, 0x65, 0x72, 0x6d, 0x12, 0x5c, 0x0a, 0x17, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6c, - 0x61, 0x62, 0x65, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x6f, 0x70, 0x6f, - 0x6c, 0x6f, 0x67, 0x79, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x4c, 0x61, 0x62, 0x65, - 0x6c, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x15, 0x6d, 0x61, - 0x74, 0x63, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x73, 0x22, 0x4c, 0x0a, 0x20, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x53, - 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, - 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x22, 0xb4, 0x01, 0x0a, 0x1a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x6f, 0x6c, - 0x75, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x42, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x2a, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x6f, 0x6c, - 0x75, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x1a, 0x52, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa3, 0x03, 0x0a, 0x09, 0x41, 0x70, 0x70, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x10, - 0x0a, 0x03, 0x63, 0x70, 0x75, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x63, 0x70, 0x75, - 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x74, 0x43, - 0x50, 0x55, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x65, 0x74, 0x43, 0x50, 0x55, - 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x70, 0x68, 0x61, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, - 0x68, 0x61, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, - 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x0a, - 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, - 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x70, 0x75, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x03, 0x67, 0x70, 0x75, 0x12, 0x15, 0x0a, 0x06, 0x61, 0x70, 0x70, 0x5f, 0x69, 0x64, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x19, 0x0a, - 0x08, 0x61, 0x70, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x54, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x07, 0x0a, 0x03, 0x4e, 0x49, 0x4c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x52, - 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4c, 0x4f, 0x53, - 0x45, 0x44, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x42, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, - 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x54, 0x41, 0x52, 0x54, 0x49, 0x4e, 0x47, 0x10, 0x04, - 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x10, 0x05, 0x22, 0x72, - 0x0a, 0x12, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x22, 0xa6, 0x02, 0x0a, 0x0a, 0x41, 0x70, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x29, 0x0a, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, - 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, - 0x6f, 0x72, 0x74, 0x52, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x04, 0x70, 0x6f, - 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, - 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x6f, 0x64, 0x52, 0x04, 0x70, 0x6f, - 0x64, 0x73, 0x12, 0x2c, 0x0a, 0x07, 0x6f, 0x6c, 0x64, 0x50, 0x6f, 0x64, 0x73, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x50, 0x6f, 0x64, 0x52, 0x07, 0x6f, 0x6c, 0x64, 0x50, 0x6f, 0x64, 0x73, - 0x1a, 0x31, 0x0a, 0x03, 0x50, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x1a, 0x36, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, - 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, - 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x22, 0x39, 0x0a, 0x0b, 0x41, - 0x70, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x08, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, - 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x08, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x4d, 0x0a, 0x0f, 0x48, 0x65, 0x6c, 0x6d, 0x41, 0x70, - 0x70, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x0e, 0x68, 0x65, 0x6c, - 0x6d, 0x41, 0x70, 0x70, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x65, 0x6c, 0x6d, 0x41, 0x70, 0x70, 0x52, 0x65, - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x0e, 0x68, 0x65, 0x6c, 0x6d, 0x41, 0x70, 0x70, 0x52, 0x65, - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x22, 0xb6, 0x01, 0x0a, 0x0e, 0x48, 0x65, 0x6c, 0x6d, 0x41, 0x70, - 0x70, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x16, - 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x72, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x68, 0x61, 0x72, 0x74, 0x12, 0x1e, 0x0a, 0x0a, - 0x61, 0x70, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x61, 0x70, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x29, - 0x0a, 0x0e, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x12, 0x17, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x06, 0x61, 0x70, 0x70, 0x49, 0x64, 0x73, 0x22, 0x3f, 0x0a, 0x0b, 0x41, 0x70, 0x70, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x0c, 0x61, 0x70, 0x70, 0x5f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0b, 0x61, - 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x2a, 0x2f, 0x0a, 0x13, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, - 0x4e, 0x4f, 0x54, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x01, 0x32, 0xf2, 0x08, 0x0a, 0x0e, - 0x41, 0x70, 0x70, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x42, - 0x0a, 0x16, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x44, 0x65, - 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, - 0x70, 0x62, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x22, 0x00, 0x12, 0x31, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x50, - 0x6f, 0x64, 0x73, 0x12, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x41, 0x70, 0x70, 0x50, 0x6f, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, - 0x12, 0x44, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x70, 0x70, 0x50, - 0x6f, 0x64, 0x73, 0x12, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x75, - 0x6c, 0x74, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x70, 0x70, 0x50, 0x6f, 0x64, - 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x64, 0x4e, 0x75, 0x6d, 0x73, 0x12, 0x13, 0x2e, - 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, - 0x74, 0x50, 0x6f, 0x64, 0x4e, 0x75, 0x6d, 0x73, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x0d, 0x47, 0x65, - 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x2e, 0x70, 0x62, - 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x22, - 0x00, 0x12, 0x3c, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x65, 0x6e, 0x61, - 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x54, - 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x00, 0x12, - 0x39, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x17, 0x4c, 0x69, - 0x73, 0x74, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x64, 0x70, - 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x54, - 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, - 0x74, 0x73, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x15, 0x41, 0x64, 0x64, 0x54, 0x68, 0x69, 0x72, 0x64, - 0x50, 0x61, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1d, 0x2e, - 0x70, 0x62, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, - 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, - 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x15, 0x55, 0x70, 0x64, - 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, - 0x6e, 0x74, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x54, 0x68, 0x69, 0x72, 0x64, - 0x50, 0x61, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x43, - 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x45, - 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, - 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, - 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x64, 0x44, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x12, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x64, 0x44, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6f, - 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x11, 0x47, 0x65, 0x74, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x12, 0x09, - 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x53, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x22, 0x00, 0x12, - 0x4a, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x12, 0x30, 0x0a, 0x0f, 0x4c, - 0x69, 0x73, 0x74, 0x41, 0x70, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x0a, - 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x2e, - 0x41, 0x70, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x00, 0x12, 0x37, 0x0a, - 0x12, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x65, 0x6c, 0x6d, 0x41, 0x70, 0x70, 0x52, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x12, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x1a, - 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x65, 0x6c, 0x6d, 0x41, 0x70, 0x70, 0x52, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x73, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x70, - 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x12, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x41, - 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, - 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x22, 0x00, - 0x42, 0x12, 0x5a, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +type AppServices struct { + Services []*AppService `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -var ( - file_worker_server_pb_app_runtime_server_proto_rawDescOnce sync.Once - file_worker_server_pb_app_runtime_server_proto_rawDescData = file_worker_server_pb_app_runtime_server_proto_rawDesc -) - -func file_worker_server_pb_app_runtime_server_proto_rawDescGZIP() []byte { - file_worker_server_pb_app_runtime_server_proto_rawDescOnce.Do(func() { - file_worker_server_pb_app_runtime_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_worker_server_pb_app_runtime_server_proto_rawDescData) - }) - return file_worker_server_pb_app_runtime_server_proto_rawDescData +func (m *AppServices) Reset() { *m = AppServices{} } +func (m *AppServices) String() string { return proto.CompactTextString(m) } +func (*AppServices) ProtoMessage() {} +func (*AppServices) Descriptor() ([]byte, []int) { + return fileDescriptor_f94cf1a886c479d6, []int{35} } -var file_worker_server_pb_app_runtime_server_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_worker_server_pb_app_runtime_server_proto_msgTypes = make([]protoimpl.MessageInfo, 56) -var file_worker_server_pb_app_runtime_server_proto_goTypes = []interface{}{ - (ServiceVolumeStatus)(0), // 0: pb.ServiceVolumeStatus - (PodStatus_Type)(0), // 1: pb.PodStatus.Type - (AppStatus_Status)(0), // 2: pb.AppStatus.Status - (*Empty)(nil), // 3: pb.Empty - (*AppReq)(nil), // 4: pb.AppReq - (*AppStatusReq)(nil), // 5: pb.AppStatusReq - (*ServiceRequest)(nil), // 6: pb.ServiceRequest - (*ServicesRequest)(nil), // 7: pb.ServicesRequest - (*TenantRequest)(nil), // 8: pb.TenantRequest - (*StatusMessage)(nil), // 9: pb.StatusMessage - (*DiskMessage)(nil), // 10: pb.DiskMessage - (*ServiceAppPodList)(nil), // 11: pb.ServiceAppPodList - (*MultiServiceAppPodList)(nil), // 12: pb.MultiServiceAppPodList - (*ComponentPodNums)(nil), // 13: pb.ComponentPodNums - (*ServiceAppPod)(nil), // 14: pb.ServiceAppPod - (*Container)(nil), // 15: pb.Container - (*DeployInfo)(nil), // 16: pb.DeployInfo - (*TenantResource)(nil), // 17: pb.TenantResource - (*TenantResourceList)(nil), // 18: pb.TenantResourceList - (*AddThirdPartyEndpointsReq)(nil), // 19: pb.AddThirdPartyEndpointsReq - (*UpdThirdPartyEndpointsReq)(nil), // 20: pb.UpdThirdPartyEndpointsReq - (*DelThirdPartyEndpointsReq)(nil), // 21: pb.DelThirdPartyEndpointsReq - (*ThirdPartyEndpoint)(nil), // 22: pb.ThirdPartyEndpoint - (*ThirdPartyEndpoints)(nil), // 23: pb.ThirdPartyEndpoints - (*ListPodsBySIDReq)(nil), // 24: pb.ListPodsBySIDReq - (*GetPodDetailReq)(nil), // 25: pb.GetPodDetailReq - (*PodEvent)(nil), // 26: pb.PodEvent - (*PodStatus)(nil), // 27: pb.PodStatus - (*PodContainer)(nil), // 28: pb.PodContainer - (*PodDetail)(nil), // 29: pb.PodDetail - (*StorageClasses)(nil), // 30: pb.StorageClasses - (*StorageClassDetail)(nil), // 31: pb.StorageClassDetail - (*TopologySelectorTerm)(nil), // 32: pb.TopologySelectorTerm - (*TopologySelectorLabelRequirement)(nil), // 33: pb.TopologySelectorLabelRequirement - (*ServiceVolumeStatusMessage)(nil), // 34: pb.ServiceVolumeStatusMessage - (*AppStatus)(nil), // 35: pb.AppStatus - (*AppStatusCondition)(nil), // 36: pb.AppStatusCondition - (*AppService)(nil), // 37: pb.AppService - (*AppServices)(nil), // 38: pb.AppServices - (*HelmAppReleases)(nil), // 39: pb.HelmAppReleases - (*HelmAppRelease)(nil), // 40: pb.HelmAppRelease - (*AppStatusesReq)(nil), // 41: pb.AppStatusesReq - (*AppStatuses)(nil), // 42: pb.AppStatuses - nil, // 43: pb.StatusMessage.StatusEntry - nil, // 44: pb.DiskMessage.DisksEntry - nil, // 45: pb.MultiServiceAppPodList.ServicePodsEntry - nil, // 46: pb.ComponentPodNums.PodNumsEntry - nil, // 47: pb.ServiceAppPod.ContainersEntry - nil, // 48: pb.DeployInfo.PodsEntry - nil, // 49: pb.DeployInfo.ServicesEntry - nil, // 50: pb.DeployInfo.EndpointsEntry - nil, // 51: pb.DeployInfo.SecretsEntry - nil, // 52: pb.DeployInfo.IngressesEntry - nil, // 53: pb.DeployInfo.ReplicatsetEntry - nil, // 54: pb.TenantResourceList.ResourcesEntry - nil, // 55: pb.StorageClassDetail.ParametersEntry - nil, // 56: pb.ServiceVolumeStatusMessage.StatusEntry - (*AppService_Pod)(nil), // 57: pb.AppService.Pod - (*AppService_Port)(nil), // 58: pb.AppService.Port +func (m *AppServices) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppServices.Unmarshal(m, b) } -var file_worker_server_pb_app_runtime_server_proto_depIdxs = []int32{ - 43, // 0: pb.StatusMessage.status:type_name -> pb.StatusMessage.StatusEntry - 44, // 1: pb.DiskMessage.disks:type_name -> pb.DiskMessage.DisksEntry - 14, // 2: pb.ServiceAppPodList.oldPods:type_name -> pb.ServiceAppPod - 14, // 3: pb.ServiceAppPodList.newPods:type_name -> pb.ServiceAppPod - 45, // 4: pb.MultiServiceAppPodList.servicePods:type_name -> pb.MultiServiceAppPodList.ServicePodsEntry - 46, // 5: pb.ComponentPodNums.podNums:type_name -> pb.ComponentPodNums.PodNumsEntry - 47, // 6: pb.ServiceAppPod.containers:type_name -> pb.ServiceAppPod.ContainersEntry - 48, // 7: pb.DeployInfo.pods:type_name -> pb.DeployInfo.PodsEntry - 49, // 8: pb.DeployInfo.services:type_name -> pb.DeployInfo.ServicesEntry - 50, // 9: pb.DeployInfo.endpoints:type_name -> pb.DeployInfo.EndpointsEntry - 51, // 10: pb.DeployInfo.secrets:type_name -> pb.DeployInfo.SecretsEntry - 52, // 11: pb.DeployInfo.ingresses:type_name -> pb.DeployInfo.IngressesEntry - 53, // 12: pb.DeployInfo.replicatset:type_name -> pb.DeployInfo.ReplicatsetEntry - 54, // 13: pb.TenantResourceList.resources:type_name -> pb.TenantResourceList.ResourcesEntry - 22, // 14: pb.ThirdPartyEndpoints.obj:type_name -> pb.ThirdPartyEndpoint - 1, // 15: pb.PodStatus.type:type_name -> pb.PodStatus.Type - 27, // 16: pb.PodDetail.status:type_name -> pb.PodStatus - 28, // 17: pb.PodDetail.init_containers:type_name -> pb.PodContainer - 28, // 18: pb.PodDetail.containers:type_name -> pb.PodContainer - 26, // 19: pb.PodDetail.events:type_name -> pb.PodEvent - 31, // 20: pb.StorageClasses.list:type_name -> pb.StorageClassDetail - 55, // 21: pb.StorageClassDetail.parameters:type_name -> pb.StorageClassDetail.ParametersEntry - 32, // 22: pb.StorageClassDetail.allowed_topologies:type_name -> pb.TopologySelectorTerm - 33, // 23: pb.TopologySelectorTerm.match_label_expressions:type_name -> pb.TopologySelectorLabelRequirement - 56, // 24: pb.ServiceVolumeStatusMessage.status:type_name -> pb.ServiceVolumeStatusMessage.StatusEntry - 36, // 25: pb.AppStatus.conditions:type_name -> pb.AppStatusCondition - 58, // 26: pb.AppService.ports:type_name -> pb.AppService.Port - 57, // 27: pb.AppService.pods:type_name -> pb.AppService.Pod - 57, // 28: pb.AppService.oldPods:type_name -> pb.AppService.Pod - 37, // 29: pb.AppServices.services:type_name -> pb.AppService - 40, // 30: pb.HelmAppReleases.helmAppRelease:type_name -> pb.HelmAppRelease - 35, // 31: pb.AppStatuses.app_statuses:type_name -> pb.AppStatus - 11, // 32: pb.MultiServiceAppPodList.ServicePodsEntry.value:type_name -> pb.ServiceAppPodList - 15, // 33: pb.ServiceAppPod.ContainersEntry.value:type_name -> pb.Container - 17, // 34: pb.TenantResourceList.ResourcesEntry.value:type_name -> pb.TenantResource - 0, // 35: pb.ServiceVolumeStatusMessage.StatusEntry.value:type_name -> pb.ServiceVolumeStatus - 7, // 36: pb.AppRuntimeSync.GetAppStatusDeprecated:input_type -> pb.ServicesRequest - 5, // 37: pb.AppRuntimeSync.GetAppStatus:input_type -> pb.AppStatusReq - 6, // 38: pb.AppRuntimeSync.GetAppPods:input_type -> pb.ServiceRequest - 7, // 39: pb.AppRuntimeSync.GetMultiAppPods:input_type -> pb.ServicesRequest - 7, // 40: pb.AppRuntimeSync.GetComponentPodNums:input_type -> pb.ServicesRequest - 6, // 41: pb.AppRuntimeSync.GetDeployInfo:input_type -> pb.ServiceRequest - 8, // 42: pb.AppRuntimeSync.GetTenantResource:input_type -> pb.TenantRequest - 3, // 43: pb.AppRuntimeSync.GetTenantResources:input_type -> pb.Empty - 6, // 44: pb.AppRuntimeSync.ListThirdPartyEndpoints:input_type -> pb.ServiceRequest - 19, // 45: pb.AppRuntimeSync.AddThirdPartyEndpoint:input_type -> pb.AddThirdPartyEndpointsReq - 20, // 46: pb.AppRuntimeSync.UpdThirdPartyEndpoint:input_type -> pb.UpdThirdPartyEndpointsReq - 21, // 47: pb.AppRuntimeSync.DelThirdPartyEndpoint:input_type -> pb.DelThirdPartyEndpointsReq - 25, // 48: pb.AppRuntimeSync.GetPodDetail:input_type -> pb.GetPodDetailReq - 3, // 49: pb.AppRuntimeSync.GetStorageClasses:input_type -> pb.Empty - 6, // 50: pb.AppRuntimeSync.GetAppVolumeStatus:input_type -> pb.ServiceRequest - 4, // 51: pb.AppRuntimeSync.ListAppServices:input_type -> pb.AppReq - 4, // 52: pb.AppRuntimeSync.ListHelmAppRelease:input_type -> pb.AppReq - 41, // 53: pb.AppRuntimeSync.ListAppStatuses:input_type -> pb.AppStatusesReq - 9, // 54: pb.AppRuntimeSync.GetAppStatusDeprecated:output_type -> pb.StatusMessage - 35, // 55: pb.AppRuntimeSync.GetAppStatus:output_type -> pb.AppStatus - 11, // 56: pb.AppRuntimeSync.GetAppPods:output_type -> pb.ServiceAppPodList - 12, // 57: pb.AppRuntimeSync.GetMultiAppPods:output_type -> pb.MultiServiceAppPodList - 13, // 58: pb.AppRuntimeSync.GetComponentPodNums:output_type -> pb.ComponentPodNums - 16, // 59: pb.AppRuntimeSync.GetDeployInfo:output_type -> pb.DeployInfo - 17, // 60: pb.AppRuntimeSync.GetTenantResource:output_type -> pb.TenantResource - 18, // 61: pb.AppRuntimeSync.GetTenantResources:output_type -> pb.TenantResourceList - 23, // 62: pb.AppRuntimeSync.ListThirdPartyEndpoints:output_type -> pb.ThirdPartyEndpoints - 3, // 63: pb.AppRuntimeSync.AddThirdPartyEndpoint:output_type -> pb.Empty - 3, // 64: pb.AppRuntimeSync.UpdThirdPartyEndpoint:output_type -> pb.Empty - 3, // 65: pb.AppRuntimeSync.DelThirdPartyEndpoint:output_type -> pb.Empty - 29, // 66: pb.AppRuntimeSync.GetPodDetail:output_type -> pb.PodDetail - 30, // 67: pb.AppRuntimeSync.GetStorageClasses:output_type -> pb.StorageClasses - 34, // 68: pb.AppRuntimeSync.GetAppVolumeStatus:output_type -> pb.ServiceVolumeStatusMessage - 38, // 69: pb.AppRuntimeSync.ListAppServices:output_type -> pb.AppServices - 39, // 70: pb.AppRuntimeSync.ListHelmAppRelease:output_type -> pb.HelmAppReleases - 42, // 71: pb.AppRuntimeSync.ListAppStatuses:output_type -> pb.AppStatuses - 54, // [54:72] is the sub-list for method output_type - 36, // [36:54] is the sub-list for method input_type - 36, // [36:36] is the sub-list for extension type_name - 36, // [36:36] is the sub-list for extension extendee - 0, // [0:36] is the sub-list for field type_name +func (m *AppServices) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppServices.Marshal(b, m, deterministic) +} +func (m *AppServices) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppServices.Merge(m, src) +} +func (m *AppServices) XXX_Size() int { + return xxx_messageInfo_AppServices.Size(m) +} +func (m *AppServices) XXX_DiscardUnknown() { + xxx_messageInfo_AppServices.DiscardUnknown(m) } -func init() { file_worker_server_pb_app_runtime_server_proto_init() } -func file_worker_server_pb_app_runtime_server_proto_init() { - if File_worker_server_pb_app_runtime_server_proto != nil { - return +var xxx_messageInfo_AppServices proto.InternalMessageInfo + +func (m *AppServices) GetServices() []*AppService { + if m != nil { + return m.Services } - if !protoimpl.UnsafeEnabled { - file_worker_server_pb_app_runtime_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Empty); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStatusReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServiceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServicesRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TenantRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DiskMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServiceAppPodList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MultiServiceAppPodList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ComponentPodNums); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServiceAppPod); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Container); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeployInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TenantResource); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TenantResourceList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddThirdPartyEndpointsReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdThirdPartyEndpointsReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DelThirdPartyEndpointsReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ThirdPartyEndpoint); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ThirdPartyEndpoints); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListPodsBySIDReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPodDetailReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PodEvent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PodStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PodContainer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PodDetail); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StorageClasses); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StorageClassDetail); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TopologySelectorTerm); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TopologySelectorLabelRequirement); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServiceVolumeStatusMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStatusCondition); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppService); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppServices); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HelmAppReleases); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HelmAppRelease); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStatusesReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppStatuses); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppService_Pod); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worker_server_pb_app_runtime_server_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppService_Port); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } + return nil +} + +type HelmAppReleases struct { + HelmAppRelease []*HelmAppRelease `protobuf:"bytes,1,rep,name=helmAppRelease,proto3" json:"helmAppRelease,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HelmAppReleases) Reset() { *m = HelmAppReleases{} } +func (m *HelmAppReleases) String() string { return proto.CompactTextString(m) } +func (*HelmAppReleases) ProtoMessage() {} +func (*HelmAppReleases) Descriptor() ([]byte, []int) { + return fileDescriptor_f94cf1a886c479d6, []int{36} +} + +func (m *HelmAppReleases) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HelmAppReleases.Unmarshal(m, b) +} +func (m *HelmAppReleases) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HelmAppReleases.Marshal(b, m, deterministic) +} +func (m *HelmAppReleases) XXX_Merge(src proto.Message) { + xxx_messageInfo_HelmAppReleases.Merge(m, src) +} +func (m *HelmAppReleases) XXX_Size() int { + return xxx_messageInfo_HelmAppReleases.Size(m) +} +func (m *HelmAppReleases) XXX_DiscardUnknown() { + xxx_messageInfo_HelmAppReleases.DiscardUnknown(m) +} + +var xxx_messageInfo_HelmAppReleases proto.InternalMessageInfo + +func (m *HelmAppReleases) GetHelmAppRelease() []*HelmAppRelease { + if m != nil { + return m.HelmAppRelease } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_worker_server_pb_app_runtime_server_proto_rawDesc, - NumEnums: 3, - NumMessages: 56, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_worker_server_pb_app_runtime_server_proto_goTypes, - DependencyIndexes: file_worker_server_pb_app_runtime_server_proto_depIdxs, - EnumInfos: file_worker_server_pb_app_runtime_server_proto_enumTypes, - MessageInfos: file_worker_server_pb_app_runtime_server_proto_msgTypes, - }.Build() - File_worker_server_pb_app_runtime_server_proto = out.File - file_worker_server_pb_app_runtime_server_proto_rawDesc = nil - file_worker_server_pb_app_runtime_server_proto_goTypes = nil - file_worker_server_pb_app_runtime_server_proto_depIdxs = nil + return nil +} + +type HelmAppRelease struct { + Revision int32 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"` + Updated string `protobuf:"bytes,2,opt,name=updated,proto3" json:"updated,omitempty"` + Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` + Chart string `protobuf:"bytes,4,opt,name=chart,proto3" json:"chart,omitempty"` + AppVersion string `protobuf:"bytes,5,opt,name=appVersion,proto3" json:"appVersion,omitempty"` + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HelmAppRelease) Reset() { *m = HelmAppRelease{} } +func (m *HelmAppRelease) String() string { return proto.CompactTextString(m) } +func (*HelmAppRelease) ProtoMessage() {} +func (*HelmAppRelease) Descriptor() ([]byte, []int) { + return fileDescriptor_f94cf1a886c479d6, []int{37} +} + +func (m *HelmAppRelease) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HelmAppRelease.Unmarshal(m, b) +} +func (m *HelmAppRelease) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HelmAppRelease.Marshal(b, m, deterministic) +} +func (m *HelmAppRelease) XXX_Merge(src proto.Message) { + xxx_messageInfo_HelmAppRelease.Merge(m, src) +} +func (m *HelmAppRelease) XXX_Size() int { + return xxx_messageInfo_HelmAppRelease.Size(m) +} +func (m *HelmAppRelease) XXX_DiscardUnknown() { + xxx_messageInfo_HelmAppRelease.DiscardUnknown(m) +} + +var xxx_messageInfo_HelmAppRelease proto.InternalMessageInfo + +func (m *HelmAppRelease) GetRevision() int32 { + if m != nil { + return m.Revision + } + return 0 +} + +func (m *HelmAppRelease) GetUpdated() string { + if m != nil { + return m.Updated + } + return "" +} + +func (m *HelmAppRelease) GetStatus() string { + if m != nil { + return m.Status + } + return "" +} + +func (m *HelmAppRelease) GetChart() string { + if m != nil { + return m.Chart + } + return "" +} + +func (m *HelmAppRelease) GetAppVersion() string { + if m != nil { + return m.AppVersion + } + return "" +} + +func (m *HelmAppRelease) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +type AppStatusesReq struct { + AppIds []string `protobuf:"bytes,1,rep,name=app_ids,json=appIds,proto3" json:"app_ids,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AppStatusesReq) Reset() { *m = AppStatusesReq{} } +func (m *AppStatusesReq) String() string { return proto.CompactTextString(m) } +func (*AppStatusesReq) ProtoMessage() {} +func (*AppStatusesReq) Descriptor() ([]byte, []int) { + return fileDescriptor_f94cf1a886c479d6, []int{38} +} + +func (m *AppStatusesReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppStatusesReq.Unmarshal(m, b) +} +func (m *AppStatusesReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppStatusesReq.Marshal(b, m, deterministic) +} +func (m *AppStatusesReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppStatusesReq.Merge(m, src) +} +func (m *AppStatusesReq) XXX_Size() int { + return xxx_messageInfo_AppStatusesReq.Size(m) +} +func (m *AppStatusesReq) XXX_DiscardUnknown() { + xxx_messageInfo_AppStatusesReq.DiscardUnknown(m) +} + +var xxx_messageInfo_AppStatusesReq proto.InternalMessageInfo + +func (m *AppStatusesReq) GetAppIds() []string { + if m != nil { + return m.AppIds + } + return nil +} + +type AppStatuses struct { + AppStatuses []*AppStatus `protobuf:"bytes,1,rep,name=app_statuses,json=appStatuses,proto3" json:"app_statuses,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AppStatuses) Reset() { *m = AppStatuses{} } +func (m *AppStatuses) String() string { return proto.CompactTextString(m) } +func (*AppStatuses) ProtoMessage() {} +func (*AppStatuses) Descriptor() ([]byte, []int) { + return fileDescriptor_f94cf1a886c479d6, []int{39} +} + +func (m *AppStatuses) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AppStatuses.Unmarshal(m, b) +} +func (m *AppStatuses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AppStatuses.Marshal(b, m, deterministic) +} +func (m *AppStatuses) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppStatuses.Merge(m, src) +} +func (m *AppStatuses) XXX_Size() int { + return xxx_messageInfo_AppStatuses.Size(m) +} +func (m *AppStatuses) XXX_DiscardUnknown() { + xxx_messageInfo_AppStatuses.DiscardUnknown(m) +} + +var xxx_messageInfo_AppStatuses proto.InternalMessageInfo + +func (m *AppStatuses) GetAppStatuses() []*AppStatus { + if m != nil { + return m.AppStatuses + } + return nil +} + +func init() { + proto.RegisterEnum("pb.ServiceVolumeStatus", ServiceVolumeStatus_name, ServiceVolumeStatus_value) + proto.RegisterEnum("pb.PodStatus_Type", PodStatus_Type_name, PodStatus_Type_value) + proto.RegisterEnum("pb.AppStatus_Status", AppStatus_Status_name, AppStatus_Status_value) + proto.RegisterType((*Empty)(nil), "pb.Empty") + proto.RegisterType((*AppReq)(nil), "pb.AppReq") + proto.RegisterType((*AppStatusReq)(nil), "pb.AppStatusReq") + proto.RegisterType((*ServiceRequest)(nil), "pb.ServiceRequest") + proto.RegisterType((*ServicesRequest)(nil), "pb.ServicesRequest") + proto.RegisterType((*TenantRequest)(nil), "pb.TenantRequest") + proto.RegisterType((*StatusMessage)(nil), "pb.StatusMessage") + proto.RegisterMapType((map[string]string)(nil), "pb.StatusMessage.StatusEntry") + proto.RegisterType((*DiskMessage)(nil), "pb.DiskMessage") + proto.RegisterMapType((map[string]float64)(nil), "pb.DiskMessage.DisksEntry") + proto.RegisterType((*ServiceAppPodList)(nil), "pb.ServiceAppPodList") + proto.RegisterType((*MultiServiceAppPodList)(nil), "pb.MultiServiceAppPodList") + proto.RegisterMapType((map[string]*ServiceAppPodList)(nil), "pb.MultiServiceAppPodList.ServicePodsEntry") + proto.RegisterType((*ComponentPodNums)(nil), "pb.ComponentPodNums") + proto.RegisterMapType((map[string]int32)(nil), "pb.ComponentPodNums.PodNumsEntry") + proto.RegisterType((*ServiceAppPod)(nil), "pb.ServiceAppPod") + proto.RegisterMapType((map[string]*Container)(nil), "pb.ServiceAppPod.ContainersEntry") + proto.RegisterType((*Container)(nil), "pb.Container") + proto.RegisterType((*DeployInfo)(nil), "pb.DeployInfo") + proto.RegisterMapType((map[string]string)(nil), "pb.DeployInfo.EndpointsEntry") + proto.RegisterMapType((map[string]string)(nil), "pb.DeployInfo.IngressesEntry") + proto.RegisterMapType((map[string]string)(nil), "pb.DeployInfo.PodsEntry") + proto.RegisterMapType((map[string]string)(nil), "pb.DeployInfo.ReplicatsetEntry") + proto.RegisterMapType((map[string]string)(nil), "pb.DeployInfo.SecretsEntry") + proto.RegisterMapType((map[string]string)(nil), "pb.DeployInfo.ServicesEntry") + proto.RegisterType((*TenantResource)(nil), "pb.TenantResource") + proto.RegisterType((*TenantResourceList)(nil), "pb.TenantResourceList") + proto.RegisterMapType((map[string]*TenantResource)(nil), "pb.TenantResourceList.ResourcesEntry") + proto.RegisterType((*AddThirdPartyEndpointsReq)(nil), "pb.AddThirdPartyEndpointsReq") + proto.RegisterType((*UpdThirdPartyEndpointsReq)(nil), "pb.UpdThirdPartyEndpointsReq") + proto.RegisterType((*DelThirdPartyEndpointsReq)(nil), "pb.DelThirdPartyEndpointsReq") + proto.RegisterType((*ThirdPartyEndpoint)(nil), "pb.ThirdPartyEndpoint") + proto.RegisterType((*ThirdPartyEndpoints)(nil), "pb.ThirdPartyEndpoints") + proto.RegisterType((*ListPodsBySIDReq)(nil), "pb.ListPodsBySIDReq") + proto.RegisterType((*GetPodDetailReq)(nil), "pb.GetPodDetailReq") + proto.RegisterType((*PodEvent)(nil), "pb.PodEvent") + proto.RegisterType((*PodStatus)(nil), "pb.PodStatus") + proto.RegisterType((*PodContainer)(nil), "pb.PodContainer") + proto.RegisterType((*PodDetail)(nil), "pb.PodDetail") + proto.RegisterType((*StorageClasses)(nil), "pb.StorageClasses") + proto.RegisterType((*StorageClassDetail)(nil), "pb.StorageClassDetail") + proto.RegisterMapType((map[string]string)(nil), "pb.StorageClassDetail.ParametersEntry") + proto.RegisterType((*TopologySelectorTerm)(nil), "pb.TopologySelectorTerm") + proto.RegisterType((*TopologySelectorLabelRequirement)(nil), "pb.TopologySelectorLabelRequirement") + proto.RegisterType((*ServiceVolumeStatusMessage)(nil), "pb.ServiceVolumeStatusMessage") + proto.RegisterMapType((map[string]ServiceVolumeStatus)(nil), "pb.ServiceVolumeStatusMessage.StatusEntry") + proto.RegisterType((*AppStatus)(nil), "pb.AppStatus") + proto.RegisterType((*AppStatusCondition)(nil), "pb.AppStatusCondition") + proto.RegisterType((*AppService)(nil), "pb.AppService") + proto.RegisterType((*AppService_Pod)(nil), "pb.AppService.Pod") + proto.RegisterType((*AppService_Port)(nil), "pb.AppService.Port") + proto.RegisterType((*AppServices)(nil), "pb.AppServices") + proto.RegisterType((*HelmAppReleases)(nil), "pb.HelmAppReleases") + proto.RegisterType((*HelmAppRelease)(nil), "pb.HelmAppRelease") + proto.RegisterType((*AppStatusesReq)(nil), "pb.AppStatusesReq") + proto.RegisterType((*AppStatuses)(nil), "pb.AppStatuses") +} + +func init() { proto.RegisterFile("app_runtime_server.proto", fileDescriptor_f94cf1a886c479d6) } + +var fileDescriptor_f94cf1a886c479d6 = []byte{ + // 2695 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x19, 0xd9, 0x6e, 0x23, 0xc7, + 0x51, 0x3c, 0x45, 0x16, 0x25, 0x8a, 0x6a, 0x1d, 0x4b, 0xd3, 0xc7, 0xae, 0x27, 0x5e, 0xc3, 0xc7, + 0x46, 0x5e, 0x2b, 0x3e, 0x76, 0xd7, 0x8e, 0x03, 0x8a, 0xa4, 0xb5, 0x4c, 0x24, 0x8a, 0x18, 0x51, + 0x0e, 0x0c, 0x04, 0x20, 0x46, 0x9c, 0xb6, 0x76, 0xe0, 0x39, 0x7a, 0x67, 0x86, 0x72, 0x08, 0xe4, + 0x25, 0x79, 0xcd, 0x67, 0x18, 0x48, 0x1e, 0x92, 0xc7, 0x20, 0x8f, 0xfe, 0x85, 0x7c, 0x8a, 0x81, + 0x20, 0x1f, 0x10, 0x54, 0x1f, 0x33, 0x3d, 0xe4, 0x68, 0x95, 0x0d, 0x10, 0xe4, 0x89, 0x53, 0xd5, + 0x55, 0x5d, 0xd5, 0xd5, 0x75, 0x75, 0x11, 0xda, 0x16, 0x63, 0xd3, 0x70, 0xee, 0xc7, 0x8e, 0x47, + 0xa7, 0x11, 0x0d, 0xaf, 0x69, 0x78, 0xc0, 0xc2, 0x20, 0x0e, 0x48, 0x91, 0x5d, 0x1a, 0xeb, 0x50, + 0x19, 0x78, 0x2c, 0x5e, 0x18, 0x77, 0xa1, 0xda, 0x65, 0xcc, 0xa4, 0xcf, 0xc9, 0x1e, 0x54, 0x91, + 0xc5, 0xb1, 0xdb, 0x85, 0x7b, 0x85, 0x77, 0xea, 0x66, 0xc5, 0x62, 0x6c, 0x68, 0x1b, 0xf7, 0x61, + 0xa3, 0xcb, 0xd8, 0x79, 0x6c, 0xc5, 0xf3, 0xe8, 0x05, 0x64, 0x1f, 0x40, 0xf3, 0x9c, 0x86, 0xd7, + 0xce, 0x8c, 0x9a, 0xf4, 0xf9, 0x9c, 0x46, 0x31, 0x79, 0x1d, 0x20, 0x12, 0x98, 0x94, 0xb8, 0x2e, + 0x31, 0x43, 0xdb, 0x38, 0x84, 0x2d, 0xc9, 0x10, 0x29, 0x8e, 0xbb, 0xd0, 0x48, 0x39, 0x22, 0xc9, + 0x02, 0x09, 0x4b, 0x64, 0x3c, 0x80, 0xcd, 0x09, 0xf5, 0x2d, 0x3f, 0x56, 0x1c, 0xaf, 0x42, 0x3d, + 0xe6, 0x88, 0x54, 0x44, 0x4d, 0x20, 0x86, 0xb6, 0xf1, 0xfb, 0x02, 0x6c, 0x0a, 0xbd, 0x4f, 0x69, + 0x14, 0x59, 0x57, 0x94, 0x7c, 0x0c, 0xd5, 0x88, 0x23, 0xda, 0x85, 0x7b, 0xa5, 0x77, 0x1a, 0x87, + 0xaf, 0x1f, 0xb0, 0xcb, 0x83, 0x0c, 0x89, 0x84, 0x06, 0x7e, 0x1c, 0x2e, 0x4c, 0x49, 0xdc, 0x79, + 0x0c, 0x0d, 0x0d, 0x4d, 0x5a, 0x50, 0xfa, 0x96, 0x2e, 0xa4, 0x38, 0xfc, 0x24, 0xbb, 0x50, 0xb9, + 0xb6, 0xdc, 0x39, 0x6d, 0x17, 0x85, 0x49, 0x38, 0xf0, 0xa4, 0xf8, 0xa8, 0x60, 0x2c, 0xa0, 0xd1, + 0x77, 0xa2, 0x6f, 0x95, 0x02, 0x0f, 0xa1, 0x62, 0x3b, 0xd1, 0xb7, 0x4a, 0x7e, 0x07, 0xe5, 0x6b, + 0xeb, 0xfc, 0x5b, 0x0a, 0x17, 0x84, 0x9d, 0x47, 0x00, 0x29, 0xf2, 0x36, 0xd1, 0x05, 0x5d, 0xb4, + 0x07, 0xdb, 0xd2, 0xc0, 0x5d, 0xc6, 0xc6, 0x81, 0x7d, 0xe2, 0x44, 0x31, 0x79, 0x1f, 0xd6, 0x03, + 0xd7, 0x1e, 0x07, 0xb6, 0x52, 0x61, 0x9b, 0x9b, 0x40, 0xa7, 0x33, 0x15, 0x05, 0x12, 0xfb, 0xf4, + 0x3b, 0x4e, 0x5c, 0xbc, 0x91, 0x58, 0x52, 0x18, 0x3f, 0x14, 0x60, 0xff, 0x74, 0xee, 0xc6, 0xce, + 0xaa, 0xd0, 0xd3, 0xe4, 0x5e, 0x35, 0xc1, 0xef, 0xe3, 0x5e, 0xf9, 0x0c, 0x4a, 0x04, 0x52, 0x0b, + 0x63, 0xe8, 0xfc, 0x9d, 0x0b, 0x68, 0x2d, 0x13, 0xe4, 0x18, 0xe6, 0x7d, 0xdd, 0x30, 0x8d, 0xc3, + 0xbd, 0x15, 0xd5, 0x51, 0x92, 0x6e, 0xaf, 0x3f, 0x16, 0xa0, 0xd5, 0x0b, 0x3c, 0x16, 0xf8, 0xd4, + 0x8f, 0xc7, 0x81, 0x3d, 0x9a, 0x7b, 0x11, 0xf9, 0x0c, 0xd6, 0x99, 0xf8, 0x94, 0x6a, 0xbf, 0x89, + 0xfb, 0x2c, 0x93, 0x1d, 0xc8, 0x5f, 0xa1, 0xac, 0xe2, 0xe8, 0x3c, 0x81, 0x0d, 0x7d, 0xe1, 0xb6, + 0xdb, 0xab, 0xe8, 0xda, 0xfc, 0x58, 0x84, 0xcd, 0x8c, 0xba, 0xb7, 0xc4, 0x13, 0x86, 0x82, 0x4d, + 0x99, 0x1b, 0x2c, 0x70, 0x55, 0xf8, 0x61, 0x4d, 0x20, 0x86, 0x36, 0x46, 0x96, 0x5c, 0x8c, 0x17, + 0x8c, 0xb6, 0x4b, 0x22, 0xb2, 0x04, 0x6a, 0xb2, 0x60, 0x94, 0xbc, 0x02, 0x35, 0x16, 0xd8, 0x53, + 0xdf, 0xf2, 0x68, 0xbb, 0xcc, 0x57, 0xf9, 0x29, 0x2c, 0x8f, 0x62, 0xc0, 0xe3, 0x92, 0xc3, 0xda, + 0x15, 0xe1, 0xdd, 0x2c, 0xb0, 0x87, 0x0c, 0xd5, 0x41, 0xb4, 0x8c, 0xa7, 0xaa, 0x50, 0x87, 0x05, + 0xb6, 0x88, 0x14, 0xd2, 0x05, 0x98, 0x05, 0x7e, 0x6c, 0x39, 0x3e, 0x0d, 0xa3, 0xf6, 0x7a, 0x6a, + 0xbb, 0xcc, 0xa1, 0x0e, 0x7a, 0x09, 0x8d, 0xb0, 0x9d, 0xc6, 0x84, 0x4a, 0xa3, 0x84, 0xeb, 0xc0, + 0x9d, 0x7b, 0x34, 0x6a, 0xd7, 0xee, 0x95, 0x50, 0x69, 0x16, 0xd8, 0x5f, 0x09, 0x4c, 0xe7, 0x04, + 0xb6, 0x96, 0xf8, 0x73, 0x4c, 0xfc, 0x93, 0xac, 0x1f, 0x6c, 0x8a, 0xfb, 0x93, 0x5c, 0xba, 0xc5, + 0xaf, 0xa1, 0x9e, 0xe0, 0xc9, 0x7d, 0x68, 0x26, 0x9a, 0x08, 0xab, 0x88, 0x2d, 0x37, 0x13, 0x2c, + 0xb7, 0xcd, 0x9b, 0xb0, 0xe1, 0x51, 0x2f, 0x08, 0x17, 0x53, 0xd7, 0xf1, 0x9c, 0x98, 0xcb, 0x28, + 0x99, 0x0d, 0x81, 0x3b, 0x41, 0x14, 0x9e, 0x62, 0xc6, 0xe6, 0xd3, 0x50, 0x64, 0x2c, 0x6e, 0xfa, + 0x92, 0x09, 0x33, 0x36, 0x97, 0x39, 0xcc, 0xf8, 0xb1, 0x0a, 0xd0, 0x17, 0x17, 0xe5, 0x7f, 0x13, + 0x90, 0xd7, 0xa0, 0x8e, 0xf2, 0x22, 0x66, 0xcd, 0x94, 0xd0, 0x14, 0x41, 0x0c, 0xd8, 0x40, 0x8b, + 0xd3, 0x6f, 0xe6, 0x2e, 0x8d, 0x68, 0x2c, 0x2f, 0x3a, 0x83, 0x23, 0x6f, 0x80, 0xbc, 0x59, 0x8f, + 0xfa, 0x71, 0xf6, 0xae, 0x11, 0xc3, 0x1d, 0x29, 0xb6, 0xc2, 0x78, 0x8a, 0xa5, 0x41, 0xde, 0x76, + 0x9d, 0x63, 0x26, 0x8e, 0x47, 0xc9, 0x03, 0x28, 0x33, 0x0c, 0xd3, 0x0a, 0xbf, 0xb3, 0x36, 0x4f, + 0x51, 0x89, 0x7a, 0x07, 0x69, 0x4c, 0x72, 0x2a, 0xf2, 0x08, 0x6a, 0xd2, 0x07, 0xd1, 0x09, 0x90, + 0xe3, 0xb5, 0x25, 0x0e, 0x95, 0xe5, 0x05, 0x57, 0x42, 0x4d, 0x3e, 0x83, 0x3a, 0xf5, 0x6d, 0x16, + 0x38, 0x7e, 0xac, 0x1c, 0xe4, 0xf5, 0x25, 0xd6, 0x81, 0x5a, 0x17, 0xbc, 0x29, 0x3d, 0xf9, 0x18, + 0xd6, 0x23, 0x3a, 0x0b, 0x69, 0x2c, 0xfc, 0xa2, 0x71, 0xf8, 0xea, 0x8a, 0x54, 0xbe, 0x2a, 0x23, + 0x52, 0xd2, 0xa2, 0x4c, 0xc7, 0xbf, 0x0a, 0x69, 0x14, 0xd1, 0xa8, 0x5d, 0xcf, 0x95, 0x39, 0x54, + 0xeb, 0x52, 0x66, 0x42, 0x4f, 0xba, 0xd0, 0x08, 0x29, 0x73, 0x9d, 0x99, 0x15, 0xa3, 0xe9, 0x81, + 0xb3, 0xdf, 0x5d, 0x62, 0x37, 0x53, 0x0a, 0x99, 0xba, 0x34, 0x1e, 0xb2, 0x9f, 0x14, 0xa0, 0x06, + 0x37, 0xbb, 0xaa, 0x30, 0x9f, 0x42, 0xfd, 0x45, 0xb9, 0xec, 0xc6, 0xfa, 0xd2, 0xf9, 0x2c, 0xc9, + 0x12, 0xff, 0x05, 0xf3, 0xe7, 0xd0, 0xcc, 0x5a, 0xf8, 0xa5, 0xb8, 0x9f, 0xc0, 0x86, 0x6e, 0xe4, + 0x97, 0x95, 0x9c, 0xb5, 0xf3, 0x4b, 0x71, 0x7f, 0x01, 0xad, 0x65, 0x33, 0xbf, 0x54, 0x51, 0xfe, + 0x6b, 0x11, 0x9a, 0xaa, 0x8f, 0x88, 0x82, 0x79, 0x38, 0xa3, 0xcb, 0x51, 0x5a, 0x58, 0x8e, 0x52, + 0x4c, 0xaf, 0x48, 0xa0, 0x87, 0x79, 0x6d, 0xc6, 0xe6, 0x22, 0xc6, 0xef, 0x43, 0x53, 0xa6, 0x81, + 0x6c, 0x98, 0x6f, 0x0a, 0xac, 0xda, 0x63, 0x39, 0x5b, 0x94, 0x57, 0xb3, 0xc5, 0xdb, 0xb0, 0x15, + 0xce, 0x7d, 0xdf, 0xf1, 0xaf, 0xa6, 0xd8, 0x65, 0xf9, 0x73, 0x8f, 0x67, 0xdd, 0x92, 0xb9, 0x29, + 0xd1, 0x5d, 0xc6, 0x46, 0x73, 0x8f, 0x7c, 0x08, 0x7b, 0x3a, 0x5d, 0xfc, 0xcc, 0x09, 0x6d, 0x4e, + 0x0d, 0x9c, 0x9a, 0xa4, 0xd4, 0x13, 0x5c, 0x42, 0x96, 0x4f, 0xa1, 0xad, 0xb3, 0x38, 0x7e, 0x4c, + 0x43, 0xdf, 0x72, 0x39, 0x57, 0x83, 0x73, 0xed, 0xa5, 0x5c, 0x43, 0xb9, 0x3a, 0x9a, 0x7b, 0xc6, + 0x5f, 0x0a, 0x40, 0xb2, 0xe6, 0xe2, 0x55, 0xbd, 0x07, 0xf5, 0x50, 0xc2, 0xaa, 0x38, 0xde, 0xc7, + 0x60, 0x58, 0x25, 0x3d, 0x50, 0x80, 0x8a, 0xa9, 0x84, 0xaf, 0x33, 0x86, 0x66, 0x76, 0x31, 0xe7, + 0x22, 0xdf, 0xc9, 0x66, 0x70, 0xb2, 0x2a, 0x44, 0xbf, 0xdc, 0x3f, 0x14, 0xe0, 0x95, 0xae, 0x6d, + 0xf3, 0x63, 0x8f, 0xad, 0x30, 0x5e, 0x24, 0x2e, 0x8e, 0xdd, 0x2b, 0x81, 0xf2, 0x7c, 0x9e, 0x94, + 0x4f, 0xfe, 0x8d, 0x12, 0xa3, 0xa4, 0x66, 0xe2, 0x27, 0x69, 0x42, 0xd1, 0x61, 0x32, 0x73, 0x16, + 0x1d, 0x86, 0x5c, 0x2c, 0x08, 0xc5, 0x85, 0x55, 0x4c, 0xfe, 0x8d, 0x0e, 0xe1, 0x44, 0xd3, 0xc0, + 0x77, 0x1d, 0x9f, 0xf2, 0x3b, 0xaa, 0x99, 0x35, 0x27, 0x3a, 0xe3, 0x30, 0x57, 0xe2, 0x82, 0xfd, + 0x9f, 0x95, 0xa0, 0xf0, 0x4a, 0x9f, 0xba, 0xff, 0x6b, 0x1d, 0x8c, 0xdf, 0x01, 0x59, 0x95, 0x81, + 0x94, 0x5a, 0xd9, 0xe4, 0xdf, 0xe4, 0x1e, 0x34, 0x66, 0xaa, 0x73, 0x1a, 0xf6, 0xa5, 0x1c, 0x1d, + 0x45, 0xda, 0xb0, 0x6e, 0xd9, 0x36, 0xe6, 0x05, 0x29, 0x54, 0x81, 0x5a, 0xe6, 0x2c, 0xeb, 0x99, + 0xd3, 0xe8, 0xc1, 0x4e, 0xce, 0x09, 0xc9, 0x03, 0xa8, 0x38, 0x31, 0x4d, 0xba, 0xb6, 0x7d, 0xee, + 0x33, 0x2b, 0x74, 0xa6, 0x20, 0x32, 0xde, 0x82, 0x16, 0xfa, 0x29, 0xa6, 0xe0, 0xa3, 0xc5, 0xf9, + 0xb0, 0x8f, 0x06, 0x92, 0xc6, 0x28, 0x24, 0xc6, 0x30, 0xbe, 0x80, 0xad, 0x63, 0x8a, 0x44, 0x7d, + 0x1a, 0x5b, 0x8e, 0x9b, 0x4b, 0x94, 0x69, 0xa4, 0x8a, 0x99, 0x46, 0xca, 0xb8, 0x84, 0xda, 0x38, + 0xb0, 0x07, 0xd7, 0x54, 0x98, 0x87, 0x77, 0x62, 0xd2, 0x3c, 0xf8, 0x8d, 0x47, 0x0c, 0xa9, 0x15, + 0x05, 0xbe, 0x64, 0x94, 0x10, 0x0a, 0xb1, 0xae, 0x54, 0xd3, 0x86, 0x9f, 0x68, 0x26, 0x4f, 0xbc, + 0x18, 0x64, 0x4f, 0xa6, 0x40, 0xe3, 0x87, 0x22, 0xaf, 0x24, 0xb2, 0x09, 0x7b, 0x5b, 0x93, 0xd2, + 0x14, 0x81, 0x93, 0x2c, 0x1e, 0x60, 0xdf, 0x77, 0x8b, 0x64, 0x4d, 0x4e, 0x29, 0x23, 0x07, 0x39, + 0x2c, 0x1b, 0xcb, 0x8e, 0xba, 0x0e, 0x01, 0xe1, 0xf1, 0x71, 0xc7, 0x69, 0x14, 0x87, 0x4a, 0x35, + 0x84, 0xcf, 0xe3, 0xd0, 0xf8, 0xbe, 0x00, 0x65, 0xde, 0x6b, 0x36, 0x60, 0x7d, 0x3c, 0x18, 0xf5, + 0x87, 0xa3, 0xe3, 0xd6, 0x1a, 0x02, 0xe6, 0xc5, 0x68, 0x84, 0x40, 0x81, 0x6c, 0x42, 0xfd, 0xfc, + 0xa2, 0xd7, 0x1b, 0x0c, 0xfa, 0x83, 0x7e, 0xab, 0x48, 0x00, 0xaa, 0x5f, 0x76, 0x87, 0x27, 0x83, + 0x7e, 0xab, 0x84, 0x74, 0x17, 0xa3, 0x5f, 0x8d, 0xce, 0x7e, 0x3d, 0x6a, 0x95, 0x49, 0x13, 0x60, + 0x32, 0x38, 0x1d, 0x8e, 0xba, 0x13, 0xe4, 0xab, 0x90, 0x0d, 0xa8, 0x75, 0x8f, 0x46, 0x67, 0xe6, + 0x69, 0xf7, 0xa4, 0x55, 0xc5, 0xd5, 0xe1, 0x68, 0x38, 0x19, 0x8a, 0xd5, 0x75, 0x84, 0xcf, 0x7b, + 0x4f, 0x07, 0xfd, 0x8b, 0x13, 0x84, 0x6b, 0x48, 0x3d, 0x3a, 0x9b, 0x98, 0x83, 0x6e, 0xff, 0xeb, + 0x56, 0x1d, 0x65, 0x5e, 0x8c, 0x9e, 0x0e, 0xba, 0x27, 0x93, 0xa7, 0x5f, 0xb7, 0xc0, 0xf8, 0x57, + 0x81, 0x37, 0xed, 0x69, 0x27, 0xb8, 0x0b, 0x15, 0xc7, 0x43, 0x0b, 0xc8, 0xe7, 0x2e, 0x07, 0x10, + 0xcb, 0x7b, 0x2e, 0x55, 0x5c, 0x38, 0xa0, 0xd9, 0xb1, 0xb4, 0x6c, 0x47, 0xde, 0x5f, 0x51, 0x5b, + 0x35, 0xd7, 0x12, 0xc4, 0x92, 0xc0, 0x6b, 0xc1, 0x54, 0x14, 0x01, 0x69, 0xb3, 0x06, 0xc7, 0x9d, + 0x72, 0x14, 0xc6, 0xb8, 0x20, 0x99, 0xb1, 0xb9, 0xec, 0xb3, 0x6b, 0x1c, 0xd1, 0x63, 0x73, 0xac, + 0x3c, 0xb2, 0xe4, 0xa8, 0x1d, 0xd6, 0x45, 0x9f, 0x2a, 0xb1, 0x72, 0x8f, 0xbb, 0xd8, 0xba, 0x08, + 0x32, 0xdc, 0xa5, 0x26, 0x7a, 0x42, 0x89, 0xea, 0xb1, 0xb9, 0xf1, 0x0f, 0xe1, 0x37, 0xc2, 0xb3, + 0x73, 0x83, 0x17, 0x71, 0x81, 0xad, 0x0e, 0xcc, 0xbf, 0x97, 0x3a, 0xc9, 0xd2, 0x72, 0x27, 0x79, + 0x3f, 0x13, 0xb3, 0xb2, 0xf7, 0x4e, 0x1c, 0x50, 0x85, 0xb0, 0x4c, 0x32, 0x95, 0x24, 0xc9, 0xdc, + 0x81, 0x75, 0xdc, 0x1d, 0x5f, 0x1c, 0xe2, 0xb8, 0x55, 0x04, 0x87, 0x0c, 0xcd, 0x78, 0x4d, 0xc3, + 0xc8, 0x09, 0x7c, 0x79, 0x4a, 0x05, 0x92, 0xc7, 0xb0, 0xe5, 0xf8, 0x68, 0xa2, 0xf4, 0xc9, 0x21, + 0xda, 0xc2, 0x96, 0x14, 0x99, 0x76, 0xfc, 0x4d, 0x24, 0x4c, 0x9f, 0x0d, 0xe4, 0x61, 0xe6, 0xa1, + 0x52, 0xbf, 0x81, 0x4b, 0x7f, 0x97, 0xbc, 0x05, 0x55, 0x8a, 0x41, 0x1c, 0xc9, 0x16, 0x70, 0x43, + 0x52, 0xf3, 0xc8, 0x36, 0xe5, 0x9a, 0xf1, 0x39, 0x34, 0xcf, 0xe3, 0x20, 0xb4, 0xae, 0x68, 0xcf, + 0xb5, 0x78, 0xff, 0xf8, 0x1e, 0x94, 0x5d, 0x87, 0x37, 0x17, 0x49, 0x4a, 0xd2, 0x29, 0x64, 0x56, + 0xe1, 0x34, 0xc6, 0x9f, 0x4b, 0x40, 0x56, 0x17, 0x6f, 0xca, 0xaa, 0x2c, 0x0c, 0xae, 0x1d, 0x34, + 0x04, 0x0d, 0x55, 0x56, 0xd5, 0x50, 0xe4, 0x4b, 0x00, 0x66, 0x85, 0x96, 0x47, 0x63, 0x3c, 0x62, + 0x89, 0x8b, 0x7f, 0x3b, 0x5f, 0xfc, 0xc1, 0x38, 0x21, 0x94, 0x0f, 0xb2, 0x94, 0x53, 0x38, 0xdb, + 0xcc, 0xb5, 0x1c, 0x6f, 0xca, 0x02, 0xd7, 0x99, 0x2d, 0xa4, 0x37, 0x6f, 0x4a, 0xec, 0x98, 0x23, + 0xc9, 0x47, 0xb0, 0x6f, 0xb9, 0x6e, 0xf0, 0x9d, 0x7c, 0xb9, 0x4d, 0xe9, 0x6f, 0x99, 0xe5, 0xf3, + 0x5b, 0x13, 0x15, 0x6a, 0x97, 0xaf, 0x8a, 0x47, 0xdc, 0x40, 0xad, 0x91, 0x03, 0xd8, 0x91, 0xf4, + 0x97, 0x8e, 0x6f, 0x63, 0x97, 0xe2, 0xa1, 0xbb, 0x09, 0x0f, 0xd8, 0x16, 0x4b, 0x47, 0x62, 0xe5, + 0x14, 0x7d, 0xef, 0x18, 0x08, 0xdf, 0x87, 0xda, 0xd3, 0x38, 0x60, 0x81, 0x1b, 0x5c, 0x39, 0x54, + 0xbd, 0x23, 0xf8, 0xa3, 0x65, 0x22, 0xb0, 0x8b, 0x73, 0xea, 0xd2, 0x59, 0x1c, 0x84, 0x13, 0x1a, + 0x7a, 0xe6, 0xb6, 0xe4, 0x99, 0x24, 0x2c, 0x9d, 0x9f, 0xc3, 0xd6, 0xd2, 0xa1, 0x5f, 0xaa, 0x99, + 0x8c, 0x61, 0x37, 0x4f, 0x12, 0xf9, 0x0d, 0xdc, 0xf1, 0xac, 0x78, 0xf6, 0x6c, 0xea, 0x5a, 0x97, + 0xd4, 0x45, 0x23, 0x60, 0x1d, 0x73, 0x02, 0x5f, 0xd5, 0xa4, 0xb7, 0xf2, 0x94, 0x3c, 0x41, 0x62, + 0xec, 0x17, 0x9d, 0x90, 0xe2, 0x63, 0xcd, 0xdc, 0xe3, 0x9b, 0x70, 0xf4, 0x20, 0xdd, 0xc2, 0x38, + 0x81, 0x7b, 0xb7, 0xb1, 0xe6, 0x9c, 0x62, 0x1f, 0xaa, 0x5c, 0x71, 0x31, 0xcf, 0xa9, 0x9b, 0x12, + 0x32, 0xfe, 0x56, 0x80, 0x8e, 0x7c, 0x46, 0x88, 0x6b, 0xc9, 0x8e, 0xcd, 0x8e, 0x96, 0xc6, 0x66, + 0xef, 0x69, 0xef, 0xf8, 0x1c, 0xfa, 0xdc, 0x19, 0x9a, 0x79, 0xdb, 0x0c, 0xed, 0xa7, 0xba, 0x85, + 0x9b, 0x87, 0x77, 0x6e, 0x90, 0xa1, 0x9b, 0xfe, 0xfb, 0x12, 0xd4, 0x93, 0xd9, 0xa4, 0xd6, 0x21, + 0x14, 0xf4, 0x0e, 0x01, 0x45, 0x61, 0xce, 0x13, 0x3d, 0x3b, 0x7e, 0x22, 0xa5, 0x4c, 0x96, 0xa2, + 0x4d, 0x97, 0x10, 0xdf, 0x81, 0xc6, 0xbd, 0xf1, 0x05, 0xf7, 0xeb, 0x9a, 0x29, 0x21, 0x7c, 0x92, + 0x47, 0x54, 0xa6, 0x52, 0xe9, 0xc3, 0x29, 0x02, 0x5d, 0x83, 0x3d, 0xb3, 0x22, 0xe5, 0xaa, 0x02, + 0x40, 0x9e, 0xe0, 0x9a, 0x86, 0xa1, 0x63, 0x4b, 0xaf, 0xac, 0x9b, 0x29, 0x42, 0xcf, 0x64, 0xb5, + 0x6c, 0x26, 0xfb, 0x84, 0xa7, 0x23, 0xdb, 0x89, 0xb9, 0xa7, 0xd4, 0xd3, 0x54, 0x91, 0x1c, 0xb4, + 0xa7, 0x96, 0x4d, 0x8d, 0x12, 0x4f, 0x79, 0xc5, 0xe6, 0xb2, 0xfd, 0xc7, 0x4f, 0x6d, 0x50, 0xdb, + 0xd0, 0x06, 0xb5, 0x58, 0xa1, 0xf9, 0xcb, 0x02, 0xd3, 0xc8, 0x86, 0xec, 0xb1, 0x18, 0xe3, 0x0d, + 0xca, 0x04, 0xaa, 0xd2, 0x96, 0xeb, 0x50, 0x1a, 0x0d, 0x4f, 0x96, 0xcb, 0x33, 0x40, 0xb5, 0x77, + 0x72, 0x76, 0xce, 0x6b, 0xb3, 0x5e, 0x72, 0x4b, 0x08, 0x9d, 0x4f, 0xba, 0x26, 0x2f, 0xb8, 0x65, + 0x01, 0x9d, 0x8d, 0xc7, 0xbc, 0x38, 0x1b, 0x21, 0x90, 0x55, 0xdd, 0x6f, 0x6a, 0x80, 0xe4, 0x0d, + 0x16, 0xa5, 0xfd, 0x93, 0x9b, 0xbd, 0xa9, 0xac, 0xaa, 0xf6, 0xa4, 0x9c, 0x6d, 0x83, 0xfe, 0x54, + 0x04, 0x40, 0xa1, 0xc2, 0x7f, 0x72, 0xd3, 0xa6, 0xd6, 0x6a, 0x16, 0xb3, 0xad, 0xe6, 0xbb, 0x50, + 0xc1, 0xc6, 0x56, 0x65, 0xca, 0x1d, 0x65, 0x7d, 0xb1, 0xd9, 0xc1, 0x38, 0x08, 0x63, 0x53, 0x50, + 0x60, 0x83, 0xc5, 0x67, 0x25, 0x65, 0x4e, 0x49, 0x56, 0x28, 0x6d, 0x39, 0x25, 0x79, 0x90, 0x8e, + 0x5d, 0x2b, 0x37, 0x92, 0x2a, 0x92, 0xce, 0x87, 0x50, 0x1a, 0x07, 0x76, 0xae, 0xd6, 0x59, 0x13, + 0xa5, 0x03, 0x84, 0x4f, 0xa0, 0x8c, 0x7a, 0x25, 0x0d, 0x7a, 0x41, 0x7b, 0x24, 0x74, 0xa0, 0xc6, + 0x07, 0xff, 0xb3, 0xc0, 0x55, 0x83, 0x41, 0x05, 0x1b, 0x8f, 0xa1, 0x91, 0x6a, 0x81, 0x25, 0x2a, + 0x9d, 0xe6, 0x88, 0x58, 0x6f, 0x66, 0x15, 0x4d, 0xe7, 0x37, 0xc6, 0x29, 0x6c, 0x3d, 0xa5, 0xae, + 0xc7, 0xff, 0x3d, 0x70, 0xa9, 0x85, 0x15, 0xee, 0x09, 0x34, 0x9f, 0x65, 0x50, 0x72, 0x13, 0x7e, + 0xda, 0x2c, 0xb1, 0xb9, 0x44, 0x69, 0xfc, 0xbd, 0x00, 0xcd, 0x2c, 0x09, 0x2a, 0x1e, 0x52, 0x51, + 0xc5, 0xe4, 0x81, 0x12, 0x18, 0xaf, 0x6f, 0xce, 0x6c, 0x0b, 0x5b, 0x2a, 0x79, 0x7d, 0x12, 0xd4, + 0x4c, 0x54, 0xca, 0xe4, 0x81, 0x5d, 0xa8, 0xcc, 0x9e, 0x59, 0xf2, 0xf1, 0x52, 0x37, 0x05, 0x40, + 0xde, 0x00, 0xb0, 0x18, 0xfb, 0x4a, 0x06, 0xa3, 0x68, 0x42, 0x34, 0x0c, 0x56, 0x57, 0x9b, 0x46, + 0xb3, 0xd0, 0x61, 0xe8, 0xb6, 0x32, 0xc6, 0x75, 0x94, 0xf1, 0x2e, 0x34, 0x13, 0xff, 0xe6, 0xff, + 0x65, 0x60, 0x03, 0x23, 0x22, 0x4f, 0x18, 0x11, 0xbb, 0x63, 0x0c, 0xbd, 0xc8, 0xf8, 0x85, 0xb0, + 0xb6, 0x24, 0x25, 0x0f, 0x61, 0x03, 0xe9, 0x22, 0x09, 0x4b, 0x63, 0x6d, 0x66, 0xa2, 0xdd, 0x6c, + 0x58, 0x29, 0xc7, 0x7b, 0x1f, 0xc0, 0x4e, 0x4e, 0x4e, 0x24, 0x75, 0xa8, 0x88, 0x76, 0x76, 0x0d, + 0xdb, 0xd9, 0xd1, 0xd9, 0x64, 0x2a, 0xc0, 0xc2, 0xe1, 0x3f, 0x6b, 0x5c, 0x3b, 0x53, 0xfc, 0x0f, + 0x74, 0xbe, 0xf0, 0x67, 0xe4, 0x08, 0xf6, 0x8f, 0x69, 0x9c, 0x08, 0xe8, 0x53, 0x16, 0xd2, 0x19, + 0xb7, 0xdc, 0x8e, 0x96, 0x73, 0xd5, 0x9f, 0x32, 0x9d, 0xed, 0x95, 0xff, 0x48, 0x8c, 0x35, 0xf2, + 0x21, 0x6c, 0xe8, 0x7b, 0x90, 0x56, 0x56, 0x67, 0xfa, 0xbc, 0x93, 0x3d, 0x85, 0xb1, 0x46, 0x1e, + 0x03, 0x08, 0x16, 0xfe, 0xd7, 0x02, 0xd1, 0x44, 0x29, 0x49, 0xf9, 0x23, 0x7a, 0x63, 0x8d, 0xf4, + 0xf9, 0xc3, 0x8b, 0xff, 0x57, 0xa0, 0xf8, 0x73, 0x55, 0xed, 0xdc, 0xfc, 0x97, 0x82, 0xb1, 0x46, + 0x8e, 0x60, 0xe7, 0x98, 0xc6, 0x2b, 0x13, 0xfe, 0xdc, 0x9d, 0x76, 0xf3, 0xa6, 0xfc, 0xc6, 0x1a, + 0xf9, 0x18, 0x36, 0x8f, 0x69, 0xac, 0x4d, 0x6b, 0xf3, 0xce, 0xd1, 0xcc, 0x8e, 0x04, 0x8d, 0x35, + 0xf2, 0x39, 0x6c, 0x1f, 0xd3, 0x78, 0x69, 0xe4, 0xb4, 0xad, 0xcf, 0x31, 0x04, 0x67, 0xce, 0x68, + 0x83, 0x5b, 0x8e, 0xac, 0x70, 0x47, 0xa4, 0x8e, 0xb4, 0xfc, 0x3f, 0xbc, 0xce, 0x7e, 0xfe, 0xd8, + 0xc5, 0x58, 0x23, 0x4f, 0xe1, 0x0e, 0x7e, 0xe5, 0xbd, 0x90, 0xf3, 0x34, 0xbf, 0x93, 0xff, 0x4c, + 0xc6, 0x93, 0xf7, 0x60, 0x2f, 0x77, 0xaa, 0x42, 0xf8, 0xfc, 0xf4, 0xc6, 0x81, 0x4b, 0x27, 0x55, + 0x53, 0x6c, 0x92, 0x3b, 0x15, 0x11, 0x9b, 0xdc, 0x38, 0x30, 0x59, 0xd9, 0x24, 0x77, 0xac, 0x41, + 0xe4, 0x24, 0xd7, 0xfd, 0x4f, 0x36, 0xf9, 0x88, 0x3b, 0x70, 0xfa, 0xe2, 0xe1, 0x5e, 0xb0, 0xf4, + 0xba, 0xef, 0xa8, 0xf7, 0x8a, 0xc0, 0x70, 0x2e, 0xbc, 0xc7, 0xa5, 0xb6, 0x5e, 0xbb, 0x08, 0xb2, + 0xdc, 0x54, 0x53, 0x34, 0xdd, 0x2f, 0xf9, 0xfd, 0x75, 0x19, 0xcb, 0xc4, 0x6c, 0x9e, 0xfd, 0xdf, + 0x78, 0x71, 0x63, 0x65, 0xac, 0x91, 0x87, 0xb0, 0x85, 0x17, 0xaa, 0xe7, 0x6c, 0x90, 0x91, 0x86, + 0x1a, 0x6f, 0x65, 0xb3, 0x35, 0x4a, 0xff, 0x14, 0x08, 0x72, 0x2c, 0xa5, 0x56, 0x9d, 0x69, 0x67, + 0x35, 0x3b, 0x23, 0xe3, 0xa3, 0x54, 0x94, 0x4a, 0x58, 0x24, 0x13, 0xd4, 0x3c, 0x5c, 0x52, 0x91, + 0x12, 0x67, 0xac, 0x5d, 0x56, 0x79, 0x79, 0xf9, 0xd9, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x33, + 0x85, 0x9a, 0x60, 0x83, 0x1e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc.ClientConnInterface +var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 +const _ = grpc.SupportPackageIsVersion4 // AppRuntimeSyncClient is the client API for AppRuntimeSync service. // @@ -4179,10 +2816,10 @@ type AppRuntimeSyncClient interface { } type appRuntimeSyncClient struct { - cc grpc.ClientConnInterface + cc *grpc.ClientConn } -func NewAppRuntimeSyncClient(cc grpc.ClientConnInterface) AppRuntimeSyncClient { +func NewAppRuntimeSyncClient(cc *grpc.ClientConn) AppRuntimeSyncClient { return &appRuntimeSyncClient{cc} } @@ -4371,65 +3008,6 @@ type AppRuntimeSyncServer interface { ListAppStatuses(context.Context, *AppStatusesReq) (*AppStatuses, error) } -// UnimplementedAppRuntimeSyncServer can be embedded to have forward compatible implementations. -type UnimplementedAppRuntimeSyncServer struct { -} - -func (*UnimplementedAppRuntimeSyncServer) GetAppStatusDeprecated(context.Context, *ServicesRequest) (*StatusMessage, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAppStatusDeprecated not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) GetAppStatus(context.Context, *AppStatusReq) (*AppStatus, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAppStatus not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) GetAppPods(context.Context, *ServiceRequest) (*ServiceAppPodList, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAppPods not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) GetMultiAppPods(context.Context, *ServicesRequest) (*MultiServiceAppPodList, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetMultiAppPods not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) GetComponentPodNums(context.Context, *ServicesRequest) (*ComponentPodNums, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetComponentPodNums not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) GetDeployInfo(context.Context, *ServiceRequest) (*DeployInfo, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetDeployInfo not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) GetTenantResource(context.Context, *TenantRequest) (*TenantResource, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetTenantResource not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) GetTenantResources(context.Context, *Empty) (*TenantResourceList, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetTenantResources not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) ListThirdPartyEndpoints(context.Context, *ServiceRequest) (*ThirdPartyEndpoints, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListThirdPartyEndpoints not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) AddThirdPartyEndpoint(context.Context, *AddThirdPartyEndpointsReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddThirdPartyEndpoint not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) UpdThirdPartyEndpoint(context.Context, *UpdThirdPartyEndpointsReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdThirdPartyEndpoint not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) DelThirdPartyEndpoint(context.Context, *DelThirdPartyEndpointsReq) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelThirdPartyEndpoint not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) GetPodDetail(context.Context, *GetPodDetailReq) (*PodDetail, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPodDetail not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) GetStorageClasses(context.Context, *Empty) (*StorageClasses, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetStorageClasses not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) GetAppVolumeStatus(context.Context, *ServiceRequest) (*ServiceVolumeStatusMessage, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAppVolumeStatus not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) ListAppServices(context.Context, *AppReq) (*AppServices, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListAppServices not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) ListHelmAppRelease(context.Context, *AppReq) (*HelmAppReleases, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListHelmAppRelease not implemented") -} -func (*UnimplementedAppRuntimeSyncServer) ListAppStatuses(context.Context, *AppStatusesReq) (*AppStatuses, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListAppStatuses not implemented") -} - func RegisterAppRuntimeSyncServer(s *grpc.Server, srv AppRuntimeSyncServer) { s.RegisterService(&_AppRuntimeSync_serviceDesc, srv) } @@ -4836,5 +3414,5 @@ var _AppRuntimeSync_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "worker/server/pb/app_runtime_server.proto", + Metadata: "app_runtime_server.proto", } diff --git a/worker/server/pb/app_runtime_server.proto b/worker/server/pb/app_runtime_server.proto index b140053a4..b72764746 100644 --- a/worker/server/pb/app_runtime_server.proto +++ b/worker/server/pb/app_runtime_server.proto @@ -133,16 +133,14 @@ message DelThirdPartyEndpointsReq { } message ThirdPartyEndpoint { - string uuid = 1; - string sid = 2; - string ip = 3; - int32 port = 4; - string status = 5; - bool is_online = 6; + string name = 1; + string componentID = 2; + string address = 3; + string status = 4; } message ThirdPartyEndpoints { - repeated ThirdPartyEndpoint obj = 1; + repeated ThirdPartyEndpoint items = 1; } message ListPodsBySIDReq { diff --git a/worker/server/server.go b/worker/server/server.go index b9ccea9a8..bc7e8eb71 100644 --- a/worker/server/server.go +++ b/worker/server/server.go @@ -55,8 +55,11 @@ import ( //RuntimeServer app runtime grpc server type RuntimeServer struct { - ctx context.Context - cancel context.CancelFunc + ctx context.Context + cancel context.CancelFunc + + logger *logrus.Entry + store store.Storer conf option.Config server *grpc.Server @@ -76,6 +79,7 @@ func CreaterRuntimeServer(conf option.Config, conf: conf, ctx: ctx, cancel: cancel, + logger: logrus.WithField("WHO", "RuntimeServer"), server: grpc.NewServer(), hostIP: conf.HostIP, store: store, @@ -480,65 +484,47 @@ func (r *RuntimeServer) ListThirdPartyEndpoints(ctx context.Context, re *pb.Serv if as == nil { return new(pb.ThirdPartyEndpoints), nil } - var pbeps []*pb.ThirdPartyEndpoint - // The same IP may correspond to two endpoints, which are internal and external endpoints. - // So it is need to filter the same IP. - exists := make(map[string]bool) - addEndpoint := func(tpe *pb.ThirdPartyEndpoint) { - if !exists[fmt.Sprintf("%s:%d", tpe.Ip, tpe.Port)] { - pbeps = append(pbeps, tpe) - exists[fmt.Sprintf("%s:%d", tpe.Ip, tpe.Port)] = true - } - } - for _, ep := range as.GetEndpoints(false) { - if ep.Subsets == nil || len(ep.Subsets) == 0 { - logrus.Debugf("Key: %s; empty subsets", fmt.Sprintf("%s/%s", ep.Namespace, ep.Name)) - continue - } - for _, subset := range ep.Subsets { - for _, port := range subset.Ports { - for _, address := range subset.Addresses { - ip := address.IP - if ip == "1.1.1.1" { - if len(as.GetServices(false)) > 0 { - ip = as.GetServices(false)[0].Annotations["domain"] - } - } - addEndpoint(&pb.ThirdPartyEndpoint{ - Uuid: port.Name, - Sid: ep.GetLabels()["service_id"], - Ip: ip, - Port: port.Port, - Status: func() string { - return "healthy" - }(), - }) + + endpoints := r.listThirdEndpoints(as) + + var items []*pb.ThirdPartyEndpoint + for _, ep := range endpoints { + items = append(items, &pb.ThirdPartyEndpoint{ + Name: ep.Name, + ComponentID: as.ServiceID, + Address: string(ep.Address), + Status: func() string { + if ep.Status == v1alpha1.EndpointReady { + return "healthy" } - for _, address := range subset.NotReadyAddresses { - ip := address.IP - if ip == "1.1.1.1" { - if len(as.GetServices(false)) > 0 { - ip = as.GetServices(false)[0].Annotations["domain"] - } - } - addEndpoint(&pb.ThirdPartyEndpoint{ - Uuid: port.Name, - Sid: ep.GetLabels()["service_id"], - Ip: ip, - Port: port.Port, - Status: func() string { - return "unhealthy" - }(), - }) - } - } - } + return "unhealthy" + }(), + }) } return &pb.ThirdPartyEndpoints{ - Obj: pbeps, + Items: items, }, nil } +func (r *RuntimeServer) listThirdEndpoints(as *v1.AppService) []*v1alpha1.ThirdComponentEndpointStatus { + logger := r.logger.WithField("Method", "listThirdComponentEndpoints"). + WithField("ComponentID", as.ServiceID) + + workload := as.GetWorkload() + if workload == nil { + // workload not found + return nil + } + + component, ok := workload.(*v1alpha1.ThirdComponent) + if !ok { + logger.Warningf("expect thirdcomponents.rainbond.io, but got %s", workload.GetObjectKind()) + return nil + } + + return component.Status.Endpoints +} + // AddThirdPartyEndpoint creates a create event. func (r *RuntimeServer) AddThirdPartyEndpoint(ctx context.Context, re *pb.AddThirdPartyEndpointsReq) (*pb.Empty, error) { as := r.store.GetAppService(re.Sid) From ffd84e74e19131ca9246d41ce2fe768a29bb3d61 Mon Sep 17 00:00:00 2001 From: glyasai Date: Sun, 15 Aug 2021 16:08:32 +0800 Subject: [PATCH 40/43] unhealthy endpoint status --- pkg/apis/rainbond/v1alpha1/third_component.go | 2 ++ .../controller/thirdcomponent/controller.go | 2 +- .../thirdcomponent/discover/staticendpoint.go | 26 ++++++++++++------- worker/server/server.go | 10 +++++-- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/pkg/apis/rainbond/v1alpha1/third_component.go b/pkg/apis/rainbond/v1alpha1/third_component.go index ef8d1f7bc..42831e6c2 100644 --- a/pkg/apis/rainbond/v1alpha1/third_component.go +++ b/pkg/apis/rainbond/v1alpha1/third_component.go @@ -316,6 +316,8 @@ const ( EndpointReady EndpointStatus = "Ready" //EndpointNotReady it means the probe not passed. EndpointNotReady EndpointStatus = "NotReady" + // EndpointUnhealthy means that the health prober failed. + EndpointUnhealthy EndpointStatus = "Unhealthy" ) // EndpointAddress - diff --git a/worker/master/controller/thirdcomponent/controller.go b/worker/master/controller/thirdcomponent/controller.go index 252a6a109..78d84e83e 100644 --- a/worker/master/controller/thirdcomponent/controller.go +++ b/worker/master/controller/thirdcomponent/controller.go @@ -335,7 +335,7 @@ func createEndpoint(component *v1alpha1.ThirdComponent, service *corev1.Service, }(), NotReadyAddresses: func() (re []corev1.EndpointAddress) { for _, se := range sourceEndpoint { - if se.Status == v1alpha1.EndpointNotReady { + if se.Status == v1alpha1.EndpointNotReady || se.Status == v1alpha1.EndpointUnhealthy { re = append(re, corev1.EndpointAddress{ IP: se.Address.GetIP(), TargetRef: &corev1.ObjectReference{ diff --git a/worker/master/controller/thirdcomponent/discover/staticendpoint.go b/worker/master/controller/thirdcomponent/discover/staticendpoint.go index 90105104a..76ea3955a 100644 --- a/worker/master/controller/thirdcomponent/discover/staticendpoint.go +++ b/worker/master/controller/thirdcomponent/discover/staticendpoint.go @@ -57,22 +57,30 @@ func (s *staticEndpoint) DiscoverOne(ctx context.Context) ([]*v1alpha1.ThirdComp } } } - if len(endpoints) == 0 { - continue - } for _, ep := range endpoints { // Make ready as the default status ep.Status = v1alpha1.EndpointReady - if s.proberManager != nil { - result, found := s.proberManager.GetResult(s.component.GetEndpointID(ep)) - if found && result != results.Success { - ep.Status = v1alpha1.EndpointNotReady - } - } } } + // Update status with probe result + if s.proberManager != nil { + var newEndpoints []*v1alpha1.ThirdComponentEndpointStatus + for _, ep := range endpoints { + result, found := s.proberManager.GetResult(s.component.GetEndpointID(ep)) + if !found { + // NotReady means the endpoint should not be online. + ep.Status = v1alpha1.EndpointNotReady + } + if result != results.Success { + ep.Status = v1alpha1.EndpointUnhealthy + } + newEndpoints = append(newEndpoints, ep) + } + return newEndpoints, nil + } + return endpoints, nil } diff --git a/worker/server/server.go b/worker/server/server.go index bc7e8eb71..bd3f729dc 100644 --- a/worker/server/server.go +++ b/worker/server/server.go @@ -494,10 +494,16 @@ func (r *RuntimeServer) ListThirdPartyEndpoints(ctx context.Context, re *pb.Serv ComponentID: as.ServiceID, Address: string(ep.Address), Status: func() string { - if ep.Status == v1alpha1.EndpointReady { + switch ep.Status { + case v1alpha1.EndpointReady: return "healthy" + case v1alpha1.EndpointNotReady: + return "notready" + case v1alpha1.EndpointUnhealthy: + return "unhealthy" + default: + return "-" // offline } - return "unhealthy" }(), }) } From 9b30b4f779025aa32cf9a4b4852c7b08ea0b85b2 Mon Sep 17 00:00:00 2001 From: glyasai Date: Tue, 17 Aug 2021 13:46:34 +0800 Subject: [PATCH 41/43] update core component definition --- .../componentdefinition.go | 40 +++++++++++++++++-- .../thirdcomponentdefinition.go | 1 + 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/worker/appm/componentdefinition/componentdefinition.go b/worker/appm/componentdefinition/componentdefinition.go index e0cc119fa..55cc6cd88 100644 --- a/worker/appm/componentdefinition/componentdefinition.go +++ b/worker/appm/componentdefinition/componentdefinition.go @@ -204,16 +204,51 @@ func (c *Builder) BuildWorkloadResource(as *v1.AppService, dbm db.Manager) error func (c *Builder) InitCoreComponentDefinition(rainbondClient rainbondversioned.Interface) { coreComponentDefinition := []*v1alpha1.ComponentDefinition{&thirdComponentDefine} for _, ccd := range coreComponentDefinition { - if c.GetComponentDefinition(ccd.Name) == nil { + oldCoreComponentDefinition := c.GetComponentDefinition(ccd.Name) + if oldCoreComponentDefinition == nil { logrus.Infof("create core componentdefinition %s", ccd.Name) if _, err := rainbondClient.RainbondV1alpha1().ComponentDefinitions(c.namespace).Create(context.Background(), ccd, metav1.CreateOptions{}); err != nil && !k8sErrors.IsNotFound(err) { logrus.Errorf("create core componentdefinition %s failire %s", ccd.Name, err.Error()) } + } else { + err := c.updateComponentDefinition(rainbondClient, oldCoreComponentDefinition, ccd) + if err != nil { + logrus.Errorf("update core componentdefinition(%s): %v", ccd.Name, err) + } } } logrus.Infof("success check core componentdefinition from cluster") } +func (c *Builder) updateComponentDefinition(rainbondClient rainbondversioned.Interface, oldComponentDefinition, newComponentDefinition *v1alpha1.ComponentDefinition) error { + newVersion := getComponentDefinitionVersion(newComponentDefinition) + oldVersion := getComponentDefinitionVersion(oldComponentDefinition) + if newVersion == "" || !(oldVersion == "" || newVersion > oldVersion) { + return nil + } + + logrus.Infof("update core componentdefinition %s", newComponentDefinition.Name) + newComponentDefinition.ResourceVersion = oldComponentDefinition.ResourceVersion + if _, err := rainbondClient.RainbondV1alpha1().ComponentDefinitions(c.namespace).Update(context.Background(), newComponentDefinition, metav1.UpdateOptions{}); err != nil { + if k8sErrors.IsNotFound(err) { + _, err := rainbondClient.RainbondV1alpha1().ComponentDefinitions(c.namespace).Create(context.Background(), newComponentDefinition, metav1.CreateOptions{}) + if err != nil { + return err + } + } + return err + } + + return nil +} + +func getComponentDefinitionVersion(componentDefinition *v1alpha1.ComponentDefinition) string { + if componentDefinition.ObjectMeta.Annotations == nil { + return "" + } + return componentDefinition.ObjectMeta.Annotations["version"] +} + func (c *Builder) createProbe(componentID string) (*v1alpha1.Probe, error) { probe, err := db.GetManager().ServiceProbeDao().GetServiceUsedProbe(componentID, "readiness") if err != nil { @@ -265,6 +300,5 @@ func (c *Builder) createHTTPGetAction(probe *dbmodel.TenantServiceProbe) *v1alph } func (c *Builder) createTCPGetAction(probe *dbmodel.TenantServiceProbe) *v1alpha1.TCPSocketAction { - return &v1alpha1.TCPSocketAction{ - } + return &v1alpha1.TCPSocketAction{} } diff --git a/worker/appm/componentdefinition/thirdcomponentdefinition.go b/worker/appm/componentdefinition/thirdcomponentdefinition.go index 5c04e55ef..409976554 100644 --- a/worker/appm/componentdefinition/thirdcomponentdefinition.go +++ b/worker/appm/componentdefinition/thirdcomponentdefinition.go @@ -97,6 +97,7 @@ var thirdComponentDefine = v1alpha1.ComponentDefinition{ Name: thirdComponentDefineName, Annotations: map[string]string{ "definition.oam.dev/description": "Rainbond built-in component type that defines third-party service components.", + "version": "2.0", }, }, Spec: v1alpha1.ComponentDefinitionSpec{ From 0fc468b1b4bb7a5a038b21db48188235e6c5bb3b Mon Sep 17 00:00:00 2001 From: glyasai Date: Tue, 17 Aug 2021 15:38:44 +0800 Subject: [PATCH 42/43] use 0.2 --- worker/appm/componentdefinition/thirdcomponentdefinition.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/appm/componentdefinition/thirdcomponentdefinition.go b/worker/appm/componentdefinition/thirdcomponentdefinition.go index 409976554..45403a779 100644 --- a/worker/appm/componentdefinition/thirdcomponentdefinition.go +++ b/worker/appm/componentdefinition/thirdcomponentdefinition.go @@ -97,7 +97,7 @@ var thirdComponentDefine = v1alpha1.ComponentDefinition{ Name: thirdComponentDefineName, Annotations: map[string]string{ "definition.oam.dev/description": "Rainbond built-in component type that defines third-party service components.", - "version": "2.0", + "version": "0.2", }, }, Spec: v1alpha1.ComponentDefinitionSpec{ From 656bbac9a8d456f51fdad5a0895527943692e1f1 Mon Sep 17 00:00:00 2001 From: glyasai Date: Tue, 17 Aug 2021 19:40:10 +0800 Subject: [PATCH 43/43] do not delete console_apps_metadata.json --- builder/exector/groupapp_restore.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/builder/exector/groupapp_restore.go b/builder/exector/groupapp_restore.go index b98e63626..43e43f52d 100644 --- a/builder/exector/groupapp_restore.go +++ b/builder/exector/groupapp_restore.go @@ -119,7 +119,7 @@ func (b *BackupAPPRestore) Run(timeout time.Duration) error { return fmt.Errorf("create cache dir error %s", err.Error()) } // delete the cache data - defer os.RemoveAll(cacheDir) + defer b.deleteCache(cacheDir) b.cacheDir = cacheDir switch backup.BackupMode { @@ -183,6 +183,23 @@ func (b *BackupAPPRestore) Run(timeout time.Duration) error { return nil } +func (b *BackupAPPRestore) deleteCache(dir string) error { + logrus.Infof("delete cache %s", dir) + return filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + return nil + } + // do not delete the metadata file + if strings.HasSuffix(path, "console_apps_metadata.json") { + return nil + } + return os.RemoveAll(path) + }) +} + func (b *BackupAPPRestore) restoreVersionAndData(backup *dbmodel.AppBackup, appSnapshot *AppSnapshot) error { for _, app := range appSnapshot.Services { //backup app image or code slug file