Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,6 @@ Version: v0.5.15
License: BSD-3-Clause
License URL: https://github.com/ulikunitz/xz/blob/v0.5.15/LICENSE

----------
Module: github.com/yaml/go-yaml
Version: v2.1.0
License: Apache-2.0
License URL: https://github.com/yaml/go-yaml/blob/v2.1.0/LICENSE

----------
Module: go.opentelemetry.io/auto/sdk
Version: v1.2.1
Expand Down
12 changes: 6 additions & 6 deletions cli/cmd/build_images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ var _ = Describe("BuildImagesCmd", func() {

c.Opts.Config = "config-without-registry.yaml"
configWithoutRegistry := files.RootConfig{
Registry: files.RegistryConfig{
Registry: &files.RegistryConfig{
// Empty server
},
Codesphere: files.CodesphereConfig{
Expand Down Expand Up @@ -174,7 +174,7 @@ var _ = Describe("BuildImagesCmd", func() {

c.Opts.Config = "config-without-dockerfile.yaml"
configWithoutDockerfile := files.RootConfig{
Registry: files.RegistryConfig{
Registry: &files.RegistryConfig{
Server: "registry.example.com",
},
Codesphere: files.CodesphereConfig{
Expand Down Expand Up @@ -211,7 +211,7 @@ var _ = Describe("BuildImagesCmd", func() {

c.Opts.Config = "config-with-dockerfile.yaml"
configWithDockerfile := files.RootConfig{
Registry: files.RegistryConfig{
Registry: &files.RegistryConfig{
Server: "registry.example.com",
},
Codesphere: files.CodesphereConfig{
Expand Down Expand Up @@ -250,7 +250,7 @@ var _ = Describe("BuildImagesCmd", func() {

c.Opts.Config = "config-with-dockerfile.yaml"
configWithDockerfile := files.RootConfig{
Registry: files.RegistryConfig{
Registry: &files.RegistryConfig{
Server: "registry.example.com",
},
Codesphere: files.CodesphereConfig{
Expand Down Expand Up @@ -290,7 +290,7 @@ var _ = Describe("BuildImagesCmd", func() {

c.Opts.Config = "config-with-dockerfile.yaml"
configWithDockerfile := files.RootConfig{
Registry: files.RegistryConfig{
Registry: &files.RegistryConfig{
Server: "registry.example.com",
},
Codesphere: files.CodesphereConfig{
Expand Down Expand Up @@ -329,7 +329,7 @@ var _ = Describe("BuildImagesCmd", func() {

c.Opts.Config = "config-with-multiple-images.yaml"
configWithMultipleImages := files.RootConfig{
Registry: files.RegistryConfig{
Registry: &files.RegistryConfig{
Server: "registry.example.com",
},
Codesphere: files.CodesphereConfig{
Expand Down
2 changes: 1 addition & 1 deletion internal/installer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewConfig() *Config {

// ParseConfigYaml reads and parses the configuration YAML file at the given path.
func (c *Config) ParseConfigYaml(configPath string) (files.RootConfig, error) {
var rootConfig files.RootConfig
rootConfig := files.NewRootConfig()

file, err := c.FileIO.Open(configPath)
if err != nil {
Expand Down
7 changes: 4 additions & 3 deletions internal/installer/config_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ type InstallConfig struct {
}

func NewInstallConfigManager() InstallConfigManager {
config := files.NewRootConfig()
return &InstallConfig{
fileIO: &util.FilesystemWriter{},
Config: &files.RootConfig{},
Config: &config,
Vault: &files.InstallVault{},
}
}
Expand All @@ -60,12 +61,12 @@ func (g *InstallConfig) LoadInstallConfigFromFile(configPath string) error {
return fmt.Errorf("failed to read %s: %w", configPath, err)
}

config := &files.RootConfig{}
config := files.NewRootConfig()
if err := config.Unmarshal(data); err != nil {
return fmt.Errorf("failed to unmarshal %s: %w", configPath, err)
}

g.Config = config
g.Config = &config
return nil
}

Expand Down
1 change: 1 addition & 0 deletions internal/installer/config_manager_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func (g *InstallConfig) ApplyProfile(profile string) error {
Enabled: false,
Pools: []files.MetalLBPoolDef{},
}
g.Config.Registry = &files.RegistryConfig{}
g.Config.Codesphere.Experiments = []string{}
g.Config.Codesphere.WorkspaceImages = &files.WorkspaceImagesConfig{
Agent: &files.ImageRef{
Expand Down
10 changes: 9 additions & 1 deletion internal/installer/files/config_yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type SecretFields struct {
type RootConfig struct {
Datacenter DatacenterConfig `yaml:"dataCenter"`
Secrets SecretsConfig `yaml:"secrets"`
Registry RegistryConfig `yaml:"registry,omitempty"`
Registry *RegistryConfig `yaml:"registry,omitempty"`
Postgres PostgresConfig `yaml:"postgres"`
Ceph CephConfig `yaml:"ceph"`
Kubernetes KubernetesConfig `yaml:"kubernetes"`
Expand Down Expand Up @@ -400,6 +400,14 @@ func (c *RootConfig) Unmarshal(data []byte) error {
return yaml.Unmarshal(data, c)
}

func NewRootConfig() RootConfig {
return RootConfig{
Registry: &RegistryConfig{},
MetalLB: &MetalLBConfig{},
ManagedServiceBackends: &ManagedServiceBackendsConfig{},
}
}

func (c *RootConfig) ExtractBomRefs() []string {
var bomRefs []string
for _, imageConfig := range c.Codesphere.DeployConfig.Images {
Expand Down
4 changes: 2 additions & 2 deletions internal/installer/files/config_yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import (

var _ = Describe("ConfigYaml", func() {
var (
rootConfig *files.RootConfig
rootConfig files.RootConfig
tempDir string
configFile string
sampleYaml string
)

BeforeEach(func() {
rootConfig = &files.RootConfig{}
rootConfig = files.NewRootConfig()

var err error
tempDir, err = os.MkdirTemp("", "config_yaml_test")
Expand Down
33 changes: 16 additions & 17 deletions internal/installer/secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ var _ = Describe("ExtractVault", func() {
Kubernetes: files.KubernetesConfig{
NeedsKubeConfig: true,
},
Registry: &files.RegistryConfig{},
}

vault := config.ExtractVault()
Expand Down Expand Up @@ -118,14 +119,13 @@ var _ = Describe("ExtractVault", func() {
})

It("does not include kubeconfig for managed k8s", func() {
config := &files.RootConfig{
Kubernetes: files.KubernetesConfig{
NeedsKubeConfig: false,
},
Codesphere: files.CodesphereConfig{
DomainAuthPrivateKey: "test-key",
DomainAuthPublicKey: "test-pub",
},
config := files.NewRootConfig()
config.Kubernetes = files.KubernetesConfig{
NeedsKubeConfig: false,
}
config.Codesphere = files.CodesphereConfig{
DomainAuthPrivateKey: "test-key",
DomainAuthPublicKey: "test-pub",
}

vault := config.ExtractVault()
Expand All @@ -146,15 +146,14 @@ var _ = Describe("ExtractVault", func() {
userPasswords[service] = service + "-pass"
}

config := &files.RootConfig{
Postgres: files.PostgresConfig{
Primary: &files.PostgresPrimaryConfig{},
UserPasswords: userPasswords,
},
Codesphere: files.CodesphereConfig{
DomainAuthPrivateKey: "test",
DomainAuthPublicKey: "test",
},
config := files.NewRootConfig()
config.Postgres = files.PostgresConfig{
Primary: &files.PostgresPrimaryConfig{},
UserPasswords: userPasswords,
}
config.Codesphere = files.CodesphereConfig{
DomainAuthPrivateKey: "test",
DomainAuthPublicKey: "test",
}

vault := config.ExtractVault()
Expand Down
6 changes: 0 additions & 6 deletions internal/tmpl/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,6 @@ Version: v0.5.15
License: BSD-3-Clause
License URL: https://github.com/ulikunitz/xz/blob/v0.5.15/LICENSE

----------
Module: github.com/yaml/go-yaml
Version: v2.1.0
License: Apache-2.0
License URL: https://github.com/yaml/go-yaml/blob/v2.1.0/LICENSE

----------
Module: go.opentelemetry.io/auto/sdk
Version: v1.2.1
Expand Down