workload: introduce abstraction to encapsulate image workloads
The workload encapsulates what the user wants to run on top of the image. Everything else we do abstracts away the OS, the hardware, the environment, and what is left is what matters: the workload. For now only the `Custom` payload is implemented which requires the user to name the packages they want installed, the repositories to pull them from and what systemd services to enable. A few other stub workloads are added to show the idea, but these are not used. The ideal is for the workload to have only the minimal number of configuration options.
This commit is contained in:
parent
39c3d6ec35
commit
7a534d4d1e
8 changed files with 159 additions and 52 deletions
7
internal/workload/anaconda.go
Normal file
7
internal/workload/anaconda.go
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package workload
|
||||
|
||||
// TODO: replace the Anaconda pipeline by the OS pipeline with the
|
||||
// anaconda workload.
|
||||
type Anaconda struct {
|
||||
BaseWorkload
|
||||
}
|
||||
22
internal/workload/custom.go
Normal file
22
internal/workload/custom.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package workload
|
||||
|
||||
type Custom struct {
|
||||
BaseWorkload
|
||||
Packages []string
|
||||
Services []string
|
||||
DisabledServices []string
|
||||
}
|
||||
|
||||
func (p *Custom) GetPackages() []string {
|
||||
return p.Packages
|
||||
}
|
||||
|
||||
func (p *Custom) GetServices() []string {
|
||||
return p.Services
|
||||
}
|
||||
|
||||
// TODO: Does this belong here? What kind of workload requires
|
||||
// services to be disabled?
|
||||
func (p *Custom) GetDisabledServices() []string {
|
||||
return p.DisabledServices
|
||||
}
|
||||
6
internal/workload/sap.go
Normal file
6
internal/workload/sap.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
package workload
|
||||
|
||||
// TODO!
|
||||
type SAP struct {
|
||||
BaseWorkload
|
||||
}
|
||||
7
internal/workload/static_webserver.go
Normal file
7
internal/workload/static_webserver.go
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package workload
|
||||
|
||||
// TODO: replace the CommitServerTree pipeline by the OS pipeline with the
|
||||
// StaticWebserver workload.
|
||||
type StaticWebserver struct {
|
||||
BaseWorkload
|
||||
}
|
||||
30
internal/workload/workload.go
Normal file
30
internal/workload/workload.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package workload
|
||||
|
||||
import "github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
|
||||
type Workload interface {
|
||||
GetPackages() []string
|
||||
GetRepos() []rpmmd.RepoConfig
|
||||
GetServices() []string
|
||||
GetDisabledServices() []string
|
||||
}
|
||||
|
||||
type BaseWorkload struct {
|
||||
Repos []rpmmd.RepoConfig
|
||||
}
|
||||
|
||||
func (p BaseWorkload) GetPackages() []string {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
func (p BaseWorkload) GetRepos() []rpmmd.RepoConfig {
|
||||
return p.Repos
|
||||
}
|
||||
|
||||
func (p BaseWorkload) GetServices() []string {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
func (p BaseWorkload) GetDisabledServices() []string {
|
||||
return []string{}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue