Add nodeutil opt to bootstrapping from rest.Config
This uses a rest.Config to bootstrap TLS for the http server, webhook auth, and the client. This can be expanded later to do other kinds of TLS bootstrapping. For now this seems to get the job done in terms of what VK expects for permissions on the cluster. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
@@ -24,7 +24,7 @@ func ClientsetFromEnv(kubeConfigPath string) (*kubernetes.Clientset, error) {
|
||||
)
|
||||
|
||||
if kubeConfigPath != "" {
|
||||
config, err = clientsetFromEnvKubeConfigPath(kubeConfigPath)
|
||||
config, err = RestConfigFromEnv(kubeConfigPath)
|
||||
} else {
|
||||
config, err = rest.InClusterConfig()
|
||||
}
|
||||
@@ -36,7 +36,8 @@ func ClientsetFromEnv(kubeConfigPath string) (*kubernetes.Clientset, error) {
|
||||
return kubernetes.NewForConfig(config)
|
||||
}
|
||||
|
||||
func clientsetFromEnvKubeConfigPath(kubeConfigPath string) (*rest.Config, error) {
|
||||
// RestConfigFromEnv is like ClientsetFromEnv except it returns a rest config instead of a full client.
|
||||
func RestConfigFromEnv(kubeConfigPath string) (*rest.Config, error) {
|
||||
_, err := os.Stat(kubeConfigPath)
|
||||
if os.IsNotExist(err) {
|
||||
return rest.InClusterConfig()
|
||||
|
||||
Reference in New Issue
Block a user