Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

[TT-8822] Improve hash comparision in Reconciliation #625

Merged
merged 16 commits into from
May 19, 2023

Conversation

buraksekili
Copy link
Collaborator

@buraksekili buraksekili commented May 15, 2023

Description

This PR improves the current hash comparison used to determine whether to send PUT requests or not, in order to update a resource.

It adds 2 status fields to ApiDefinition and SecurityPolicy CRDs

  • latestTykSpecHash which stores the hash of lastly fetched resource from Tyk
  • latestCRDSpecHash which stores the hash of lastly reconciled CR.

Related Issue

Motivation and Context

Test Coverage For This Change

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). If PRing from your fork, don't come from your master!
  • Make sure you are making a pull request against our master branch (left side). Also, it would be best if you started your change off our latest master.
  • Make sure you are updating CHANGELOG.md based on your changes.
  • My change requires a change to the documentation.
    • If you've changed APIs, describe what needs to be updated in the documentation.
  • I have updated the documentation accordingly.
  • If you've changed API models, please update CRDs.
    • make manifests
    • make helm
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Check your code additions will not fail linting checks:
    • gofmt -s -w .
    • go vet ./...
    • golangci-lint run

Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
…case of errors

Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
@buraksekili buraksekili changed the title Improve hash comparision in Reconciliation [TT-8822] Improve hash comparision in Reconciliation May 15, 2023
@buraksekili buraksekili marked this pull request as ready for review May 15, 2023 12:45
@buraksekili buraksekili requested a review from a team as a code owner May 15, 2023 12:45
@buraksekili buraksekili requested review from andrei-tyk and removed request for a team May 15, 2023 12:45
controllers/common.go Outdated Show resolved Hide resolved
…akes one argument

Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
buraksekili and others added 6 commits May 18, 2023 23:40
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

2.2% 2.2% Coverage
12.3% 12.3% Duplication

@singhpr singhpr merged commit 910af9b into master May 19, 2023
@singhpr singhpr deleted the fix/TT-8822/reconciliation branch May 19, 2023 06:35
buger pushed a commit that referenced this pull request May 22, 2024
* Improve hash comparision in Policy Controller

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Add retry for policy controller

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Wrap error prone functions with wait.For() to retrigger execution in case of errors

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Improve hasher of ApiDefinition Controller

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Add wait.For to tests

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* remove retry functions after creating a tyk resource

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* remove old tests

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Update calculateHash() function according to feedback - so, it only takes one argument

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Remove extra print statements

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* move errors to constats

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Resolve linter issues

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Move cuddled statemtn

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Resolve conflicts

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Remove duplicated assignment

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

---------

Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Co-authored-by: Pranshu <104971506+singhpr@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants