Skip to content

Conversation

@zetxqx
Copy link
Contributor

@zetxqx zetxqx commented Dec 8, 2025

What type of PR is this?

/kind bug
/kind cleanup

What this PR does / why we need it:

This fixes an issue where the controller manager would fail to start if the InferenceModelRewrite or InferenceObjective CRDs were missing. This change introduces a dynamic check for the existence of these CRDs before attempting to set up reconcilers or adding them to the cache. This allows the controller to gracefully handle environments where these optional CRDs are not installed, even when CRD reconciliation is generally enabled.

Tested with deleting the inferenceModelRewrites CRD and start the EPP successfully.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

Make InferenceModelRewrite and InferenceObjective optional to install

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Dec 8, 2025
@netlify
Copy link

netlify bot commented Dec 8, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 04c65b4
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/694044856d1538000835a69c
😎 Deploy Preview https://deploy-preview-1967--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 8, 2025
@zetxqx zetxqx force-pushed the skipconfig branch 2 times, most recently from e264344 to 1c13110 Compare December 8, 2025 17:47
@zetxqx
Copy link
Contributor Author

zetxqx commented Dec 8, 2025

/cc @kfswain @ahg-g

This is another inferenceModelRewrites hardening PR. This will let both inferenceModelRewrites and InferenceObjective be optional for EPP startup. In case someone missing install those CRDs and not planning to use them. Revealed in #1936

I tested this working well by deleting the infrenceModelRewrites CRD in my cluster and start the EPP with my custom image including this PR. And the EPP can start successfully.

@k8s-ci-robot k8s-ci-robot requested a review from ahg-g December 8, 2025 18:55
@zetxqx zetxqx changed the title fix(epp): conditionally skip watching InferenceModelRewrite and InferenceObjective fix(inferenceModelRewrites): conditionally skip watching InferenceModelRewrite and InferenceObjective Dec 8, 2025
)

type ControllerConfig struct {
disableK8sCrdReconcile bool
Copy link
Contributor

@ahg-g ahg-g Dec 12, 2025

Choose a reason for hiding this comment

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

I would flip this from disable to enable semantic, also rename to startCrdReconcilers

Copy link
Contributor

Choose a reason for hiding this comment

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

mostly to avoid cases like !disable, double negate is not a good pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call, updated in 35a3485

Copy link
Contributor

@ahg-g ahg-g left a comment

Choose a reason for hiding this comment

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

sounds good to me, left one nit, let me know if you agree

@ahg-g
Copy link
Contributor

ahg-g commented Dec 12, 2025

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 12, 2025
@zetxqx zetxqx requested a review from ahg-g December 13, 2025 09:24
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 14, 2025
@ahg-g
Copy link
Contributor

ahg-g commented Dec 15, 2025

needs a rebase unfortunately

…enceObjective when disableK8sCrdReconcile is true

This fixes an issue where the controller manager would fail to start if the InferenceModelRewrite or InferenceObjective CRDs were missing.
This change introduces a dynamic check for the existence of these CRDs before attempting to set up reconcilers or adding them to the cache. This allows the controller to gracefully handle environments where these optional CRDs are not installed, even when CRD reconciliation is generally enabled.

Refactoring:
- Moved kindExists to pkg/epp/server/controller_manager.go
- Updated kindExists signature to accept discovery.DiscoveryInterface
- Reused discovery client in NewDefaultManager and ExtProcServerRunner.SetupWithManager to avoid repeated client creation overhead.

Done by: gemini-cli
TEST=go test ./pkg/epp/server/... passed
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 15, 2025
@zetxqx zetxqx force-pushed the skipconfig branch 2 times, most recently from 59db1d2 to ab7f4b4 Compare December 15, 2025 17:17
@ahg-g
Copy link
Contributor

ahg-g commented Dec 15, 2025

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 15, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, zetxqx

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

@k8s-ci-robot k8s-ci-robot merged commit d4f98e1 into kubernetes-sigs:main Dec 15, 2025
12 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants