Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Use stored versions for duck types #192

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vitreuz
Copy link
Contributor

@vitreuz vitreuz commented Mar 19, 2021

Switch to stored versions due to bug with missing sink information on other sources

Signed-off-by: Sebastian Vidrio svidrio@vmware.com

Signed-off-by: Sebastian Vidrio <svidrio@vmware.com>
@vitreuz vitreuz marked this pull request as ready for review March 19, 2021 00:22
Copy link
Contributor

@scothis scothis left a comment

Choose a reason for hiding this comment

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

What if the stored version for the CRD is not also served?

const storedMeta = duckMetas.find(meta => meta.kind === cur[0] && meta.apiVersion.endsWith(cur[1].name))
return storedMeta ? acc.concat(storedMeta) : acc
}, [])
// const latestVersions = latestDuckTypeVersions(duckVersions)
Copy link
Contributor

Choose a reason for hiding this comment

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

What this comment for?
Also looks like this was the only reference to latestDuckTypeVersions I think

const crdNames: string[] = uniqueMetas.map((meta) => {
const group: string = meta?.apiVersion.split("/")[0] || "nogroup"
// TODO: this is currently a guess and potentially risky
const plural: string = meta?.kind.toLocaleLowerCase() + 's' || "noname"
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we able to get the CRD? Or are you trying to avoid more API calls?

}
return acc
const stored = StoredVersions(sourceMetas)
const storedMetas: ResourceMeta[] = stored.reduce((acc: ResourceMeta[], cur) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Pull out this reduce as a function from this and discovery?

@vitreuz
Copy link
Contributor Author

vitreuz commented Mar 22, 2021

@scothis

What if the stored version for the CRD is not also served?

Hmm, interesting. What would be the "best" version to display?

The CLI currently just gets the "first served version," but that also runs into the issue we were seeing. It seems the sink field is lost on some versions of eventing sources, and only present on the stored version.

Would it be better if we don't handle this at all and just push the bug upstream?

@scothis
Copy link
Contributor

scothis commented Mar 23, 2021

...but that also runs into the issue we were seeing. It seems the sink field is lost on some versions of eventing sources, and only present on the stored version.

Would it be better if we don't handle this at all and just push the bug upstream?

It's possible that only select versions of the resources support the duck type you're looking for. Or it could be an issue in the conversion webhook for those resources.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants