Skip to content

Commit

Permalink
Merge branch 'main' into NET-11563-Frontend-Expose-SSO-obtained-Consu…
Browse files Browse the repository at this point in the history
…l-token-in-WebUI
  • Loading branch information
philrenaud authored Feb 7, 2025
2 parents 9b8bfa8 + 00d74ab commit e21cfcd
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .changelog/22109.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
aws-auth: Fix bug where calls to AWS IAM and STS services error out due to URL with multiple trailing slashes.
```
3 changes: 3 additions & 0 deletions .changelog/22113.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
metadata: memoize the parsed build versions
```
16 changes: 12 additions & 4 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
* @hashicorp/consul-selfmanage-maintainers

# Techical Writer Review

/website/content/docs/ @hashicorp/consul-docs
/website/content/commands/ @hashicorp/consul-docs
/website/content/api-docs/ @hashicorp/consul-docs
# engineering and web presence get notified of, and can approve changes to web tooling, but not content.

/website/ @hashicorp/web-presence @hashicorp/consul-selfmanage-maintainers
/website/data/
/website/public/
/website/content/

# education and engineering get notified of, and can approve changes to web content.

/website/data/ @hashicorp/consul-docs @hashicorp/consul-selfmanage-maintainers
/website/public/ @hashicorp/consul-docs @hashicorp/consul-selfmanage-maintainers
/website/content/ @hashicorp/consul-docs @hashicorp/consul-selfmanage-maintainers


# release configuration
Expand Down
38 changes: 37 additions & 1 deletion agent/metadata/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,48 @@
package metadata

import (
"sync"

"github.com/hashicorp/go-version"
"github.com/hashicorp/serf/serf"
)

type versionTuple struct {
Value *version.Version
Err error
}

var versionCache sync.Map // string->versionTuple

// Build extracts the Consul version info for a member.
func Build(m *serf.Member) (*version.Version, error) {
str := versionFormat.FindString(m.Tags["build"])
build := m.Tags["build"]

ok, v, err := getMemoizedBuildVersion(build)
if ok {
return v, err
}

v, err = parseBuildAsVersion(build)

versionCache.Store(build, versionTuple{Value: v, Err: err})

return v, err
}

func getMemoizedBuildVersion(build string) (bool, *version.Version, error) {
rawTuple, ok := versionCache.Load(build)
if !ok {
return false, nil, nil
}
tuple, ok := rawTuple.(versionTuple)
if !ok {
return false, nil, nil
}
return true, tuple.Value, tuple.Err
}

func parseBuildAsVersion(build string) (*version.Version, error) {
str := versionFormat.FindString(build)
return version.NewVersion(str)
}
10 changes: 5 additions & 5 deletions agent/metadata/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ func IsConsulServer(m serf.Member) (bool, *Server) {
}
}

buildVersion, err := Build(&m)
if err != nil {
return false, nil
}

wanJoinPort := 0
wanJoinPortStr, ok := m.Tags["wan_join_port"]
if ok {
Expand Down Expand Up @@ -180,6 +175,11 @@ func IsConsulServer(m serf.Member) (bool, *Server) {

addr := &net.TCPAddr{IP: m.Addr, Port: port}

buildVersion, err := Build(&m)
if err != nil {
return false, nil
}

parts := &Server{
Name: m.Name,
ShortName: strings.TrimSuffix(m.Name, "."+datacenter),
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ require (
github.com/google/tcpproxy v0.0.0-20180808230851-dfa16c61dad2
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/hashi-derek/grpc-proxy v0.0.0-20231207191910-191266484d75
github.com/hashicorp/consul-awsauth v0.0.0-20220713182709-05ac1c5c2706
github.com/hashicorp/consul-awsauth v0.0.0-20250130185352-0a5f57fe920a
github.com/hashicorp/consul-net-rpc v0.0.0-20221205195236-156cfab66a69
github.com/hashicorp/consul/api v1.29.4
github.com/hashicorp/consul/envoyextensions v0.7.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rH
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg=
github.com/hashi-derek/grpc-proxy v0.0.0-20231207191910-191266484d75 h1:V5Uqf7VoWMd6UhNf/5EMA8LMPUm95GYvk2YF5SzT24o=
github.com/hashi-derek/grpc-proxy v0.0.0-20231207191910-191266484d75/go.mod h1:5eEnHfK72jOkp4gC1dI/Q/E9MFNOM/ewE/vql5ijV3g=
github.com/hashicorp/consul-awsauth v0.0.0-20220713182709-05ac1c5c2706 h1:1ZEjnveDe20yFa6lSkfdQZm5BR/b271n0MsB5R2L3us=
github.com/hashicorp/consul-awsauth v0.0.0-20220713182709-05ac1c5c2706/go.mod h1:1Cs8FlmD1BfSQXJGcFLSV5FuIx1AbJP+EJGdxosoS2g=
github.com/hashicorp/consul-awsauth v0.0.0-20250130185352-0a5f57fe920a h1:PlTwRwGofi9cjXO57+1E6WnNLy2qvClT4y5jg3M5r8M=
github.com/hashicorp/consul-awsauth v0.0.0-20250130185352-0a5f57fe920a/go.mod h1:kmtdeOrrLwhUY6PoKQf0RRYuOA8xJmalhVJBOcMsyNs=
github.com/hashicorp/consul-net-rpc v0.0.0-20221205195236-156cfab66a69 h1:wzWurXrxfSyG1PHskIZlfuXlTSCj1Tsyatp9DtaasuY=
github.com/hashicorp/consul-net-rpc v0.0.0-20221205195236-156cfab66a69/go.mod h1:svUZZDvotY8zTODknUePc6mZ9pX8nN0ViGwWcUSOBEA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand Down

0 comments on commit e21cfcd

Please sign in to comment.