Skip to content

Commit b728806

Browse files
flaper87pierreprinetti
authored andcommitted
Don't fail on missing sshkeys (openshift#176)
Not all the scenarios supported by CAPO require the manager to pull the kubeconfig configs from the nodes. Rather than failing due to missing ssh keys, we should just log the inability to pull the config file and continue with the execution. This is an interim solution until openshift#174 is resolved. Related to openshift#175
1 parent ee02f66 commit b728806

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

pkg/cloud/openstack/machine/actuator.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ type OpenstackClient struct {
6868
}
6969

7070
func NewActuator(params openstack.ActuatorParams) (*OpenstackClient, error) {
71-
if _, err := os.Stat(SshPublicKeyPath); err != nil {
72-
return nil, fmt.Errorf("public key for the ssh key pair not found")
73-
}
74-
75-
if _, err := os.Stat(SshPrivateKeyPath); err != nil {
76-
return nil, fmt.Errorf("private key for the ssh key pair not found")
77-
}
78-
7971
return &OpenstackClient{
8072
params: params,
8173
client: params.Client,
@@ -302,6 +294,16 @@ func getIPFromInstance(instance *clients.Instance) (string, error) {
302294
}
303295

304296
func (oc *OpenstackClient) GetKubeConfig(cluster *clusterv1.Cluster, master *clusterv1.Machine) (string, error) {
297+
if _, err := os.Stat(SshPublicKeyPath); err != nil {
298+
klog.Infof("Can't get the KubeConfig file as the public ssh key could not be found: %v\n", SshPublicKeyPath)
299+
return "", nil
300+
}
301+
302+
if _, err := os.Stat(SshPrivateKeyPath); err != nil {
303+
klog.Infof("Can't get the KubeConfig file as the private ssh key could not be found: %v\n", SshPrivateKeyPath)
304+
return "", nil
305+
}
306+
305307
ip, err := oc.GetIP(cluster, master)
306308
if err != nil {
307309
return "", err

0 commit comments

Comments
 (0)