Skip to content

Commit a504fff

Browse files
Create bootstrap-success before setting selinux to enforcing mode
Signed-off-by: Alexandr Demicev <alexandr.demicev@suse.com>
1 parent 0663c43 commit a504fff

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

bootstrap/internal/ignition/butane/butane.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ storage:
121121
{{ . | Indent 10 }}
122122
{{- end }}
123123
124-
mkdir -p /run/cluster-api && echo success > /run/cluster-api/bootstrap-success.complete
125124
{{range .PostRKE2Commands }}
126125
{{ . | Indent 10 }}
127126
{{- end }}

bootstrap/internal/ignition/ignition.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,23 @@ const (
3131
)
3232

3333
var (
34-
serverSystemdServices = []string{
34+
serverDeployCommands = []string{
3535
"semanage fcontext -a -t systemd_unit_file_t /usr/lib/systemd/system/rke2-server.service",
3636
"setenforce 0",
3737
"systemctl enable rke2-server.service",
3838
"systemctl start rke2-server.service",
3939
"restorecon /etc/systemd/system/rke2-server.service",
40+
"mkdir -p /run/cluster-api && echo success > /run/cluster-api/bootstrap-success.complete",
4041
"setenforce 1",
4142
}
4243

43-
workerSystemdServices = []string{
44+
workerDeployCommands = []string{
4445
"semanage fcontext -a -t systemd_unit_file_t /usr/lib/systemd/system/rke2-agent.service",
4546
"setenforce 0",
4647
"systemctl enable rke2-agent.service",
4748
"systemctl start rke2-agent.service",
4849
"restorecon /etc/systemd/system/rke2-agent.service",
50+
"mkdir -p /run/cluster-api && echo success > /run/cluster-api/bootstrap-success.complete",
4951
"setenforce 1",
5052
}
5153
)
@@ -136,11 +138,11 @@ func render(input *cloudinit.BaseUserData, ignitionConfig *bootstrapv1.Additiona
136138
}
137139

138140
func getControlPlaneRKE2Commands(baseUserData *cloudinit.BaseUserData) ([]string, error) {
139-
return getRKE2Commands(baseUserData, controlPlaneCommand, airGappedControlPlaneCommand, serverSystemdServices)
141+
return getRKE2Commands(baseUserData, controlPlaneCommand, airGappedControlPlaneCommand, serverDeployCommands)
140142
}
141143

142144
func getWorkerRKE2Commands(baseUserData *cloudinit.BaseUserData) ([]string, error) {
143-
return getRKE2Commands(baseUserData, workerCommand, airGappedWorkerCommand, workerSystemdServices)
145+
return getRKE2Commands(baseUserData, workerCommand, airGappedWorkerCommand, workerDeployCommands)
144146
}
145147

146148
func getRKE2Commands(baseUserData *cloudinit.BaseUserData, command, airgappedCommand string, systemdServices []string) ([]string, error) {

bootstrap/internal/ignition/ignition_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,16 @@ var _ = Describe("getControlPlaneRKE2Commands", func() {
207207
It("should return slice of control plane commands", func() {
208208
commands, err := getControlPlaneRKE2Commands(baseUserData)
209209
Expect(err).ToNot(HaveOccurred())
210-
Expect(commands).To(HaveLen(7))
211-
Expect(commands).To(ContainElements(fmt.Sprintf(controlPlaneCommand, baseUserData.RKE2Version), serverSystemdServices[0], serverSystemdServices[1]))
210+
Expect(commands).To(HaveLen(8))
211+
Expect(commands).To(ContainElements(fmt.Sprintf(controlPlaneCommand, baseUserData.RKE2Version), serverDeployCommands[0], serverDeployCommands[1]))
212212
})
213213

214214
It("should return slice of control plane commands with air gapped", func() {
215215
baseUserData.AirGapped = true
216216
commands, err := getControlPlaneRKE2Commands(baseUserData)
217217
Expect(err).ToNot(HaveOccurred())
218-
Expect(commands).To(HaveLen(7))
219-
Expect(commands).To(ContainElements(airGappedControlPlaneCommand, serverSystemdServices[0], serverSystemdServices[1]))
218+
Expect(commands).To(HaveLen(8))
219+
Expect(commands).To(ContainElements(airGappedControlPlaneCommand, serverDeployCommands[0], serverDeployCommands[1]))
220220
})
221221

222222
It("should return error if base userdata is nil", func() {
@@ -247,16 +247,16 @@ var _ = Describe("getWorkerRKE2Commands", func() {
247247
It("should return slice of worker commands", func() {
248248
commands, err := getWorkerRKE2Commands(baseUserData)
249249
Expect(err).ToNot(HaveOccurred())
250-
Expect(commands).To(HaveLen(7))
251-
Expect(commands).To(ContainElements(fmt.Sprintf(workerCommand, baseUserData.RKE2Version), workerSystemdServices[0], workerSystemdServices[1]))
250+
Expect(commands).To(HaveLen(8))
251+
Expect(commands).To(ContainElements(fmt.Sprintf(workerCommand, baseUserData.RKE2Version), workerDeployCommands[0], workerDeployCommands[1]))
252252
})
253253

254254
It("should return slice of worker commands with air gapped", func() {
255255
baseUserData.AirGapped = true
256256
commands, err := getWorkerRKE2Commands(baseUserData)
257257
Expect(err).ToNot(HaveOccurred())
258-
Expect(commands).To(HaveLen(7))
259-
Expect(commands).To(ContainElements(airGappedWorkerCommand, workerSystemdServices[0], workerSystemdServices[1]))
258+
Expect(commands).To(HaveLen(8))
259+
Expect(commands).To(ContainElements(airGappedWorkerCommand, workerDeployCommands[0], workerDeployCommands[1]))
260260
})
261261

262262
It("should return error if base userdata is nil", func() {

0 commit comments

Comments
 (0)