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

Reconcile resources #51

Merged
merged 5 commits into from
Oct 16, 2018
Merged

Reconcile resources #51

merged 5 commits into from
Oct 16, 2018

Conversation

joelanford
Copy link
Member

This PR add several improvements. It:

  • Adds logic to perform resource reconciliation when a CR has not changed.
  • Uses the state of the CR's release status to determine whether an installation, update, or reconciliation should be performed.
  • Fixes an issue with the helm reconciler chart configuration, which could be mutated across different CR instances.
  • Improves error messages and logging.
  • Makes changes to several installer helper functions for clarity and error handling.

Copy link
Collaborator

@hasbro17 hasbro17 left a comment

Choose a reason for hiding this comment

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

LGTM

return err
}
helper := resource.NewHelper(expected.Client, expected.Mapping)
_, err = helper.Create(expected.Namespace, true, expected.Object)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is interesting. I've never come across the cli-runtime or Info before. Quite convenient that the tiller kubeclient can provide that for us.

// - If the custom resource does not have a release, a new release will be installed
// - If the custom resource has changes for an existing release, the release will be updated
// - If the custom resource has no changes for an existing release, the underlying resources will be reconciled.
func (c installer) ReconcileRelease(r *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

One more thing. Not that I can see this anywhere but you might want to double check that none of the installer methods are modifying the installer. Otherwise we should use pointer receivers (c *installer). If not then this is fine.
Just pointing it out since its been a while since I've seen non pointer receivers.

Copy link
Member Author

Choose a reason for hiding this comment

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

The struct fields are storageBackend, tillerKubeClient and chartDir, none of which should change, so I think non-pointer receivers is what we want.

@joelanford joelanford merged commit 0096917 into operator-framework:master Oct 16, 2018
@joelanford joelanford deleted the reconcile-resources branch October 16, 2018 13:31
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.

None yet

3 participants