Skip to content

Commit 0663c43

Browse files
Merge pull request #206 from alexander-demicev/cherrypick-selinux
[release-0.2] Fix selinux in ignition for SLE micro
2 parents 297b370 + 5d15f50 commit 0663c43

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

bootstrap/internal/ignition/ignition.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,21 @@ const (
3232

3333
var (
3434
serverSystemdServices = []string{
35+
"semanage fcontext -a -t systemd_unit_file_t /usr/lib/systemd/system/rke2-server.service",
36+
"setenforce 0",
3537
"systemctl enable rke2-server.service",
3638
"systemctl start rke2-server.service",
39+
"restorecon /etc/systemd/system/rke2-server.service",
40+
"setenforce 1",
3741
}
3842

3943
workerSystemdServices = []string{
44+
"semanage fcontext -a -t systemd_unit_file_t /usr/lib/systemd/system/rke2-agent.service",
45+
"setenforce 0",
4046
"systemctl enable rke2-agent.service",
4147
"systemctl start rke2-agent.service",
48+
"restorecon /etc/systemd/system/rke2-agent.service",
49+
"setenforce 1",
4250
}
4351
)
4452

bootstrap/internal/ignition/ignition_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,15 @@ 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(3))
210+
Expect(commands).To(HaveLen(7))
211211
Expect(commands).To(ContainElements(fmt.Sprintf(controlPlaneCommand, baseUserData.RKE2Version), serverSystemdServices[0], serverSystemdServices[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(3))
218+
Expect(commands).To(HaveLen(7))
219219
Expect(commands).To(ContainElements(airGappedControlPlaneCommand, serverSystemdServices[0], serverSystemdServices[1]))
220220
})
221221

@@ -247,15 +247,15 @@ 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(3))
250+
Expect(commands).To(HaveLen(7))
251251
Expect(commands).To(ContainElements(fmt.Sprintf(workerCommand, baseUserData.RKE2Version), workerSystemdServices[0], workerSystemdServices[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(3))
258+
Expect(commands).To(HaveLen(7))
259259
Expect(commands).To(ContainElements(airGappedWorkerCommand, workerSystemdServices[0], workerSystemdServices[1]))
260260
})
261261

0 commit comments

Comments
 (0)