Skip to content

migrate info cmd to use catalog api - #1256

Open
Shubhamag12 wants to merge 1 commit into
IBM:mainfrom
Shubhamag12:migrate-info
Open

migrate info cmd to use catalog api#1256
Shubhamag12 wants to merge 1 commit into
IBM:mainfrom
Shubhamag12:migrate-info

Conversation

@Shubhamag12

Copy link
Copy Markdown
Contributor
  1. Migrate info cmd to use new implementation of catalog
  2. moved legacy and catalog logic to common.go for openshift and podman runtime to consume it.

Comment thread ai-services/internal/pkg/application/common/info.go Outdated

for _, pod := range pods {
if strings.HasPrefix(pod.PodName, catalogID) && pod.Status == catalogTypes.Running {
if strings.Contains(pod.PodName, "ui") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if strings.Contains(pod.PodName, "ui") {
if strings.HasSuffix(pod.PodName, "-ui") {

Use suffix and -ui

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else if strings.Contains(pod.PodName, "api") {
} else if strings.HasSuffix(pod.PodName, "-api") {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment thread ai-services/internal/pkg/application/common/info.go Outdated
Comment thread ai-services/cmd/ai-services/cmd/application/info.go
Comment thread ai-services/internal/pkg/application/openshift/info.go Outdated
Comment on lines +115 to +116
params["UI_STATUS"] = uiStatus
params["API_STATUS"] = apiStatus

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said where is vars_file being used?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use constants


for _, pod := range pods {
if strings.HasPrefix(pod.PodName, catalogID) && pod.Status == catalogTypes.Running {
if strings.Contains(pod.PodName, "ui") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for podman as well, it the same way. we can take it up as a separate task

Comment on lines +31 to +33
uiContainerName := fmt.Sprintf("%s-ui", pod.PodName)
apiContainerName := ""
if strings.Contains(container.Name, "backend-server") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@Shubhamag12 Shubhamag12 Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use constant for running string

Signed-off-by: sagarwal-ibm <sagarwal@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants