-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
feat(conf) implement 'node_id' for configurable node ID #10385
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.
LGTM
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.
LGTM. Please rebase so I can merge.
@gszr Rebased. Thank you for the prompt review. |
At first glance test failures do not look related; I have logged the failure and restarted the job. |
Tests seem to be consistently failing but are not related. |
We will need to dig further. @hbagdi can you please run some local testing comparing your branch to |
aab9a61
to
adb2179
Compare
@@ -1845,3 +1845,7 @@ | |||
# behavior and explicitly instructs Kong which | |||
# OpenResty installation to use. | |||
|
|||
#node_id = # Node ID for the Kong node. Every Kong node | |||
# in a Kong cluster must have a unique and |
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.
# in a Kong cluster must have a unique and | |
# in a Kong cluster must have an unique and |
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.
"a unique" is correct; please see https://preply.com/en/question/which-is-correct-a-unique-or-an-unique-49748
5d55be2
to
264659e
Compare
f52a24e
to
368f8d2
Compare
@gszr @chronolaw This should be ready for another review. |
kong/pdk/node.lua
Outdated
end | ||
end | ||
-- 3. generate a new id | ||
if not node_id then | ||
_NODE.get_id() |
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 think this can be preserved in the else
branch above, so the new id is logged, as it was
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 did this to improve the readability of the code a bit. Is logging the new ID necessary?
If so, I can add another log at the end of these conditional blocks to log it unconditionally.
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.
IMO it's questionable that it achieves the goal of improving readability -- it introduces an unnecessary conditional. But let's not bikeshed over this; I can approve / merge if you are adamant on the change.
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.
Let's keep it as is and move on.
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 added a log at INFO level for node-id.
Kong automatically generates node IDs for each node in a cluster. Node IDs are the only unique identifiers that exist to track a Kong node within a cluster (no assumption is made that hostname is unique across all Kong nodes). When integrating closely with an orchestrator, a configurable node ID helps the operator to source the ID from the underlying orchestrator like kubernetes instead of letting Kong generating one. For most customers, letting Kong generate a Node ID will be sufficient.
Summary
Kong automatically generates node IDs for each node in a cluster. Node IDs are the only unique identifiers that exist to track a Kong node within a cluster (no assumption is made that hostname is unique across all Kong nodes).
When integrating closely with an orchestrator, a configurable node ID helps the operator to source the ID from the underlying orchestrator like Kubernetes instead of letting Kong generate one.
For most customers, letting Kong generate a Node ID will be sufficient.
Checklist
Full changelog
node_id
configuration parameter