Repository navigation
Conversation
The server certificate of the root shard's internal proxy was generated with a hard-coded "svc.cluster.local" SAN, while the operator addresses that proxy through GetRootShardProxyBaseURL(), i.e. "<name>-proxy.<namespace>.svc.<clusterDomain>". With a non-default spec.clusterDomain the operator's own client (NewInternalKubeconfigClient -> NewRootShardProxyClient, used by the kubeconfig-rbac controller) therefore failed the TLS handshake, so the RBAC for Kubeconfig.spec.authorization was never created and scoped permissions were silently not granted. Derive the SAN from the RootShard's cluster domain, defaulting to cluster.local, and factor the domain lookup into resources.GetRootShardClusterDomain(), which GetRootShardBaseHost() and GetRootShardProxyBaseHost() use as well. Fixes kcp-dev#303 Signed-off-by: Nikita Aboltin <aboltin.nikita@rwb.ru>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @2mind. Thanks for your PR. I'm waiting for a kcp-dev 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-sigs/prow repository. |
|
/kind bug |
|
Friendly ping for review (fixes #303). We currently work around the missing internal-proxy SAN by setting |
Summary
The internal proxy's server certificate was built with a hard-coded cluster domain:
while everything that dials the proxy goes through
resources.GetRootShardProxyBaseHost()→<service>.<namespace>.svc.<clusterDomain>. Withspec.clusterDomain: cozy.locala certificate for the proxy looks like this, and the operator's own client cannot verify it:The affected client is
client.NewInternalKubeconfigClient()(viaNewRootShardProxyClient), which thekubeconfig-rbaccontroller uses to create the RBAC forKubeconfig.spec.authorization— so scoped permissions were silently not granted for every Kubeconfig whose target is aFrontProxy.Change
resources.GetRootShardClusterDomain()— new helper for the "cluster domain or default" lookup that was open-coded in several places;GetRootShardBaseHost()andGetRootShardProxyBaseHost()now use it too.frontproxy.serverDNSNames()— the DNS name list is factored out ofserverCertificateReconciler()and its fully qualified Service name is derived from that cluster domain instead of the hard-codedcluster.local.The SAN list keeps the short forms, and for front-proxies the external hostnames are added exactly as before; only the fully qualified name changes.
Verification
go build ./...,go vet ./internal/...,go test ./internal/... ./pkg/...— all pass.spec.clusterDomain: cozy.localthe generated Certificate now carrieskcp-proxy.kcp-system.svc.cozy.local, which is exactly the entry we had to add by hand throughspec.proxy.certificateTemplatesin our installation (kcp-operator v0.9.0, chart 0.7.10), where this was the reason thekubeconfig-rbacbindings never appeared —Kubeconfig.status.authorization.provisionedClusterstayed empty.What Type of PR Is This?
/kind bug
Related Issue(s)
Fixes #303
Release Notes