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

cli: update generated haproxy config with readiness endpoint #23463

Merged
merged 1 commit into from
Mar 8, 2018
Merged

cli: update generated haproxy config with readiness endpoint #23463

merged 1 commit into from
Mar 8, 2018

Conversation

asubiotto
Copy link
Contributor

Release note (cli change): The generated haproxy config has been
extended with readiness checks.

@asubiotto asubiotto requested a review from a-robinson March 6, 2018 15:21
@asubiotto asubiotto requested a review from a team as a code owner March 6, 2018 15:21
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@asubiotto
Copy link
Contributor Author

Will cherrypick this into 2.0.

Copy link
Contributor

@a-robinson a-robinson left a comment

Choose a reason for hiding this comment

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

I assume you tested this manually to make sure haproxy responds appropriately to a node being unhealthy?

@@ -107,6 +145,7 @@ listen psql
bind :26257
mode tcp
balance roundrobin
{{range .}} server cockroach{{.Desc.NodeID}} {{.Desc.Address.AddressField}} check
option httpchk GET /health?ready=1
Copy link
Contributor

Choose a reason for hiding this comment

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

Does httpchck work for HTTPS endpoints automatically or do you need to tweak this for secure clusters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tested it with a secure cluster and it works fine.

@@ -75,7 +89,31 @@ func runGenHAProxyCmd(cmd *cobra.Command, args []string) error {
w = f
}

err = configTemplate.Execute(w, nodeStatuses.Nodes)
fs := flag.NewFlagSet("haproxy", flag.ContinueOnError)
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic could use a unit test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks for the suggestion. It caught a bug regarding not reinitializing state between loops.

@asubiotto
Copy link
Contributor Author

Yeah, I did test this manually.

Copy link
Contributor

@a-robinson a-robinson left a comment

Choose a reason for hiding this comment

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

LGTM. If @mberhault is back online it'd be nice to have him confirm this, but it looks good to me.

Args: []string{"-http-port"},
},
}
expected := []haProxyNodeInfo{
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit, but the convention throughout most of the code base is to include the expected results next to the input that generates them, rather than in separate slices that readers have to mentally join together. You can leave this is as if you want, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem! Updated.

Release note (cli change): The generated haproxy config has been
extended with readiness checks.
@asubiotto asubiotto merged commit d1258a7 into cockroachdb:master Mar 8, 2018
@asubiotto asubiotto deleted the haproxy-cfg branch May 22, 2018 15:59
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.

3 participants