Silence SELinux warning on INSTALL_K3S_SKIP_SELINUX_RPM (#8703)

When k3s is installed with INSTALL_K3S_SKIP_SELINUX_RPM=true or
INSTALL_K3S_SKIP_DOWNLOAD=true or INSTALL_K3S_SKIP_DOWNLOAD=selinux,
the following message(or similar) is seen on Amazon Linux 2023/Centos
```
[INFO]  Skipping installation of SELinux RPM
[WARN]  Failed to find the k3s-selinux policy, please install:
    dnf install -y container-selinux
    dnf install -y https://rpm.rancher.io/k3s/stable/common/centos/8/noarch/

[INFO]  Creating /usr/bin/kubectl symlink to k3s
```

whereas now

```
[INFO]  Skipping installation of SELinux RPM
[INFO]  Creating /usr/bin/kubectl symlink to k3s
```

Signed-off-by: Harsimran Singh Maan <maan.harry@gmail.com>
This commit is contained in:
Harsimran Singh Maan 2024-01-02 12:30:07 -08:00 committed by GitHub
parent aca1c2fd11
commit baaab250a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -547,10 +547,11 @@ setup_selinux() {
if [ "$INSTALL_K3S_SKIP_SELINUX_RPM" = true ] || can_skip_download_selinux || [ ! -d /usr/share/selinux ]; then
info "Skipping installation of SELinux RPM"
else
get_k3s_selinux_version
install_selinux_rpm ${rpm_site} ${rpm_channel} ${rpm_target} ${rpm_site_infix}
return
fi
get_k3s_selinux_version
install_selinux_rpm ${rpm_site} ${rpm_channel} ${rpm_target} ${rpm_site_infix}
policy_error=fatal
if [ "$INSTALL_K3S_SELINUX_WARN" = true ] || [ "${ID_LIKE:-}" = coreos ] || [ "${VARIANT_ID:-}" = coreos ]; then