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

Always configure anonymous token in primary DC #106

Merged
merged 5 commits into from
Jun 14, 2022
Merged

Conversation

pglass
Copy link

@pglass pglass commented Jun 10, 2022

Changes proposed in this PR:

This changes the acl-controller to always configure the anonymous token in the primary datacenter, and in the default partition.

How I've tested this PR:

Unit tests

How I expect reviewers to test this PR:

👀

Checklist:

  • Tests added
  • CHANGELOG entry added

@pglass pglass requested review from a team, sanon-dev and cthain and removed request for a team and sanon-dev June 10, 2022 22:14
@pglass pglass temporarily deployed to dockerhub/hashicorpdev June 10, 2022 22:54 Inactive
@pglass pglass temporarily deployed to dockerhub/hashicorpdev June 10, 2022 23:08 Inactive
Namespace: controller.DefaultPartition,
Partition: controller.DefaultNamespace,
}
}
Copy link
Author

Choose a reason for hiding this comment

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

policyNames := []string{}
for _, policy := range policies {
policyNames = append(policyNames, policy.Name)
}
Copy link
Author

Choose a reason for hiding this comment

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

I changed this bit to collect the policy names. Then we do a contains check and the order of policies doesn't matter.

partitionsEnabled: true,
expPolicy: expEntAnonTokenPolicy,
},
}
Copy link
Author

@pglass pglass Jun 10, 2022

Choose a reason for hiding this comment

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

This I moved to the command_ent_test.go so that it doesn't run for the OSS binary, since the controller now passes in an explicit partition=default query option.

Copy link
Contributor

@cthain cthain left a comment

Choose a reason for hiding this comment

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

Looks good Paul. I just left a couple of minor notes.

Config: Config{Datacenter: "dc1"},
DebugConfig: Config{
PrimaryDatacenter: "dc1",
MeshGatewayWANFederationEnabled: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

The MeshGatewayWANFederationEnabled flag isn't needed for the test anymore.. maybe we should remove it, what do you think?

Copy link
Author

Choose a reason for hiding this comment

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

Updated! I renamed some of the tests. See what you think!

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 for the renaming.

Sorry for any confusion, I wasn't very clear about my comment for the MeshGatewayWANFederationEnabled field. I was trying to say that we don't actually use this field in the code anymore. And since we don't need it, maybe we should remove it from both the ACL controller and the tests. As you mentioned before it's in the DebugConfig part of the agent/self response, so it's not "stable". So it may just be better to get rid of it.

Copy link
Author

Choose a reason for hiding this comment

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

Oh, I meant to remove the field, too (forgot to git add again before committing)

require.Len(t, policies, 2)
require.Equal(t, policies[1].Name, "global-management")
// Otherwise, we expect the global-management policy and anonymous-token-policy
// in the default partition, or if partitions are not enabled.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment reads a bit awkwardly. It seems like the ", or if partitions are not enabled" at the end of the comment is not needed.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, I can fix the wording. Basically, we hit this in the OSS case (no partitions) or in ENT but in the default partition (partitions disabled in the controller).

@pglass pglass temporarily deployed to dockerhub/hashicorpdev June 14, 2022 17:24 Inactive
@pglass pglass temporarily deployed to dockerhub/hashicorpdev June 14, 2022 18:16 Inactive
@pglass pglass merged commit b09a402 into main Jun 14, 2022
@pglass pglass deleted the pglass/anon-token-fix branch June 14, 2022 19:46
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.

2 participants