Skip to content

Commit

Permalink
feat: Rollout Dashboard should allow user select namespace. Return em…
Browse files Browse the repository at this point in the history
…pty availableNamespaces if failed to fetch rollouts
  • Loading branch information
perenesenko committed Jun 17, 2021
1 parent ec9d03c commit 1304d4d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,20 +364,20 @@ func (s *ArgoRolloutsServer) RolloutToRolloutInfo(ro *v1alpha1.Rollout) (*rollou
}

func (s *ArgoRolloutsServer) GetNamespace(ctx context.Context, e *empty.Empty) (*rollout.NamespaceInfo, error) {
rolloutList, err := s.Options.RolloutsClientset.ArgoprojV1alpha1().Rollouts("").List(ctx, v1.ListOptions{})
if err != nil {
return nil, err
}
var m = make(map[string]bool)
var namespaces []string

for _, r := range rolloutList.Items {
ns := r.Namespace
if !m[ns] {
m[ns] = true
namespaces = append(namespaces, ns)
rolloutList, err := s.Options.RolloutsClientset.ArgoprojV1alpha1().Rollouts("").List(ctx, v1.ListOptions{})
if err == nil {
for _, r := range rolloutList.Items {
ns := r.Namespace
if !m[ns] {
m[ns] = true
namespaces = append(namespaces, ns)
}
}
}

return &rollout.NamespaceInfo{Namespace: s.Options.Namespace, AvailableNamespaces: namespaces}, nil
}

Expand Down

0 comments on commit 1304d4d

Please sign in to comment.