Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operator preview CRD tiles do not display the correct examples for CRDs with more than 1 apiVersion #56

Open
fanny-jiang opened this issue Oct 24, 2023 · 0 comments · May be fixed by #60

Comments

@fanny-jiang
Copy link

fanny-jiang commented Oct 24, 2023

Describe the bug
We maintain the Datadog Agent Operator and one of its CRDs (DatadogAgent) has two versions,v2alpha1 (new) and v1alpha1 (old). Both CRDs are included in the clusterserviceversion.yaml and when alm-examples are provided for each CRD version, only the 1st listed example is displayed. This issue occurs in the https://operatorhub.io/preview page. I haven't pushed an updated clusterserviceversion.yaml file containing the new examples, so I haven't been able to confirm whether the problem occurs in the http://operatorhub.io listed operator tiles, but I can update the issue if I do see it happening

What did you do?
A clear and concise description of the steps you took. For example, steps to reproduce the behavior:

  1. Go to 'https://operatorhub.io/preview'
  2. Paste contents of a clusterserviceversion.yaml file of CRDs containing more than 1 apiVersion for a given CRD kind. Example: https://gist.github.com/fanny-jiang/4f1829eb3262d47ebd64050a59fd7ec4
  3. Scroll down to 'Custom Resource Definitions'
  4. Click each tile for the given CRD (i.e. DatadogAgent).
  5. Observe that the 1st tile displays the 1st defined YAML example of the alm-examples list for the given CRD kind: DatadogAgent, showing apiVersion: v1alpha1
  6. Observe that the 2nd tile also displays the YAML example for apiVersion: v1alpha1

What did you expect to see?
I expected to see one CRD tile for each apiVersion of a given CRD kind name displaying the YAML example corresponding to its apiVersion.
Tile 1 with name DatadogAgent should display a YAML example for apiVersion: v1alpha1.
Tile 2 with the name DatadogAgent should display a YAML example for apiVersion: v2alpha.

What did you see instead?
Instead, I see 2 CRD tiles with the kind: DatadogAgent, both displaying YAML examples for apiVersion: v1alpha1.

Additional context
I notice that when I switch the order of the examples in the alm-examples list, whichever is listed first is displayed in the UI. For example, if the example for v2alpha1 is listed before v1alpha1, the UI displays v2alpha1, and vice versa.

alm-examples: |-
      [
        <v2alpha2_example>,   <= displayed in UI
        <v1alpha1_example>,
        ...
      ]
tthvo added a commit to tthvo/operatorhub.io that referenced this issue Jul 9, 2024
Solves k8s-operatorhub#56. When getting example YAMLs for CRDs, apiVersion should be
considered in cases where a CRD is shipped with >= 2 versions.

Signed-off-by: Thuan Vo <[email protected]>
tthvo added a commit to tthvo/operatorhub.io that referenced this issue Jul 9, 2024
Solves k8s-operatorhub#56. When getting example YAMLs for CRDs, apiVersion should be
considered in cases where a CRD is shipped with >= 2 versions.

Signed-off-by: Thuan Vo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant