Skip to content

Commit

Permalink
fix: use rollout to list pods
Browse files Browse the repository at this point in the history
Signed-off-by: Kiloson <[email protected]>
  • Loading branch information
kilosonc committed Apr 25, 2024
1 parent 6437055 commit 3ef1f63
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ bin/

# makefile
tmp/
tools/
tools/

config-dev.yaml
20 changes: 14 additions & 6 deletions pkg/cd/cd.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ var (
Group: "",
Kind: "Pod",
}
GKRollout = schema.GroupKind{
Group: "argoproj.io",
Kind: "Rollout",
}
)

const (
Expand Down Expand Up @@ -204,18 +208,17 @@ func (c *cd) GetResourceTree(ctx context.Context,
}

resourceTree := make([]ResourceNode, 0, len(resourceTreeInArgo.Nodes))
pd, err := workload.GetAbility(GKPod)
if err != nil {
return nil, err
}
gt := getter.New(pd)

nodesMap := make(map[string][]ResourceNode)
for _, node := range resourceTreeInArgo.Nodes {
nodesMap[node.Kind] = append(nodesMap[node.Kind], ResourceNode{ResourceNode: node})
}

if rolloutNodes, ok := nodesMap["Rollout"]; ok {
ra, err := workload.GetAbility(GKRollout)
if err != nil {
return nil, err
}
gt := getter.New(ra)
nodesMap["Pod"] = make([]ResourceNode, 0)
for _, rolloutNode := range rolloutNodes {
err := c.informerFactories.GetDynamicFactory(params.RegionEntity.ID,
Expand All @@ -242,6 +245,11 @@ func (c *cd) GetResourceTree(ctx context.Context,
return resources, nil
}

pd, err := workload.GetAbility(GKPod)
if err != nil {
return nil, err
}
gt := getter.New(pd)
for _, n := range nodesMap["Pod"] {
node := n.ResourceNode
if n.Kind == "Pod" {
Expand Down

0 comments on commit 3ef1f63

Please sign in to comment.