@@ -19,6 +19,7 @@ package config
1919import (
2020 "fmt"
2121 "os"
22+ "strings"
2223
2324 "github.com/pkg/errors"
2425 "k8s.io/klog"
@@ -73,7 +74,7 @@ func GetVMStartupScript(machine *actuators.MachineScope, bootstrapToken string)
7374 SaKey : string (machine .Scope .ClusterConfig .SAKeyPair .Key ),
7475 BootstrapToken : bootstrapToken ,
7576 LBAddress : dnsName ,
76- KubernetesVersion : machine .Machine .Spec .Versions .ControlPlane ,
77+ KubernetesVersion : trimKubernetesVersion ( machine .Machine .Spec .Versions .ControlPlane ) ,
7778 CloudProviderConfig : getAzureCloudProviderConfig (machine ),
7879 })
7980 if err != nil {
@@ -100,7 +101,7 @@ func GetVMStartupScript(machine *actuators.MachineScope, bootstrapToken string)
100101 PodSubnet : machine .Scope .Cluster .Spec .ClusterNetwork .Pods .CIDRBlocks [0 ],
101102 ServiceSubnet : machine .Scope .Cluster .Spec .ClusterNetwork .Services .CIDRBlocks [0 ],
102103 ServiceDomain : machine .Scope .Cluster .Spec .ClusterNetwork .ServiceDomain ,
103- KubernetesVersion : machine .Machine .Spec .Versions .ControlPlane ,
104+ KubernetesVersion : trimKubernetesVersion ( machine .Machine .Spec .Versions .ControlPlane ) ,
104105 CloudProviderConfig : getAzureCloudProviderConfig (machine ),
105106 })
106107
@@ -116,7 +117,7 @@ func GetVMStartupScript(machine *actuators.MachineScope, bootstrapToken string)
116117 CACertHash : caCertHash ,
117118 BootstrapToken : bootstrapToken ,
118119 InternalLBAddress : azure .DefaultInternalLBIPAddress ,
119- KubernetesVersion : machine .Machine .Spec .Versions .Kubelet ,
120+ KubernetesVersion : trimKubernetesVersion ( machine .Machine .Spec .Versions .Kubelet ) ,
120121 CloudProviderConfig : getAzureCloudProviderConfig (machine ),
121122 })
122123
@@ -130,6 +131,11 @@ func GetVMStartupScript(machine *actuators.MachineScope, bootstrapToken string)
130131 return startupScript , nil
131132}
132133
134+ // trimKubernetesVersion removes "v" from prefix if given in this format: v1.13.4
135+ func trimKubernetesVersion (version string ) string {
136+ return strings .TrimPrefix (version , "v" )
137+ }
138+
133139// getAzureCloudProviderConfig gets azure provider config for control plane and kubelet
134140func getAzureCloudProviderConfig (machine * actuators.MachineScope ) string {
135141 return fmt .Sprintf (`{
0 commit comments