Skip to content

CNFCERT-1258: Add kustomize validation check - #3054

Merged
jc-rh merged 1 commit into
openshift-kni:mainfrom
sebrandon1:add_kustomization_test
Aug 12, 2026
Merged

CNFCERT-1258: Add kustomize validation check#3054
jc-rh merged 1 commit into
openshift-kni:mainfrom
sebrandon1:add_kustomization_test

Conversation

@sebrandon1

@sebrandon1 sebrandon1 commented Oct 30, 2025

Copy link
Copy Markdown
Contributor

Summary

Adds a kustomize validation check that runs kustomize build against all kustomization.yaml files to catch YAML structure issues early. Ported from telco-reference#433 (merged).

  • New GitHub Actions workflow runs on PRs to main
  • New make test-kustomize target for local validation; also wired into ci-job and lint
  • Script auto-generates temporary related-images/patch.yaml via envsubst when missing, cleans up on exit
  • Excludes vendor/, .git/, bin/, telco5g-konflux/ directories

Jira: CNFCERT-1258

Related PRs

Repo PR Status
telco-reference #433 merged
cnf-features-deploy #3097 open
numaresources-operator #2398 open
cluster-group-upgrades-operator #4462 open
mixed-cpu-node-plugin #18 open
eapol-operator #21 open
kkube #2 open
performance-addon-operators #969 open

Test plan

  • make test-kustomize passes locally
  • GitHub Actions workflow triggers on PR to main
  • Intentionally break a kustomization.yaml and confirm the check fails

@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from bda0fd3 to 9e3d962 Compare October 30, 2025 20:05
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from 9e3d962 to cd26643 Compare November 21, 2025 20:21
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from cd26643 to f20c118 Compare December 16, 2025 19:44
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from f20c118 to d88abd7 Compare January 13, 2026 15:04
@sebrandon1 sebrandon1 changed the title Add kustomize validation check CNFCERT-1258: Add kustomize validation check Jan 16, 2026
@openshift-ci-robot

openshift-ci-robot commented Jan 16, 2026

Copy link
Copy Markdown

@sebrandon1: This pull request references CNFCERT-1258 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 task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Similar to: openshift-kni/telco-reference#433

Changes:

  • Adds a quick PR check that attempts to kustomize build appropriate files. Only runs against main.
  • Adds a make path for make test-kustomize which runs the script. Users can run this locally as well as there are safeguards to ensure kustomize exists first.
  • Skips YAMLs that might require external plugins. See EXCLUDED_DIRS.

Example run:

$ make test-kustomize 
hack/test-kustomize.sh
Generating temporary patch file for validation: ./config/manager/related-images/patch.yaml

Checking all kustomization.yaml files can build successfully...

 ./config/crd: OK
 ./config/default: OK
 ./config/manager: OK
 ./config/manifests: OK
 ./config/networkpolicies: OK
 ./config/prometheus: OK
 ./config/rbac: OK
 ./config/samples: OK
 ./config/scorecard: OK

Summary: Checked 9 kustomization.yaml files, skipped 0 (require external plugins)
All kustomization files validated successfully!

Cleaning up temporary files...
 Removed: ./config/manager/related-images/patch.yaml
Kustomize validation completed successfully.

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.

@sebrandon1

Copy link
Copy Markdown
Contributor Author

/retest

@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch 2 times, most recently from 15b2e13 to 0bcb84b Compare February 25, 2026 21:21
@sebrandon1

Copy link
Copy Markdown
Contributor Author

/retest

@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from 231c2f8 to fd70e58 Compare April 14, 2026 21:55
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 14, 2026
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from fd70e58 to c8a6ad3 Compare April 16, 2026 22:25
@sebrandon1

Copy link
Copy Markdown
Contributor Author

/retest

@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from c8a6ad3 to aca47b2 Compare April 16, 2026 22:37
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 16, 2026
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from aca47b2 to 4b99d22 Compare April 16, 2026 22:56
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 16, 2026
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from 4b99d22 to 4592b5b Compare April 17, 2026 12:46
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 17, 2026
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from 4592b5b to 68a452d Compare April 17, 2026 12:53
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 22, 2026
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from 68a452d to d7d6305 Compare April 27, 2026 22:18
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 27, 2026
@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@sebrandon1, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 77789a93-fd01-4eeb-ad38-01fc5f9966b2

📥 Commits

Reviewing files that changed from the base of the PR and between d649b92 and bd4be7a.

📒 Files selected for processing (1)
  • hack/test-kustomize.sh
📝 Walkthrough

Walkthrough

Adds pull-request kustomization validation through GitHub Actions, Make integration, and a script that discovers and builds kustomizations with cleanup and aggregated failure reporting.

Changes

Kustomize validation

Layer / File(s) Summary
Pull-request validation workflow
.github/workflows/kustomize-validation.yml
Runs make test-kustomize for pull requests targeting main with read-only repository permissions.
Make validation entrypoint
Makefile
Adds test-kustomize and wires it into the ci-job and lint prerequisite chains.
Kustomization discovery and build validation
hack/test-kustomize.sh
Optionally generates a related-images patch, discovers kustomizations, runs builds, handles exclusions and temporary-file cleanup, and reports aggregate failures.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PullRequest
  participant GitHubActions
  participant Runner
  participant Make
  participant TestScript
  participant Kustomize
  PullRequest->>GitHubActions: triggers workflow for main
  GitHubActions->>Runner: starts validation job
  Runner->>Make: run make test-kustomize
  Make->>TestScript: invoke validation script
  TestScript->>Kustomize: build discovered kustomizations
  Kustomize-->>TestScript: return build output or errors
  TestScript-->>Make: return validation status
Loading

Suggested reviewers: missxiaoguo, rauhersu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
Title check ✅ Passed The title clearly identifies the addition of a Kustomize validation check, which is the main change in the pull request.
Description check ✅ Passed The description explains the purpose, implementation, related work, and test plan for the Kustomize validation check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/kustomize-validation.yml:
- Around line 27-43: Remove the entire manual kustomize install loop and
subsequent sudo mv/kustomize/version check in the workflow (the curl | bash
download, retry loop, sudo mv kustomize /usr/local/bin/, and kustomize version
lines). Instead rely on the repository Makefile targets (test-kustomize and the
kustomize task) which install a pinned kustomize v5.1.1 into ./bin and update
PATH; delete the redundant installation steps to avoid the unpinned curl|bash
supply-chain risk and keep the workflow using the Makefile-managed kustomize.

In `@hack/test-kustomize.sh`:
- Around line 99-100: The script exits early due to set -e when running
BUILD_OUTPUT=$(kustomize build "$dir" 2>&1); change this to prevent errexit,
e.g. run BUILD_OUTPUT=$(kustomize build "$dir" 2>&1) || BUILD_EXIT=$? || true
(or temporarily disable errexit with set +e / set -e), then replace the
subsequent check that uses "$?" with a check against BUILD_EXIT (e.g. if [
"${BUILD_EXIT:-0}" -eq 0 ]; then) so each directory is tested and failures are
aggregated for the summary while still capturing the build output in
BUILD_OUTPUT.

In `@internal/clusterconfig/lvmconfig.go`:
- Around line 101-102: Current code only clears uid and resourceVersion on the
LocalVolume (lv.SetUID("") / lv.SetResourceVersion("")) leaving other transient
metadata; replace that ad-hoc cleanup by invoking the package's CleanResource
helper to fully sanitize metadata (e.g., call CleanResource(&lv.ObjectMeta) for
the LocalVolume) and do the same for the StorageClass export; remove the lone
SetUID/SetResourceVersion lines and ensure CleanResource is applied to the
resource ObjectMeta so managedFields, generation, ownerReferences, status,
creationTimestamp, etc., are all cleared consistently.
🪄 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: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 72dbf3e9-2924-4e4f-92b7-b9b534a788b8

📥 Commits

Reviewing files that changed from the base of the PR and between b6a88cc and d7d6305.

📒 Files selected for processing (5)
  • .github/workflows/kustomize-validation.yml
  • .golangci.yml
  • Makefile
  • hack/test-kustomize.sh
  • internal/clusterconfig/lvmconfig.go
💤 Files with no reviewable changes (1)
  • .golangci.yml

Comment thread .github/workflows/kustomize-validation.yml Outdated
Comment thread hack/test-kustomize.sh Outdated
Comment thread internal/clusterconfig/lvmconfig.go Outdated
@sebrandon1

Copy link
Copy Markdown
Contributor Author

/retest-required

