@@ -30,16 +30,16 @@ var (
30
30
configureForKubeVIPScriptOnRemote = common .ConfigFilePathOnRemote (
31
31
"configure-for-kube-vip.sh" )
32
32
33
- configureForKubeVIPScriptOnRemotePreKubeadmCommand = "/bin/bash " + configureForKubeVIPScriptOnRemote + " use-super-admin.conf"
34
- configureForKubeVIPScriptOnRemotePostKubeadmCommand = "/bin/bash " + configureForKubeVIPScriptOnRemote + " use-admin.conf"
33
+ configureForKubeVIPScriptOnRemotePreKubeadmCommand = "/bin/bash " +
34
+ configureForKubeVIPScriptOnRemote + " use-super-admin.conf"
35
+ configureForKubeVIPScriptOnRemotePostKubeadmCommand = "/bin/bash " +
36
+ configureForKubeVIPScriptOnRemote + " use-admin.conf"
35
37
36
38
setHostAliasesScriptOnRemoteCommand = "/bin/bash " + configureForKubeVIPScriptOnRemote + " set-host-aliases"
37
39
)
38
40
39
- var (
40
- //go:embed templates/configure-for-kube-vip.sh
41
- configureForKubeVIPScript []byte
42
- )
41
+ //go:embed templates/configure-for-kube-vip.sh
42
+ var configureForKubeVIPScript []byte
43
43
44
44
type kubeVIPFromConfigMapProvider struct {
45
45
client client.Reader
@@ -72,7 +72,7 @@ func (p *kubeVIPFromConfigMapProvider) GenerateFilesAndCommands(
72
72
ctx context.Context ,
73
73
spec v1alpha1.ControlPlaneEndpointSpec ,
74
74
cluster * clusterv1.Cluster ,
75
- ) ([]bootstrapv1.File , [] string , []string , error ) {
75
+ ) (files []bootstrapv1.File , preKubeadmCommands , postKubeadmCommands []string , err error ) {
76
76
data , err := getTemplateFromConfigMap (ctx , p .client , p .configMapKey )
77
77
if err != nil {
78
78
return nil , nil , nil , fmt .Errorf ("failed getting template data: %w" , err )
@@ -83,7 +83,7 @@ func (p *kubeVIPFromConfigMapProvider) GenerateFilesAndCommands(
83
83
return nil , nil , nil , fmt .Errorf ("failed templating static Pod: %w" , err )
84
84
}
85
85
86
- files : = []bootstrapv1.File {
86
+ files = []bootstrapv1.File {
87
87
{
88
88
Content : kubeVIPStaticPod ,
89
89
Owner : kubeVIPFileOwner ,
@@ -114,7 +114,10 @@ func (p *kubeVIPFromConfigMapProvider) GenerateFilesAndCommands(
114
114
// See https://github.com/kubernetes/kubernetes/issues/122420#issuecomment-1864609518
115
115
needCommands , err := needHackCommands (cluster )
116
116
if err != nil {
117
- return nil , nil , nil , fmt .Errorf ("failed to determine if kube-vip commands are needed: %w" , err )
117
+ return nil , nil , nil , fmt .Errorf (
118
+ "failed to determine if kube-vip commands are needed: %w" ,
119
+ err ,
120
+ )
118
121
}
119
122
if ! needCommands {
120
123
return files , nil , nil , nil
@@ -129,11 +132,11 @@ func (p *kubeVIPFromConfigMapProvider) GenerateFilesAndCommands(
129
132
},
130
133
)
131
134
132
- preKubeadmCommands : = []string {
135
+ preKubeadmCommands = []string {
133
136
setHostAliasesScriptOnRemoteCommand ,
134
137
configureForKubeVIPScriptOnRemotePreKubeadmCommand ,
135
138
}
136
- postKubeadmCommands : = []string {configureForKubeVIPScriptOnRemotePostKubeadmCommand }
139
+ postKubeadmCommands = []string {configureForKubeVIPScriptOnRemotePostKubeadmCommand }
137
140
138
141
return files , preKubeadmCommands , postKubeadmCommands , nil
139
142
}
0 commit comments