Skip to content

Commit

Permalink
feat: use TMPDIR env variable during preflights
Browse files Browse the repository at this point in the history
if TMPDIR is not empty we should use it during preflights.
  • Loading branch information
ricardomaraschini committed Sep 24, 2024
1 parent 4d04007 commit 6339d1c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cmd/embedded-cluster/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,16 @@ func RunHostPreflights(c *cli.Context, applier *addons.Applier, replicatedAPIURL
return fmt.Errorf("unable to read host preflights: %w", err)
}

tmpdir := "/tmp"
if t := os.Getenv("TMPDIR"); t != "" {
tmpdir = t
}

data := preflights.TemplateData{
ReplicatedAPIURL: replicatedAPIURL,
ProxyRegistryURL: proxyRegistryURL,
IsAirgap: isAirgap,
TempDir: tmpdir,
}
chpfs, err := preflights.GetClusterHostPreflights(c.Context, data)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/preflights/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
path: /var/openebs
- diskUsage:
collectorName: tmp-path-usage
path: /tmp
path: {{ .TempDir }}
- memory: {}
- cpu: {}
- time: {}
Expand Down Expand Up @@ -178,9 +178,9 @@ spec:
outcomes:
- fail:
when: 'total < 5Gi'
message: The filesystem at /tmp has less than 5Gi of total space
message: The filesystem at {{ .TempDir }} has less than 5Gi of total space
- pass:
message: The filesystem at /tmp has sufficient space
message: The filesystem at {{ .TempDir }} has sufficient space
- textAnalyze:
checkName: Default Route
fileName: host-collectors/run-host/ip-route-table.txt
Expand Down
1 change: 1 addition & 0 deletions pkg/preflights/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type TemplateData struct {
IsAirgap bool
ReplicatedAPIURL string
ProxyRegistryURL string
TempDir string
}

func renderTemplate(spec string, data TemplateData) (string, error) {
Expand Down

0 comments on commit 6339d1c

Please sign in to comment.