Configuration: no longer hardcode mesh certs#12189
Conversation
…Discovery: no longer hardcode Envoy listener cert paths.
|
Hi @drichelson. Thanks for your PR. I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
pilot/cmd/pilot-agent/main.go
Outdated
| path.Join(model.AuthCertsPath, model.KeyFilename), | ||
| path.Join(model.AuthCertsPath, model.RootCertFilename), | ||
| } | ||
| if role.Type == model.Ingress { |
There was a problem hiding this comment.
@rshriram mentioned that we probably don't need this. Can this be confirmed? if not I'd prefer to remove it in a separate PR in case it needs to be reverted.
|
|
||
| // setupFilterChains sets up filter chains based on authentication policy. | ||
| func setupFilterChains(authnPolicy *authn.Policy, sdsUdsPath string, sdsUseTrustworthyJwt, sdsUseNormalJwt bool, meta map[string]string) []plugin.FilterChain { | ||
| func setupFilterChains(authnPolicy *authn.Policy, serverCertPaths *meshconfig.ServerCertPaths, sdsUdsPath string, sdsUseTrustworthyJwt, sdsUseNormalJwt bool, meta map[string]string) []plugin.FilterChain { |
There was a problem hiding this comment.
line is 204 characters (from lll)
| port := in.ServiceInstance.Endpoint.ServicePort | ||
| authnPolicy := model.GetConsolidateAuthenticationPolicy(in.Env.IstioConfigStore, in.ServiceInstance.Service, port) | ||
| return setupFilterChains(authnPolicy, in.Env.Mesh.SdsUdsPath, in.Env.Mesh.EnableSdsTokenMount, in.Env.Mesh.SdsUseK8SSaJwt, in.Node.Metadata) | ||
| return setupFilterChains(authnPolicy, in.Env.Mesh.MeshTrafficServerCertPaths, in.Env.Mesh.SdsUdsPath, in.Env.Mesh.EnableSdsTokenMount, in.Env.Mesh.SdsUseK8SSaJwt, in.Node.Metadata) |
There was a problem hiding this comment.
line is 181 characters (from lll)
| } | ||
| for _, c := range cases { | ||
| if got := setupFilterChains(c.in, c.sdsUdsPath, c.useTrustworthyJwt, c.useNormalJwt, map[string]string{}); !reflect.DeepEqual(got, c.expected) { | ||
| if got := setupFilterChains(c.in, c.serverCertPaths, c.sdsUdsPath, c.useTrustworthyJwt, c.useNormalJwt, map[string]string{}); !reflect.DeepEqual(got, c.expected) { |
There was a problem hiding this comment.
line is 165 characters (from lll)
|
/ok-to-test |
|
You are missing changes to cluster.go (istio mtls setting client side) |
Based on my reading of cluster.go: when in Only in when in Does this make sense? It looks like wiring in the client cert paths for ISTIO_MUTUAL mode will be a bit more gnarly. |
…nd use them when setting up listeners
pilot/pkg/model/context.go
Outdated
| NodeMetadataDNSDomains = "DNS_DOMAINS" | ||
|
|
||
| // NodeMetadataTlsServerCertChain is the absolute path to server cert-chain file | ||
| NodeMetadataTlsServerCertChain = "TLS_SERVER_CERT_CHAIN" |
There was a problem hiding this comment.
const NodeMetadataTlsServerCertChain should be NodeMetadataTLSServerCertChain (from golint)
pilot/pkg/model/context.go
Outdated
| NodeMetadataTlsServerCertChain = "TLS_SERVER_CERT_CHAIN" | ||
|
|
||
| // NodeMetadataTlsServerKey is the absolute path to server private key file | ||
| NodeMetadataTlsServerKey = "TLS_SERVER_KEY" |
There was a problem hiding this comment.
const NodeMetadataTlsServerKey should be NodeMetadataTLSServerKey (from golint)
pilot/pkg/model/context.go
Outdated
| NodeMetadataTlsServerKey = "TLS_SERVER_KEY" | ||
|
|
||
| // NodeMetadataTlsServerRootCert is the absolute path to server root cert file | ||
| NodeMetadataTlsServerRootCert = "TLS_SERVER_ROOT_CERT" |
There was a problem hiding this comment.
const NodeMetadataTlsServerRootCert should be NodeMetadataTLSServerRootCert (from golint)
pilot/pkg/model/context.go
Outdated
| NodeMetadataTlsServerRootCert = "TLS_SERVER_ROOT_CERT" | ||
|
|
||
| // NodeMetadataTlsClientCertChain is the absolute path to client cert-chain file | ||
| NodeMetadataTlsClientCertChain = "TLS_CLIENT_CERT_CHAIN" |
There was a problem hiding this comment.
const NodeMetadataTlsClientCertChain should be NodeMetadataTLSClientCertChain (from golint)
pilot/pkg/model/context.go
Outdated
| NodeMetadataTlsClientCertChain = "TLS_CLIENT_CERT_CHAIN" | ||
|
|
||
| // NodeMetadataTlsClientKey is the absolute path to client private key file | ||
| NodeMetadataTlsClientKey = "TLS_CLIENT_KEY" |
There was a problem hiding this comment.
const NodeMetadataTlsClientKey should be NodeMetadataTLSClientKey (from golint)
pilot/pkg/model/context.go
Outdated
| NodeMetadataTlsClientKey = "TLS_CLIENT_KEY" | ||
|
|
||
| // NodeMetadataTlsClientRootCert is the absolute path to client root cert file | ||
| NodeMetadataTlsClientRootCert = "TLS_CLIENT_ROOT_CERT" |
There was a problem hiding this comment.
const NodeMetadataTlsClientRootCert should be NodeMetadataTLSClientRootCert (from golint)
| role.TrustDomain = spiffe.GetTrustDomain() | ||
| log.Infof("Proxy role: %#v", role) | ||
|
|
||
| // Add cert paths as node metadata only if they differ from defaults |
There was a problem hiding this comment.
Should we always set the metadata? we handle the absence of these fields properly in Pilot-discovery.
|
Do you need to customize the names of the files, or just the directory ? I can see the use case for using a different dir - that's why we have the base dir. ( and watching the base dir is indeed needed - again, the base was mostly intended for local testing - with the plan to move to SDS ). It feels far too complicated for something that will soon be dead code - and our tradition of paying technical debt and removing dead code is not so great. In general the entire watching business has |
We need the path to each cert/key to be custom. This includes separate keys/certs for client and server connections.
A small SDS server makes sense to simplify Pilot-Agent and envoy hot restarts. The changes I made here to watcher code and agent config will be useful and needed for our use case if/when that happens. |
|
@rshriram any thoughts on these changes? |
| tls *networking.TLSSettings, | ||
| serviceAccounts []string, | ||
| sni string, | ||
| metadata map[string]string, |
Addresses #11984
Follow-on to #12142 (closed)