@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from d7d6305 to 019eb8c Compare April 30, 2026 21:36

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@hack/test-kustomize.sh`:
- Around line 37-46: Add an explicit preflight check for the envsubst command
(from gettext) similar to the existing kustomize check: verify that envsubst is
available (command -v envsubst) before any patch generation or usage, emit a
clear error message advising installation of gettext/envsubst with
platform-specific instructions (e.g., apt install gettext on Linux, brew install
gettext on macOS) and exit non-zero if missing; update the script area that
later calls envsubst so it's guarded by this new check and references the symbol
envsubst to locate where to add it.
🪄 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: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 4f76d700-7508-4274-a730-a7a6e2546eed

📥 Commits

Reviewing files that changed from the base of the PR and between d7d6305 and 019eb8c.

📒 Files selected for processing (5)
  • .github/workflows/kustomize-validation.yml
  • .golangci.yml
  • Makefile
  • hack/test-kustomize.sh
  • internal/clusterconfig/lvmconfig.go
💤 Files with no reviewable changes (1)
  • .golangci.yml
✅ Files skipped from review due to trivial changes (2)
  • .github/workflows/kustomize-validation.yml
  • internal/clusterconfig/lvmconfig.go

Comment thread hack/test-kustomize.sh
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from 019eb8c to bd90136 Compare June 3, 2026 15:54

@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

🤖 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 @.github/workflows/kustomize-validation.yml:
- Around line 16-17: The checkout step using actions/checkout@v4 currently
leaves credentials persisted; update that step to include persist-credentials:
false so the checkout does not retain Git credentials (since this workflow only
runs read-only validation). Locate the job step with name "Checkout repository"
and the uses: actions/checkout@v4 and add the persist-credentials: false key
under that step.
- Line 17: Replace the loose tag reference in the workflow's actions/checkout
usage with a pinned commit SHA: locate the line containing "uses:
actions/checkout@v4" and change it to use the exact commit SHA for the desired
v4 release (e.g., actions/checkout@<commit-sha>), and optionally add a comment
noting the v4 version for readability; ensure the unique string
"actions/checkout" is updated everywhere in this workflow.
🪄 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: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 2aeeac8b-97fb-4562-b609-4b6e894f22cf

📥 Commits

Reviewing files that changed from the base of the PR and between 019eb8c and bd90136.

📒 Files selected for processing (5)
  • .github/workflows/kustomize-validation.yml
  • .golangci.yml
  • Makefile
  • hack/test-kustomize.sh
  • internal/clusterconfig/lvmconfig.go
💤 Files with no reviewable changes (1)
  • .golangci.yml
🚧 Files skipped from review as they are similar to previous changes (3)
  • hack/test-kustomize.sh
  • Makefile
  • internal/clusterconfig/lvmconfig.go

Comment thread .github/workflows/kustomize-validation.yml
Comment thread .github/workflows/kustomize-validation.yml
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from bd90136 to 0e5562d Compare June 4, 2026 16:54
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from 0e5562d to 5891878 Compare June 15, 2026 22:08
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch 3 times, most recently from 47bf53f to a8e813a Compare July 28, 2026 15:22
@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch 3 times, most recently from c58f253 to 52ec517 Compare August 3, 2026 20:00
@openshift-ci-robot

openshift-ci-robot commented Aug 4, 2026

Copy link
Copy Markdown

@sebrandon1: This pull request references CNFCERT-1258 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:

Summary

Adds a kustomize validation check that runs kustomize build against all kustomization.yaml files to catch YAML structure issues early. Ported from telco-reference#433 (merged).

  • New GitHub Actions workflow runs on PRs to main
  • New make test-kustomize target for local validation; also wired into ci-job and lint
  • Script auto-generates temporary related-images/patch.yaml via envsubst when missing, cleans up on exit
  • Excludes vendor/, .git/, bin/, telco5g-konflux/ directories

Jira: CNFCERT-1258

Related PRs

Repo PR Status
telco-reference #433 merged
cnf-features-deploy #3097 open
numaresources-operator #2398 open
cluster-group-upgrades-operator #4462 open
mixed-cpu-node-plugin #18 open
eapol-operator #21 open
kkube #2 open
performance-addon-operators #969 open

Test plan

  • make test-kustomize passes locally
  • GitHub Actions workflow triggers on PR to main
  • Intentionally break a kustomization.yaml and confirm the check fails

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.

@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch 3 times, most recently from bd8a73a to 8144578 Compare August 11, 2026 13:05
@openshift-ci

openshift-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

@sebrandon1: 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/ipc-e2e-flow-v6v4 8144578 link false /test ipc-e2e-flow-v6v4
ci/prow/ipc-e2e-flow-v4v6 8144578 link false /test ipc-e2e-flow-v4v6
ci/prow/ibu-e2e-flow-v4v6 8144578 link false /test ibu-e2e-flow-v4v6

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.

@sebrandon1
sebrandon1 force-pushed the add_kustomization_test branch from 8144578 to bd4be7a Compare August 12, 2026 13:29
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 12, 2026
@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jc-rh

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

The pull request process is described 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 12, 2026
@jc-rh
jc-rh merged commit 1daee61 into openshift-kni:main Aug 12, 2026
12 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants