Skip to content

Commit

Permalink
k8s selinux rpm changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dbw7 committed Sep 18, 2024
1 parent 2ade744 commit c43dcfb
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## General

* Extracted the K3S and RKE2 package and repository definitions into artifacts.yaml

## API

### Image Definition Changes
Expand All @@ -12,6 +14,8 @@

## Bug Fixes

* [#565](https://github.com/suse-edge/edge-image-builder/issues/565) - K3S SELinux uses an outdated package

---

# v1.1.0-rc2
Expand Down
7 changes: 7 additions & 0 deletions config/artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ endpoint-copier-operator:
elemental:
register-repository: https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Staging/standard
system-agent-repository: https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Staging/standard
kubernetes:
k3s:
selinuxPackage: k3s-selinux-1.6-1.slemicro.noarch
selinuxRepository: https://rpm.rancher.io/k3s/stable/common/slemicro/noarch
rke2:
selinuxPackage: rke2-selinux
selinuxRepository: https://rpm.rancher.io/rke2/stable/common/slemicro/noarch
4 changes: 2 additions & 2 deletions pkg/eib/eib.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ func appendKubernetesSELinuxRPMs(ctx *image.Context) error {
log.AuditInfo("SELinux is enabled in the Kubernetes configuration. " +
"The necessary RPM packages will be downloaded.")

selinuxPackage, err := kubernetes.SELinuxPackage(ctx.ImageDefinition.Kubernetes.Version)
selinuxPackage, err := kubernetes.SELinuxPackage(ctx.ImageDefinition.Kubernetes.Version, ctx.ArtifactSources)
if err != nil {
return fmt.Errorf("identifying selinux package: %w", err)
}

repository, err := kubernetes.SELinuxRepository(ctx.ImageDefinition.Kubernetes.Version)
repository, err := kubernetes.SELinuxRepository(ctx.ImageDefinition.Kubernetes.Version, ctx.ArtifactSources)
if err != nil {
return fmt.Errorf("identifying selinux repository: %w", err)
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/image/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,14 @@ type ArtifactSources struct {
RegisterRepository string `yaml:"register-repository"`
SystemAgentRepository string `yaml:"system-agent-repository"`
} `yaml:"elemental"`
Kubernetes struct {
K3s struct {
SelinuxPackage string `yaml:"selinuxPackage"`
SelinuxRepository string `yaml:"selinuxRepository"`
} `yaml:"k3s"`
Rke2 struct {
SelinuxPackage string `yaml:"selinuxPackage"`
SelinuxRepository string `yaml:"selinuxRepository"`
} `yaml:"rke2"`
} `yaml:"kubernetes"`
}
16 changes: 8 additions & 8 deletions pkg/kubernetes/selinux.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/suse-edge/edge-image-builder/pkg/image"
)

func SELinuxPackage(version string) (string, error) {
const (
k3sPackage = "k3s-selinux"
rke2Package = "rke2-selinux"
func SELinuxPackage(version string, sources *image.ArtifactSources) (string, error) {
var (
k3sPackage = sources.Kubernetes.K3s.SelinuxPackage
rke2Package = sources.Kubernetes.Rke2.SelinuxPackage
)

switch {
Expand All @@ -26,10 +26,10 @@ func SELinuxPackage(version string) (string, error) {
}
}

func SELinuxRepository(version string) (image.AddRepo, error) {
const (
k3sRepository = "https://rpm.rancher.io/k3s/stable/common/slemicro/noarch"
rke2Repository = "https://rpm.rancher.io/rke2/stable/common/slemicro/noarch"
func SELinuxRepository(version string, sources *image.ArtifactSources) (image.AddRepo, error) {
var (
k3sRepository = sources.Kubernetes.K3s.SelinuxRepository
rke2Repository = sources.Kubernetes.Rke2.SelinuxRepository
)

var url string
Expand Down

0 comments on commit c43dcfb

Please sign in to comment.