Why does operator-courier verify complain about mismatched versions?

10/29/2019

I'm trying to verify a CSV I built out for my Kubernetes operator using Operator Framework's operator-sdk. While doing that, I'm running into the following error.

What does this error from operator-courier verify mean?

ERROR: CRD.spec.version does not match CSV.spec.crd.owned.version
-- Josiah
kubernetes

1 Answer

10/29/2019

This can occur if you simply have a CRD in your bundle that isn't mentioned in the CSV, but has a spec.version that isn't the same as the CSV.

Otherwise, you have a CSV that is probably something like this:

apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
spec:
  customeresourcedefinitions:
    owned:
    - name: something
    version: v1alpha1  <=================

and a CRD that is something like this

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: something
spec:
  version: v1alpha2  <===================

Those two versions need to align.

You might also see this in your installPlan's status.conditions.message if you get that far:

    CustomResourceDefinition.apiextensions.k8s.io
    "something.mycompany.com" is invalid: spec.version:
    Invalid value: "v1alpha2": must match the first version in spec.versions
-- Josiah
Source: StackOverflow