Skip to content

Deploy three-tier demo app service provider with kind cluster integration#26

Closed
ebichman-1 wants to merge 8 commits into
dcm-project:mainfrom
ebichman-1:add-three-tier-app
Closed

Deploy three-tier demo app service provider with kind cluster integration#26
ebichman-1 wants to merge 8 commits into
dcm-project:mainfrom
ebichman-1:add-three-tier-app

Conversation

@ebichman-1
Copy link
Copy Markdown

Description

Implements deployment of the Three Tier Demo App Service Provider (three-tier-demo-service-provider)
for provisioning Pet Clinic applications into local Kubernetes clusters via the DCM API gateway.

Changes

  1. compose.yaml
  • Added three-tier-demo-service-provider service under three-tier profile
  • Configured with correct image:
    quay.io/gciavarrini/three-tier-demo-service-provider:dev
  • Wired dependencies: k8s-container-service-provider, postgres, nats,
    service-provider-manager
  • Added database configuration (DB_NAME, DB_PASS) for three-tier-sp database
  1. Documentation
  • Created comprehensive deployment guide following k8s-container-sp-kind.md
    style
  • Prerequisites section explaining k8s-container-service-provider dependency
  • Step-by-step setup instructions (4 steps)
  • Troubleshooting section with common issues and solutions
  • Architecture explanation with "Why this is needed" table

Verify the setup:

```bash
curl -s http://localhost:9080/api/v1alpha1/health/providers | jq .
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This returns

{
  "path": "health",
  "status": "ok"
}

If you want the list of the providers , you need curl -s http://localhost:9080/api/v1alpha1/providers | jq .
that returns:

{
  "providers": [
    {
      "create_time": "2026-04-03T09:09:16.702995Z",
      "endpoint": "http://k8s-container-service-provider:8080/api/v1alpha1/containers",
      "health_status": "ready",
      "id": "2b489144-25d8-4569-adff-0ce2d28373fe",
      "name": "k8s-container-provider",
      "schema_version": "v1alpha1",
      "service_type": "container",
      "update_time": "2026-04-13T13:30:41.241445Z"
    }
  ]
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure, yeah... now I see that issue with the api path, I'll fix the documentation
Thanks

Comment thread docs/three-tier-app-kind.md Outdated
Comment on lines +25 to +33
### 1. Add the three-tier-demo-service-provider to compose.yaml

The compose file must include the `three-tier-demo-service-provider` service under a `three-tier` profile.
See the `compose.yaml` for the service definition. The service:

- Uses `quay.io/gciavarrini/three-tier-demo-service-provider:dev` as the image
- Depends on `k8s-container-service-provider`, `postgres`, and `nats`
- Mounts the same kubeconfig as the k8s-container-service-provider
- Exposes port 8080 for DCM integration
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The three-tier-demo-service-provider is already in the compose.yaml so no need for this section.

Comment thread docs/three-tier-app-kind.md Outdated
Check the SP is registered with DCM:

```bash
curl -s http://localhost:9080/api/v1alpha1/health/providers | jq '.data[] | select(.name | contains("three-tier"))'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

as before

Suggested change
curl -s http://localhost:9080/api/v1alpha1/health/providers | jq '.data[] | select(.name | contains("three-tier"))'
curl -s http://localhost:9080/api/v1alpha1/providers | jq '.data[] | select(.name | contains("three-tier"))'

Comment thread docs/three-tier-app-kind.md Outdated
Check the SP is registered with DCM:

```bash
curl -s http://localhost:9080/api/v1alpha1/health/providers | jq .
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

as before

Suggested change
curl -s http://localhost:9080/api/v1alpha1/health/providers | jq .
curl -s http://localhost:9080/api/v1alpha1/providers | jq .

### 2. Start the three-tier SP

```bash
podman-compose --profile three-tier up -d
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When i run this i get

