Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/path-overlay' into path-overlay
Browse files Browse the repository at this point in the history
# Conflicts:
#	pkg/cli/apply/run.go
#	pkg/cli/apply/utils.go
#	pkg/workloads/apply.go
#	pkg/workloads/config.go
  • Loading branch information
salexo committed Feb 4, 2025
2 parents 189e0fa + d678e00 commit 3c06f70
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions pkg/cli/apply/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,48 @@ func doesStorageClassExist(ctx context.Context, clientset kubernetes.Clientset,
return true, nil
}

func loadFileList(execFlags *workloads.ExecFlags) error {

Check failure on line 243 in pkg/cli/apply/run.go

View workflow job for this annotation

GitHub Actions / lint

loadFileList redeclared in this block

Check failure on line 243 in pkg/cli/apply/run.go

View workflow job for this annotation

GitHub Actions / lint

loadFileList redeclared in this block

Check failure on line 243 in pkg/cli/apply/run.go

View workflow job for this annotation

GitHub Actions / Run tests

loadFileList redeclared in this block
if execFlags.Path == "" && execFlags.OverlayPath != "" {
return fmt.Errorf("cannot load workload with an overlay path without base path")
}
if execFlags.Path == "" {
return nil
}

files := map[string]string{}

entries, err := os.ReadDir(execFlags.Path)
if err != nil {
return fmt.Errorf("error reading directory: %w", err)
}

for _, entry := range entries {
if !entry.IsDir() {
files[entry.Name()] = filepath.Join(execFlags.Path, entry.Name())
}
}

if execFlags.OverlayPath != "" {
overlayFiles, err := os.ReadDir(execFlags.OverlayPath)
if err != nil {
return fmt.Errorf("error reading directory: %w", err)
}
for _, overlayFile := range overlayFiles {
if !overlayFile.IsDir() {
files[overlayFile.Name()] = filepath.Join(execFlags.OverlayPath, overlayFile.Name())
}
}
}

for k, v := range files {
logrus.Debugf("Discovered file %s from %s", k, v)
}

execFlags.WorkloadFiles = files

return nil
}

// loadCustomConfig loads custom configuration data from a file
func loadCustomConfig(path string) (any, error) {
logrus.Debugln("Loading custom config")
Expand Down

0 comments on commit 3c06f70

Please sign in to comment.