mirror of
https://github.com/google/nomulus
synced 2025-12-23 06:15:42 +00:00
Fix a Cloud Scheduler deployment bug (#2707)
For GKE all tasks should be on backend, BSA was on its own service because of egress IP constraint. Also made it possible to specify a timeout for the Cloud Scheduler job, with the default (3m) suitable for most tasks.
This commit is contained in:
@@ -301,6 +301,7 @@
|
|||||||
<url><![CDATA[/_dr/task/bsaValidate]]></url>
|
<url><![CDATA[/_dr/task/bsaValidate]]></url>
|
||||||
<name>bsaValidate</name>
|
<name>bsaValidate</name>
|
||||||
<service>bsa</service>
|
<service>bsa</service>
|
||||||
|
<timeout>10m</timeout>
|
||||||
<description>
|
<description>
|
||||||
Validates the processed BSA data in the database against the original
|
Validates the processed BSA data in the database against the original
|
||||||
block lists.
|
block lists.
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ type Task struct {
|
|||||||
URL string `xml:"url"`
|
URL string `xml:"url"`
|
||||||
Description string `xml:"description"`
|
Description string `xml:"description"`
|
||||||
Service string `xml:"service"`
|
Service string `xml:"service"`
|
||||||
|
Timeout string `xml:"timeout"`
|
||||||
Schedule string `xml:"schedule"`
|
Schedule string `xml:"schedule"`
|
||||||
Name string `xml:"name"`
|
Name string `xml:"name"`
|
||||||
}
|
}
|
||||||
@@ -189,7 +190,9 @@ func (manager TasksSyncManager) getArgs(task Task, operationType string) []strin
|
|||||||
description = strings.ReplaceAll(description, "\n", " ")
|
description = strings.ReplaceAll(description, "\n", " ")
|
||||||
|
|
||||||
var service = "backend"
|
var service = "backend"
|
||||||
if task.Service != "backend" && task.Service != "" {
|
// Only BSA tasks run on the BSA service in GAE. GKE tasks are always
|
||||||
|
// on the backend service.
|
||||||
|
if task.Service != "backend" && task.Service != "" && !gke {
|
||||||
service = task.Service
|
service = task.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +203,7 @@ func (manager TasksSyncManager) getArgs(task Task, operationType string) []strin
|
|||||||
uri = fmt.Sprintf("https://%s-dot-%s.appspot.com%s", service, projectName, strings.TrimSpace(task.URL))
|
uri = fmt.Sprintf("https://%s-dot-%s.appspot.com%s", service, projectName, strings.TrimSpace(task.URL))
|
||||||
}
|
}
|
||||||
|
|
||||||
return []string{
|
args := []string{
|
||||||
"--project", projectName,
|
"--project", projectName,
|
||||||
"scheduler", "jobs", operationType,
|
"scheduler", "jobs", operationType,
|
||||||
"http", task.Name,
|
"http", task.Name,
|
||||||
@@ -212,6 +215,12 @@ func (manager TasksSyncManager) getArgs(task Task, operationType string) []strin
|
|||||||
"--oidc-service-account-email", getCloudSchedulerServiceAccountEmail(),
|
"--oidc-service-account-email", getCloudSchedulerServiceAccountEmail(),
|
||||||
"--oidc-token-audience", clientId,
|
"--oidc-token-audience", clientId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if task.Timeout != "" {
|
||||||
|
args = append(args, "--attempt-deadline", task.Timeout)
|
||||||
|
}
|
||||||
|
|
||||||
|
return args
|
||||||
}
|
}
|
||||||
|
|
||||||
func (manager TasksSyncManager) fetchExistingRecords() ExistingEntries {
|
func (manager TasksSyncManager) fetchExistingRecords() ExistingEntries {
|
||||||
|
|||||||
Reference in New Issue
Block a user