Skip to content
This repository was archived by the owner on Jan 25, 2019. It is now read-only.

Support multiple resources #48

Merged
merged 5 commits into from
Oct 15, 2018
Merged

Support multiple resources #48

merged 5 commits into from
Oct 15, 2018

Conversation

joelanford
Copy link
Member

This PR mostly (but not completely) supersedes #43. It:

  • Updates the controller and installer components to expect unstructured objects.
  • Fixes a bug in the reconcilier that prevented multiple instances of a resource from being correctly reconciled due to the use of a global variable to track lastResourceVersion.
  • Adds a finalizer and associated logic, which is a better way to handle uninstalling releases.
  • Adds new functions to support watches and reconciliation for multiple resource types.

Each of these changes is contained in its own commit on this branch.

@@ -199,7 +296,7 @@ func (c installer) syncReleaseStatus(status v1alpha1.HelmAppStatus) {

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not part of this PR but just noticed that syncReleaseStatus doesn't return an error while c.storageBackend.Create(status.Release) could on line 294.
From the header comment for storageBackend.Create

An error is returned if the storage driver failed to store the release, or a release with identical an key already exists.

Are we purposefully ignoring the error if the release already exists? The storage driver could fail for some other reason as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I think I caught that in the original PR. I've got another PR coming on the heels of this one that will fix that.

c.syncReleaseStatus(r.Status)

status := v1alpha1.StatusFor(r)
c.syncReleaseStatus(*status)

if err != nil || latestRelease == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also not a change from this PR but shouldn't this check be done directly after line 206:

tiller := tillerRendererForCR(r, c.storageBackend, c.tillerKubeClient)
latestRelease, err := c.storageBackend.Last(releaseName(r))
if err != nil || latestRelease == nil {
...
} else {
...
}

status := v1alpha1.StatusFor(r)

Functionally it's the same but it's a bit more readable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. And also fixed in the next PR.

@hasbro17
Copy link
Collaborator

@joelanford overall LGTM after nits.

We don't have an e2e test for this in the CI right?
We should probably follow that up in a new issue after this PR.

Something similar to the ansible-operator e2e tests where we build and run the helm-app-operator for a sample watches.yaml and chart directory.
https://github.com/operator-framework/operator-sdk/pull/582/files

@joelanford
Copy link
Member Author

Correct - no e2e tests yet, but definitely needed. Added new issue #50

@joelanford joelanford merged commit 535b588 into operator-framework:master Oct 15, 2018
@joelanford joelanford deleted the multiple-resources branch October 15, 2018 16:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants