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

Ability to query older versions of a vmspec #184

Merged
merged 1 commit into from
Nov 3, 2021

Conversation

yitsushi
Copy link
Contributor

What this PR does / why we need it:

With this change set, we can query older versions of a spec. We need this for update and update validation.

Which issue(s) this PR fixes:
Related to #66

Special notes for your reviewer:

I tried to come up with a proper solution to this, but all of them had
flaws.

== Options I found and explored their possibilities

  1. Add a new version argument to the Get function.

That's just ugly as hell. I like the Options pattern. Much easier to
update without breaking 300 calls in the codebase.

  1. Add a new function on the Repo.

It seems odd and I think it's unnecessary because Get can handle it.

  1. Create a function only on the containerd repo implementation.

That would require checks and casting everywhere we want to use it.

== Conclusion

I picked options 1, because it causes less pain not and long term.
It does not matter what content store we are using, it HAS to be able
to manage versions somehow, even if it's an external service, the
Repository implementation has to handle versions, without versions
we are are playing with a bag of venomous snakes without any kind of
antidote, maybe fun, but not safe.

Checklist:

  • squashed commits into logical changes
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

@yitsushi yitsushi added the kind/feature New feature or request label Oct 29, 2021
infrastructure/containerd/repo.go Show resolved Hide resolved
infrastructure/containerd/repo.go Show resolved Hide resolved
core/ports/repositories.go Show resolved Hide resolved
infrastructure/containerd/repo.go Show resolved Hide resolved
@yitsushi yitsushi force-pushed the spec-get-older-versions branch from ccc98a4 to 062c1ad Compare November 2, 2021 08:48
I tried to come up with a proper solution to this, but all of them had
flaws.

== Options I found and explored their possibilities

1. Add a new version argument to the Get function.

That's just ugly as hell. I like the Options pattern. Much easier to
update without breaking 300 calls in the codebase.

2. Add a new function on the Repo.

It seems odd and I think it's unnecessary because Get can handle it.

3. Create a function only on the Containerd repo implementation.

That would require checks and casting everywhere we want to use it.

== Conclusion

I picked options 1, because it causes less pain not and long term.
It does not matter what content store we are using, it HAS to be able
to manage versions somehow, even if it's an external service, the
Repository implementation has to handle versions, without versions
we are are playing with a bag of venomous snakes without any kind of
antidote, maybe fun, but not safe.

Related to liquidmetal-dev#66
@yitsushi yitsushi force-pushed the spec-get-older-versions branch from 062c1ad to 428b933 Compare November 2, 2021 08:53
Comment on lines -62 to -64
exists, err = repo.Exists(ctx, testOwnerName, testOwnerNamespace)
Expect(err).NotTo(HaveOccurred())
Expect(exists).To(BeFalse())
Copy link
Contributor Author

@yitsushi yitsushi Nov 2, 2021

Choose a reason for hiding this comment

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

Removed because it was a duplication, the previous 3 lines are exactly the same, and couldn't figure out what else does it want to test

@yitsushi yitsushi requested a review from richardcase November 2, 2021 09:01
Copy link
Member

@richardcase richardcase left a comment

Choose a reason for hiding this comment

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

I have no more comments.

@yitsushi yitsushi merged commit 7f6db21 into liquidmetal-dev:main Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants