mirror of
https://github.com/ysoftdevs/gardener-extension-shoot-fleet-agent.git
synced 2026-04-01 06:33:50 +02:00
Initial v1.0.0 commit
This commit is contained in:
24
pkg/controller/utils.go
Normal file
24
pkg/controller/utils.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
func writeKubeconfigToTempFile(kubeconfig []byte) (path string, error error) {
|
||||
tmpFile, err := ioutil.TempFile(os.TempDir(), "kubeconfig-")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if _, err = tmpFile.Write(kubeconfig); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Close the file
|
||||
if err := tmpFile.Close(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return tmpFile.Name(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user