➜ podman-compose --profile three-tier up -d
5a05a2ea5f95b8cb514e8f6b51fb90cc7a930a9818c4c659abe90bb2e2d58599
57a9bb067945c4b4d681ef11f65d66827df585e070cf83e2625d8dbaf40e1426
d9a04a05bb724bb4fa54f94bf5c95120b8cf60e5e555145063abf68e50532324
Trying to pull quay.io/dcm-project/catalog-manager:latest...
Getting image source signatures
Copying blob 637bdb9e3680 skipped: already exists  
Copying blob f52b3e1cd2c3 skipped: already exists  
Copying blob d70a90fdfb36 skipped: already exists  
Copying config 231ab65dec done   | 
Writing manifest to image destination
c6dcbf75100f5a53ff6bcb235e7e81b7432947623a02f96b2fedae83f2051361
Trying to pull quay.io/dcm-project/policy-manager:latest...
Getting image source signatures
Copying blob c3d205b197fa skipped: already exists  
Copying blob 4d1c90b89094 skipped: already exists  
Copying blob d70a90fdfb36 skipped: already exists  
Copying config cbd36b9ef9 done   | 
Writing manifest to image destination
0d2394f4634f86ab9f68ad49eb0e324863aede0c007ea369f1545b88b35cfc08
Trying to pull quay.io/dcm-project/placement-manager:latest...
Getting image source signatures
Copying blob 729ac8a02bea skipped: already exists  
Copying blob 3981efc92410 skipped: already exists  
Copying blob d70a90fdfb36 skipped: already exists  
Copying config cfeb7294a9 done   | 
Writing manifest to image destination
07a4d4bcd44501969cc13d322d11c54101fd850aa0e11e0f07065f24e9f75e2b
Trying to pull quay.io/dcm-project/service-provider-manager:latest...
Getting image source signatures
Copying blob 60b878fa7b7f skipped: already exists  
Copying blob 4f56b5b38ecc skipped: already exists  
Copying blob d70a90fdfb36 skipped: already exists  
Copying config f8996d9057 done   | 
Writing manifest to image destination
eed8fcd1c08f16693691d191b16d4fe324d67b170b8f45f28ec0284ad2ee6ac0
Trying to pull quay.io/gciavarrini/three-tier-demo-service-provider:dev...
Getting image source signatures
Copying blob 5fd3c8d94518 skipped: already exists  
Copying blob d70a90fdfb36 skipped: already exists  
Copying config 42534ad93f done   | 
Writing manifest to image destination
c810219aa38eb1d6f18f1047cd036f8c328a17c24ffe7c062d04e4b45f1ada96
cc12afe5c76d25c8fc0580fd4b6edb2f2f560855b5b749cd5b98038d4dfc197f
api-gateway-main_postgres_1
api-gateway-main_nats_1
api-gateway-main_catalog-manager_1
api-gateway-main_policy-manager_1
api-gateway-main_placement-manager_1
api-gateway-main_service-provider-manager_1
Traceback (most recent call last):
  File "/usr/bin/podman-compose", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/lib/python3.13/site-packages/podman_compose.py", line 4255, in main
    asyncio.run(async_main())
    ~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/usr/lib64/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib64/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/podman_compose.py", line 4251, in async_main
    await podman_compose.run()
  File "/usr/lib/python3.13/site-packages/podman_compose.py", line 2071, in run
    retcode = await cmd(self, args)
              ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/podman_compose.py", line 3187, in compose_up
    exit_code = await run_container(
                ^^^^^^^^^^^^^^^^^^^^
        compose, cnt["name"], deps_from_container(args, cnt), ([], "start", [cnt["name"]])
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/site-packages/podman_compose.py", line 3088, in run_container
    await check_dep_conditions(compose, deps)
  File "/usr/lib/python3.13/site-packages/podman_compose.py", line 3052, in check_dep_conditions
    deps_cd.extend(compose.container_names_by_service[d.name])
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'k8s-container-service-provider'

can you verify?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'll investigate the issue that cause this error

Comment thread compose.yaml
Comment thread docs/three-tier-app-kind.md Outdated
Find the Pet Clinic service type offered by the three-tier SP. Then provision an instance:

```bash
curl -X POST http://localhost:9080/api/v1alpha1/service-type-instances \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No, user's are not supposed to create service-type-instances on their own. Furthermore, you can see that the API Gateway only supports GET on this endpoint:

service-type-instances-collection:
.

Instead, user's should create a CatalogItemInstance based on the pre-seeded CatalogItem

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for that comment, fixed that on the last commit

Comment thread compose.yaml

three-tier-demo-service-provider:
profiles: ["providers", "three-tier"]
image: quay.io/gciavarrini/three-tier-demo-service-provider:dev
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This repo should point to the dcm-project images. In this case: quay.io/dcm-project/three-tier-app-demo-service-provider:main (by the time this gets merged, new images from the main branch will be tagged as main)
You can change it locally for your development.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't have the official image yet, i suggested using this dev image as a temporary workaround.
Agree on using the correct one in the PR

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread compose.yaml
@ygalblum
Copy link
Copy Markdown
Contributor

Also please make sure to use --signoff as part of the git commit commands.

Comment thread docs/three-tier-app-kind.md Outdated
### 2. Provision a Pet Clinic application

Use the DCM Service Provider Manager API to provision a Pet Clinic app.
> **Important:** Users are not supposed to create service-type-instances on their own. The API Gateway only supports GET on the `/api/v1alpha1/service-type-instances` endpoint. Instead, you must create a CatalogItemInstance based on a pre-seeded CatalogItem.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment is true for all types. Nothing specific. So, I don't think it needs to be here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Gloria already comment me in on that on email. ! I'll make sure to include it in every commit going forward. Sure, Thanks!

@ebichman-1 ebichman-1 force-pushed the add-three-tier-app branch 3 times, most recently from 7b7d9a7 to b20a668 Compare April 19, 2026 16:50
- Add three-tier-demo-service-provider to compose.yaml under three-tier profile
- Wire to k8s-container-service-provider, postgres, and nats services
- Create docs/three-tier-app-kind.md with setup and troubleshooting guide

Signed-off-by: ebichman-1 <ebichman@redhat.com>
- Added the missing compose.yaml configuration for initialize the database

Signed-off-by: ebichman-1 <ebichman@redhat.com>
- Updated the three-tier-app-kind.md guide with improved styling to enhance the user experience.

Signed-off-by: ebichman-1 <ebichman@redhat.com>
- Fixes according to the comments in the CR

Signed-off-by: ebichman-1 <ebichman@redhat.com>
- Fixes according to the comments in the CR

Assisted-by: Claude (Anthropic)
Signed-off-by: ebichman-1 <ebichman@redhat.com>
\
- Fixes according to the comments in the CR - Added the database creation SQL command for the three-tier app
Assisted-by: Claude (Anthropic)

Signed-off-by: ebichman-1 <ebichman@redhat.com>
- Fixes according to the comments in the PR
- Changed the documentation according to PR comments

Assisted-by: Claude (Anthropic)
Signed-off-by: ebichman-1 <ebichman@redhat.com>
… align

  documentation

  Fixes the deployment failure when running 'podman-compose --profile three-tier
   up -d'
  that resulted in 'KeyError: k8s-container-service-provider'
  (PRPs/logs-with-issues.log:309).

  Root cause: three-tier-demo-service-provider depends on
  k8s-container-service-provider
  (compose.yaml line 193), but they had separate profiles. When only --profile
  three-tier
  was specified, k8s-container wasn't loaded, causing dependency resolution to
  fail.

  Changes:

  1. compose.yaml (line 129):
     - Add 'three-tier' to k8s-container-service-provider profiles
     - Ensures k8s-container loads automatically when three-tier profile is
  activated
     - Preserves backward compatibility (k8s-container can still run
  independently)

  2. Makefile:
     - Add run-k8s-container: Deploy k8s-container provider only
     - Add run-three-tier: Deploy three-tier + k8s-container (with dependency)
     - Add run-all-providers: Deploy all service providers
     - All targets validate kubeconfig.yaml exists and set
  K8S_CONTAINER_SP_KUBECONFIG
     - Update .PHONY declaration

  3. docs/three-tier-app-kind.md:
     - Add Makefile usage instructions (recommended approach)
     - Update verification commands to use 'podman ps' (podman-compose ps
  compatibility)

  4. docs/k8s-container-sp-kind.md:
     - Fix network name: api-gateway_default → api-gateway-srv-container_default
     - Update step 2 to clarify starting core services first
     - Add Makefile target as recommended deployment method

  5. RUN.md:
     - Add 'Three-tier demo app service provider' section
     - Document prerequisites and deployment workflow
     - Add THREE_TIER_SP_* variables to configuration table
     - Update verification commands from podman-compose to podman ps

  6. .env.example:
     - Add three-tier service provider configuration variables

  7. README.md:
     - Update quick-start with new Makefile targets

  Tested:
  - make validate-config ✓
  - make run ✓
  - make run-k8s-container ✓
  - make run-three-tier ✓ (no KeyError - primary fix verified)
  - Error handling (missing kubeconfig) ✓
  - Both services deploy and register successfully
  - Databases created (service-provider, three-tier-sp)

  Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
  Signed-off-by: ebichman-1 <ebichman@redhat.com>

Signed-off-by: ebichman-1 <ebichman@redhat.com>
@gciavarrini
Copy link
Copy Markdown
Contributor

Closing in favor of #29, which carries the same work with an updated compose wiring and documentation.
Thanks @ebichman-1 for the draft.

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.

3 participants