-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into net-2904-apigw-http-route-service-weight-div…
…ision-error
- Loading branch information
Showing
94 changed files
with
3,203 additions
and
1,953 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
ca: support Vault agent auto-auth config for Vault CA provider using AppRole authentication. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
ca: support Vault agent auto-auth config for Vault CA provider using Kubernetes authentication. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
mesh: Add ServiceResolver RequestTimeout for route timeouts to make request timeouts configurable | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
proxycfg: ensure that an irrecoverable error in proxycfg closes the xds session and triggers a replacement proxycfg watcher | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
proxycfg: fix a bug where terminating gateways were not cleaning up deleted service resolvers for their referenced services | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
mesh: Fix resolution of service resolvers with subsets for external upstreams | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package ca | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"os" | ||
"strings" | ||
|
||
"github.com/hashicorp/consul/agent/structs" | ||
) | ||
|
||
// left out 2 config options as we are re-using vault agent's auth config. | ||
// Why? | ||
// remove_secret_id_file_after_reading - don't remove what we don't own | ||
// secret_id_response_wrapping_path - wrapping the secret before writing to disk | ||
// (which we don't need to do) | ||
|
||
func NewAppRoleAuthClient(authMethod *structs.VaultAuthMethod) (*VaultAuthClient, error) { | ||
authClient := NewVaultAPIAuthClient(authMethod, "") | ||
// check for hardcoded /login params | ||
if legacyCheck(authMethod.Params, "role_id", "secret_id") { | ||
return authClient, nil | ||
} | ||
|
||
// check for required config params | ||
key := "role_id_file_path" | ||
if val, ok := authMethod.Params[key].(string); !ok { | ||
return nil, fmt.Errorf("missing '%s' value", key) | ||
} else if strings.TrimSpace(val) == "" { | ||
return nil, fmt.Errorf("'%s' value is empty", key) | ||
} | ||
authClient.LoginDataGen = ArLoginDataGen | ||
|
||
return authClient, nil | ||
} | ||
|
||
func ArLoginDataGen(authMethod *structs.VaultAuthMethod) (map[string]any, error) { | ||
// don't need to check for legacy params as this func isn't used in that case | ||
params := authMethod.Params | ||
// role_id is required | ||
roleIdFilePath := params["role_id_file_path"].(string) | ||
// secret_id is optional (secret_ok is used in check below) | ||
// secretIdFilePath, secret_ok := params["secret_id_file_path"].(string) | ||
secretIdFilePath, hasSecret := params["secret_id_file_path"].(string) | ||
if hasSecret && strings.TrimSpace(secretIdFilePath) == "" { | ||
hasSecret = false | ||
} | ||
|
||
var err error | ||
var rawRoleID, rawSecretID []byte | ||
data := make(map[string]any) | ||
if rawRoleID, err = os.ReadFile(roleIdFilePath); err != nil { | ||
return nil, err | ||
} | ||
data["role_id"] = string(rawRoleID) | ||
if hasSecret { | ||
switch rawSecretID, err = os.ReadFile(secretIdFilePath); { | ||
case err != nil: | ||
return nil, err | ||
case len(bytes.TrimSpace(rawSecretID)) > 0: | ||
data["secret_id"] = strings.TrimSpace(string(rawSecretID)) | ||
} | ||
} | ||
|
||
return data, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package ca | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"strings" | ||
|
||
"github.com/hashicorp/consul/agent/structs" | ||
) | ||
|
||
func NewK8sAuthClient(authMethod *structs.VaultAuthMethod) (*VaultAuthClient, error) { | ||
params := authMethod.Params | ||
role, ok := params["role"].(string) | ||
if !ok || strings.TrimSpace(role) == "" { | ||
return nil, fmt.Errorf("missing 'role' value") | ||
} | ||
// don't check for `token_path` as it is optional | ||
|
||
authClient := NewVaultAPIAuthClient(authMethod, "") | ||
// Note the `jwt` can be passed directly in the authMethod as a Param value | ||
// is a freeform map in the config where they could hardcode it. | ||
if legacyCheck(params, "jwt") { | ||
return authClient, nil | ||
} | ||
|
||
authClient.LoginDataGen = K8sLoginDataGen | ||
return authClient, nil | ||
} | ||
|
||
func K8sLoginDataGen(authMethod *structs.VaultAuthMethod) (map[string]any, error) { | ||
params := authMethod.Params | ||
role := params["role"].(string) | ||
|
||
// read token from file on path | ||
tokenPath, ok := params["token_path"].(string) | ||
if !ok || strings.TrimSpace(tokenPath) == "" { | ||
tokenPath = defaultK8SServiceAccountTokenPath | ||
} | ||
rawToken, err := os.ReadFile(tokenPath) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return map[string]any{ | ||
"role": role, | ||
"jwt": strings.TrimSpace(string(rawToken)), | ||
}, nil | ||
} |
Oops, something went wrong.