Skip to content

Commit c8d2d1a

Browse files
authored
Merge pull request #117 from andypitcher/el10
feat: add el10 and remove el8 support
2 parents 5e3ecb3 + 7aeb1f1 commit c8d2d1a

11 files changed

Lines changed: 53 additions & 77 deletions

File tree

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
e2e:
2525
strategy:
2626
matrix:
27-
distro: [centos8, centos9, fedora42]
27+
distro: [centos9, centos10, fedora42]
2828

2929
runs-on: ubuntu-latest
3030
steps:

Dockerfile

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,7 @@ ARG POLICY
44
# to build the SELinux policies and package them as RPM for each
55
# of the target platforms.
66

7-
FROM quay.io/centos/centos:stream8 AS centos8
8-
9-
10-
# Stream8 is now EOL and the DNS it relied on for mirror lists
11-
# (mirrorlist.centos.org), no longer resolves.
12-
# The adhoc solution is to disable the use of the mirrorlist and default
13-
# to vault.centos.org instead.
14-
#
15-
# https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/
16-
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
17-
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
18-
7+
FROM quay.io/centos/centos:stream9 AS centos9
198
RUN yum install -y \
209
createrepo_c \
2110
epel-release \
@@ -25,15 +14,16 @@ RUN yum install -y \
2514
rpm-build \
2615
rpm-sign
2716

28-
FROM quay.io/centos/centos:stream9 AS centos9
17+
FROM quay.io/centos/centos:stream10 AS centos10
2918
RUN yum install -y \
3019
createrepo_c \
3120
epel-release \
3221
container-selinux \
3322
selinux-policy-devel \
3423
yum-utils \
3524
rpm-build \
36-
rpm-sign
25+
rpm-sign \
26+
gnupg2
3727

3828
FROM fedora:42 AS fedora42
3929
RUN dnf clean all && dnf install -y \

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,10 @@ e2e-%:
112112
limactl cp hack/e2e/setup-vm.sh $(subst :,/,$*):/tmp/setup-vm.sh
113113
limactl shell $(subst :,/,$*) sudo /tmp/setup-vm.sh
114114

115-
limactl stop $(subst :,/,$*)
116-
limactl delete $(subst :,/,$*)
115+
limactl delete -f $(subst :,/,$*)
117116

118117
e2e-%-clean:
119-
limactl stop $(subst :,/,$*)
120-
limactl delete $(subst :,/,$*)
118+
limactl delete -f $(subst :,/,$*)
121119

122120
help: ## display Makefile's help.
123121
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ The following Rancher compnents are covered by the policy:
2020

2121
| Operating System | Version | Supported | Policy | E2E |
2222
| :-------------------- | :------ | :----------------- | :--------- | :-------------------- |
23-
| RHEL/CentOS/Rocky | 8 | :white_check_mark: | [centos8] | :white_check_mark: |
2423
| RHEL/CentOS/Rocky | 9 | :white_check_mark: | [centos9] | :white_check_mark: |
24+
| RHEL/CentOS/Rocky | 10 | :white_check_mark: | [centos10] | :white_check_mark: |
2525
| Fedora | 42 | :white_check_mark: | [fedora42] | :white_check_mark: |
2626
| SUSE SLE/Micro | Stable | :white_check_mark: | [microos] | :construction: |
2727

@@ -50,8 +50,8 @@ The following list shows the expected tag to (example) transformation for RPM's
5050
| v0.2.testing.1 | Clean | `rancher-selinux-0.2-1.el7.noarch.rpm` | Testing ||
5151
| v0.2.production.1 | Clean | `rancher-selinux-0.2-1.el7.noarch.rpm` | Production ||
5252

53-
[centos8]: https://github.com/rancher/rancher-selinux/tree/main/policy/centos8
5453
[centos9]: https://github.com/rancher/rancher-selinux/tree/main/policy/centos9
54+
[centos10]: https://github.com/rancher/rancher-selinux/tree/main/policy/centos10
5555
[fedora42]: https://github.com/rancher/rancher-selinux/tree/main/policy/fedora42
5656
[microos]: https://github.com/rancher/rancher-selinux/tree/main/policy/microos
5757
[fluentbit]: https://github.com/rancher/charts/blob/262597a41a175cfb4785d70fd76b33d56f8c1f95/charts/rancher-logging/106.0.1%2Bup4.10.0-rancher.4/templates/loggings/k3s/daemonset.yaml#L22

hack/e2e/centos10.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
images:
2+
- location: https://dl.rockylinux.org/pub/rocky/10/images/x86_64/Rocky-10-GenericCloud-Base.latest.x86_64.qcow2
3+
arch: x86_64
4+
- location: https://dl.rockylinux.org/pub/rocky/10/images/aarch64/Rocky-10-GenericCloud-Base.latest.aarch64.qcow2
5+
arch: aarch64

hack/e2e/centos8.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

hack/e2e/setup-vm.sh

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ function enforceSELinux(){
66
echo "> Check SELinux status"
77
# Short circuit if SELinux is not being enforced.
88
getenforce | grep -q Enforcing
9-
# Remove dontaudits from policy for debugging
9+
# Remove dontaudits from policy for debugging.
1010
sudo semodule -DB
11-
# Install container-selinux and selinux-policy latest versions
11+
# Install extra kernel modules needed for networking/conntrack (EL10 requirement).
12+
# See: https://docs.rke2.io/install/requirements#linux
13+
# We target $(uname -r) to ensure modules match the running kernel and avoid a reboot.
14+
sudo dnf install "kernel-modules-extra-$(uname -r)" -y
15+
# Install container-selinux and selinux-policy latest versions.
1216
sudo dnf install -y container-selinux selinux-policy --best --allowerasing
13-
# Install rancher-selinux policy
17+
# Install rancher-selinux policy.
1418
sudo dnf install -y /tmp/rancher-selinux.rpm
1519
}
1620

@@ -40,13 +44,17 @@ function installDependencies(){
4044

4145
function installRKE2(){
4246
echo "> Installing RKE2"
43-
curl -sfL https://get.rke2.io | sh -
47+
# Download the official RKE2 installer script and patch the script to include EL10 in the RPM-based OS detection logic.
48+
# This changes '7|8|9)' to '7|8|9|10)' so the script doesn't fall back to a generic tarball install.
49+
# TODO: use the default install command once https://github.com/rancher/rke2/pull/9557 is merged.
50+
curl -sfL https://get.rke2.io -o install.sh
51+
sed -i 's/7|8|9)/7|8|9|10)/g' install.sh && sh install.sh
4452
systemctl start rke2-server.service
4553
systemctl enable rke2-server.service
4654

4755
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml
4856
echo "export KUBECONFIG=/etc/rancher/rke2/rke2.yaml" >> ~/.bashrc
49-
# Making the kubeconfig world-readable, as this is for tests purposes only.
57+
# Making the kubeconfig world-readable, as this is for test purposes only.
5058
chmod +r /etc/rancher/rke2/rke2.yaml
5159

5260
kubectl wait --for=create node/$(hostname) --timeout=240s
@@ -70,26 +78,24 @@ function installRancher(){
7078
--namespace cattle-system \
7179
--set hostname=rancher.local \
7280
--set replicas=1 \
73-
--wait
74-
75-
# Background processes, such as Fleet deployment need to take place, which
76-
# may result in intermittent errors. Adding some extra verification,
77-
# such as rancher-webhook deployment creation.
81+
--wait
7882

83+
# Background processes, such as Fleet deployment need to take place, which may result in intermittent errors.
84+
# Adding some extra verification, such as rancher-webhook deployment creation.
7985
kubectl wait --for=condition=ready -n cattle-system pod -l app=rancher --timeout=600s
8086
kubectl wait --for=create -n cattle-system deployment/rancher-webhook --timeout=240s
8187
kubectl wait --for=condition=ready -n cattle-system pod -l app=rancher-webhook --timeout=240s
8288
}
8389

84-
# Example: installRancherChart "rancher-monitoring" "cattle-monitoring-system" "rancher-monitoring-prometheus-node-exporter" "app.kubernetes.io/name=prometheus-node-exporter" "--set prometheus.prometheusSpec.maximumStartupDurationSeconds=60"
90+
# Example: installRancherChart "rancher-monitoring" "cattle-monitoring-system" "rancher-monitoring-prometheus-node-exporter" "app.kubernetes.io/name=prometheus-node-exporter" "--set ...".
8591
function installRancherChart() {
8692
local CHART_NAME="$1"
8793
local NAMESPACE="$2"
8894
local DAEMONSET_NAME="$3"
8995
local POD_LABEL_SELECTOR="$4"
90-
local EXTRA_HELM_ARGS="${@:5}" # Collect any additional arguments
96+
local EXTRA_HELM_ARGS="${@:5}" # Collect any additional arguments.
9197

92-
# Add Rancher charts repository
98+
# Add Rancher charts repository.
9399
helm repo add rancher-charts https://charts.rancher.io/
94100

95101
echo "> Installing CRD chart ${CHART_NAME}-crd in namespace ${NAMESPACE}"
@@ -108,7 +114,7 @@ function installRancherChart() {
108114
--set global.seLinux.enabled=true \
109115
${EXTRA_HELM_ARGS}
110116

111-
# Wait for DaemonSet creation and Pod readiness
117+
# Wait for DaemonSet creation and Pod readiness.
112118
kubectl wait --for=create -n "${NAMESPACE}" daemonset/"${DAEMONSET_NAME}" --timeout=240s
113119
kubectl wait --for=condition=ready -n "${NAMESPACE}" pod -l "${POD_LABEL_SELECTOR}" --timeout=240s
114120
}
@@ -125,12 +131,12 @@ function uninstallRancherChart() {
125131
echo "> Deleting namespace ${NAMESPACE}"
126132
kubectl delete ns "${NAMESPACE}" --timeout=120s
127133

128-
# Force-reclaim caches to provide a clean memory slate for the next chart test
129-
# This was added to help mitigate time-out issues in e2e
134+
# Force-reclaim caches to provide a clean memory slate for the next chart test.
135+
# This was added to help mitigate time-out issues in e2e.
130136
sudo sync && echo 3 > /proc/sys/vm/drop_caches
131137
}
132138

133-
# Example: e2eSELinuxVerification "fluentbit" "fluent-bit" "cattle-logging-system" "rke_logreader_t"
139+
# Example: e2eSELinuxVerification "fluentbit" "fluent-bit" "cattle-logging-system" "rke_logreader_t".
134140
function e2eSELinuxVerification(){
135141
local CONTAINER_NAME="$1"
136142
local CONTAINER_RUNNING_NAME="$2"
@@ -171,45 +177,42 @@ function main(){
171177
installRKE2
172178
installRancher
173179

174-
# Note: Append this list with new components to install and test the rancher-selinux policy
175-
# Value: A space-separated list of arguments:
176-
# Namespace DaemonSet PodLabel ContainerName ContainerRunningName SELinuxType ExtraHelmArgs
180+
# Note: Append this list with new components to install and test the rancher-selinux policy.
181+
# Value: A space-separated list of arguments: Namespace DaemonSet PodLabel ContainerName ContainerRunningName SELinuxType ExtraHelmArgs.
177182
declare -A COMPONENTS=(
178183
[rancher-monitoring]="cattle-monitoring-system rancher-monitoring-prometheus-node-exporter app.kubernetes.io/name=prometheus-node-exporter node-exporter node-exporter prom_node_exporter_t --set prometheus.prometheusSpec.maximumStartupDurationSeconds=60"
179184
[rancher-logging]="cattle-logging-system rancher-logging-root-fluentbit app.kubernetes.io/name=fluentbit fluentbit fluent-bit rke_logreader_t"
180185
)
181186

182187
for CHART_NAME in "${!COMPONENTS[@]}"; do
183-
# Read the space-separated values into individual variables
188+
# Read the space-separated values into individual variables.
184189
read -r NAMESPACE DAEMONSET_NAME POD_LABEL CONTAINER_NAME CONTAINER_RUNNING_NAME SELINUX_TYPE EXTRA_HELM_ARGS <<< "${COMPONENTS[${CHART_NAME}]}"
185190

186191
echo "> Installing and testing Chart: ${CHART_NAME} in Namespace: ${NAMESPACE} with SELinux type ${SELINUX_TYPE}"
187192

188-
# 1. Install the chart (passing the collected variables)
193+
# 1. Install the chart (passing the collected variables).
189194
installRancherChart \
190195
"${CHART_NAME}" \
191196
"${NAMESPACE}" \
192197
"${DAEMONSET_NAME}" \
193198
"${POD_LABEL}" \
194199
"${EXTRA_HELM_ARGS}"
195200

196-
# 2. Run E2E SELinux Verification
201+
# 2. Run E2E SELinux Verification.
197202
e2eSELinuxVerification \
198203
"${CONTAINER_NAME}" \
199204
"${CONTAINER_RUNNING_NAME}" \
200205
"${NAMESPACE}" \
201206
"${SELINUX_TYPE}"
202207

203-
# 3. Uninstall the chart (free some resources)
208+
# 3. Uninstall the chart (free some resources).
204209
uninstallRancherChart \
205210
"${CHART_NAME}" \
206211
"${NAMESPACE}"
207212
done
208213
}
209214

210-
# This is needed as Rocky does not include it in the PATH,
211-
# which is required for the Helm install.
215+
# Rocky does not include this in the PATH by default, which is required for Helm.
212216
export PATH=$PATH:/usr/local/bin
213217

214218
main
215-

hack/upload

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ function aws_auth()
5252
function upload_artefacts()
5353
{
5454
case "${POLICY}" in
55-
"centos8")
56-
S3_POLICY_DIR="centos/8"
57-
;;
5855
"centos9")
5956
S3_POLICY_DIR="centos/9"
6057
;;
58+
"centos10")
59+
S3_POLICY_DIR="centos/10"
60+
;;
6161
"fedora42")
6262
S3_POLICY_DIR="fedora/42"
6363
;;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# vim: sw=4:ts=4:et
22

3-
%define selinux_policyver 3.14.3-139
4-
%define container_policyver 2.229.0-2
3+
%define selinux_policyver 42.1.7-1
4+
%define container_policyver 2.244.0-1
55

66
%define relabel_files() \
77
mkdir -p /var/lib/rancher/rke /etc/kubernetes /opt/rke; \
88
restorecon -R /var/lib/rancher /etc/kubernetes /opt/rke;
99

1010
Name: rancher-selinux
1111
Version: %{rancher_selinux_version}
12-
Release: %{rancher_selinux_release}.el8
12+
Release: %{rancher_selinux_release}.el10
1313
Summary: SELinux policy module for Rancher
1414
Vendor: SUSE LLC
1515
Packager: SUSE LLC <https://www.suse.com/>

0 commit comments

Comments
 (0)