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

fix: set readiness once only #465

Merged
merged 4 commits into from
Mar 7, 2023

Conversation

Kavindu-Dodan
Copy link
Contributor

@Kavindu-Dodan Kavindu-Dodan commented Mar 3, 2023

This PR

The current readiness state can be changed because of an underlying sync provider error. This seems to be incorrect as not ready state make flagd to not receive traffic through K8s services [1]

For example, if HTTP endpoint-backed sync provider get an error, the current logic set readiness to false. Similarly, if grpc connectivity is lost for grpc provider, readiness goes to false state till connection establishment completes.

This PR fix this behavior by setting the ready state once only per sync provider. This means if there is at least a single successful sync, sync provider sets its readiness to true.

Going further, we might need to decide if we need better readiness state handling.

[1] - https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes

@codecov
Copy link

codecov bot commented Mar 3, 2023

Codecov Report

Merging #465 (e8add4d) into main (f5ca5f9) will decrease coverage by 0.13%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #465      +/-   ##
==========================================
- Coverage   62.24%   62.12%   -0.13%     
==========================================
  Files          13       13              
  Lines        1658     1650       -8     
==========================================
- Hits         1032     1025       -7     
+ Misses        563      562       -1     
  Partials       63       63              
Impacted Files Coverage Δ
pkg/sync/http/http_sync.go 43.29% <ø> (-2.71%) ⬇️
pkg/sync/grpc/grpc_sync.go 62.04% <100.00%> (+0.07%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@thisthat
Copy link
Member

thisthat commented Mar 6, 2023

The readiness state should change since this tells K8s when traffic can be scheduled to that Pod, but it depends on our semantics of ready state. With this change, we lost consistency in favor of availability and partition tolerance. Given that flagd is injected as a sidecar by OFO, I suggest going ahead with this change since it makes it more resilient and doesn't block traffic to the original pod.

@toddbaert
Copy link
Member

toddbaert commented Mar 6, 2023

I may have misunderstood the first PR introducing health checks or misread the code, because I thought this was already how it was implemented:

This PR fix this behavior by setting the ready state once only per sync provider. This means if there is at least a single successful sync, sync provider sets its readiness to true.

😅

@toddbaert
Copy link
Member

Can we add some tests to establish expectations around this behavior? Perhaps it will be easier once this is merged?

@beeme1mr
Copy link
Member

beeme1mr commented Mar 6, 2023

Can you please include a section in the docs that describes the behavior in a follow up PR? An example of what I'm looking for can be found here. Users should be able to understand what endpoints are available and the behavior to expect when using them.

Copy link
Contributor

@skyerus skyerus left a comment

Choose a reason for hiding this comment

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

Nice find

Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
@Kavindu-Dodan
Copy link
Contributor Author

@toddbaert I added readiness state validation except for K8s

@Kavindu-Dodan Kavindu-Dodan requested a review from toddbaert March 7, 2023 17:59
@beeme1mr beeme1mr merged commit 41a888d into open-feature:main Mar 7, 2023
beeme1mr pushed a commit that referenced this pull request Mar 7, 2023
🤖 I have created a release *beep* *boop*
---


##
[0.4.1](v0.4.0...v0.4.1)
(2023-03-07)


### 🔄 Refactoring

* remove unused struct field
([#458](#458))
([a04c0b8](a04c0b8))


### 🧹 Chore

* **deps:** update sigstore/cosign-installer digest to bd2d118
([#471](#471))
([ee90f48](ee90f48))


### 🐛 Bug Fixes

* **deps:** update module
github.com/open-feature/go-sdk-contrib/providers/flagd to v0.1.10
([#459](#459))
([cbdf9b0](cbdf9b0))
* **deps:** update module golang.org/x/net to v0.8.0
([#468](#468))
([10d5f2c](10d5f2c))
* fix broken image signing
([#461](#461))
([05bb51c](05bb51c))
* fixing image delimeter
([#463](#463))
([b4ee495](b4ee495))
* security issues
([#464](#464))
([7f1e759](7f1e759))
* set readiness once only
([#465](#465))
([41a888d](41a888d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@Kavindu-Dodan Kavindu-Dodan deleted the fix/readiness-fix branch March 9, 2023 22:13
@github-actions github-actions bot mentioned this pull request Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants