Skip to content

feat: add configurable app directory with --appdir flag#670

Open
shwetha-s-poojary wants to merge 8 commits intoIBM:mainfrom
shwetha-s-poojary:configure_app_dir
Open

feat: add configurable app directory with --appdir flag#670
shwetha-s-poojary wants to merge 8 commits intoIBM:mainfrom
shwetha-s-poojary:configure_app_dir

Conversation

@shwetha-s-poojary
Copy link
Copy Markdown
Member

@shwetha-s-poojary shwetha-s-poojary commented Apr 24, 2026

What does this PR include?

  • Add --basedir flag to catalog configure and application create commands
  • Introduce constants.DefaultBaseDir as single source of truth for default path
  • Add early permission validation before any operations
  • Update all templates to use dynamic baseDir from values
  • Set AI_SERVICES_BASE_DIR environment variable for runtime path resolution
  • Update vars.ModelDirectory dynamically based on baseDir
  • Modify application templates to use {{ .Values.baseDir }}
  • Update test files to use constants.GetApplicationsPath()

Fixes: #625

Enables: Users to specify custom storage locations for AI services data

Results:

# ls /root
go  project-ai-services  shubham  test_no_write_perm
# ai-services catalog configure --basedir /root/shwetha --runtime podman
Enter admin password:
Confirm admin password:
No existing pods found for application: ai-services

 Executing Layer 1/3: [catalog-secret.yaml.tmpl]
-------
Processing template: catalog-secret.yaml.tmpl
⠹ Deploying catalog service...-------
-------

 Executing Layer 2/3: [catalog-db.yaml.tmpl]
-------
Processing template: catalog-db.yaml.tmpl
⠴ Deploying catalog service...'catalog-db.yaml.tmpl', 'ai-services--db': Starting Pod Readiness check...
'catalog-db.yaml.tmpl', 'ai-services--db': Performing Containers Creation check for pod...
'catalog-db.yaml.tmpl', 'ai-services--db': Waiting for Containers Creation... Timeout set: 5m0s
'catalog-db.yaml.tmpl', 'ai-services--db': Containers creation check for pod is completed
'catalog-db.yaml.tmpl', 'ai-services--db', '3199f9b3e939-infra': Performing Container Readiness check...
'catalog-db.yaml.tmpl', 'ai-services--db', '3199f9b3e939-infra': Waiting for Container Readiness... Timeout set: 2m0s
'catalog-db.yaml.tmpl', 'ai-services--db', '3199f9b3e939-infra': Readiness Check for the container is completed!
-------
'catalog-db.yaml.tmpl', 'ai-services--db', 'ai-services--db-postgresql': Performing Container Readiness check...
'catalog-db.yaml.tmpl', 'ai-services--db', 'ai-services--db-postgresql': Waiting for Container Readiness... Timeout set: 2m30s
⠴ Deploying catalog service...'catalog-db.yaml.tmpl', 'ai-services--db', 'ai-services--db-postgresql': Readiness Check for the container is completed!
-------
'catalog-db.yaml.tmpl', 'ai-services--db': Pod has been successfully deployed and ready!
-------
-------
-------

 Executing Layer 3/3: [catalog.yaml.tmpl]
-------
Processing template: catalog.yaml.tmpl
⠇ Deploying catalog service...'catalog.yaml.tmpl', 'ai-services--catalog': Starting Pod Readiness check...
'catalog.yaml.tmpl', 'ai-services--catalog': Performing Containers Creation check for pod...
'catalog.yaml.tmpl', 'ai-services--catalog': Waiting for Containers Creation... Timeout set: 5m0s
'catalog.yaml.tmpl', 'ai-services--catalog': Containers creation check for pod is completed
'catalog.yaml.tmpl', 'ai-services--catalog', 'e9fc9d787ec1-infra': Performing Container Readiness check...
'catalog.yaml.tmpl', 'ai-services--catalog', 'e9fc9d787ec1-infra': Waiting for Container Readiness... Timeout set: 2m0s
⠏ Deploying catalog service...'catalog.yaml.tmpl', 'ai-services--catalog', 'e9fc9d787ec1-infra': Readiness Check for the container is completed!
-------
'catalog.yaml.tmpl', 'ai-services--catalog', 'ai-services--catalog-ui': Performing Container Readiness check...
'catalog.yaml.tmpl', 'ai-services--catalog', 'ai-services--catalog-ui': Waiting for Container Readiness... Timeout set: 2m10s
⠏ Deploying catalog service...'catalog.yaml.tmpl', 'ai-services--catalog', 'ai-services--catalog-ui': Readiness Check for the container is completed!
-------
'catalog.yaml.tmpl', 'ai-services--catalog', 'ai-services--catalog-backend': Performing Container Readiness check...
'catalog.yaml.tmpl', 'ai-services--catalog', 'ai-services--catalog-backend': Waiting for Container Readiness... Timeout set: 2m0s
'catalog.yaml.tmpl', 'ai-services--catalog', 'ai-services--catalog-backend': Readiness Check for the container is completed!
-------
'catalog.yaml.tmpl', 'ai-services--catalog': Pod has been successfully deployed and ready!
-------
-------
-------
✔ Catalog service deployed successfully
-------
Next Steps:
-------
- Access the Catalog UI at http://10.20.186.34:45691
# ai-services application ps --runtime podman
 APPLICATION NAME    POD NAME                STATUS
─────────────────────────────────────────────────────────────────
 ai-services         ai-services--db         Running (healthy)
                     ai-services--catalog    Running (healthy)
# ls /root/shwetha/ai-services/
db

Comment thread ai-services/cmd/ai-services/cmd/application/create.go Outdated
Comment thread ai-services/cmd/ai-services/cmd/application/create.go Outdated
Comment thread ai-services/cmd/ai-services/cmd/application/create.go Outdated
Comment thread ai-services/cmd/ai-services/cmd/application/create.go Outdated
Comment thread ai-services/cmd/ai-services/cmd/catalog/configure.go Outdated
Comment thread ai-services/cmd/ai-services/cmd/application/create.go Outdated
Comment thread ai-services/cmd/ai-services/cmd/application/create.go Outdated
@shwetha-s-poojary shwetha-s-poojary force-pushed the configure_app_dir branch 4 times, most recently from 9476ae4 to 884921e Compare April 28, 2026 13:36
@shwetha-s-poojary
Copy link
Copy Markdown
Member Author

The requirement was to add custom basedir support. We implemented it for CLI application create first (via --params baseDir=/custom/path) since that's currently supported, and also made catalog configure configurable with --basedir. However, catalog implementation is still in progress and can't be fully tested yet.

The CLI approach has a critical flaw: application create sets AI_SERVICES_BASE_DIR env var locally, but application delete reads from the current environment's AI_SERVICES_BASE_DIR If the env var isn't set during delete, it uses the default path and fails to find/clean up application data created with a custom basedir.

In my opinion it's better to keep custom basedir support only for catalog configure. Remove it from CLI application create because:

  • CLI has gaps requiring explicit env var management across operations.Not worth fixing CLI gaps for a workflow we're deprecating.
  • We're migrating to catalog-based workflow anyway.
  • Catalog backend maintains AI_SERVICES_BASE_DIR consistently across all operations which is read via GetBaseDir()

Wdyt @mkumatag @mayuka-c @Shubhamag12

@mkumatag
Copy link
Copy Markdown
Member

In my opinion it's better to keep custom basedir support only for catalog configure. Remove it from CLI application create because:

  • CLI has gaps requiring explicit env var management across operations.Not worth fixing CLI gaps for a workflow we're deprecating.
  • We're migrating to catalog-based workflow anyway.
  • Catalog backend maintains AI_SERVICES_BASE_DIR consistently across all operations which is read via GetBaseDir()

make sense, the other enhancement will impact this

@shwetha-s-poojary shwetha-s-poojary force-pushed the configure_app_dir branch 2 times, most recently from 5d432a5 to 88ac007 Compare April 29, 2026 12:23
Comment thread ai-services/assets/catalog/podman/values.yaml Outdated
Comment thread ai-services/assets/catalog/podman/values.yaml Outdated
Comment thread ai-services/assets/applications/rag/podman/values.yaml Outdated
Comment thread ai-services/assets/applications/rag-dev/podman/values.yaml Outdated
Comment thread ai-services/cmd/ai-services/cmd/application/create.go Outdated
Comment thread ai-services/internal/pkg/utils/util.go Outdated
Comment thread ai-services/tests/e2e/cli/output.go Outdated
Comment thread ai-services/internal/pkg/constants/common.go Outdated
Comment thread ai-services/tests/e2e/cli/output.go Outdated
Comment thread ai-services/assets/applications/rag-cpu/podman/values.yaml Outdated
Comment thread ai-services/cmd/ai-services/cmd/application/create.go Outdated
Comment thread ai-services/cmd/ai-services/cmd/application/create.go Outdated
Comment thread ai-services/internal/pkg/utils/util.go Outdated
Comment thread ai-services/internal/pkg/utils/util.go Outdated
Comment thread ai-services/internal/pkg/vars/var.go Outdated
Comment thread ai-services/tests/e2e/cli/output.go Outdated
Comment thread ai-services/cmd/ai-services/cmd/application/create.go Outdated
Comment thread ai-services/cmd/ai-services/cmd/application/create.go Outdated
Comment thread ai-services/internal/pkg/catalog/cli/configure/podman/configure.go Outdated
Comment thread ai-services/internal/pkg/application/podman/create.go Outdated
Comment thread ai-services/internal/pkg/application/podman/create.go Outdated
Comment thread ai-services/internal/pkg/catalog/cli/configure/podman/configure.go Outdated
Comment thread ai-services/internal/pkg/catalog/cli/configure/podman/configure.go Outdated
Comment thread ai-services/internal/pkg/catalog/cli/configure/podman/configure.go Outdated
Comment thread ai-services/internal/pkg/constants/common.go Outdated
Comment thread ai-services/internal/pkg/utils/util.go Outdated
shwetha-s-poojary added 7 commits April 30, 2026 09:55
- Add --appdir flag to catalog configure and application create commands
- Introduce constants.DefaultAppDir as single source of truth for default path
- Add early permission validation before any operations
- Update all templates to use dynamic appDir from values
- Set AI_SERVICES_APP_DIR environment variable for runtime path resolution
- Update vars.ModelDirectory dynamically based on appDir
- Modify application templates to use {{ .Values.appDir }}
- Update test files to use constants.GetApplicationsPath()

Fixes: Hardcoded /var/lib/ai-services path throughout codebase
Enables: Users to specify custom storage locations for AI services data

Signed-off-by: shwetha-s-poojary <shwetha.s-pooojary@ibm.com>
…bdirectory

- Rename validateAppDir to validateBaseDir (moved to utils)
- Change all appDir references to baseDir in code, comments, and YAML
- Convert application create --basedir flag to --params baseDir
- Create ai-services/ subdirectory to isolate data
- Fix GetBaseDir() to process custom path

Signed-off-by: shwetha-s-poojary <shwetha.s-pooojary@ibm.com>
Signed-off-by: shwetha-s-poojary <shwetha.s-pooojary@ibm.com>
Signed-off-by: shwetha-s-poojary <shwetha.s-pooojary@ibm.com>
- Move path utilities from constants to utils package
- Remove ModelDirectory global variable
- Simplify baseDir configuration in values.yaml
- Update documentation and test expectations

Signed-off-by: shwetha-s-poojary <shwetha.s-pooojary@ibm.com>
…dateBaseDir

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants