Skip to content

Commit 982993b

Browse files
karank8s-ci-robot
authored andcommitted
vsphere generate-yaml usability changes, timeout for clusterctl (#302)
* vsphere generate-yaml usability changes * Change timeouts, copy ssh keys if they dontexist
1 parent 578ec1b commit 982993b

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

clusterctl/clusterdeployer/clusterclient.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ const (
3535
ApiServerPort = 443
3636
RetryIntervalKubectlApply = 5 * time.Second
3737
RetryIntervalResourceReady = 5 * time.Second
38-
TimeoutKubectlApply = 2 * time.Minute
39-
TimeoutResourceReady = 2 * time.Minute
40-
TimeoutMachineReady = 5 * time.Minute
38+
TimeoutKubectlApply = 5 * time.Minute
39+
TimeoutResourceReady = 5 * time.Minute
40+
TimeoutMachineReady = 10 * time.Minute
4141
)
4242

4343
type clusterClient struct {

clusterctl/clusterdeployer/clusterdeployer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ func (d *ClusterDeployer) writeKubeconfig(kubeconfig string) error {
300300

301301
func waitForKubeconfigReady(provider ProviderDeployer, cluster *clusterv1.Cluster, machine *clusterv1.Machine) (string, error) {
302302
kubeconfig := ""
303-
err := util.Poll(500*time.Millisecond, 120*time.Second, func() (bool, error) {
303+
err := util.Poll(5*time.Second, 10*time.Minute, func() (bool, error) {
304304
glog.V(2).Infof("Waiting for kubeconfig on %v to become ready...", machine.Name)
305305
k, err := provider.GetKubeConfig(cluster, machine)
306306
if err != nil {

clusterctl/examples/vsphere/generate-yaml.sh

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,33 @@ while test $# -gt 0; do
4040
done
4141

4242
if [ $OVERWRITE -ne 1 ] && [ -f $PROVIDERCOMPONENT_GENERATED_FILE ]; then
43-
echo File $PROVIDERCOMPONENT_GENERATED_FILE already exists. Delete it manually before running this script.
43+
echo "File $PROVIDERCOMPONENT_GENERATED_FILE already exists. Delete it manually before running this script."
4444
exit 1
4545
fi
4646

47-
if [ ! -f $MACHINE_CONTROLLER_SSH_PRIVATE_FILE ]; then
48-
echo Generate SSH key files fo machine controller
49-
ssh-keygen -t rsa -f $MACHINE_CONTROLLER_SSH_PRIVATE_FILE -N ""
47+
# Check if the ssh key already exists. If not, generate and copy to the .ssh dir.
48+
if [ ! -f $MACHINE_CONTROLLER_SSH_HOME$MACHINE_CONTROLLER_SSH_PRIVATE_FILE ]; then
49+
echo "Generating SSH key files for machine controller."
50+
# This is needed because GetKubeConfig assumes the key in the home .ssh dir.
51+
ssh-keygen -t rsa -f $MACHINE_CONTROLLER_SSH_HOME$MACHINE_CONTROLLER_SSH_PRIVATE_FILE -N ""
5052
fi
5153

52-
# Copy file to home ssh directory till using vsphere GetIP logic that
53-
# does not assume the file at this location
54-
cp $MACHINE_CONTROLLER_SSH_PUBLIC_FILE $MACHINE_CONTROLLER_SSH_HOME
55-
cp $MACHINE_CONTROLLER_SSH_PRIVATE_FILE $MACHINE_CONTROLLER_SSH_HOME
56-
57-
MACHINE_CONTROLLER_SSH_PUBLIC=$(cat $MACHINE_CONTROLLER_SSH_PUBLIC_FILE|base64 -w0)
58-
MACHINE_CONTROLLER_SSH_PRIVATE=$(cat $MACHINE_CONTROLLER_SSH_PRIVATE_FILE|base64 -w0)
54+
OS=$(uname)
55+
if [[ "$OS" =~ "Linux" ]]; then
56+
MACHINE_CONTROLLER_SSH_PUBLIC=$(cat $MACHINE_CONTROLLER_SSH_HOME$MACHINE_CONTROLLER_SSH_PUBLIC_FILE|base64 -w0)
57+
MACHINE_CONTROLLER_SSH_PRIVATE=$(cat $MACHINE_CONTROLLER_SSH_HOME$MACHINE_CONTROLLER_SSH_PRIVATE_FILE|base64 -w0)
58+
elif [[ "$OS" =~ "Darwin" ]]; then
59+
MACHINE_CONTROLLER_SSH_PUBLIC=$(cat $MACHINE_CONTROLLER_SSH_HOME$MACHINE_CONTROLLER_SSH_PUBLIC_FILE|base64)
60+
MACHINE_CONTROLLER_SSH_PRIVATE=$(cat $MACHINE_CONTROLLER_SSH_HOME$MACHINE_CONTROLLER_SSH_PRIVATE_FILE|base64)
61+
else
62+
echo "Unrecognized OS : $OS"
63+
exit 1
64+
fi
5965

6066
cat $PROVIDERCOMPONENT_TEMPLATE_FILE \
6167
| sed -e "s/\$MACHINE_CONTROLLER_SSH_PUBLIC/$MACHINE_CONTROLLER_SSH_PUBLIC/" \
6268
| sed -e "s/\$MACHINE_CONTROLLER_SSH_PRIVATE/$MACHINE_CONTROLLER_SSH_PRIVATE/" \
63-
> $PROVIDERCOMPONENT_GENERATED_FILE
69+
> $PROVIDERCOMPONENT_GENERATED_FILE
70+
71+
echo "Done generating $PROVIDERCOMPONENT_GENERATED_FILE"
72+
echo "You will still need to generate the cluster.yaml and machines.yaml"

0 commit comments

Comments
 (0)