migrate info cmd to use catalog api - #1256
Conversation
Shubhamag12
commented
Aug 14, 2026
- Migrate info cmd to use new implementation of catalog
- moved legacy and catalog logic to common.go for openshift and podman runtime to consume it.
1418a73 to
3ad2d3c
Compare
|
|
||
| for _, pod := range pods { | ||
| if strings.HasPrefix(pod.PodName, catalogID) && pod.Status == catalogTypes.Running { | ||
| if strings.Contains(pod.PodName, "ui") { |
There was a problem hiding this comment.
| if strings.Contains(pod.PodName, "ui") { | |
| if strings.HasSuffix(pod.PodName, "-ui") { |
Use suffix and -ui
There was a problem hiding this comment.
we cannot use suffix right as pod name will have replicaSet id and pod id at the end. We would have to trim them to use suffix.
eg: chat-bot-ui-7b7fd6f549-d8ght
There was a problem hiding this comment.
Good point.. please find a way. What I think is maybe this will conflict with service/component name when using BYO service.
| if strings.HasPrefix(pod.PodName, catalogID) && pod.Status == catalogTypes.Running { | ||
| if strings.Contains(pod.PodName, "ui") { | ||
| uiStatus = "running" | ||
| } else if strings.Contains(pod.PodName, "api") { |
There was a problem hiding this comment.
| } else if strings.Contains(pod.PodName, "api") { | |
| } else if strings.HasSuffix(pod.PodName, "-api") { |
| params["UI_STATUS"] = uiStatus | ||
| params["API_STATUS"] = apiStatus |
There was a problem hiding this comment.
This will not work as its not only UI/API that user will have. There would be MCP url too. So we should not be hard coding UI_STATUS and API_STATUS
There was a problem hiding this comment.
As said where is vars_file being used?
There was a problem hiding this comment.
We should utilize and make it generic for now
| func RenderLegacyInfo(opts types.InfoOptions, rt runtime.Runtime) error { | ||
| listFilters := map[string][]string{} | ||
| if opts.Name != "" { | ||
| listFilters["label"] = []string{fmt.Sprintf("ai-services.io/application=%s", opts.Name)} |
|
|
||
| for _, pod := range pods { | ||
| if strings.HasPrefix(pod.PodName, catalogID) && pod.Status == catalogTypes.Running { | ||
| if strings.Contains(pod.PodName, "ui") { |
There was a problem hiding this comment.
I see lot of hardcoding ones ui, api. We should never be checking based on podname as it can be anything. Need to find an alternative way
There was a problem hiding this comment.
for podman as well, it the same way. we can take it up as a separate task
| uiContainerName := fmt.Sprintf("%s-ui", pod.PodName) | ||
| apiContainerName := "" | ||
| if strings.Contains(container.Name, "backend-server") { |
There was a problem hiding this comment.
We have been doing for podman runtime the same way. We can modify this maybe as a separate task?
| "github.com/project-ai-services/ai-services/internal/pkg/vars" | ||
| ) | ||
|
|
||
| const legacyFlagName = "legacy" |
There was a problem hiding this comment.
Can we move constant to common place, so that we can use same constant across commands.
here we can use commn constant
| if strings.Contains(pod.PodName, "ui") { | ||
| uiStatus = "running" | ||
| } else if strings.Contains(pod.PodName, "api") { | ||
| apiStatus = "running" |
There was a problem hiding this comment.
please use constant for running string
Signed-off-by: sagarwal-ibm <sagarwal@ibm.com>
1a99dea to
282ebcf
Compare