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

Bug 1804812: fix(deployment): deployment spec hash #1301

Merged

Conversation

ecordell
Copy link
Member

@ecordell ecordell commented Feb 19, 2020

Description of the change:
Use deployment spec hash for determining if change is needed on cluster

DeepDerivative will miss cases where values are removed, because an
empty value is treated as unchanged.

This adds some duplication to the apiservice handling, but I avoided doing any serious refactoring to ensure this cherry picks cleanly.

Motivation for the change:

We had been using deep derivative to compare the operator's view of what the deployment should be to the cluster's. But that has a lot of edge cases (zero values for ints, unsetting previously set values), so instead we just store a hash of the deployment spec on the resulting deployment and recalculate it when we need to compare.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 19, 2020
@ecordell ecordell changed the title [wip] fix(deployment): use deployment spec hash for determining if change Bug 1751903: fix(deployment): use deployment spec hash for determining if change Feb 19, 2020
@openshift-ci-robot openshift-ci-robot added bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Feb 19, 2020
@openshift-ci-robot
Copy link
Collaborator

@ecordell: This pull request references Bugzilla bug 1751903, which is invalid:

  • expected the bug to target the "4.5.0" release, but it targets "4.4.0" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1751903: fix(deployment): use deployment spec hash for determining if change

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ecordell ecordell changed the title Bug 1751903: fix(deployment): use deployment spec hash for determining if change Bug 1804812: fix(deployment): use deployment spec hash for determining if change Feb 19, 2020
@openshift-ci-robot openshift-ci-robot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Feb 19, 2020
@openshift-ci-robot
Copy link
Collaborator

@ecordell: This pull request references Bugzilla bug 1804812, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Bug 1804812: fix(deployment): use deployment spec hash for determining if change

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ecordell
Copy link
Member Author

/retest

1 similar comment
@ecordell
Copy link
Member Author

/retest

@ecordell ecordell changed the title Bug 1804812: fix(deployment): use deployment spec hash for determining if change Bug 1804812: fix(deployment): deployment spec hash Feb 21, 2020
@ecordell
Copy link
Member Author

/retest

1 similar comment
@exdx
Copy link
Member

exdx commented Feb 24, 2020

/retest

@@ -104,6 +107,11 @@ func (i *StrategyDeploymentInstaller) deploymentForSpec(name string, spec appsv1
return
}

// Calculate hash without template annotations
Copy link
Member

Choose a reason for hiding this comment

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

Interesting - why do we calculate the deployment hash without the annotations?

@exdx
Copy link
Member

exdx commented Feb 24, 2020

/retest
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 24, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 24, 2020
@ecordell
Copy link
Member Author

/retest

1 similar comment
@ecordell
Copy link
Member Author

/retest

Copy link
Member

@njhale njhale left a comment

Choose a reason for hiding this comment

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

Nice! TIL: FNV hashing is a thing.

/lgtm

_, err = crc.OperatorsV1alpha1().ClusterServiceVersions(otherNamespaceName).Update(fetchedCSV)
return err
}
require.NoError(t, retry.RetryOnConflict(retry.DefaultBackoff, updateCSV))
Copy link
Member

Choose a reason for hiding this comment

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

cool -- common source of flakes?

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 27, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

3 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

Copy link
Member

@awgreene awgreene left a comment

Choose a reason for hiding this comment

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

A couple of questions but the design looks great. Nice work!

Makefile Show resolved Hide resolved
pkg/controller/install/deployment.go Show resolved Hide resolved
pkg/controller/operators/olm/apiservices.go Show resolved Hide resolved
pkg/controller/operators/olm/apiservices.go Show resolved Hide resolved
pkg/controller/operators/olm/apiservices.go Show resolved Hide resolved
pkg/controller/operators/olm/apiservices.go Show resolved Hide resolved
pkg/controller/operators/olm/apiservices.go Show resolved Hide resolved
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

5 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@awgreene
Copy link
Member

/lgtm

Thanks for answering my questions.

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: awgreene, ecordell, exdx, njhale

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

5 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit deb58f1 into operator-framework:master Feb 28, 2020
@openshift-ci-robot
Copy link
Collaborator

@ecordell: All pull requests linked via external trackers have merged. Bugzilla bug 1804812 has been moved to the MODIFIED state.

In response to this:

Bug 1804812: fix(deployment): deployment spec hash

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ecordell
Copy link
Member Author

/cherry-pick release-4.4

@openshift-cherrypick-robot

@ecordell: new pull request created: #1333

In response to this:

/cherry-pick release-4.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants