Vendor c/common changes

Vendor latest c/common with changes to add a new Farms
table to containers.conf and update system connection to
add a connection to a farm when --farm is set.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
This commit is contained in:
Urvashi Mohnani
2023-08-08 10:47:48 -04:00
parent 57fac93b30
commit b672ddc792
44 changed files with 2704 additions and 13267 deletions

View File

@@ -79,6 +79,8 @@ type Config struct {
Secrets SecretConfig `toml:"secrets"`
// ConfigMap section defines configurations for the configmaps management
ConfigMaps ConfigMapConfig `toml:"configmaps"`
// Farms defines configurations for the buildfarm farms
Farms FarmConfig `toml:"farms"`
}
// ContainersConfig represents the "containers" TOML config table
@@ -676,6 +678,14 @@ type MachineConfig struct {
Provider string `toml:"provider,omitempty"`
}
// FarmConfig represents the "farm" TOML config tabls
type FarmConfig struct {
// Default is the default farm to be used when farming out builds
Default string `toml:"default,omitempty"`
// List is a map of farms created where key=farm-name and value=list of connections
List map[string][]string `toml:"list,omitempty"`
}
// Destination represents destination for remote service
type Destination struct {
// URI, required. Example: ssh://root@example.com:22/run/podman/podman.sock
@@ -1241,6 +1251,10 @@ func ReadCustomConfig() (*Config, error) {
return nil, err
}
}
// Let's always initialize the farm list so it is never nil
if newConfig.Farms.List == nil {
newConfig.Farms.List = make(map[string][]string)
}
return newConfig, nil
}

View File

@@ -798,3 +798,11 @@ default_sysctls = [
# TOML does not provide a way to end a table other than a further table being
# defined, so every key hereafter will be part of [machine] and not the
# main config.
[farms]
#
# the default farm to use when farming out builds
# default = ""
#
# map of existing farms
#[farms.list]

View File

@@ -660,3 +660,11 @@ default_sysctls = [
# TOML does not provide a way to end a table other than a further table being
# defined, so every key hereafter will be part of [machine] and not the
# main config.
[farms]
#
# the default farm to use when farming out builds
# default = ""
#
# map of existing farms
#[farms.list]

View File

@@ -234,6 +234,7 @@ func DefaultConfig() (*Config, error) {
Engine: *defaultEngineConfig,
Secrets: defaultSecretConfig(),
Machine: defaultMachineConfig(),
Farms: defaultFarmConfig(),
}, nil
}
@@ -257,6 +258,14 @@ func defaultMachineConfig() MachineConfig {
}
}
// defaultFarmConfig returns the default farms configuration.
func defaultFarmConfig() FarmConfig {
emptyList := make(map[string][]string)
return FarmConfig{
List: emptyList,
}
}
// defaultConfigFromMemory returns a default engine configuration. Note that the
// config is different for root and rootless. It also parses the storage.conf.
func defaultConfigFromMemory() (*EngineConfig, error) {