Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## UNRELEASED

BUG FIXES:
* Control plane
* Use global ACL auth method to provision ACL tokens for API Gateway in secondary datacenter [[GH-1481](https://github.com/hashicorp/consul-k8s/pull/1481)]

## 0.48.0 (September 01, 2022)

FEATURES:
Expand Down
11 changes: 10 additions & 1 deletion control-plane/subcommand/server-acl-init/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,16 @@ func (c *Command) Run(args []string) int {
return 1
}
serviceAccountName := c.withPrefix("api-gateway-controller")
if err := c.createACLPolicyRoleAndBindingRule("api-gateway-controller", rules, consulDC, primaryDC, localPolicy, primary, localComponentAuthMethodName, serviceAccountName, consulClient); err != nil {

// API gateways require a global policy/token because they must
// create config-entry resources in the primary, even when deployed
// to a secondary datacenter
authMethodName := localComponentAuthMethodName
if !primary {
authMethodName = globalComponentAuthMethodName
}
err = c.createACLPolicyRoleAndBindingRule("api-gateway-controller", rules, consulDC, primaryDC, globalPolicy, primary, authMethodName, serviceAccountName, consulClient)
if err != nil {
c.log.Error(err.Error())
return 1
}
Expand Down
6 changes: 3 additions & 3 deletions control-plane/subcommand/server-acl-init/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,7 @@ func TestRun_PoliciesAndBindingRulesACLLogin_SecondaryDatacenter(t *testing.T) {
TokenFlags: []string{"-api-gateway-controller"},
PolicyNames: []string{"api-gateway-controller-policy-" + secondaryDatacenter},
Roles: []string{resourcePrefix + "-api-gateway-controller-acl-role-" + secondaryDatacenter},
GlobalAuthMethod: false,
GlobalAuthMethod: true,
},
{
TestName: "Snapshot Agent",
Expand Down Expand Up @@ -2599,8 +2599,8 @@ func TestRun_ValidateLoginToken_SecondaryDatacenter(t *testing.T) {
ComponentName: "api-gateway-controller",
TokenFlags: []string{"-api-gateway-controller"},
Roles: []string{resourcePrefix + "-api-gateway-controller-acl-role-dc2"},
GlobalAuthMethod: false,
GlobalToken: false,
GlobalAuthMethod: true,
GlobalToken: true,
},
{
ComponentName: "snapshot-agent",
Expand Down