-
Notifications
You must be signed in to change notification settings - Fork 323
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
remove health checks controller and use endpoints controller for health checks #472
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks really good!! i think this is the right approach. let me know when you would like a thorough review!! 😄
CONSUL_VERSION: 1.9.0-rc1 # Consul's OSS version to use in tests | ||
CONSUL_ENT_VERSION: 1.9.0+ent-rc1 # Consul's enterprise version to use in tests | ||
CONSUL_VERSION: 1.9.4 # Consul's OSS version to use in tests | ||
CONSUL_ENT_VERSION: 1.9.4+ent # Consul's enterprise version to use in tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just got pushed into master and will go away when we rebase feature-tproxy next.
@@ -208,13 +226,26 @@ func (r *EndpointsController) createServiceRegistrations(pod corev1.Pod, service | |||
tags = append(tags, strings.Split(raw, ",")...) | |||
} | |||
|
|||
status, _, err := getReadyStatusAndReason(&pod) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont use the "reason" field here because setting the Message field in the check on registration causes the Notes/Output field to get jumbled the next time we issue an update which occurs a couple ms later. It's fine and only has the effect of there being no Notes field until the UpdateTTL() is issues a couple ms later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds good. What exactly gets jumbled here though just for my own understanding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Notes field gets set and you cannot override it with later update.
So you end up with:
Notes: "k8s probe failed"
Output: "k8s probe healthy"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really good note and I think it would be good as a comment in the code since I'm sure readers would wonder!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I'll add a comment about it!
9797b44
to
c4fda60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done!!
@@ -208,13 +226,26 @@ func (r *EndpointsController) createServiceRegistrations(pod corev1.Pod, service | |||
tags = append(tags, strings.Split(raw, ",")...) | |||
} | |||
|
|||
status, _, err := getReadyStatusAndReason(&pod) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds good. What exactly gets jumbled here though just for my own understanding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great. I tested it out and it worked as expected!
Couple comments on things. Also I noticed that we're not testing what happens when the pod is in pending phase:
Not sure if that makes sense to test in the endpoints controller use-case but we did have that test before in the health check controller called "inject init container has completed but containers not yet running",
.
@@ -208,13 +226,26 @@ func (r *EndpointsController) createServiceRegistrations(pod corev1.Pod, service | |||
tags = append(tags, strings.Split(raw, ",")...) | |||
} | |||
|
|||
status, _, err := getReadyStatusAndReason(&pod) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really good note and I think it would be good as a comment in the code since I'm sure readers would wonder!
Excellent comments and questions @lkysow, thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦊
}, | ||
} | ||
if inject { | ||
pod.Labels[labelInject] = injected | ||
pod.Labels[annotationStatus] = injected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize now after seeing this that annotationStatus
could probably have a better name since it's used for both annotation and label now. Not a blocker though but something to address at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I was going through all of the places to change this it occurred to me its pretty wonky.
The label const doesn't belong in annotations.go either :(
I'll try to clean it up before GA if we can come to an agreement on where it belongs?
…th checks (#472) remove health checks controller and use endpoints controller for health checks.
…th checks (#472) remove health checks controller and use endpoints controller for health checks.
…th checks (#472) remove health checks controller and use endpoints controller for health checks.
…th checks (#472) remove health checks controller and use endpoints controller for health checks.
…th checks (#472) remove health checks controller and use endpoints controller for health checks.
…th checks (#472) remove health checks controller and use endpoints controller for health checks.
…th checks (#472) remove health checks controller and use endpoints controller for health checks.
…th checks (#472) remove health checks controller and use endpoints controller for health checks.
Update values docs to match website
Changes proposed in this PR:
How I've tested this PR:
Unit tests for rule changes have been added.
Unit tests have been added which assert that health checks are added on creation of the services.
Unit tests have been added which assert that health checks update their state when the service transitions from healthy/unhealthy in the endpoints controller. (This could be expanded I think)
Run consul-helm acceptance tests which confirm health checks function still.
Manually deployed the consul-k8s image to a cluster (with acls enabled). deployed an app with readiness probes and validated that modifying the k8s readiness probes to pass/fail results in the consul service updating it's health state as "critical" or "passing" and that it shows up in the UI.
How I expect reviewers to test this PR:
Code review, unit tests, manually deploy.
Reminder to reviewers that you'll need to deploy a k8s service in front of your app such as :
Checklist: