diff --git a/api/v1beta1/config_types.go b/api/v1beta1/config_types.go index 3ab71d02..c2021603 100644 --- a/api/v1beta1/config_types.go +++ b/api/v1beta1/config_types.go @@ -288,6 +288,11 @@ type ConfigSpec struct { // +optional Bundles ConfigBundles `json:"bundles,omitempty"` + // PriorityQueues represents a list of bundles/components' name which needs to be prioritized + // the first one has the highest priority and the last one has the lowest priority + // +optional + PriorityQueues []string `json:"priorityQueues,omitempty"` + // Staging represents configuration about staging Staging *ConfigStaging `json:"staging"` diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 710c7032..62e12c7d 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -660,6 +660,11 @@ func (in *ConfigSpec) DeepCopyInto(out *ConfigSpec) { (*out)[key] = outVal } } + if in.PriorityQueues != nil { + in, out := &in.PriorityQueues, &out.PriorityQueues + *out = make([]string, len(*in)) + copy(*out, *in) + } if in.Staging != nil { in, out := &in.Staging, &out.Staging *out = new(ConfigStaging) diff --git a/config/crds/env.samsahai.io_configs.yaml b/config/crds/env.samsahai.io_configs.yaml index 658dd36d..e131d814 100644 --- a/config/crds/env.samsahai.io_configs.yaml +++ b/config/crds/env.samsahai.io_configs.yaml @@ -183,6 +183,13 @@ spec: description: Envs represents urls of values file per environments ordering by less priority to high priority type: object + priorityQueues: + description: PriorityQueues represents a list of bundles/components' + name which needs to be prioritized the first one has the highest priority + and the last one has the lowest priority + items: + type: string + type: array report: description: Reporter represents configuration about reporter properties: diff --git a/docs/docs.go b/docs/docs.go index 3df68ece..b2be3bf6 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2020-06-12 13:43:13.431642 +0700 +07 m=+0.161754686 +// 2020-06-18 09:43:32.662924 +0700 +07 m=+0.108614951 package docs @@ -1037,6 +1037,13 @@ var doc = `{ "description": "Envs represents urls of values file per environments\nordering by less priority to high priority\n+optional", "type": "object" }, + "priorityQueues": { + "description": "PriorityQueues represents a list of bundles/components' name which needs to be prioritized\nthe first one has the highest priority and the last one has the lowest priority\n+optional", + "type": "array", + "items": { + "type": "string" + } + }, "report": { "description": "Reporter represents configuration about reporter\n+optional", "type": "object", diff --git a/docs/swagger.json b/docs/swagger.json index 4c69e651..6f601cc8 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1016,6 +1016,13 @@ "description": "Envs represents urls of values file per environments\nordering by less priority to high priority\n+optional", "type": "object" }, + "priorityQueues": { + "description": "PriorityQueues represents a list of bundles/components' name which needs to be prioritized\nthe first one has the highest priority and the last one has the lowest priority\n+optional", + "type": "array", + "items": { + "type": "string" + } + }, "report": { "description": "Reporter represents configuration about reporter\n+optional", "type": "object", diff --git a/docs/swagger.yaml b/docs/swagger.yaml index d281b259..3e551e6e 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -350,6 +350,14 @@ definitions: ordering by less priority to high priority +optional type: object + priorityQueues: + description: |- + PriorityQueues represents a list of bundles/components' name which needs to be prioritized + the first one has the highest priority and the last one has the lowest priority + +optional + items: + type: string + type: array report: $ref: '#/definitions/v1beta1.ConfigReporter' description: |- diff --git a/internal/config/controller.go b/internal/config/controller.go index 1b625f4f..e0823fdc 100644 --- a/internal/config/controller.go +++ b/internal/config/controller.go @@ -146,6 +146,17 @@ func (c *controller) GetBundles(configName string) (s2hv1beta1.ConfigBundles, er return config.Spec.Bundles, nil } +// GetPriorityQueues returns a list of priority queues which defined in Config +func (c *controller) GetPriorityQueues(configName string) ([]string, error) { + config, err := c.Get(configName) + if err != nil { + logger.Error(err, "cannot get Config", "name", configName) + return []string{}, err + } + + return config.Spec.PriorityQueues, nil +} + // Update updates Config CRD func (c *controller) Update(config *s2hv1beta1.Config) error { if err := c.client.Update(context.TODO(), config); err != nil { diff --git a/internal/configuration.go b/internal/configuration.go index bf70a666..1b0d563e 100644 --- a/internal/configuration.go +++ b/internal/configuration.go @@ -17,6 +17,9 @@ type ConfigController interface { // GetBundles returns a group of components for each bundle GetBundles(configName string) (s2hv1beta1.ConfigBundles, error) + // GetPriorityQueues returns a list of priority queues which defined in Config + GetPriorityQueues(configName string) ([]string, error) + // Update updates Config CRD Update(config *s2hv1beta1.Config) error diff --git a/internal/desiredcomponent/controller.go b/internal/desiredcomponent/controller.go index e92cada4..4bb712ef 100644 --- a/internal/desiredcomponent/controller.go +++ b/internal/desiredcomponent/controller.go @@ -127,6 +127,11 @@ func (c *controller) Reconcile(req reconcile.Request) (reconcile.Result, error) logger.Error(err, "cannot get bundle name", "team", c.teamName, "component", comp.Spec.Name) } + priorityQueues, err := c.s2hClient.GetPriorityQueues(ctx, &samsahairpc.TeamName{Name: c.teamName}) + if err != nil { + logger.Error(err, "cannot get priority queues", "team", c.teamName) + } + comps := []*s2hv1beta1.QueueComponent{ { Name: comp.Spec.Name, @@ -135,7 +140,7 @@ func (c *controller) Reconcile(req reconcile.Request) (reconcile.Result, error) }, } q := queue.NewUpgradeQueue(c.teamName, req.Namespace, comp.Spec.Name, bundle.Name, comps) - err = c.queueCtrl.Add(q) + err = c.queueCtrl.Add(q, priorityQueues.GetQueues()) if err != nil { return reconcile.Result{}, err } diff --git a/internal/queue.go b/internal/queue.go index 2e978ae3..b8a5efe2 100644 --- a/internal/queue.go +++ b/internal/queue.go @@ -8,8 +8,8 @@ import ( // QueueController manages updating component queue through CRD type QueueController interface { - // Add adds Queue - Add(q *v1beta1.Queue) error + // Add adds Queue with priority list + Add(q *v1beta1.Queue, priorityQueues []string) error // AddTop adds Queue to the top AddTop(q *v1beta1.Queue) error diff --git a/internal/queue/controller.go b/internal/queue/controller.go index 21aacbcc..a136df52 100644 --- a/internal/queue/controller.go +++ b/internal/queue/controller.go @@ -34,8 +34,8 @@ func NewUpgradeQueue(teamName, namespace, name, bundle string, comps []*s2hv1bet } qLabels := internal.GetDefaultLabels(teamName) - qLabels["app"] = name - qLabels["component"] = name + qLabels["app"] = queueName + qLabels["component"] = queueName return &s2hv1beta1.Queue{ ObjectMeta: metav1.ObjectMeta{ Name: queueName, @@ -62,12 +62,12 @@ func New(ns string, runtimeClient client.Client) internal.QueueController { return c } -func (c *controller) Add(q *s2hv1beta1.Queue) error { - return c.add(context.TODO(), q, false) +func (c *controller) Add(q *s2hv1beta1.Queue, priorityQueues []string) error { + return c.add(context.TODO(), q, false, priorityQueues) } func (c *controller) AddTop(q *s2hv1beta1.Queue) error { - return c.add(context.TODO(), q, true) + return c.add(context.TODO(), q, true, nil) } func (c *controller) Size() int { @@ -111,8 +111,9 @@ func (c *controller) RemoveAllQueues() error { return c.client.DeleteAllOf(context.TODO(), &s2hv1beta1.Queue{}, client.InNamespace(c.namespace)) } -// `queue` always contains 1 component -func (c *controller) add(ctx context.Context, queue *s2hv1beta1.Queue, atTop bool) error { +// incoming s`queue` always contains 1 component +// will add component into queue ordering by priority +func (c *controller) add(ctx context.Context, queue *s2hv1beta1.Queue, atTop bool, priorityQueues []string) error { if len(queue.Spec.Components) == 0 { return fmt.Errorf("components should not be empty, queueName: %s", queue.Name) } @@ -148,28 +149,32 @@ func (c *controller) add(ctx context.Context, queue *s2hv1beta1.Queue, atTop boo } } for i := range updatingList { - updatingList[i].Spec.Components.Sort() - updatingList[i].Spec.NoOfRetry = 0 - updatingList[i].Spec.NextProcessAt = nil - updatingList[i].Status.State = s2hv1beta1.Waiting - updatingList[i].Spec.Components.Sort() - if err := c.client.Update(ctx, &updatingList[i]); err != nil { - return err + if updatingList[i].Name != "" { + updatingList[i].Spec.Components.Sort() + updatingList[i].Spec.NoOfRetry = 0 + updatingList[i].Spec.NextProcessAt = nil + updatingList[i].Status.State = s2hv1beta1.Waiting + updatingList[i].Spec.Components.Sort() + if err := c.client.Update(ctx, &updatingList[i]); err != nil { + return err + } + queueList.Items[i] = updatingList[i] } - queueList.Items[i] = updatingList[i] } updatingList = c.addExistingBundleQueue(queue, queueList) for i := range updatingList { - isAlreadyInBundle = true - updatingList[i].Spec.NoOfRetry = 0 - updatingList[i].Spec.NextProcessAt = nil - updatingList[i].Status.State = s2hv1beta1.Waiting - updatingList[i].Spec.Components.Sort() - if err := c.client.Update(ctx, &updatingList[i]); err != nil { - return err + if updatingList[i].Name != "" { + isAlreadyInBundle = true + updatingList[i].Spec.NoOfRetry = 0 + updatingList[i].Spec.NextProcessAt = nil + updatingList[i].Status.State = s2hv1beta1.Waiting + updatingList[i].Spec.Components.Sort() + if err := c.client.Update(ctx, &updatingList[i]); err != nil { + return err + } + queueList.Items[i] = updatingList[i] } - queueList.Items[i] = updatingList[i] } queueList.Sort() @@ -187,21 +192,28 @@ func (c *controller) add(ctx context.Context, queue *s2hv1beta1.Queue, atTop boo if err = c.client.Update(ctx, pQueue); err != nil { return err } - } else if !isAlreadyInBundle { - // queue not exist - if atTop { - queue.Spec.NoOfOrder = queueList.TopQueueOrder() - } else { - queue.Spec.NoOfOrder = queueList.LastQueueOrder() + } else { + updatingList = c.setQueueOrderFollowingPriorityQueues(queue, queueList, priorityQueues) + for i := range updatingList { + if err := c.client.Update(ctx, &updatingList[i]); err != nil { + return err + } } - queue.Status.State = s2hv1beta1.Waiting - queue.Status.CreatedAt = &now - queue.Status.UpdatedAt = &now + if !isAlreadyInBundle { + // queue not exist + if atTop { + queue.Spec.NoOfOrder = queueList.TopQueueOrder() + } - queue.Spec.Components.Sort() - if err = c.client.Create(ctx, queue); err != nil { - return err + queue.Status.State = s2hv1beta1.Waiting + queue.Status.CreatedAt = &now + queue.Status.UpdatedAt = &now + + queue.Spec.Components.Sort() + if err = c.client.Create(ctx, queue); err != nil { + return err + } } } @@ -230,26 +242,105 @@ func (c *controller) isMatchWithStableComponent(ctx context.Context, q *s2hv1bet return } +// expect sorted queue list +func (c *controller) setQueueOrderFollowingPriorityQueues(queue *s2hv1beta1.Queue, list *s2hv1beta1.QueueList, priorityQueues []string) []s2hv1beta1.Queue { + targetNo := c.getPriorityNo(queue, priorityQueues) + if targetNo == -1 || len(list.Items) == 0 { + queue.Spec.NoOfOrder = list.LastQueueOrder() + return []s2hv1beta1.Queue{} + } + + existingQueueNo := c.getExistingQueueNumberInList(queue, list) + + var items []s2hv1beta1.Queue + var updating []s2hv1beta1.Queue + var found, foundTop bool + expectedNo := list.LastQueueOrder() + for i, q := range list.Items { + priorityNo := c.getPriorityNo(&list.Items[i], priorityQueues) + isLowerPriority := priorityNo == -1 || priorityNo > targetNo + if !found && isLowerPriority { + if i-1 < 0 { + expectedNo = list.TopQueueOrder() + foundTop = true + } else { + expectedNo = list.Items[i-1].Spec.NoOfOrder + 1 + } + + found = true + + } + + if found && existingQueueNo != i { + if !foundTop { + q.Spec.NoOfOrder = q.Spec.NoOfOrder + 1 + } + updating = append(updating, q) + } + + items = append(items, q) + } + + if existingQueueNo != -1 && items != nil { + items[existingQueueNo].Spec.NoOfOrder = expectedNo + updating = append(updating, items[existingQueueNo]) + } else { + queue.Spec.NoOfOrder = expectedNo + } + + list.Items = items + return updating +} + +func (c *controller) getPriorityNo(queue *s2hv1beta1.Queue, priorityQueues []string) int { + for i, priorComp := range priorityQueues { + if queue.Spec.Name == priorComp { + return i + } + + for _, comp := range queue.Spec.Components { + if comp.Name == priorComp { + return i + } + } + } + + return -1 +} + +func (c *controller) getExistingQueueNumberInList(queue *s2hv1beta1.Queue, list *s2hv1beta1.QueueList) int { + for i, q := range list.Items { + for _, qComp := range q.Spec.Components { + // queue already existed + if qComp.Name == queue.Spec.Components[0].Name { + return i + } + } + } + + return -1 +} + // addExistingBundleQueue returns updated bundle queue list func (c *controller) addExistingBundleQueue(queue *s2hv1beta1.Queue, list *s2hv1beta1.QueueList) []s2hv1beta1.Queue { if queue.Spec.Bundle == "" { return []s2hv1beta1.Queue{} } + updating := make([]s2hv1beta1.Queue, len(list.Items)) var items []s2hv1beta1.Queue - var updating []s2hv1beta1.Queue var containComp = false - for _, q := range list.Items { + for i, q := range list.Items { if !containComp && q.ContainSameComponent(queue.Spec.Name, queue.Spec.Components[0]) { // only add one `queue` to items containComp = true // update component of bundle } else if q.Spec.Bundle == queue.Spec.Bundle { var found bool - for i, qComp := range q.Spec.Components { + for j, qComp := range q.Spec.Components { if qComp.Name == queue.Spec.Components[0].Name { - q.Spec.Components[i].Repository = queue.Spec.Components[0].Repository - q.Spec.Components[i].Version = queue.Spec.Components[0].Version + q.Spec.Components[j].Repository = queue.Spec.Components[0].Repository + q.Spec.Components[j].Version = queue.Spec.Components[0].Version found = true break } @@ -260,7 +351,7 @@ func (c *controller) addExistingBundleQueue(queue *s2hv1beta1.Queue, list *s2hv1 q.Spec.Components = append(q.Spec.Components, queue.Spec.Components[0]) } - updating = append(updating, q) + updating[i] = q } items = append(items, q) @@ -274,10 +365,11 @@ func (c *controller) addExistingBundleQueue(queue *s2hv1beta1.Queue, list *s2hv1 func (c *controller) removeAndUpdateSimilarQueue(queue *s2hv1beta1.Queue, list *s2hv1beta1.QueueList) ( removing []s2hv1beta1.Queue, updating []s2hv1beta1.Queue) { + updating = make([]s2hv1beta1.Queue, len(list.Items)) var items []s2hv1beta1.Queue var containComp = false - for _, q := range list.Items { + for i, q := range list.Items { if !containComp && q.ContainSameComponent(queue.Spec.Name, queue.Spec.Components[0]) { // only add one `queue` to items containComp = true @@ -297,7 +389,7 @@ func (c *controller) removeAndUpdateSimilarQueue(queue *s2hv1beta1.Queue, list * if len(newComps) != len(q.Spec.Components) { q.Spec.Components = newComps - updating = append(updating, q) + updating[i] = q } } diff --git a/internal/queue/controller_test.go b/internal/queue/controller_test.go index a8da8cd3..49f43c31 100644 --- a/internal/queue/controller_test.go +++ b/internal/queue/controller_test.go @@ -66,8 +66,10 @@ var _ = Describe("Queue Controller", func() { g.Expect(len(queueList.Items)).To(Equal(2)) g.Expect(len(removing)).To(Equal(2)) - g.Expect(len(updating)).To(Equal(1)) - g.Expect(len(updating[0].Spec.Components)).To(Equal(1)) + + newUpdating := getNonEmptyQueue(updating) + g.Expect(len(newUpdating)).To(Equal(1)) + g.Expect(len(newUpdating[0].Spec.Components)).To(Equal(1)) }) It("should skip same component version", func() { @@ -98,7 +100,9 @@ var _ = Describe("Queue Controller", func() { g.Expect(len(queueList.Items)).To(Equal(1)) g.Expect(len(removing)).To(Equal(0)) - g.Expect(len(updating)).To(Equal(0)) + + newUpdating := getNonEmptyQueue(updating) + g.Expect(len(newUpdating)).To(Equal(0)) }) }) @@ -108,25 +112,26 @@ var _ = Describe("Queue Controller", func() { g := NewWithT(GinkgoT()) c := controller{} - name := "alpine" + alpine := "alpine" + ubuntu := "ubuntu" queue := &v1beta1.Queue{ Spec: v1beta1.QueueSpec{Name: "group", Bundle: "group", - Components: v1beta1.QueueComponents{{Name: "ubuntu", Repository: name, Version: "3.9.4"}}, + Components: v1beta1.QueueComponents{{Name: ubuntu, Repository: ubuntu, Version: "3.9.4"}}, }, Status: v1beta1.QueueStatus{}, } queueList := &v1beta1.QueueList{ Items: []v1beta1.Queue{ { - Spec: v1beta1.QueueSpec{Name: name, - Components: v1beta1.QueueComponents{{Name: name, Repository: name, Version: "3.9.0"}}, + Spec: v1beta1.QueueSpec{Name: alpine, + Components: v1beta1.QueueComponents{{Name: alpine, Repository: alpine, Version: "3.9.0"}}, }, Status: v1beta1.QueueStatus{}, }, { - Spec: v1beta1.QueueSpec{Name: name, Bundle: "group", - Components: v1beta1.QueueComponents{{Name: name, Repository: name, Version: "3.9.1"}}, + Spec: v1beta1.QueueSpec{Name: alpine, Bundle: "group", + Components: v1beta1.QueueComponents{{Name: alpine, Repository: alpine, Version: "3.9.1"}}, }, Status: v1beta1.QueueStatus{}, }, @@ -136,8 +141,10 @@ var _ = Describe("Queue Controller", func() { updating := c.addExistingBundleQueue(queue, queueList) g.Expect(len(queueList.Items)).To(Equal(2)) - g.Expect(len(updating)).To(Equal(1)) - g.Expect(len(updating[0].Spec.Components)).To(Equal(2)) + + newUpdating := getNonEmptyQueue(updating) + g.Expect(len(newUpdating)).To(Equal(1)) + g.Expect(len(newUpdating[0].Spec.Components)).To(Equal(2)) }) It("should skip same component version", func() { @@ -167,10 +174,150 @@ var _ = Describe("Queue Controller", func() { updating := c.addExistingBundleQueue(queue, queueList) g.Expect(len(queueList.Items)).To(Equal(1)) - g.Expect(len(updating)).To(Equal(0)) + + newUpdating := getNonEmptyQueue(updating) + g.Expect(len(newUpdating)).To(Equal(0)) }) }) + Describe("Set queue order following priority queues", func() { + It("should set order of the highest component queue following priority queues", func() { + + g := NewWithT(GinkgoT()) + + c := controller{} + alpine := "alpine" + ubuntu := "ubuntu" + + priorityQueues := []string{"ubuntu", "alpine"} + + queue := &v1beta1.Queue{ + Spec: v1beta1.QueueSpec{Name: ubuntu, + Components: v1beta1.QueueComponents{{Name: ubuntu, Repository: ubuntu, Version: "3.9.4"}}, + }, + Status: v1beta1.QueueStatus{}, + } + queueList := &v1beta1.QueueList{ + Items: []v1beta1.Queue{ + { + Spec: v1beta1.QueueSpec{ + Name: alpine, + NoOfOrder: 1, + Components: v1beta1.QueueComponents{{Name: alpine, Repository: alpine, Version: "3.9.0"}}, + }, + Status: v1beta1.QueueStatus{}, + }, + }, + } + + updating := c.setQueueOrderFollowingPriorityQueues(queue, queueList, priorityQueues) + + g.Expect(len(queueList.Items)).To(Equal(1)) + g.Expect(queue.Spec.NoOfOrder).To(Equal(0)) + + newUpdating := getNonEmptyQueue(updating) + g.Expect(len(newUpdating)).To(Equal(1)) + g.Expect(newUpdating[0].Spec.Name).To(Equal(alpine)) + g.Expect(newUpdating[0].Spec.NoOfOrder).To(Equal(1)) + + }) + + It("should set order of lower component queue following priority queues", func() { + + g := NewWithT(GinkgoT()) + + c := controller{} + alpine := "alpine" + ubuntu := "ubuntu" + + priorityQueues := []string{"alpine", "ubuntu"} + + queue := &v1beta1.Queue{ + Spec: v1beta1.QueueSpec{Name: ubuntu, + Components: v1beta1.QueueComponents{{Name: ubuntu, Repository: ubuntu, Version: "3.9.4"}}, + }, + Status: v1beta1.QueueStatus{}, + } + queueList := &v1beta1.QueueList{ + Items: []v1beta1.Queue{ + { + Spec: v1beta1.QueueSpec{ + Name: alpine, + NoOfOrder: 1, + Components: v1beta1.QueueComponents{{Name: alpine, Repository: alpine, Version: "3.9.0"}}, + }, + Status: v1beta1.QueueStatus{}, + }, + }, + } + + updating := c.setQueueOrderFollowingPriorityQueues(queue, queueList, priorityQueues) + + g.Expect(len(queueList.Items)).To(Equal(1)) + g.Expect(queue.Spec.NoOfOrder).To(Equal(2)) + + newUpdating := getNonEmptyQueue(updating) + g.Expect(len(newUpdating)).To(Equal(0)) + + }) + + It("should set order of the highest bundle queue following priority queues", func() { + + g := NewWithT(GinkgoT()) + + c := controller{} + alpine := "alpine" + ubuntu := "ubuntu" + stretch := "stretch" + + priorityQueues := []string{"group", "alpine"} + + queue := &v1beta1.Queue{ + Spec: v1beta1.QueueSpec{Name: "group", Bundle: "group", + Components: v1beta1.QueueComponents{{Name: ubuntu, Repository: ubuntu, Version: "3.9.4"}}, + }, + Status: v1beta1.QueueStatus{}, + } + queueList := &v1beta1.QueueList{ + Items: []v1beta1.Queue{ + { + Spec: v1beta1.QueueSpec{ + Name: alpine, + NoOfOrder: 1, + Components: v1beta1.QueueComponents{{Name: alpine, Repository: alpine, Version: "3.9.0"}}, + }, + Status: v1beta1.QueueStatus{}, + }, + { + Spec: v1beta1.QueueSpec{ + Name: "group", + Bundle: "group", + NoOfOrder: 2, + Components: v1beta1.QueueComponents{ + {Name: stretch, Repository: stretch, Version: "3.9.1"}, + {Name: ubuntu, Repository: ubuntu, Version: "3.9.2"}, + }, + }, + Status: v1beta1.QueueStatus{}, + }, + }, + } + + updating := c.setQueueOrderFollowingPriorityQueues(queue, queueList, priorityQueues) + + g.Expect(len(queueList.Items)).To(Equal(2)) + + newUpdating := getNonEmptyQueue(updating) + g.Expect(len(newUpdating)).To(Equal(2)) + g.Expect(newUpdating[0].Spec.Name).To(Equal(alpine)) + g.Expect(newUpdating[0].Spec.NoOfOrder).To(Equal(1)) + g.Expect(newUpdating[1].Spec.Name).To(Equal("group")) + g.Expect(newUpdating[1].Spec.NoOfOrder).To(Equal(0)) + + }) + + }) + Describe("Reset Queue order", func() { It("should reset order of all Queues correctly", func() { g := NewWithT(GinkgoT()) @@ -222,3 +369,14 @@ var _ = Describe("Queue Controller", func() { }) }) }) + +func getNonEmptyQueue(queues []v1beta1.Queue) []v1beta1.Queue { + out := make([]v1beta1.Queue, 0) + for _, q := range queues { + if q.Spec.Name != "" { + out = append(out, q) + } + } + + return out +} diff --git a/internal/reporter/msteams/reporter_test.go b/internal/reporter/msteams/reporter_test.go index c29e3c7b..1f647596 100644 --- a/internal/reporter/msteams/reporter_test.go +++ b/internal/reporter/msteams/reporter_test.go @@ -562,6 +562,10 @@ func (c *mockConfigCtrl) Update(config *s2hv1beta1.Config) error { return nil } +func (c *mockConfigCtrl) GetPriorityQueues(configName string) ([]string, error) { + return nil, nil +} + func (c *mockConfigCtrl) Delete(configName string) error { return nil } diff --git a/internal/reporter/rest/reporter_test.go b/internal/reporter/rest/reporter_test.go index 7202d5f2..9fa5b6fa 100644 --- a/internal/reporter/rest/reporter_test.go +++ b/internal/reporter/rest/reporter_test.go @@ -277,6 +277,10 @@ func (c *mockConfigCtrl) GetBundles(configName string) (s2hv1beta1.ConfigBundles return s2hv1beta1.ConfigBundles{}, nil } +func (c *mockConfigCtrl) GetPriorityQueues(configName string) ([]string, error) { + return nil, nil +} + func (c *mockConfigCtrl) Update(config *s2hv1beta1.Config) error { return nil } diff --git a/internal/reporter/shell/reporter_test.go b/internal/reporter/shell/reporter_test.go index bf9f502c..81a0c176 100644 --- a/internal/reporter/shell/reporter_test.go +++ b/internal/reporter/shell/reporter_test.go @@ -208,6 +208,10 @@ func (c *mockConfigCtrl) GetBundles(configName string) (s2hv1beta1.ConfigBundles return s2hv1beta1.ConfigBundles{}, nil } +func (c *mockConfigCtrl) GetPriorityQueues(configName string) ([]string, error) { + return nil, nil +} + func (c *mockConfigCtrl) Update(config *s2hv1beta1.Config) error { return nil } diff --git a/internal/reporter/slack/reporter_test.go b/internal/reporter/slack/reporter_test.go index df2630e0..2359f85c 100644 --- a/internal/reporter/slack/reporter_test.go +++ b/internal/reporter/slack/reporter_test.go @@ -474,6 +474,10 @@ func (c *mockConfigCtrl) GetBundles(configName string) (s2hv1beta1.ConfigBundles return s2hv1beta1.ConfigBundles{}, nil } +func (c *mockConfigCtrl) GetPriorityQueues(configName string) ([]string, error) { + return nil, nil +} + func (c *mockConfigCtrl) Update(config *s2hv1beta1.Config) error { return nil } diff --git a/internal/samsahai/checker/samsahai/check_test.go b/internal/samsahai/checker/samsahai/check_test.go index 40ca3ff6..970deb32 100644 --- a/internal/samsahai/checker/samsahai/check_test.go +++ b/internal/samsahai/checker/samsahai/check_test.go @@ -263,6 +263,10 @@ func (c *mockConfigCtrl) GetBundles(configName string) (s2hv1beta1.ConfigBundles return s2hv1beta1.ConfigBundles{}, nil } +func (c *mockConfigCtrl) GetPriorityQueues(configName string) ([]string, error) { + return nil, nil +} + func (c *mockConfigCtrl) Update(config *s2hv1beta1.Config) error { return nil } diff --git a/internal/samsahai/exporter/metric_test.go b/internal/samsahai/exporter/metric_test.go index 8367235a..516d6195 100644 --- a/internal/samsahai/exporter/metric_test.go +++ b/internal/samsahai/exporter/metric_test.go @@ -288,6 +288,10 @@ func (c *mockConfigCtrl) GetBundles(configName string) (s2hv1beta1.ConfigBundles return s2hv1beta1.ConfigBundles{}, nil } +func (c *mockConfigCtrl) GetPriorityQueues(configName string) ([]string, error) { + return nil, nil +} + func (c *mockConfigCtrl) Update(config *s2hv1beta1.Config) error { return nil } diff --git a/internal/samsahai/rpc.go b/internal/samsahai/rpc.go index 07425803..6b87abf9 100644 --- a/internal/samsahai/rpc.go +++ b/internal/samsahai/rpc.go @@ -254,3 +254,13 @@ func (c *controller) getBundleName(compName, teamName string) string { return "" } + +func (c *controller) GetPriorityQueues(ctx context.Context, teamName *rpc.TeamName) (*rpc.PriorityQueues, error) { + if err := c.authenticateRPC(ctx); err != nil { + return nil, err + } + + queues, _ := c.GetConfigController().GetPriorityQueues(teamName.Name) + + return &rpc.PriorityQueues{Queues: queues}, nil +} diff --git a/internal/samsahai/webhook/webhook_test.go b/internal/samsahai/webhook/webhook_test.go index 9b11553c..004558fc 100644 --- a/internal/samsahai/webhook/webhook_test.go +++ b/internal/samsahai/webhook/webhook_test.go @@ -395,6 +395,10 @@ func (c *mockConfigCtrl) GetBundles(configName string) (s2hv1beta1.ConfigBundles return s2hv1beta1.ConfigBundles{}, nil } +func (c *mockConfigCtrl) GetPriorityQueues(configName string) ([]string, error) { + return nil, nil +} + func (c *mockConfigCtrl) Update(config *s2hv1beta1.Config) error { return nil } diff --git a/internal/staging/controller_test.go b/internal/staging/controller_test.go index 89bc7ba0..8ec39ce4 100644 --- a/internal/staging/controller_test.go +++ b/internal/staging/controller_test.go @@ -232,6 +232,10 @@ func (c *mockConfigCtrl) GetBundles(configName string) (s2hv1beta1.ConfigBundles return s2hv1beta1.ConfigBundles{}, nil } +func (c *mockConfigCtrl) GetPriorityQueues(configName string) ([]string, error) { + return nil, nil +} + func (c *mockConfigCtrl) Update(config *s2hv1beta1.Config) error { return nil } diff --git a/pkg/samsahai/rpc/service.pb.go b/pkg/samsahai/rpc/service.pb.go index 1edd24c8..4a89f790 100644 --- a/pkg/samsahai/rpc/service.pb.go +++ b/pkg/samsahai/rpc/service.pb.go @@ -68,7 +68,7 @@ func (x ComponentUpgrade_UpgradeStatus) Number() protoreflect.EnumNumber { // Deprecated: Use ComponentUpgrade_UpgradeStatus.Descriptor instead. func (ComponentUpgrade_UpgradeStatus) EnumDescriptor() ([]byte, []int) { - return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{3, 0} + return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{5, 0} } type ComponentUpgrade_IssueType int32 @@ -120,7 +120,7 @@ func (x ComponentUpgrade_IssueType) Number() protoreflect.EnumNumber { // Deprecated: Use ComponentUpgrade_IssueType.Descriptor instead. func (ComponentUpgrade_IssueType) EnumDescriptor() ([]byte, []int) { - return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{3, 1} + return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{5, 1} } type ComponentUpgrade_ReverificationStatus int32 @@ -169,7 +169,7 @@ func (x ComponentUpgrade_ReverificationStatus) Number() protoreflect.EnumNumber // Deprecated: Use ComponentUpgrade_ReverificationStatus.Descriptor instead. func (ComponentUpgrade_ReverificationStatus) EnumDescriptor() ([]byte, []int) { - return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{3, 2} + return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{5, 2} } type Empty struct { @@ -312,6 +312,100 @@ func (x *BundleName) GetName() string { return "" } +type TeamName struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *TeamName) Reset() { + *x = TeamName{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TeamName) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TeamName) ProtoMessage() {} + +func (x *TeamName) ProtoReflect() protoreflect.Message { + mi := &file_pkg_samsahai_rpc_service_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 TeamName.ProtoReflect.Descriptor instead. +func (*TeamName) Descriptor() ([]byte, []int) { + return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{3} +} + +func (x *TeamName) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type PriorityQueues struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Queues []string `protobuf:"bytes,1,rep,name=queues,proto3" json:"queues,omitempty"` +} + +func (x *PriorityQueues) Reset() { + *x = PriorityQueues{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PriorityQueues) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PriorityQueues) ProtoMessage() {} + +func (x *PriorityQueues) ProtoReflect() protoreflect.Message { + mi := &file_pkg_samsahai_rpc_service_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 PriorityQueues.ProtoReflect.Descriptor instead. +func (*PriorityQueues) Descriptor() ([]byte, []int) { + return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{4} +} + +func (x *PriorityQueues) GetQueues() []string { + if x != nil { + return x.Queues + } + return nil +} + type ComponentUpgrade struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -334,7 +428,7 @@ type ComponentUpgrade struct { func (x *ComponentUpgrade) Reset() { *x = ComponentUpgrade{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[3] + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -347,7 +441,7 @@ func (x *ComponentUpgrade) String() string { func (*ComponentUpgrade) ProtoMessage() {} func (x *ComponentUpgrade) ProtoReflect() protoreflect.Message { - mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[3] + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -360,7 +454,7 @@ func (x *ComponentUpgrade) ProtoReflect() protoreflect.Message { // Deprecated: Use ComponentUpgrade.ProtoReflect.Descriptor instead. func (*ComponentUpgrade) Descriptor() ([]byte, []int) { - return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{3} + return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{5} } func (x *ComponentUpgrade) GetStatus() ComponentUpgrade_UpgradeStatus { @@ -459,7 +553,7 @@ type Component struct { func (x *Component) Reset() { *x = Component{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[4] + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -472,7 +566,7 @@ func (x *Component) String() string { func (*Component) ProtoMessage() {} func (x *Component) ProtoReflect() protoreflect.Message { - mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[4] + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -485,7 +579,7 @@ func (x *Component) ProtoReflect() protoreflect.Message { // Deprecated: Use Component.ProtoReflect.Descriptor instead. func (*Component) Descriptor() ([]byte, []int) { - return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{4} + return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{6} } func (x *Component) GetName() string { @@ -514,7 +608,7 @@ type Image struct { func (x *Image) Reset() { *x = Image{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[5] + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -527,7 +621,7 @@ func (x *Image) String() string { func (*Image) ProtoMessage() {} func (x *Image) ProtoReflect() protoreflect.Message { - mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[5] + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -540,7 +634,7 @@ func (x *Image) ProtoReflect() protoreflect.Message { // Deprecated: Use Image.ProtoReflect.Descriptor instead. func (*Image) Descriptor() ([]byte, []int) { - return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{5} + return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{7} } func (x *Image) GetRepository() string { @@ -568,7 +662,7 @@ type ImageList struct { func (x *ImageList) Reset() { *x = ImageList{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[6] + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -581,7 +675,7 @@ func (x *ImageList) String() string { func (*ImageList) ProtoMessage() {} func (x *ImageList) ProtoReflect() protoreflect.Message { - mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[6] + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -594,7 +688,7 @@ func (x *ImageList) ProtoReflect() protoreflect.Message { // Deprecated: Use ImageList.ProtoReflect.Descriptor instead. func (*ImageList) Descriptor() ([]byte, []int) { - return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{6} + return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{8} } func (x *ImageList) GetImages() []*Image { @@ -616,7 +710,7 @@ type TeamWithCurrentComponent struct { func (x *TeamWithCurrentComponent) Reset() { *x = TeamWithCurrentComponent{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[7] + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -629,7 +723,7 @@ func (x *TeamWithCurrentComponent) String() string { func (*TeamWithCurrentComponent) ProtoMessage() {} func (x *TeamWithCurrentComponent) ProtoReflect() protoreflect.Message { - mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[7] + mi := &file_pkg_samsahai_rpc_service_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -642,7 +736,7 @@ func (x *TeamWithCurrentComponent) ProtoReflect() protoreflect.Message { // Deprecated: Use TeamWithCurrentComponent.ProtoReflect.Descriptor instead. func (*TeamWithCurrentComponent) Descriptor() ([]byte, []int) { - return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{7} + return file_pkg_samsahai_rpc_service_proto_rawDescGZIP(), []int{9} } func (x *TeamWithCurrentComponent) GetTeamName() string { @@ -673,116 +767,126 @@ var file_pkg_samsahai_rpc_service_proto_rawDesc = []byte{ 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x0a, 0x0a, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xd1, 0x07, 0x0a, - 0x10, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, - 0x65, 0x12, 0x4c, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x34, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, - 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, - 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, - 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x3f, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, - 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, - 0x6e, 0x65, 0x6e, 0x74, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, - 0x12, 0x4e, 0x0a, 0x09, 0x69, 0x73, 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, - 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, - 0x6e, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x49, 0x73, 0x73, 0x75, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x69, 0x73, 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x2a, 0x0a, 0x10, 0x71, 0x75, 0x65, 0x75, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, - 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x71, 0x75, 0x65, 0x75, - 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x10, - 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, - 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, - 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x49, 0x6d, - 0x61, 0x67, 0x65, 0x52, 0x10, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, - 0x67, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x74, 0x65, 0x73, 0x74, 0x42, 0x75, 0x69, 0x6c, 0x64, - 0x54, 0x79, 0x70, 0x65, 0x49, 0x44, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x65, - 0x73, 0x74, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x49, 0x44, 0x12, 0x12, 0x0a, - 0x04, 0x72, 0x75, 0x6e, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x75, 0x6e, - 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, - 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, - 0x79, 0x12, 0x6f, 0x0a, 0x14, 0x72, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x3b, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, - 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, - 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x14, 0x72, 0x65, - 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x22, 0x45, 0x0a, 0x0d, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x00, 0x12, 0x19, - 0x0a, 0x15, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, - 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x22, 0x86, 0x01, 0x0a, 0x09, 0x49, 0x73, - 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x73, 0x73, 0x75, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x24, - 0x0a, 0x20, 0x49, 0x73, 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x44, 0x45, 0x53, 0x49, - 0x52, 0x45, 0x44, 0x5f, 0x56, 0x45, 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, - 0x45, 0x44, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x73, 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, - 0x02, 0x12, 0x1f, 0x0a, 0x1b, 0x49, 0x73, 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, - 0x4e, 0x56, 0x49, 0x52, 0x4f, 0x4e, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x49, 0x53, 0x53, 0x55, 0x45, - 0x10, 0x03, 0x22, 0x7c, 0x0a, 0x14, 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x20, 0x0a, 0x1c, 0x52, 0x65, - 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1c, - 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x12, 0x20, - 0x0a, 0x1c, 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x02, - 0x22, 0x52, 0x0a, 0x09, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, - 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x05, 0x69, - 0x6d, 0x61, 0x67, 0x65, 0x22, 0x39, 0x0a, 0x05, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, - 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x74, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x22, - 0x40, 0x0a, 0x09, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x33, 0x0a, 0x06, - 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, - 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, - 0x68, 0x61, 0x69, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, - 0x73, 0x22, 0x77, 0x0a, 0x18, 0x54, 0x65, 0x61, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x43, 0x75, 0x72, - 0x72, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, - 0x08, 0x74, 0x65, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x1e, 0x0a, 0x08, + 0x54, 0x65, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x28, 0x0a, 0x0e, + 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x51, 0x75, 0x65, 0x75, 0x65, 0x73, 0x12, 0x16, + 0x0a, 0x06, 0x71, 0x75, 0x65, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, + 0x71, 0x75, 0x65, 0x75, 0x65, 0x73, 0x22, 0xd1, 0x07, 0x0a, 0x10, 0x43, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x12, 0x4c, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x73, 0x61, + 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, + 0x61, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x74, 0x65, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x52, 0x0a, - 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x32, 0x8e, 0x03, 0x0a, 0x03, 0x52, - 0x50, 0x43, 0x12, 0x5e, 0x0a, 0x17, 0x52, 0x75, 0x6e, 0x50, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6d, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x12, 0x26, 0x2e, + 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x4e, 0x0a, 0x09, 0x69, 0x73, + 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x55, 0x70, - 0x67, 0x72, 0x61, 0x64, 0x65, 0x1a, 0x1b, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, - 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x12, 0x64, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, - 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x54, - 0x65, 0x61, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x43, 0x6f, - 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x1a, 0x1f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, - 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x49, - 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x61, 0x0a, 0x1a, 0x53, 0x65, 0x6e, 0x64, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x75, 0x65, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x26, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, - 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x43, 0x6f, - 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x1a, 0x1b, - 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, - 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x0d, 0x47, - 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x2e, 0x73, - 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, - 0x68, 0x61, 0x69, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, 0x6d, 0x70, - 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x20, 0x2e, 0x73, 0x61, 0x6d, 0x73, + 0x67, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x49, 0x73, 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x09, 0x69, 0x73, 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x71, 0x75, + 0x65, 0x75, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x71, 0x75, 0x65, 0x75, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, + 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x10, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4d, + 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, + 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x10, 0x69, + 0x6d, 0x61, 0x67, 0x65, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x12, + 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x28, 0x0a, + 0x0f, 0x74, 0x65, 0x73, 0x74, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x49, 0x44, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x65, 0x73, 0x74, 0x42, 0x75, 0x69, 0x6c, + 0x64, 0x54, 0x79, 0x70, 0x65, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x75, 0x6e, 0x73, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x75, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x69, + 0x73, 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0a, 0x69, 0x73, 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x6f, 0x0a, 0x14, 0x72, + 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, - 0x2e, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x12, 0x5a, 0x10, 0x70, - 0x6b, 0x67, 0x2f, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2f, 0x72, 0x70, 0x63, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, + 0x65, 0x2e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x14, 0x72, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x45, 0x0a, 0x0d, + 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x0a, + 0x15, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x46, + 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, + 0x53, 0x10, 0x01, 0x22, 0x86, 0x01, 0x0a, 0x09, 0x49, 0x73, 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x73, 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x55, + 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x49, 0x73, 0x73, 0x75, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x44, 0x45, 0x53, 0x49, 0x52, 0x45, 0x44, 0x5f, 0x56, 0x45, + 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x1b, + 0x0a, 0x17, 0x49, 0x73, 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x49, 0x4d, 0x41, 0x47, + 0x45, 0x5f, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x1f, 0x0a, 0x1b, 0x49, + 0x73, 0x73, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x4e, 0x56, 0x49, 0x52, 0x4f, 0x4e, + 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x49, 0x53, 0x53, 0x55, 0x45, 0x10, 0x03, 0x22, 0x7c, 0x0a, 0x14, + 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x20, 0x0a, 0x1c, 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1c, 0x52, 0x65, 0x76, 0x65, 0x72, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x46, + 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x12, 0x20, 0x0a, 0x1c, 0x52, 0x65, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x02, 0x22, 0x52, 0x0a, 0x09, 0x43, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x69, + 0x6d, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x61, 0x6d, + 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, + 0x69, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x22, 0x39, + 0x0a, 0x05, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x22, 0x40, 0x0a, 0x09, 0x49, 0x6d, 0x61, + 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x33, 0x0a, 0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, + 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x49, 0x6d, + 0x61, 0x67, 0x65, 0x52, 0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x22, 0x77, 0x0a, 0x18, 0x54, + 0x65, 0x61, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x43, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x61, 0x6d, 0x4e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x61, 0x6d, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, + 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x43, + 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x73, 0x32, 0xe9, 0x03, 0x0a, 0x03, 0x52, 0x50, 0x43, 0x12, 0x5e, 0x0a, 0x17, + 0x52, 0x75, 0x6e, 0x50, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x12, 0x26, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, + 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x43, + 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x1a, + 0x1b, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, + 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x64, 0x0a, 0x11, + 0x47, 0x65, 0x74, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x2e, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, + 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x57, 0x69, 0x74, + 0x68, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, + 0x74, 0x1a, 0x1f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, + 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x69, + 0x73, 0x74, 0x12, 0x61, 0x0a, 0x1a, 0x53, 0x65, 0x6e, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x75, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x12, 0x26, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, + 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, + 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x1a, 0x1b, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, + 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, + 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, + 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x54, 0x65, + 0x61, 0x6d, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x4e, + 0x61, 0x6d, 0x65, 0x1a, 0x20, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, + 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x42, 0x75, 0x6e, 0x64, 0x6c, + 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x59, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x51, 0x75, 0x65, 0x75, 0x65, 0x73, 0x12, 0x1e, 0x2e, 0x73, 0x61, 0x6d, + 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, + 0x69, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x24, 0x2e, 0x73, 0x61, 0x6d, + 0x73, 0x61, 0x68, 0x61, 0x69, 0x2e, 0x69, 0x6f, 0x2e, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, + 0x69, 0x2e, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x51, 0x75, 0x65, 0x75, 0x65, 0x73, + 0x42, 0x12, 0x5a, 0x10, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x61, 0x6d, 0x73, 0x61, 0x68, 0x61, 0x69, + 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -798,7 +902,7 @@ func file_pkg_samsahai_rpc_service_proto_rawDescGZIP() []byte { } var file_pkg_samsahai_rpc_service_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_pkg_samsahai_rpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_pkg_samsahai_rpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_pkg_samsahai_rpc_service_proto_goTypes = []interface{}{ (ComponentUpgrade_UpgradeStatus)(0), // 0: samsahai.io.samsahai.ComponentUpgrade.UpgradeStatus (ComponentUpgrade_IssueType)(0), // 1: samsahai.io.samsahai.ComponentUpgrade.IssueType @@ -806,31 +910,35 @@ var file_pkg_samsahai_rpc_service_proto_goTypes = []interface{}{ (*Empty)(nil), // 3: samsahai.io.samsahai.Empty (*TeamWithComponentName)(nil), // 4: samsahai.io.samsahai.TeamWithComponentName (*BundleName)(nil), // 5: samsahai.io.samsahai.BundleName - (*ComponentUpgrade)(nil), // 6: samsahai.io.samsahai.ComponentUpgrade - (*Component)(nil), // 7: samsahai.io.samsahai.Component - (*Image)(nil), // 8: samsahai.io.samsahai.Image - (*ImageList)(nil), // 9: samsahai.io.samsahai.ImageList - (*TeamWithCurrentComponent)(nil), // 10: samsahai.io.samsahai.TeamWithCurrentComponent + (*TeamName)(nil), // 6: samsahai.io.samsahai.TeamName + (*PriorityQueues)(nil), // 7: samsahai.io.samsahai.PriorityQueues + (*ComponentUpgrade)(nil), // 8: samsahai.io.samsahai.ComponentUpgrade + (*Component)(nil), // 9: samsahai.io.samsahai.Component + (*Image)(nil), // 10: samsahai.io.samsahai.Image + (*ImageList)(nil), // 11: samsahai.io.samsahai.ImageList + (*TeamWithCurrentComponent)(nil), // 12: samsahai.io.samsahai.TeamWithCurrentComponent } var file_pkg_samsahai_rpc_service_proto_depIdxs = []int32{ 0, // 0: samsahai.io.samsahai.ComponentUpgrade.status:type_name -> samsahai.io.samsahai.ComponentUpgrade.UpgradeStatus - 7, // 1: samsahai.io.samsahai.ComponentUpgrade.components:type_name -> samsahai.io.samsahai.Component + 9, // 1: samsahai.io.samsahai.ComponentUpgrade.components:type_name -> samsahai.io.samsahai.Component 1, // 2: samsahai.io.samsahai.ComponentUpgrade.issueType:type_name -> samsahai.io.samsahai.ComponentUpgrade.IssueType - 8, // 3: samsahai.io.samsahai.ComponentUpgrade.imageMissingList:type_name -> samsahai.io.samsahai.Image + 10, // 3: samsahai.io.samsahai.ComponentUpgrade.imageMissingList:type_name -> samsahai.io.samsahai.Image 2, // 4: samsahai.io.samsahai.ComponentUpgrade.reverificationStatus:type_name -> samsahai.io.samsahai.ComponentUpgrade.ReverificationStatus - 8, // 5: samsahai.io.samsahai.Component.image:type_name -> samsahai.io.samsahai.Image - 8, // 6: samsahai.io.samsahai.ImageList.images:type_name -> samsahai.io.samsahai.Image - 7, // 7: samsahai.io.samsahai.TeamWithCurrentComponent.components:type_name -> samsahai.io.samsahai.Component - 6, // 8: samsahai.io.samsahai.RPC.RunPostComponentUpgrade:input_type -> samsahai.io.samsahai.ComponentUpgrade - 10, // 9: samsahai.io.samsahai.RPC.GetMissingVersion:input_type -> samsahai.io.samsahai.TeamWithCurrentComponent - 6, // 10: samsahai.io.samsahai.RPC.SendUpdateStateQueueMetric:input_type -> samsahai.io.samsahai.ComponentUpgrade + 10, // 5: samsahai.io.samsahai.Component.image:type_name -> samsahai.io.samsahai.Image + 10, // 6: samsahai.io.samsahai.ImageList.images:type_name -> samsahai.io.samsahai.Image + 9, // 7: samsahai.io.samsahai.TeamWithCurrentComponent.components:type_name -> samsahai.io.samsahai.Component + 8, // 8: samsahai.io.samsahai.RPC.RunPostComponentUpgrade:input_type -> samsahai.io.samsahai.ComponentUpgrade + 12, // 9: samsahai.io.samsahai.RPC.GetMissingVersion:input_type -> samsahai.io.samsahai.TeamWithCurrentComponent + 8, // 10: samsahai.io.samsahai.RPC.SendUpdateStateQueueMetric:input_type -> samsahai.io.samsahai.ComponentUpgrade 4, // 11: samsahai.io.samsahai.RPC.GetBundleName:input_type -> samsahai.io.samsahai.TeamWithComponentName - 3, // 12: samsahai.io.samsahai.RPC.RunPostComponentUpgrade:output_type -> samsahai.io.samsahai.Empty - 9, // 13: samsahai.io.samsahai.RPC.GetMissingVersion:output_type -> samsahai.io.samsahai.ImageList - 3, // 14: samsahai.io.samsahai.RPC.SendUpdateStateQueueMetric:output_type -> samsahai.io.samsahai.Empty - 5, // 15: samsahai.io.samsahai.RPC.GetBundleName:output_type -> samsahai.io.samsahai.BundleName - 12, // [12:16] is the sub-list for method output_type - 8, // [8:12] is the sub-list for method input_type + 6, // 12: samsahai.io.samsahai.RPC.GetPriorityQueues:input_type -> samsahai.io.samsahai.TeamName + 3, // 13: samsahai.io.samsahai.RPC.RunPostComponentUpgrade:output_type -> samsahai.io.samsahai.Empty + 11, // 14: samsahai.io.samsahai.RPC.GetMissingVersion:output_type -> samsahai.io.samsahai.ImageList + 3, // 15: samsahai.io.samsahai.RPC.SendUpdateStateQueueMetric:output_type -> samsahai.io.samsahai.Empty + 5, // 16: samsahai.io.samsahai.RPC.GetBundleName:output_type -> samsahai.io.samsahai.BundleName + 7, // 17: samsahai.io.samsahai.RPC.GetPriorityQueues:output_type -> samsahai.io.samsahai.PriorityQueues + 13, // [13:18] is the sub-list for method output_type + 8, // [8:13] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name 8, // [8:8] is the sub-list for extension extendee 0, // [0:8] is the sub-list for field type_name @@ -879,7 +987,7 @@ func file_pkg_samsahai_rpc_service_proto_init() { } } file_pkg_samsahai_rpc_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ComponentUpgrade); i { + switch v := v.(*TeamName); i { case 0: return &v.state case 1: @@ -891,7 +999,7 @@ func file_pkg_samsahai_rpc_service_proto_init() { } } file_pkg_samsahai_rpc_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Component); i { + switch v := v.(*PriorityQueues); i { case 0: return &v.state case 1: @@ -903,7 +1011,7 @@ func file_pkg_samsahai_rpc_service_proto_init() { } } file_pkg_samsahai_rpc_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Image); i { + switch v := v.(*ComponentUpgrade); i { case 0: return &v.state case 1: @@ -915,7 +1023,7 @@ func file_pkg_samsahai_rpc_service_proto_init() { } } file_pkg_samsahai_rpc_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImageList); i { + switch v := v.(*Component); i { case 0: return &v.state case 1: @@ -927,6 +1035,30 @@ func file_pkg_samsahai_rpc_service_proto_init() { } } file_pkg_samsahai_rpc_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Image); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_samsahai_rpc_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImageList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_samsahai_rpc_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TeamWithCurrentComponent); i { case 0: return &v.state @@ -945,7 +1077,7 @@ func file_pkg_samsahai_rpc_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pkg_samsahai_rpc_service_proto_rawDesc, NumEnums: 3, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/samsahai/rpc/service.proto b/pkg/samsahai/rpc/service.proto index f30f7a7b..90152bd1 100644 --- a/pkg/samsahai/rpc/service.proto +++ b/pkg/samsahai/rpc/service.proto @@ -8,6 +8,7 @@ service RPC { rpc GetMissingVersion (TeamWithCurrentComponent) returns (ImageList); rpc SendUpdateStateQueueMetric (ComponentUpgrade) returns (Empty); rpc GetBundleName (TeamWithComponentName) returns (BundleName); + rpc GetPriorityQueues (TeamName) returns (PriorityQueues); } message Empty { @@ -22,6 +23,14 @@ message BundleName { string name = 1; } +message TeamName { + string name = 1; +} + +message PriorityQueues { + repeated string queues = 1; +} + message ComponentUpgrade { enum UpgradeStatus { UpgradeStatus_FAILURE = 0; diff --git a/pkg/samsahai/rpc/service.twirp.go b/pkg/samsahai/rpc/service.twirp.go index ddfe99ed..f3b04da8 100644 --- a/pkg/samsahai/rpc/service.twirp.go +++ b/pkg/samsahai/rpc/service.twirp.go @@ -40,6 +40,8 @@ type RPC interface { SendUpdateStateQueueMetric(context.Context, *ComponentUpgrade) (*Empty, error) GetBundleName(context.Context, *TeamWithComponentName) (*BundleName, error) + + GetPriorityQueues(context.Context, *TeamName) (*PriorityQueues, error) } // =================== @@ -48,7 +50,7 @@ type RPC interface { type rPCProtobufClient struct { client HTTPClient - urls [4]string + urls [5]string opts twirp.ClientOptions } @@ -65,11 +67,12 @@ func NewRPCProtobufClient(addr string, client HTTPClient, opts ...twirp.ClientOp } prefix := urlBase(addr) + RPCPathPrefix - urls := [4]string{ + urls := [5]string{ prefix + "RunPostComponentUpgrade", prefix + "GetMissingVersion", prefix + "SendUpdateStateQueueMetric", prefix + "GetBundleName", + prefix + "GetPriorityQueues", } return &rPCProtobufClient{ @@ -159,13 +162,33 @@ func (c *rPCProtobufClient) GetBundleName(ctx context.Context, in *TeamWithCompo return out, nil } +func (c *rPCProtobufClient) GetPriorityQueues(ctx context.Context, in *TeamName) (*PriorityQueues, error) { + ctx = ctxsetters.WithPackageName(ctx, "samsahai.io.samsahai") + ctx = ctxsetters.WithServiceName(ctx, "RPC") + ctx = ctxsetters.WithMethodName(ctx, "GetPriorityQueues") + out := new(PriorityQueues) + err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + // =============== // RPC JSON Client // =============== type rPCJSONClient struct { client HTTPClient - urls [4]string + urls [5]string opts twirp.ClientOptions } @@ -182,11 +205,12 @@ func NewRPCJSONClient(addr string, client HTTPClient, opts ...twirp.ClientOption } prefix := urlBase(addr) + RPCPathPrefix - urls := [4]string{ + urls := [5]string{ prefix + "RunPostComponentUpgrade", prefix + "GetMissingVersion", prefix + "SendUpdateStateQueueMetric", prefix + "GetBundleName", + prefix + "GetPriorityQueues", } return &rPCJSONClient{ @@ -276,6 +300,26 @@ func (c *rPCJSONClient) GetBundleName(ctx context.Context, in *TeamWithComponent return out, nil } +func (c *rPCJSONClient) GetPriorityQueues(ctx context.Context, in *TeamName) (*PriorityQueues, error) { + ctx = ctxsetters.WithPackageName(ctx, "samsahai.io.samsahai") + ctx = ctxsetters.WithServiceName(ctx, "RPC") + ctx = ctxsetters.WithMethodName(ctx, "GetPriorityQueues") + out := new(PriorityQueues) + err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + // ================== // RPC Server Handler // ================== @@ -336,6 +380,9 @@ func (s *rPCServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { case "/twirp/samsahai.io.samsahai.RPC/GetBundleName": s.serveGetBundleName(ctx, resp, req) return + case "/twirp/samsahai.io.samsahai.RPC/GetPriorityQueues": + s.serveGetPriorityQueues(ctx, resp, req) + return default: msg := fmt.Sprintf("no handler for path %q", req.URL.Path) err = badRouteError(msg, req.Method, req.URL.Path) @@ -860,6 +907,135 @@ func (s *rPCServer) serveGetBundleNameProtobuf(ctx context.Context, resp http.Re callResponseSent(ctx, s.hooks) } +func (s *rPCServer) serveGetPriorityQueues(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveGetPriorityQueuesJSON(ctx, resp, req) + case "application/protobuf": + s.serveGetPriorityQueuesProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *rPCServer) serveGetPriorityQueuesJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetPriorityQueues") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + reqContent := new(TeamName) + unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} + if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + return + } + + // Call service method + var respContent *PriorityQueues + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = s.RPC.GetPriorityQueues(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *PriorityQueues and nil error while calling GetPriorityQueues. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + var buf bytes.Buffer + marshaler := &jsonpb.Marshaler{OrigName: true} + if err = marshaler.Marshal(&buf, respContent); err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + respBytes := buf.Bytes() + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *rPCServer) serveGetPriorityQueuesProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetPriorityQueues") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := ioutil.ReadAll(req.Body) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + return + } + reqContent := new(TeamName) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + // Call service method + var respContent *PriorityQueues + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = s.RPC.GetPriorityQueues(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *PriorityQueues and nil error while calling GetPriorityQueues. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + func (s *rPCServer) ServiceDescriptor() ([]byte, int) { return twirpFileDescriptor0, 0 } @@ -1388,51 +1564,55 @@ func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) } var twirpFileDescriptor0 = []byte{ - // 734 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x4f, 0xdb, 0x4a, - 0x10, 0xc7, 0x09, 0x09, 0x64, 0x78, 0xbc, 0x67, 0x56, 0x20, 0xfc, 0x02, 0x02, 0xcb, 0x42, 0x55, - 0xd4, 0x4a, 0xa1, 0x85, 0x5e, 0xaa, 0x1e, 0x5a, 0x48, 0xdc, 0xd4, 0x2a, 0x31, 0x74, 0x4d, 0x40, - 0xed, 0x81, 0x68, 0x9b, 0x6c, 0xc3, 0xaa, 0xc4, 0x76, 0xbd, 0x6b, 0xaa, 0x48, 0x3d, 0xf7, 0xd8, - 0xef, 0xd6, 0x6f, 0x54, 0x79, 0x49, 0x6c, 0x27, 0x71, 0x08, 0x95, 0x7a, 0xf2, 0x78, 0xf6, 0x37, - 0xb3, 0xf3, 0x9b, 0x9d, 0x3f, 0xb0, 0xe3, 0x7f, 0xe9, 0xed, 0x73, 0xd2, 0xe7, 0xe4, 0x9a, 0xb0, - 0xfd, 0xc0, 0xef, 0xec, 0x73, 0x1a, 0xdc, 0xb2, 0x0e, 0xad, 0xfa, 0x81, 0x27, 0x3c, 0xb4, 0x3e, - 0x3a, 0xab, 0x32, 0xaf, 0x3a, 0x92, 0x8d, 0x25, 0x28, 0x98, 0x7d, 0x5f, 0x0c, 0x8c, 0x0f, 0xb0, - 0x71, 0x4e, 0x49, 0xff, 0x92, 0x89, 0xeb, 0x9a, 0xd7, 0xf7, 0x3d, 0x97, 0xba, 0xc2, 0x26, 0x7d, - 0x8a, 0xca, 0xb0, 0x2c, 0x28, 0xe9, 0x47, 0xb2, 0xa6, 0xe8, 0x4a, 0xa5, 0x84, 0xe3, 0x7f, 0xb4, - 0x07, 0xab, 0x9d, 0x34, 0x58, 0xcb, 0x49, 0xc0, 0xb8, 0xd2, 0xd0, 0x01, 0x8e, 0x43, 0xb7, 0x7b, - 0x43, 0xa5, 0x0d, 0x82, 0x45, 0x37, 0xf1, 0x25, 0x65, 0xe3, 0xd7, 0x12, 0xa8, 0xf1, 0xad, 0x2d, - 0xbf, 0x17, 0x90, 0x2e, 0x45, 0x27, 0x50, 0xe4, 0x82, 0x88, 0x90, 0x4b, 0xe8, 0xbf, 0x07, 0xcf, - 0xab, 0x59, 0x0c, 0xaa, 0x93, 0x76, 0xd5, 0xe1, 0xd7, 0x91, 0xb6, 0x78, 0xe8, 0x23, 0xbe, 0x36, - 0x97, 0x5c, 0x3b, 0x46, 0x2d, 0x3f, 0x41, 0xed, 0x15, 0x40, 0xcc, 0x82, 0x6b, 0x8b, 0x7a, 0xbe, - 0xb2, 0x72, 0xb0, 0x3b, 0x27, 0x02, 0x9c, 0x32, 0x41, 0x36, 0x94, 0x18, 0xe7, 0x21, 0x3d, 0x1f, - 0xf8, 0x54, 0x2b, 0x48, 0x06, 0x4f, 0x1f, 0xc8, 0xc0, 0x1a, 0xd9, 0xe1, 0xc4, 0x05, 0x7a, 0x0c, - 0xea, 0xd7, 0x90, 0x86, 0xf4, 0x2d, 0xe3, 0xc2, 0x0b, 0x06, 0x32, 0xe8, 0xa2, 0x0c, 0x7a, 0x4a, - 0x8f, 0x1a, 0xa0, 0xb2, 0x3e, 0xe9, 0xd1, 0x26, 0xe3, 0x9c, 0xb9, 0xbd, 0x13, 0xc6, 0x85, 0xb6, - 0x24, 0x29, 0x6c, 0x65, 0x87, 0x60, 0x45, 0x68, 0x3c, 0x65, 0x84, 0xb6, 0xa1, 0x14, 0x65, 0x8a, - 0xfb, 0xa4, 0x43, 0xb5, 0x65, 0x79, 0x5b, 0xa2, 0x40, 0x15, 0xf8, 0x4f, 0x50, 0x2e, 0x8e, 0x43, - 0x76, 0xd3, 0x8d, 0x62, 0xb4, 0xea, 0x5a, 0x49, 0x62, 0x26, 0xd5, 0x51, 0xf6, 0x83, 0xd0, 0xe5, - 0x1a, 0xe8, 0x4a, 0xa5, 0x80, 0xa5, 0x8c, 0x76, 0x00, 0x18, 0xc7, 0xf4, 0x96, 0x06, 0xec, 0xf3, - 0x40, 0x5b, 0xd1, 0x95, 0xca, 0x32, 0x4e, 0x69, 0x90, 0x07, 0xeb, 0xc1, 0x9d, 0xcc, 0x3a, 0x44, - 0x30, 0xcf, 0xbd, 0x7b, 0x51, 0xed, 0x1f, 0x99, 0xcb, 0x97, 0x0f, 0xcc, 0x25, 0xce, 0x70, 0x81, - 0x33, 0x1d, 0x1b, 0x26, 0xac, 0x8e, 0xd5, 0x0e, 0xfa, 0x1f, 0x36, 0xc6, 0x14, 0xed, 0x37, 0x47, - 0xd6, 0x49, 0x0b, 0x9b, 0xea, 0xc2, 0xf4, 0x91, 0xd3, 0xaa, 0xd5, 0x4c, 0xc7, 0x51, 0x15, 0xe3, - 0x87, 0x02, 0xa5, 0xf8, 0x05, 0xd1, 0x06, 0xac, 0xc5, 0x3f, 0xed, 0x96, 0xfd, 0xce, 0x3e, 0xbd, - 0xb4, 0xd5, 0x05, 0xb4, 0x07, 0x7a, 0xa2, 0xae, 0x9b, 0x8e, 0x85, 0xcd, 0x7a, 0xfb, 0xc2, 0xc4, - 0x8e, 0x75, 0x6a, 0xcb, 0x6b, 0xcc, 0xba, 0xaa, 0xa0, 0x2d, 0xd8, 0x4c, 0x50, 0x56, 0xf3, 0xa8, - 0x61, 0xb6, 0x9b, 0x96, 0xe3, 0x58, 0x76, 0x43, 0xcd, 0xa1, 0x5d, 0xd8, 0x4a, 0x0e, 0x4d, 0xfb, - 0xc2, 0xc2, 0xa7, 0x76, 0xd3, 0xb4, 0xcf, 0xdb, 0x96, 0xe3, 0xb4, 0x4c, 0x35, 0x6f, 0x7c, 0x87, - 0xf5, 0x2c, 0xf6, 0x48, 0x87, 0xed, 0x2c, 0x7d, 0x2a, 0xba, 0x59, 0x88, 0x11, 0x7f, 0x65, 0x26, - 0x62, 0x94, 0x86, 0x9c, 0x81, 0xa1, 0x14, 0x3f, 0x46, 0x56, 0xd3, 0xa3, 0x67, 0x50, 0x90, 0xf5, - 0x26, 0x5b, 0x72, 0x4e, 0x65, 0xde, 0x21, 0x8d, 0x17, 0x50, 0x90, 0xff, 0x51, 0xed, 0x04, 0xd4, - 0xf7, 0x38, 0x8b, 0x4a, 0x7e, 0xe8, 0x35, 0xa5, 0x41, 0x2a, 0xe4, 0x05, 0xe9, 0x0d, 0x9b, 0x3d, - 0x12, 0x8d, 0xd7, 0x50, 0x92, 0xa6, 0xb2, 0xac, 0x0f, 0xa1, 0x28, 0x1d, 0x46, 0xa3, 0x65, 0x6e, - 0x57, 0x0c, 0xa1, 0xc6, 0x37, 0xd0, 0xe2, 0x09, 0x19, 0x06, 0x01, 0x75, 0x45, 0xc2, 0xef, 0xbe, - 0x21, 0x39, 0x3e, 0x49, 0x72, 0x7f, 0x3c, 0x49, 0x0e, 0x7e, 0xe6, 0x21, 0x8f, 0xcf, 0x6a, 0xe8, - 0x0a, 0x36, 0x71, 0xe8, 0x9e, 0x79, 0x5c, 0x4c, 0xcd, 0xca, 0x47, 0x0f, 0xeb, 0x86, 0xf2, 0x0c, - 0xa2, 0x72, 0x05, 0xa0, 0x2e, 0xac, 0x35, 0xa8, 0x18, 0xb6, 0xff, 0x05, 0x0d, 0x38, 0xf3, 0x5c, - 0x54, 0xcd, 0xb6, 0x98, 0x95, 0x89, 0xf2, 0xee, 0x3d, 0xa9, 0x94, 0xb9, 0x27, 0x50, 0x76, 0xa8, - 0xdb, 0x6d, 0xf9, 0x5d, 0x22, 0x64, 0xf3, 0xd0, 0xf7, 0xd1, 0xf8, 0x6a, 0x52, 0x11, 0xb0, 0xce, - 0xdf, 0x21, 0x72, 0x05, 0xab, 0x0d, 0x2a, 0x52, 0x3b, 0xe7, 0xc9, 0x1c, 0x12, 0xe9, 0x75, 0x55, - 0xd6, 0xb3, 0xc1, 0x89, 0xbb, 0x63, 0xf4, 0x51, 0x9d, 0x5c, 0xb6, 0x9f, 0x8a, 0x72, 0xcb, 0x1e, - 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x78, 0xff, 0x86, 0x8a, 0x87, 0x07, 0x00, 0x00, + // 786 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x51, 0x4f, 0xe3, 0x46, + 0x10, 0xc6, 0x09, 0x09, 0xf1, 0x50, 0xa8, 0x59, 0x41, 0x71, 0x03, 0x0a, 0x96, 0x85, 0xaa, 0xa8, + 0x95, 0x42, 0x0b, 0x7d, 0xa9, 0xfa, 0xd0, 0x42, 0xe2, 0xa6, 0x56, 0x89, 0xa1, 0xeb, 0x04, 0xc4, + 0x3d, 0x10, 0xf9, 0x92, 0xbd, 0xb0, 0x3a, 0x62, 0xfb, 0xbc, 0x6b, 0x4e, 0x91, 0xee, 0xf9, 0xfe, + 0xdf, 0xfd, 0x8c, 0xfb, 0x17, 0x27, 0x6f, 0x12, 0xdb, 0x49, 0x1c, 0xc2, 0x49, 0xf7, 0xe4, 0xd9, + 0xd9, 0x99, 0x6f, 0x67, 0xbe, 0x9d, 0x9d, 0x31, 0x54, 0xfc, 0xb7, 0x83, 0x13, 0xe6, 0x0c, 0x99, + 0xf3, 0xe0, 0xd0, 0x93, 0xc0, 0xef, 0x9d, 0x30, 0x12, 0x3c, 0xd1, 0x1e, 0xa9, 0xf9, 0x81, 0xc7, + 0x3d, 0xb4, 0x3b, 0xdd, 0xab, 0x51, 0xaf, 0x36, 0x95, 0xf5, 0x0d, 0x28, 0x18, 0x43, 0x9f, 0x8f, + 0xf4, 0x3b, 0xd8, 0x6b, 0x13, 0x67, 0x78, 0x4b, 0xf9, 0x43, 0xdd, 0x1b, 0xfa, 0x9e, 0x4b, 0x5c, + 0x6e, 0x39, 0x43, 0x82, 0xca, 0x50, 0xe2, 0xc4, 0x19, 0x46, 0xb2, 0x2a, 0x69, 0x52, 0x55, 0xc6, + 0xf1, 0x1a, 0x1d, 0xc3, 0x56, 0x2f, 0x6d, 0xac, 0xe6, 0x84, 0xc1, 0xac, 0x52, 0xd7, 0x00, 0x2e, + 0x42, 0xb7, 0xff, 0x48, 0x84, 0x0f, 0x82, 0x75, 0x37, 0xc1, 0x12, 0xb2, 0x5e, 0x81, 0x52, 0x7b, + 0x8a, 0x99, 0xb5, 0x5f, 0x85, 0xed, 0xeb, 0x80, 0x7a, 0x01, 0xe5, 0xa3, 0xff, 0x43, 0x12, 0x12, + 0x86, 0x7e, 0x80, 0xe2, 0x3b, 0x21, 0xa9, 0x92, 0x96, 0xaf, 0xca, 0x78, 0xb2, 0xd2, 0x3f, 0x6d, + 0x80, 0x12, 0xc7, 0xdf, 0xf1, 0x07, 0x81, 0xd3, 0x27, 0xe8, 0x12, 0x8a, 0x8c, 0x3b, 0x3c, 0x64, + 0x02, 0x74, 0xfb, 0xf4, 0xf7, 0x5a, 0x16, 0x17, 0xb5, 0x79, 0xbf, 0xda, 0xe4, 0x6b, 0x0b, 0x5f, + 0x3c, 0xc1, 0x88, 0x03, 0xcc, 0x25, 0x01, 0xce, 0x90, 0x94, 0x9f, 0x23, 0xe9, 0x2f, 0x80, 0x98, + 0x0f, 0xa6, 0xae, 0x6b, 0xf9, 0xea, 0xe6, 0xe9, 0xd1, 0x8a, 0x08, 0x70, 0xca, 0x05, 0x59, 0x20, + 0x53, 0xc6, 0x42, 0xd2, 0x1e, 0xf9, 0x44, 0x2d, 0x88, 0x0c, 0x7e, 0x7d, 0x61, 0x06, 0xe6, 0xd4, + 0x0f, 0x27, 0x10, 0xe8, 0x67, 0x50, 0x04, 0x5b, 0xff, 0x52, 0xc6, 0xbd, 0x60, 0x24, 0x82, 0x2e, + 0x8a, 0xa0, 0x17, 0xf4, 0xa8, 0x09, 0x0a, 0x1d, 0x3a, 0x03, 0xd2, 0xa2, 0x8c, 0x51, 0x77, 0x70, + 0x49, 0x19, 0x57, 0x37, 0x44, 0x0a, 0x07, 0xd9, 0x21, 0x98, 0x91, 0x35, 0x5e, 0x70, 0x42, 0x87, + 0x20, 0x47, 0x4c, 0x31, 0xdf, 0xe9, 0x11, 0xb5, 0x24, 0x4e, 0x4b, 0x14, 0xa8, 0x0a, 0xdf, 0x73, + 0xc2, 0xf8, 0x45, 0x48, 0x1f, 0xfb, 0x51, 0x8c, 0x66, 0x43, 0x95, 0x85, 0xcd, 0xbc, 0x3a, 0x62, + 0x3f, 0x08, 0x5d, 0xa6, 0x82, 0x26, 0x55, 0x0b, 0x58, 0xc8, 0xa8, 0x02, 0x40, 0x19, 0x26, 0x4f, + 0x24, 0xa0, 0x6f, 0x46, 0xea, 0xa6, 0x26, 0x55, 0x4b, 0x38, 0xa5, 0x41, 0x1e, 0xec, 0x06, 0x63, + 0x99, 0xf6, 0x1c, 0x4e, 0x3d, 0x77, 0x7c, 0xa3, 0xea, 0x77, 0x82, 0xcb, 0x3f, 0x5f, 0xc8, 0x25, + 0xce, 0x80, 0xc0, 0x99, 0xc0, 0xba, 0x01, 0x5b, 0x33, 0xb5, 0x83, 0x7e, 0x84, 0xbd, 0x19, 0x45, + 0xf7, 0x9f, 0x73, 0xf3, 0xb2, 0x83, 0x0d, 0x65, 0x6d, 0x71, 0xcb, 0xee, 0xd4, 0xeb, 0x86, 0x6d, + 0x2b, 0x92, 0xfe, 0x51, 0x02, 0x39, 0xbe, 0x41, 0xb4, 0x07, 0x3b, 0xf1, 0xa2, 0xdb, 0xb1, 0xfe, + 0xb3, 0xae, 0x6e, 0x2d, 0x65, 0x0d, 0x1d, 0x83, 0x96, 0xa8, 0x1b, 0x86, 0x6d, 0x62, 0xa3, 0xd1, + 0xbd, 0x31, 0xb0, 0x6d, 0x5e, 0x59, 0xe2, 0x18, 0xa3, 0xa1, 0x48, 0xe8, 0x00, 0xf6, 0x13, 0x2b, + 0xb3, 0x75, 0xde, 0x34, 0xba, 0x2d, 0xd3, 0xb6, 0x4d, 0xab, 0xa9, 0xe4, 0xd0, 0x11, 0x1c, 0x24, + 0x9b, 0x86, 0x75, 0x63, 0xe2, 0x2b, 0xab, 0x65, 0x58, 0xed, 0xae, 0x69, 0xdb, 0x1d, 0x43, 0xc9, + 0xeb, 0x1f, 0x60, 0x37, 0x2b, 0x7b, 0xa4, 0xc1, 0x61, 0x96, 0x3e, 0x15, 0xdd, 0x32, 0x8b, 0x69, + 0xfe, 0xd2, 0x52, 0x8b, 0x29, 0x0d, 0x39, 0x1d, 0x83, 0x1c, 0x5f, 0x46, 0x56, 0x7b, 0x40, 0xbf, + 0x41, 0x41, 0xd4, 0x9b, 0x78, 0x92, 0x2b, 0x2a, 0x73, 0x6c, 0xa9, 0xff, 0x01, 0x05, 0xb1, 0x8e, + 0x6a, 0x27, 0x20, 0xbe, 0xc7, 0x68, 0x54, 0xf2, 0x13, 0xd4, 0x94, 0x06, 0x29, 0x90, 0xe7, 0xce, + 0x60, 0xf2, 0xd8, 0x23, 0x51, 0xff, 0x1b, 0x64, 0xe1, 0x2a, 0xca, 0xfa, 0x0c, 0x8a, 0x02, 0x70, + 0xdc, 0x87, 0x56, 0x9c, 0x3d, 0x31, 0xd5, 0xdf, 0x83, 0x1a, 0xf7, 0xda, 0x30, 0x08, 0x88, 0xcb, + 0x93, 0xfc, 0x9e, 0x6b, 0xb7, 0xb3, 0x9d, 0x24, 0xf7, 0xd5, 0x9d, 0xe4, 0xf4, 0x73, 0x1e, 0xf2, + 0xf8, 0xba, 0x8e, 0xee, 0x61, 0x1f, 0x87, 0xee, 0xb5, 0xc7, 0xf8, 0x42, 0xaf, 0xfc, 0xe9, 0x65, + 0xaf, 0xa1, 0xbc, 0x24, 0x51, 0x31, 0x4c, 0x50, 0x1f, 0x76, 0x9a, 0x84, 0x4f, 0x9e, 0xff, 0x0d, + 0x09, 0x18, 0xf5, 0x5c, 0x54, 0xcb, 0xf6, 0x58, 0xc6, 0x44, 0xf9, 0xe8, 0x19, 0x2a, 0x05, 0xf7, + 0x0e, 0x94, 0x6d, 0xe2, 0xf6, 0x3b, 0x7e, 0xdf, 0xe1, 0xe2, 0xf1, 0x10, 0x31, 0x1c, 0x5a, 0x84, + 0x07, 0xb4, 0xf7, 0x6d, 0x12, 0xb9, 0x87, 0xad, 0x26, 0xe1, 0xa9, 0xe9, 0xf5, 0xcb, 0x8a, 0x24, + 0xd2, 0x83, 0xaf, 0xac, 0x65, 0x1b, 0xa7, 0xe0, 0xee, 0x04, 0x51, 0x73, 0xb3, 0xad, 0xb2, 0xfc, + 0x0c, 0x01, 0x7b, 0x9c, 0xbd, 0x3f, 0x8b, 0x72, 0x81, 0x5e, 0x29, 0xf3, 0x7f, 0x04, 0xaf, 0x8b, + 0xe2, 0x57, 0xe0, 0xec, 0x4b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3e, 0x7e, 0x28, 0x76, 0x2c, 0x08, + 0x00, 0x00, } diff --git a/test/e2e/queue/ctrl.go b/test/e2e/queue/ctrl.go index 7d5d8a56..48c784a0 100644 --- a/test/e2e/queue/ctrl.go +++ b/test/e2e/queue/ctrl.go @@ -51,7 +51,7 @@ var _ = Describe("[e2e] Queue controller", func() { s2hv1beta1.QueueComponents{{Name: "alpine", Version: "3.9.3"}}, ) - var err = controller.Add(q) + var err = controller.Add(q, nil) Expect(err).To(BeNil()) size := controller.Size() @@ -89,15 +89,15 @@ var _ = Describe("[e2e] Queue controller", func() { Expect(controller.Size()).To(Equal(0), "should start with empty queue") - By("Create 3 queue") + By("Create 3 queues") - err = controller.Add(alpine390) + err = controller.Add(alpine390, nil) Expect(err).To(BeNil()) - err = controller.Add(ubuntu) + err = controller.Add(ubuntu, nil) Expect(err).To(BeNil()) err = controller.Add(queue.NewUpgradeQueue(teamName, namespace, "node", "", s2hv1beta1.QueueComponents{{Name: "node", Version: "11.0.0"}}, - )) + ), nil) Expect(err).To(BeNil()) size = controller.Size() Expect(size).To(Equal(3)) @@ -108,7 +108,7 @@ var _ = Describe("[e2e] Queue controller", func() { By("Adding alpine 3.9.1") - err = controller.Add(alpine391) + err = controller.Add(alpine391, nil) Expect(err).To(BeNil()) first, err = controller.First() Expect(err).To(BeNil()) @@ -147,29 +147,29 @@ var _ = Describe("[e2e] Queue controller", func() { var err error var first *s2hv1beta1.Queue - var alpine = queue.NewUpgradeQueue(teamName, namespace, "application", "application", + var alpine = queue.NewUpgradeQueue(teamName, namespace, "group", "group", s2hv1beta1.QueueComponents{{Name: "alpine", Version: "3.9.0"}}, ) var ubuntu = queue.NewUpgradeQueue(teamName, namespace, "ubuntu", "", s2hv1beta1.QueueComponents{{Name: "ubuntu", Version: "18.04"}}, ) - var node = queue.NewUpgradeQueue(teamName, namespace, "application", "application", + var node = queue.NewUpgradeQueue(teamName, namespace, "group", "group", s2hv1beta1.QueueComponents{{Name: "node", Version: "11.0.0"}}, ) var size int Expect(controller.Size()).To(Equal(0), "should start with empty queue") - By("Create 2 queue") + By("Create 2 queues") - err = controller.Add(alpine) + err = controller.Add(alpine, nil) Expect(err).To(BeNil()) - err = controller.Add(ubuntu) + err = controller.Add(ubuntu, nil) Expect(err).To(BeNil()) By("Add node application") - err = controller.Add(node) + err = controller.Add(node, nil) Expect(err).To(BeNil()) size = controller.Size() Expect(size).To(Equal(2)) @@ -177,8 +177,8 @@ var _ = Describe("[e2e] Queue controller", func() { first, err = controller.First() Expect(err).To(BeNil()) Expect(len(first.Spec.Components)).To(Equal(2)) - Expect(first.ContainSameComponent("application", alpine.Spec.Components[0])).To(BeTrue()) - Expect(first.ContainSameComponent("application", node.Spec.Components[0])).To(BeTrue()) + Expect(first.ContainSameComponent("group", alpine.Spec.Components[0])).To(BeTrue()) + Expect(first.ContainSameComponent("group", node.Spec.Components[0])).To(BeTrue()) By("Removing all queues") @@ -193,7 +193,7 @@ var _ = Describe("[e2e] Queue controller", func() { var err error var first *s2hv1beta1.Queue - var application = queue.NewUpgradeQueue(teamName, namespace, "application", "application", + var application = queue.NewUpgradeQueue(teamName, namespace, "group", "group", s2hv1beta1.QueueComponents{ {Name: "alpine", Version: "3.9.0"}, {Name: "node", Version: "11.0.0"}, @@ -202,23 +202,23 @@ var _ = Describe("[e2e] Queue controller", func() { var ubuntu = queue.NewUpgradeQueue(teamName, namespace, "ubuntu", "", s2hv1beta1.QueueComponents{{Name: "ubuntu", Version: "18.04"}}, ) - var node = queue.NewUpgradeQueue(teamName, namespace, "application", "application", + var node = queue.NewUpgradeQueue(teamName, namespace, "group", "group", s2hv1beta1.QueueComponents{{Name: "node", Version: "11.0.2"}}, ) var size int Expect(controller.Size()).To(Equal(0), "should start with empty queue") - By("Create 2 queue") + By("Create 2 queues") - err = controller.Add(application) + err = controller.Add(application, nil) Expect(err).To(BeNil()) - err = controller.Add(ubuntu) + err = controller.Add(ubuntu, nil) Expect(err).To(BeNil()) By("Update node application") - err = controller.Add(node) + err = controller.Add(node, nil) Expect(err).To(BeNil()) size = controller.Size() Expect(size).To(Equal(2)) @@ -226,8 +226,8 @@ var _ = Describe("[e2e] Queue controller", func() { first, err = controller.First() Expect(err).To(BeNil()) Expect(len(first.Spec.Components)).To(Equal(2)) - Expect(first.ContainSameComponent("application", application.Spec.Components[0])).To(BeTrue()) - Expect(first.ContainSameComponent("application", node.Spec.Components[0])).To(BeTrue()) + Expect(first.ContainSameComponent("group", application.Spec.Components[0])).To(BeTrue()) + Expect(first.ContainSameComponent("group", node.Spec.Components[0])).To(BeTrue()) By("Removing all queues") @@ -242,7 +242,7 @@ var _ = Describe("[e2e] Queue controller", func() { var err error var first *s2hv1beta1.Queue - var application = queue.NewUpgradeQueue(teamName, namespace, "application", "application", + var application = queue.NewUpgradeQueue(teamName, namespace, "group", "group", s2hv1beta1.QueueComponents{ {Name: "alpine", Version: "3.9.0"}, {Name: "node", Version: "11.0.0"}, @@ -258,16 +258,16 @@ var _ = Describe("[e2e] Queue controller", func() { Expect(controller.Size()).To(Equal(0), "should start with empty queue") - By("Create 2 queue") + By("Create 2 queues") - err = controller.Add(application) + err = controller.Add(application, nil) Expect(err).To(BeNil()) - err = controller.Add(duplicatedNode) + err = controller.Add(duplicatedNode, nil) Expect(err).To(BeNil()) By("Update node application to not in bundle") - err = controller.Add(node) + err = controller.Add(node, nil) Expect(err).To(BeNil()) size = controller.Size() Expect(size).To(Equal(2)) @@ -275,7 +275,80 @@ var _ = Describe("[e2e] Queue controller", func() { first, err = controller.First() Expect(err).To(BeNil()) Expect(len(first.Spec.Components)).To(Equal(1)) - Expect(first.ContainSameComponent("application", application.Spec.Components[0])).To(BeTrue()) + Expect(first.ContainSameComponent("group", application.Spec.Components[0])).To(BeTrue()) + + By("Removing all queues") + + err = controller.RemoveAllQueues() + Expect(err).To(BeNil()) + size = controller.Size() + Expect(size).To(Equal(0)) + }, 3) + + It("should successfully create queue following priority queues", func(done Done) { + defer close(done) + + priorityQueues := []string{"alpine", "ubuntu"} + + var err error + var size int + var alpine = queue.NewUpgradeQueue(teamName, namespace, "group", "group", + s2hv1beta1.QueueComponents{{Name: "alpine", Version: "3.9.1"}}, + ) + var ubuntu16 = queue.NewUpgradeQueue(teamName, namespace, "ubuntu", "", + s2hv1beta1.QueueComponents{{Name: "ubuntu", Version: "16.04"}}, + ) + var ubuntu18 = queue.NewUpgradeQueue(teamName, namespace, "ubuntu", "", + s2hv1beta1.QueueComponents{{Name: "ubuntu", Version: "18.04"}}, + ) + var node = queue.NewUpgradeQueue(teamName, namespace, "group", "group", + s2hv1beta1.QueueComponents{{Name: "node", Version: "11.0.0"}}, + ) + + Expect(controller.Size()).To(Equal(0), "should start with empty queue") + + By("Create 1 bundle queue") + + err = controller.Add(node, priorityQueues) + Expect(err).To(BeNil()) + + By("Create 1 queue with higher priority") + + err = controller.Add(ubuntu16, priorityQueues) + Expect(err).To(BeNil()) + + size = controller.Size() + Expect(size).To(Equal(2)) + + first, err := controller.First() + Expect(err).To(BeNil()) + Expect(first.ContainSameComponent(ubuntu16.Name, ubuntu16.Spec.Components[0])).To(BeTrue()) + + By("Create 1 bundle queue with the highest priority") + + err = controller.Add(alpine, priorityQueues) + Expect(err).To(BeNil()) + + size = controller.Size() + Expect(size).To(Equal(2)) + + first, err = controller.First() + Expect(err).To(BeNil()) + Expect(first.ContainSameComponent(alpine.Name, alpine.Spec.Components[0])).To(BeTrue()) + Expect(first.ContainSameComponent(node.Name, node.Spec.Components[0])).To(BeTrue()) + + By("Create 1 queue with lower priority") + + err = controller.Add(ubuntu18, priorityQueues) + Expect(err).To(BeNil()) + + size = controller.Size() + Expect(size).To(Equal(2)) + + first, err = controller.First() + Expect(err).To(BeNil()) + Expect(first.ContainSameComponent(alpine.Name, alpine.Spec.Components[0])).To(BeTrue()) + Expect(first.ContainSameComponent(node.Name, node.Spec.Components[0])).To(BeTrue()) By("Removing all queues") diff --git a/test/e2e/staging/ctrl.go b/test/e2e/staging/ctrl.go index 9cb880bc..10bc8b14 100644 --- a/test/e2e/staging/ctrl.go +++ b/test/e2e/staging/ctrl.go @@ -256,7 +256,8 @@ var _ = Describe("[e2e] Staging controller", func() { Bundles: s2hv1beta1.ConfigBundles{ bundleName: []string{redisCompName, mariaDBCompName}, }, - Components: []*s2hv1beta1.Component{&configCompRedis, &configCompWordpress}, + PriorityQueues: []string{wordpressCompName, redisCompName}, + Components: []*s2hv1beta1.Component{&configCompRedis, &configCompWordpress}, }, } @@ -413,8 +414,8 @@ var _ = Describe("[e2e] Staging controller", func() { mariaDBQueue := queue.NewUpgradeQueue(teamName, namespace, bundleName, bundleName, s2hv1beta1.QueueComponents{{Name: mariaDBCompName, Repository: "bitnami/mariadb", Version: "10.3.18-debian-9-r32"}}, ) - Expect(queueCtrl.Add(redisQueue)).To(BeNil()) - Expect(queueCtrl.Add(mariaDBQueue)).To(BeNil()) + Expect(queueCtrl.Add(redisQueue, nil)).To(BeNil()) + Expect(queueCtrl.Add(mariaDBQueue, nil)).To(BeNil()) By("Deploying") err = wait.PollImmediate(2*time.Second, deployTimeout, func() (ok bool, err error) {