Skip to content

Commit

Permalink
Disable background cache refresh for Connect Leaf Certs
Browse files Browse the repository at this point in the history
The rationale behind removing them is that all of our own code (xDS, builtin connect proxy) use the cache notification mechanism. This ensures that the blocking fetch behind the scenes is always executing. Therefore the only way you might go to get a certificate and have to wait is when 1) the request has never been made for that cert before or 2) you are using the v1/agent/connect/ca/leaf API for retrieving the cert yourself.

In the first case, the refresh change doesn’t alter the behavior. In the second case, it can be mitigated by using blocking queries with that API which just like normal cache notification mechanism will cause the blocking fetch to be initiated and to get leaf certs as soon as needed.

If you are not using blocking queries, or Envoy/xDS, or the builtin connect proxy but are retrieving the certs yourself then the HTTP endpoint might take a little longer to respond.
  • Loading branch information
mkeeler committed Jul 20, 2020
1 parent eecc925 commit 9269ef7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion agent/cache-types/connect_ca_leaf.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const caChangeJitterWindow = 30 * time.Second
// ConnectCALeaf supports fetching and generating Connect leaf
// certificates.
type ConnectCALeaf struct {
RegisterOptionsBlockingRefresh
RegisterOptionsBlockingNoRefresh
caIndex uint64 // Current index for CA roots

// rootWatchMu protects access to the rootWatchSubscribers map and
Expand Down
9 changes: 9 additions & 0 deletions agent/cache-types/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ func (r RegisterOptionsBlockingRefresh) RegisterOptions() cache.RegisterOptions
}
}

type RegisterOptionsBlockingNoRefresh struct{}

func (r RegisterOptionsBlockingNoRefresh) RegisterOptions() cache.RegisterOptions {
return cache.RegisterOptions{
Refresh: false,
SupportsBlocking: true,
}
}

// RegisterOptionsNoRefresh can be embedded into a struct to implement
// part of the agent/cache.Type interface.
// When embedded into a struct it identifies the cache type as one which
Expand Down

0 comments on commit 9269ef7

Please sign in to comment.