Skip to content

OTA-1975: add products-data container and service to service products.json if present in graph-data image#270

Open
ankitathomas wants to merge 1 commit into
openshift:masterfrom
ankitathomas:products-data
Open

OTA-1975: add products-data container and service to service products.json if present in graph-data image#270
ankitathomas wants to merge 1 commit into
openshift:masterfrom
ankitathomas:products-data

Conversation

@ankitathomas

@ankitathomas ankitathomas commented Jul 9, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features
    • Added an additional products-data TCP port on 8090 for the graph-building service (and matching container port exposure).
  • Development
    • Development Docker images now ensure products.json exists by downloading it when missing, or initializing an empty file if the download fails.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 9, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 9, 2026

Copy link
Copy Markdown

@ankitathomas: This pull request references OTA-1975 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2ea73663-89d1-4498-b17c-09c1a82e8119

📥 Commits

Reviewing files that changed from the base of the PR and between 44c10ab and 2511f54.

📒 Files selected for processing (4)
  • controllers/new.go
  • controllers/testdata/resources/zz_fixture_Test_newKubeResources_deployment.yaml
  • controllers/testdata/resources/zz_fixture_Test_newKubeResources_graph_builder_service.yaml
  • dev/Dockerfile
🚧 Files skipped from review as they are similar to previous changes (4)
  • controllers/testdata/resources/zz_fixture_Test_newKubeResources_deployment.yaml
  • dev/Dockerfile
  • controllers/testdata/resources/zz_fixture_Test_newKubeResources_graph_builder_service.yaml
  • controllers/new.go

Walkthrough

The development image now prepares products.json. Graph-builder Kubernetes resources declare and expose a TCP products-data port on 8090, with deployment and Service fixtures updated accordingly.

Changes

Products data exposure

Layer / File(s) Summary
Prepare products data
dev/Dockerfile
Conditionally downloads products.json and falls back to {} when the download fails.
Expose graph-builder port
controllers/new.go, controllers/testdata/resources/zz_fixture_Test_newKubeResources_*.yaml
Adds the products-data TCP port on 8090 to the graph-builder container and Service definitions, with matching fixtures.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a products-data container and service for products.json when present in the graph-data image.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No test titles changed; the PR only updates fixtures and resource specs, and existing test names are static and deterministic.
Test Structure And Quality ✅ Passed No Ginkgo test code changed; the PR only updates generated fixtures and production port wiring, so the listed Ginkgo quality risks don’t apply.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; only unit-test fixtures and production code changed, with no MicroShift-unsafe APIs/features in test code.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests were added in the touched files; the PR only changes controller/service fixtures and a Dockerfile, so there are no SNO assumptions to flag.
Topology-Aware Scheduling Compatibility ✅ Passed The PR only adds a new service/container port and a Dockerfile data fetch; the Deployment has no affinity, nodeSelector, tolerations, or topology spread changes.
Ote Binary Stdout Contract ✅ Passed PR only adds service/container ports and a Dockerfile download; no process-level stdout writes or logging setup were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; only controller, fixture, and Dockerfile changes, so the IPv6/disconnected-network test check is not applicable.
No-Weak-Crypto ✅ Passed The PR only adds a new service/container port and a curl fallback; the added lines contain no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB or secret comparisons.
Container-Privileges ✅ Passed Touched manifests/code add only ports and a file download; no privileged, host*, SYS_ADMIN, or allowPrivilegeEscalation settings were introduced.
No-Sensitive-Data-In-Logs ✅ Passed Touched hunks add ports and a public products.json download; no new log statements or secret/PII fields were introduced.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
controllers/testdata/resources/zz_fixture_Test_newKubeResources_deployment.yaml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

controllers/testdata/resources/zz_fixture_Test_newKubeResources_graph_builder_service.yaml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

dev/Dockerfile

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ankitathomas
Once this PR has been reviewed and has the lgtm label, please assign pratikmahajan for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
controllers/new.go (1)

1040-1133: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider avoiding repeated magic port literal and hardcoded bind address.

8082 is repeated 5 times across Args/Ports/Probes/Service, and "::" is hardcoded rather than sourced from a ConfigMap/env like ADDRESS is for policy-engine. Extracting a shared constant for the port would reduce drift risk, and aligning the address with the existing env-config pattern would improve consistency with the rest of the file.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@controllers/new.go` around lines 1040 - 1133, Update
newProductsServiceContainer and newProductsService to use a shared named
constant for port 8082 across arguments, container/service ports, and probes,
and replace the hardcoded "::" bind address with the file’s established
ConfigMap or environment-based ADDRESS pattern used by policy-engine.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@controllers/new.go`:
- Line 1063: Update newProductsServiceContainer to use dedicated minimal volume
mounts instead of newGraphBuilderVolumeMounts(instance). Mount only the
cincinnati-graph-data volume at the products graph-data path needed to serve
products.json, excluding /etc/configs, pull-secret, and trusted-ca; then update
the affected deployment fixture to match.

In `@dev/Dockerfile`:
- Around line 7-10: Update the products.json setup commands so curl treats
non-2xx responses as failures and uses the existing empty-object fallback, then
remove the unconditional `|| true` from the mkdir/mv command. Ensure directory
creation and moving products.json fail the image build when placement is
unsuccessful.

---

Nitpick comments:
In `@controllers/new.go`:
- Around line 1040-1133: Update newProductsServiceContainer and
newProductsService to use a shared named constant for port 8082 across
arguments, container/service ports, and probes, and replace the hardcoded "::"
bind address with the file’s established ConfigMap or environment-based ADDRESS
pattern used by policy-engine.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3700c0d7-8643-43c6-b35b-5beb34cbac30

