Skip to content

Conversation

@echen-98
Copy link
Contributor

@echen-98 echen-98 commented Jul 16, 2021

Issue #, if available:
Update of maintenance window was being "blocked" by custom code: multiple differences were triggering an update, and the custom update code considered the engine versions different even if desired had 6.x and latest had 6.0.5.

Since this takes precedence over the generated code, the generated code was never reached (and the maintenance window was therefore never updated).

Description of changes:

  • change RemoveFromDelta to be common to all resources
  • remove function engineVersionsDiffer (+ tests) and replace it with calls to delta.DifferentAt
  • handle case where only major version is specified in post-delta hook
  • update post_set_output hook in ReadOne to retrieve the latest maintenance window
  • e2e test for this scenario

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@echen-98 echen-98 force-pushed the maintenance-window branch from d8f0acc to 8b3fd06 Compare July 16, 2021 23:19
Comment on lines +40 to +42
delta.Differences = differences
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: This method may return boolean indicating if there was a removal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ACK, not sure how we would use that return value but we can add it on later if there is a use for it

Comment on lines +26 to +30
func filterDelta(
delta *ackcompare.Delta,
desired *resource,
latest *resource,
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice.

Not related to this PR but mentioning it here due to its context: I think this is where Server defaults can be handled: Remove differences from delta when corresponding spec field is nil if last applied spec also had that field nil.

  • This will require access to "last applied spec" which needs to be kept somewhere for reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep this should enable us to (at least temporarily) handle defaults before the framework-level solution is ready

Comment on lines +49 to +51
//TODO: for all the fields here, reevaluate if the latest observed state should always be populated,
// even if the corresponding field was not specified in desired

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be fine to populate observed state fields here, the filterDelta() should determine if the diff is to be ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed

@ack-bot
Copy link
Collaborator

ack-bot commented Jul 17, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: echen-98, kumargauravsharma

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:
  • OWNERS [echen-98,kumargauravsharma]

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

@kumargauravsharma
Copy link
Contributor

It can be merged after successful e2e tests

@kumargauravsharma kumargauravsharma merged commit d36fa20 into aws-controllers-k8s:main Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants