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

Feature/name k8s node #312

Merged
merged 6 commits into from
Sep 9, 2020
Merged

Feature/name k8s node #312

merged 6 commits into from
Sep 9, 2020

Conversation

adilyse
Copy link
Contributor

@adilyse adilyse commented Aug 19, 2020

Update of PR #103.

Changes proposed in this PR:

  • Be able to configure the synthetic Consul node name where catalog sync registers services.

How I've tested this PR:
Using consul-helm #580, I deployed with catalog sync enabled by default.

How I expect reviewers to test this PR:
Similarly.

Checklist:
☑️ Tests added
☑️ CHANGELOG entry added (HashiCorp engineers only, community PRs should not add a changelog entry)
-> to be added when the PR exists to link to

@adilyse adilyse marked this pull request as ready for review August 21, 2020 17:11
@adilyse adilyse requested review from a team, ishustava and thisisnotashwin and removed request for a team August 21, 2020 17:11
Copy link
Contributor

@thisisnotashwin thisisnotashwin left a comment

Choose a reason for hiding this comment

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

This looks great!! Had a few suggested changes, but LGTM with those addressed

catalog/to-consul/testing.go Outdated Show resolved Hide resolved
catalog/to-consul/testing.go Outdated Show resolved Hide resolved
Copy link
Contributor

@thisisnotashwin thisisnotashwin left a comment

Choose a reason for hiding this comment

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

Re-approving for posterity 😉

Copy link
Contributor

@ishustava ishustava left a comment

Choose a reason for hiding this comment

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

This mostly looks good and works in a non-secure installation; thanks for making these changes!

The one major issue I've found is that it doesn't work with ACLs enabled. That is because the ACL rules for the sync catalog process hard-code the node name to k8s-sync. Once that is fixed, we will also need to make sure that the token is updated when the node name changes. Currently, the behavior of the acl-init job is to not update the token if the Kubernetes secret for a component already exists.

Other than that, I had a question about adding ConsulNodeName to the Syncer interface. I don't think this is the pattern we've used here in the past, so I'm curious why you decided to implement it this way.

catalog/to-consul/syncer.go Outdated Show resolved Hide resolved
catalog/to-consul/resource_test.go Show resolved Hide resolved
catalog/to-consul/syncer_test.go Show resolved Hide resolved
subcommand/sync-catalog/command.go Outdated Show resolved Hide resolved
Copy link
Contributor Author

@adilyse adilyse left a comment

Choose a reason for hiding this comment

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

Good catch on the ACLs! I've added support in the ACL system for configuring and updating the sync node name.

catalog/to-consul/syncer.go Outdated Show resolved Hide resolved
@adilyse adilyse requested a review from ishustava August 27, 2020 18:21
Copy link
Contributor

@ishustava ishustava left a comment

Choose a reason for hiding this comment

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

The ACL changes look good! Everything works as expected from a functional perspective with ACLs enabled. Thank you for adding those validations checking that node names are valid DNS names too!

I have a couple of comments about the code. I'd like to address them before we merge if possible:

  1. About the Syncer interface, I'd prefer that we used our existing pattern of passing the node name directly to the resource struct rather than changing the Syncer interface.
  2. We don't have any tests in resource_test.go or syncer_test.go that check that changing the node name works. I left some comments about that in my first review.

I've also left a couple of suggestions.

catalog/to-consul/syncer.go Outdated Show resolved Hide resolved
subcommand/server-acl-init/command.go Show resolved Hide resolved
subcommand/server-acl-init/command.go Outdated Show resolved Hide resolved
subcommand/server-acl-init/command.go Outdated Show resolved Hide resolved
subcommand/server-acl-init/command.go Outdated Show resolved Hide resolved
subcommand/server-acl-init/command.go Outdated Show resolved Hide resolved
subcommand/server-acl-init/command_test.go Outdated Show resolved Hide resolved
subcommand/server-acl-init/command_test.go Outdated Show resolved Hide resolved
subcommand/server-acl-init/create_or_update.go Outdated Show resolved Hide resolved
subcommand/sync-catalog/command.go Outdated Show resolved Hide resolved
@ishustava ishustava added area/sync Related to catalog sync type/enhancement New feature or request labels Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sync Related to catalog sync type/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants