Skip to content

Fix custom metrics adapter OpenAPI v3 definitions#1195

Open
bruno-espino wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
bruno-espino:fix/openapi-v3-config
Open

Fix custom metrics adapter OpenAPI v3 definitions#1195
bruno-espino wants to merge 1 commit into
GoogleCloudPlatform:masterfrom
bruno-espino:fix/openapi-v3-config

Conversation

@bruno-espino

@bruno-espino bruno-espino commented May 20, 2026

Copy link
Copy Markdown

Set OpenAPIV3Config with the same generated definitions used for OpenAPI v2.

Observed from adapter logs with gcr.io/gke-release/custom-metrics-stackdriver-adapter:v0.16.7-gke.0 after the API aggregation layer queried OpenAPI v3:

Failed to build OpenAPI v3 for group apis/custom.metrics.k8s.io/v1beta2, "cannot find model definition for io.k8s.metrics.pkg.apis.custom_metrics.v1beta2.MetricValueList..."
Failed to build OpenAPI v3 for group apis/custom.metrics.k8s.io/v1beta1, "cannot find model definition for io.k8s.metrics.pkg.apis.custom_metrics.v1beta1.MetricValueList..."
Failed to build OpenAPI v3 for group apis/external.metrics.k8s.io/v1beta1, "cannot find model definition for io.k8s.metrics.pkg.apis.external_metrics.v1beta1.ExternalMetricValueList..."

Local repro: leave OpenAPIV3Config nil, call cmd.Config() before WithCustomMetrics / WithExternalMetrics, then build v3 definitions for one of the model names above. custom-metrics-apiserver initializes a default v3 config at that point, before metric providers are registered, so the custom/external metric definitions are missing.

#1174 added the name mapping for OpenAPIConfig, but OpenAPIV3Config is still nil. This wires v3 to the same generated definitions and adds a regression test for the exact missing model names.

@google-cla

google-cla Bot commented May 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant