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

Fix validators interface. Add refAddonStage testutils. Fix 001_default_channel. #34

Merged

Conversation

sugarraysam
Copy link
Contributor

@sugarraysam sugarraysam commented Dec 13, 2021

This PR adds a few changes and can be a bit confusing because many files are touched, but they all work together.

Changes

  • Add testutils.GetReferenceAddonStage to help writing validators, especially getting a quick and easy SucceedingCandidate, that includes a full MetaBundle object
  • Fix the 001_default_channel validator
  • Modifies the validator interface so validators can return a failureMsg that will give users instructions on how to fix the failure
  • Refactored the meta_loader_test.go to use the testutils.GetReferenceAddonStage helper

Issue found with &registry.Annotations{}

It seems our extraction code extracts bundles using the deprecated packageManifest format:

# Inspect the local cache
$ tree /tmp/mtcli-07b10894-0673-4d95-b6ef-0cbd9701c9c3
/tmp/mtcli-07b10894-0673-4d95-b6ef-0cbd9701c9c3
└── quay.io
    └── osd-addons
        └── reference-addon-index@sha256:0c8b02008f2c2faeb681ae8cd454821266a794435aea4b3f7ae28c74bc2e280d
            └── reference-addon
                ├── 0.1.0
                │   └── reference-addon.csv.yaml
                ├── 0.1.1
                │   └── reference-addon.csv.yaml
                ├── 0.1.2
                │   └── reference-addon.csv.yaml
                ├── 0.1.3
                │   └── reference-addon.csv.yaml
                ├── 0.1.4
                │   └── reference-addon.csv.yaml
                ├── 0.1.5
                │   └── reference-addon.csv.yaml
                └── package.yaml

The issue with this format is that we do not get access to the annotations.yaml file. Now I might be wrong, but I believe we need to validate some of these annotations as OLM depends on them to run the workloads properly. For example, look at the commented out pkg/validators/validator_001_default_channel.go::matchesDefaultChannelAnnotations::#line 61 which validates default channel annotations.

cc @yashvardhan-kukreja @ashishmax31

Bundles format expected output (from mtbundles)

├── 0.1.0
│   ├── manifests
│   │   └── reference-addon.csv.yaml
│   └── metadata
│       └── annotations.yaml
├── 0.1.1
│   ├── manifests
│   │   └── reference-addon.csv.yaml
│   └── metadata
│       └── annotations.yaml
├── 0.1.2
│   ├── manifests
│   │   └── reference-addon.csv.yaml
│   └── metadata
│       └── annotations.yaml
├── 0.1.3
│   ├── manifests
│   │   └── reference-addon.csv.yaml
│   └── metadata
│       └── annotations.yaml
├── 0.1.4
│   ├── manifests
│   │   └── reference-addon.csv.yaml
│   └── metadata
│       └── annotations.yaml
├── 0.1.5
│   ├── manifests
│   │   └── reference-addon.csv.yaml
│   └── metadata
│       └── annotations.yaml

@sugarraysam sugarraysam changed the title Fix validators interface. Add refAddonStage testutils. Fix 001_defaul… Fix validators interface. Add refAddonStage testutils. Fix 001_default_channel. Dec 13, 2021
@yashvardhan-kukreja
Copy link
Contributor

Fab work @sugarraysam !
Just some minor suggestions and doubts. Rest we're good to go :)

@ashishmax31
Copy link
Contributor

@sugarraysam Interesting, let me go through the code today and find out why its exporting bundles in the package manifests format.

@sugarraysam sugarraysam force-pushed the sblaisdo-fix-default-channel branch 2 times, most recently from 2db8fda to 13195e9 Compare December 14, 2021 17:12
Copy link
Contributor

@yashvardhan-kukreja yashvardhan-kukreja left a comment

Choose a reason for hiding this comment

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

lgtm! Great work @sugarraysam , thanks 🚀

@yashvardhan-kukreja yashvardhan-kukreja merged commit 47a1619 into mt-sre:master Dec 17, 2021
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.

None yet

3 participants