opentelemetry-operator icon indicating copy to clipboard operation
opentelemetry-operator copied to clipboard

config-sync fails to validate CRD before applying due to .status element

Open varyag00 opened this issue 6 months ago • 4 comments

Hi! When attempting to install opentelemetry-operator helm chart via config-sync, the following error occurs:

KNV1045: Configs with "status" specified are not allowed. 
To fix, either remove the config or remove the "status" field in the config: source: 
/repo/source/0.88.1/opentelemetry-operator/templates/admission-webhooks/operator-webhook.yaml 
metadata.name: opampbridges.opentelemetry.io group: apiextensions.k8s.io version: v1 kind: 
CustomResourceDefinition For more information, see https://g.co/cloud/acm-errors#knv1045

The error points me towards the CRDs, each of which has this top-level status property:

  • https://github.com/open-telemetry/opentelemetry-helm-charts/blob/main/charts/opentelemetry-operator/conf/crds/crd-opentelemetry.io_opampbridges.yaml#L1771
  • https://github.com/open-telemetry/opentelemetry-helm-charts/blob/main/charts/opentelemetry-operator/conf/crds/crd-opentelemetryinstrumentation.yaml#L1889
  • https://github.com/open-telemetry/opentelemetry-helm-charts/blob/main/charts/opentelemetry-operator/conf/crds/crd-opentelemetrycollector.yaml#L9313
  • https://github.com/open-telemetry/opentelemetry-helm-charts/blob/main/charts/opentelemetry-operator/conf/crds/crd-opentelemetry.io_targetallocators.yaml#L3410

I did a little digging and I believe a top-level .status is unusual. Here are a few projects with similar problems:

  • https://github.com/cert-manager/cert-manager/issues/4376
  • https://github.com/prometheus-community/helm-charts/issues/632

Should status be removed here?

P.S. I can include more information if requested, but the error seemed pointed enough.

Edit: removing .status did indeed fix the problem. I believe .status should be removed on all of these CRDs linked above, and I'll open a PR to do that when I have the time.

varyag00 avatar May 07 '25 13:05 varyag00

@varyag00 we copy these directly from the operator repo where they are defined. I'm gonna transfer this issue there.

TylerHelmuth avatar May 19 '25 14:05 TylerHelmuth

It looks like this is added by operator-sdk. @pavolloffay @frzifus @IshwarKanse does any of you know if this is required by OLM?

swiatekm avatar May 21 '25 16:05 swiatekm

I am not sure how status: in the helm CRD is created https://github.com/open-telemetry/opentelemetry-helm-charts/blob/main/charts/opentelemetry-operator/conf/crds/crd-opentelemetrycollector.yaml#L9313

it's not present in the CRDs in this repo (at least it's not the same) https://github.com/open-telemetry/opentelemetry-operator/blob/main/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml#L4519

pavolloffay avatar May 22 '25 15:05 pavolloffay

The Helm repo pulls from the bundle, which does have the status: https://github.com/open-telemetry/opentelemetry-operator/blob/d674a4afc8493215be051f347cf884497c902641/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml#L9308. That's why I said it had to be operator-sdk, as that's what generates the bundle.

swiatekm avatar May 22 '25 16:05 swiatekm