Problem
cmd/crc-agent/main.go contains a map-based rewriteKubeconfigServer, while internal/resources/kubeconfig.go already provides the typed shared RewriteKubeconfigServer. The implementations differ: the agent copy silently skips malformed entries and does not clear insecure-skip-tls-verify, while the shared helper does.
cmd/crc-agent/tlsutil.go also contains unused CA, client-certificate, serving-certificate, and PEM helpers. Only TLSFromPEM is used, and it only wraps tls.X509KeyPair.
References
cmd/crc-agent/main.go:374-403
internal/resources/kubeconfig.go:51-68
cmd/crc-agent/tlsutil.go:52-202
cmd/crc-agent/clusterclient.go:72-74
Suggested direction
Use the shared kubeconfig rewrite and remove the local duplicate. Remove unused TLS helpers and private constants, or call tls.X509KeyPair directly. Preserve tests for insecure flags, file-based CA data, and empty or malformed cluster entries.
Problem
cmd/crc-agent/main.gocontains a map-basedrewriteKubeconfigServer, whileinternal/resources/kubeconfig.goalready provides the typed sharedRewriteKubeconfigServer. The implementations differ: the agent copy silently skips malformed entries and does not clearinsecure-skip-tls-verify, while the shared helper does.cmd/crc-agent/tlsutil.goalso contains unused CA, client-certificate, serving-certificate, and PEM helpers. OnlyTLSFromPEMis used, and it only wrapstls.X509KeyPair.References
cmd/crc-agent/main.go:374-403internal/resources/kubeconfig.go:51-68cmd/crc-agent/tlsutil.go:52-202cmd/crc-agent/clusterclient.go:72-74Suggested direction
Use the shared kubeconfig rewrite and remove the local duplicate. Remove unused TLS helpers and private constants, or call
tls.X509KeyPairdirectly. Preserve tests for insecure flags, file-based CA data, and empty or malformed cluster entries.