renoki-co/php-k8s

Working with multiple kubeconfig file having same context has issue due to "LoadsFromKubeConfig.php#writeTempFileForContext attempting to reuse"

declum opened this issue · 2 comments

Working with multiple kubeconfig file having same context has issue due to "LoadsFromKubeConfig.php#writeTempFileForContext attempting to reuse"

$tempFilePath = $tempFolder.DIRECTORY_SEPARATOR."ctx-{$context}-{$fileName}";

if (file_exists($tempFilePath)) {
return $tempFilePath;
}

I think it should be fine, else it might load /tmp folder if it uses random, but client should be aware of it.

Probably do a checksum and error out instead of just returning if the file exists with the context.

I'm assuming there should be a user-host-context prefix, right?