Skip to content

Commit

Permalink
Add missing envars to upload container
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVulaj committed Jun 25, 2024
1 parent b5e4345 commit 78af8d2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
30 changes: 20 additions & 10 deletions controllers/mustgather/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,21 @@ const (

gatherCommandBinaryAudit = "gather_audit_logs"
gatherCommandBinaryNoAudit = "gather"
gatherCommand = "\ntimeout %v bash -x -c -- '/usr/bin/%v'\n\nstatus=$?\nif [[ $status -eq 124 || $status -eq 137 ]]; then\n echo \"Gather timed out.\"\n exit 0\nfi"
gatherCommand = "timeout %v bash -x -c -- '/usr/bin/%v'\n\nstatus=$?\nif [[ $status -eq 124 || $status -eq 137 ]]; then\n echo \"Gather timed out.\"\n exit 0\nfi"
mustGatherImage = "quay.io/openshift/origin-must-gather"
gatherContainerName = "gather"

uploadContainerName = "upload"
uploadEnvUsername = "username"
uploadEnvPassword = "password"
uploadEnvCaseId = "caseid"
uploadEnvInternalUser = "internal_user"
uploadEnvHttpProxy = "http_proxy"
uploadEnvHttpsProxy = "https_proxy"
uploadEnvNoProxy = "no_proxy"
uploadCommand = "count=0\nuntil [ $count -gt 4 ]\ndo\n while `pgrep -a gather > /dev/null`\n do\n echo \"waiting for gathers to complete ...\" \n sleep 120\n count=0\n done\n echo \"no gather is running ($count / 4)\"\n ((count++))\n sleep 30\ndone\n/usr/local/bin/upload\n"
uploadContainerName = "upload"
uploadEnvUsername = "username"
uploadEnvPassword = "password"
uploadEnvCaseId = "caseid"
uploadEnvInternalUser = "internal_user"
uploadEnvHttpProxy = "http_proxy"
uploadEnvHttpsProxy = "https_proxy"
uploadEnvNoProxy = "no_proxy"
uploadEnvMustGatherOutput = "must_gather_output"
uploadEnvMustGatherUpload = "must_gather_upload"
uploadCommand = "count=0\nuntil [ $count -gt 4 ]\ndo\n while `pgrep -a gather > /dev/null`\n do\n echo \"waiting for gathers to complete ...\"\n sleep 120\n count=0\n done\n echo \"no gather is running ($count / 4)\"\n ((count++))\n sleep 30\ndone\n/usr/local/bin/upload"
)

func getJobTemplate(operatorImage string, clusterVersion string, mustGather v1alpha1.MustGather) *batchv1.Job {
Expand Down Expand Up @@ -180,6 +182,14 @@ func getUploadContainer(
Name: uploadEnvCaseId,
Value: caseId,
},
{
Name: uploadEnvMustGatherOutput,
Value: volumeMountPath,
},
{
Name: uploadEnvMustGatherUpload,
Value: volumeUploadMountPath,
},
{
Name: uploadEnvInternalUser,
Value: strconv.FormatBool(internalUser),
Expand Down
2 changes: 1 addition & 1 deletion controllers/mustgather/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func Test_getGatherContainer(t *testing.T) {
testFailed = true
}

if !strings.HasPrefix(containerCommand, fmt.Sprintf("\ntimeout %v", tt.timeout)) {
if !strings.HasPrefix(containerCommand, fmt.Sprintf("timeout %v", tt.timeout)) {
t.Logf("the duration was not properly added to the container command, got %v but wanted %v", strings.Split(containerCommand, " ")[1], tt.timeout.String())
testFailed = true
}
Expand Down

0 comments on commit 78af8d2

Please sign in to comment.