mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
ipn/ipnlocal, envknob: make it possible to configure the cert client to act in read-only mode (#15250)
* ipn/ipnlocal,envknob: add some primitives for HA replica cert share. Add an envknob for configuring an instance's cert store as read-only, so that it does not attempt to issue or renew TLS credentials, only reads them from its cert store. This will be used by the Kubernetes Operator's HA Ingress to enable multiple replicas serving the same HTTPS endpoint to be able to share the same cert. Also some minor refactor to allow adding more tests for cert retrieval logic. Signed-off-by: Irbe Krumina <irbe@tailscale.com>
This commit is contained in:
@@ -417,6 +417,23 @@ func App() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// IsCertShareReadOnlyMode returns true if this replica should never attempt to
|
||||
// issue or renew TLS credentials for any of the HTTPS endpoints that it is
|
||||
// serving. It should only return certs found in its cert store. Currently,
|
||||
// this is used by the Kubernetes Operator's HA Ingress via VIPServices, where
|
||||
// multiple Ingress proxy instances serve the same HTTPS endpoint with a shared
|
||||
// TLS credentials. The TLS credentials should only be issued by one of the
|
||||
// replicas.
|
||||
// For HTTPS Ingress the operator and containerboot ensure
|
||||
// that read-only replicas will not be serving the HTTPS endpoints before there
|
||||
// is a shared cert available.
|
||||
func IsCertShareReadOnlyMode() bool {
|
||||
m := String("TS_CERT_SHARE_MODE")
|
||||
return m == modeRO
|
||||
}
|
||||
|
||||
const modeRO = "ro"
|
||||
|
||||
// CrashOnUnexpected reports whether the Tailscale client should panic
|
||||
// on unexpected conditions. If TS_DEBUG_CRASH_ON_UNEXPECTED is set, that's
|
||||
// used. Otherwise the default value is true for unstable builds.
|
||||
|
Reference in New Issue
Block a user