📥 Commits

Reviewing files that changed from the base of the PR and between 0c73b3c and 12324be.

📒 Files selected for processing (5)
  • controllers/names.go
  • controllers/new.go
  • controllers/testdata/resources/zz_fixture_Test_newKubeResources_deployment.yaml
  • controllers/updateservice_controller.go
  • dev/Dockerfile

Comment thread controllers/new.go Outdated
Protocol: corev1.ProtocolTCP,
},
},
VolumeMounts: k.newGraphBuilderVolumeMounts(instance),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Products container is over-mounted with unrelated secrets/config.

newProductsServiceContainer reuses k.newGraphBuilderVolumeMounts(instance) wholesale, which (per the fixture) mounts /etc/configs (gb.toml), pull-secret (registry credentials), and trusted-ca in addition to cincinnati-graph-data. The products-service only needs read access to /var/lib/cincinnati/graph-data/products to serve products.json; there's no evident need for registry pull-secret or trusted CA material in this container. This unnecessarily widens the container's access to sensitive data (registry credentials) for a component whose only job is serving a static JSON file.

🔒 Proposed fix: dedicated, minimal volume mounts
-		VolumeMounts: k.newGraphBuilderVolumeMounts(instance),
+		VolumeMounts: []corev1.VolumeMount{
+			{
+				MountPath: "/var/lib/cincinnati/graph-data",
+				Name:      "cincinnati-graph-data",
+			},
+		},

Note: the fixture file controllers/testdata/resources/zz_fixture_Test_newKubeResources_deployment.yaml will need updating to match once this is fixed.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
VolumeMounts: k.newGraphBuilderVolumeMounts(instance),
VolumeMounts: []corev1.VolumeMount{
{
MountPath: "/var/lib/cincinnati/graph-data",
Name: "cincinnati-graph-data",
},
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@controllers/new.go` at line 1063, Update newProductsServiceContainer to use
dedicated minimal volume mounts instead of
newGraphBuilderVolumeMounts(instance). Mount only the cincinnati-graph-data
volume at the products graph-data path needed to serve products.json, excluding
/etc/configs, pull-secret, and trusted-ca; then update the affected deployment
fixture to match.

Comment thread dev/Dockerfile Outdated
Comment on lines +7 to +10
RUN curl -L -o products.json https://access.redhat.com/product-life-cycles/api/v2/products || echo "{}" > products.json

RUN mkdir -p /var/lib/cincinnati-graph-data/products && mv products.json /var/lib/cincinnati-graph-data/products/ || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Curl/mv failures are silently swallowed — build succeeds even when products.json fetch/placement fails.

  • Line 7: curl lacks -f/--fail, so a non-2xx HTTP response (e.g. API outage, 404/500) still exits 0 and its body gets written into products.json instead of triggering the {} fallback.
  • Line 9: || true swallows any mkdir/mv failure, so the build succeeds even if products.json never ends up under /products/, leaving products-service without data at runtime with no build-time signal.
🛠️ Proposed fix
-RUN curl -L -o products.json https://access.redhat.com/product-life-cycles/api/v2/products || echo "{}" > products.json
+RUN curl -f -L -o products.json https://access.redhat.com/product-life-cycles/api/v2/products || echo "{}" > products.json

-RUN mkdir -p /var/lib/cincinnati-graph-data/products && mv products.json /var/lib/cincinnati-graph-data/products/ || true
+RUN mkdir -p /var/lib/cincinnati-graph-data/products && mv products.json /var/lib/cincinnati-graph-data/products/
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
RUN curl -L -o products.json https://access.redhat.com/product-life-cycles/api/v2/products || echo "{}" > products.json
RUN mkdir -p /var/lib/cincinnati-graph-data/products && mv products.json /var/lib/cincinnati-graph-data/products/ || true
RUN curl -f -L -o products.json https://access.redhat.com/product-life-cycles/api/v2/products || echo "{}" > products.json
RUN mkdir -p /var/lib/cincinnati-graph-data/products && mv products.json /var/lib/cincinnati-graph-data/products/
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dev/Dockerfile` around lines 7 - 10, Update the products.json setup commands
so curl treats non-2xx responses as failures and uses the existing empty-object
fallback, then remove the unconditional `|| true` from the mkdir/mv command.
Ensure directory creation and moving products.json fail the image build when
placement is unsuccessful.

@ankitathomas

Copy link
Copy Markdown
Author

@ankitathomas: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:
Test name Commit Details Required Rerun command
ci/prow/operator-e2e-old-ocp-published-graph-data 12324be link true /test operator-e2e-old-ocp-published-graph-data
ci/prow/operator-e2e-hypershift-local-graph-data 12324be link true /test operator-e2e-hypershift-local-graph-data
ci/prow/operator-e2e-new-ocp-published-graph-data 12324be link true /test operator-e2e-new-ocp-published-graph-data
ci/prow/operator-e2e-new-ocp-published-graph-data-fips 12324be link true /test operator-e2e-new-ocp-published-graph-data-fips

Full PR test history. Your PR dashboard.
Details

Needs the binaries from openshift/cincinnati#1072 to pass.

@ankitathomas ankitathomas changed the title [WIP] OTA-1975: add products-data container and service to service products.json if present in graph-data image OTA-1975: add products-data container and service to service products.json if present in graph-data image Jul 20, 2026
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 20, 2026
@ankitathomas ankitathomas reopened this Jul 20, 2026
@ankitathomas

Copy link
Copy Markdown
Author

/retest

1 similar comment
@ankitathomas

Copy link
Copy Markdown
Author

/retest

Signed-off-by: Ankita Thomas <[email protected]>
Co-authored by: Claude
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@ankitathomas: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants