Skip to content

Commit

Permalink
Merge pull request #206 from alexander-demicev/cherrypick-selinux
Browse files Browse the repository at this point in the history
[release-0.2] Fix selinux in ignition for SLE micro
  • Loading branch information
alexander-demicev committed Nov 22, 2023
2 parents 297b370 + 5d15f50 commit 0663c43
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions bootstrap/internal/ignition/ignition.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@ const (

var (
serverSystemdServices = []string{
"semanage fcontext -a -t systemd_unit_file_t /usr/lib/systemd/system/rke2-server.service",
"setenforce 0",
"systemctl enable rke2-server.service",
"systemctl start rke2-server.service",
"restorecon /etc/systemd/system/rke2-server.service",
"setenforce 1",
}

workerSystemdServices = []string{
"semanage fcontext -a -t systemd_unit_file_t /usr/lib/systemd/system/rke2-agent.service",
"setenforce 0",
"systemctl enable rke2-agent.service",
"systemctl start rke2-agent.service",
"restorecon /etc/systemd/system/rke2-agent.service",
"setenforce 1",
}
)

Expand Down
8 changes: 4 additions & 4 deletions bootstrap/internal/ignition/ignition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ var _ = Describe("getControlPlaneRKE2Commands", func() {
It("should return slice of control plane commands", func() {
commands, err := getControlPlaneRKE2Commands(baseUserData)
Expect(err).ToNot(HaveOccurred())
Expect(commands).To(HaveLen(3))
Expect(commands).To(HaveLen(7))
Expect(commands).To(ContainElements(fmt.Sprintf(controlPlaneCommand, baseUserData.RKE2Version), serverSystemdServices[0], serverSystemdServices[1]))
})

It("should return slice of control plane commands with air gapped", func() {
baseUserData.AirGapped = true
commands, err := getControlPlaneRKE2Commands(baseUserData)
Expect(err).ToNot(HaveOccurred())
Expect(commands).To(HaveLen(3))
Expect(commands).To(HaveLen(7))
Expect(commands).To(ContainElements(airGappedControlPlaneCommand, serverSystemdServices[0], serverSystemdServices[1]))
})

Expand Down Expand Up @@ -247,15 +247,15 @@ var _ = Describe("getWorkerRKE2Commands", func() {
It("should return slice of worker commands", func() {
commands, err := getWorkerRKE2Commands(baseUserData)
Expect(err).ToNot(HaveOccurred())
Expect(commands).To(HaveLen(3))
Expect(commands).To(HaveLen(7))
Expect(commands).To(ContainElements(fmt.Sprintf(workerCommand, baseUserData.RKE2Version), workerSystemdServices[0], workerSystemdServices[1]))
})

It("should return slice of worker commands with air gapped", func() {
baseUserData.AirGapped = true
commands, err := getWorkerRKE2Commands(baseUserData)
Expect(err).ToNot(HaveOccurred())
Expect(commands).To(HaveLen(3))
Expect(commands).To(HaveLen(7))
Expect(commands).To(ContainElements(airGappedWorkerCommand, workerSystemdServices[0], workerSystemdServices[1]))
})

Expand Down

0 comments on commit 0663c43

Please sign in to comment.