diff --git a/pkg/jobconfig/files.go b/pkg/jobconfig/files.go index 83b6733cc0e..c2f4ceb1306 100644 --- a/pkg/jobconfig/files.go +++ b/pkg/jobconfig/files.go @@ -50,6 +50,10 @@ func (i *Info) ConfigMapName() string { if i.Type == "periodics" { return fmt.Sprintf("job-config-%s", promotion.FlavorForBranch("")) } + // job-config shards for master are already too big, shard them further by type + if i.Branch == "master" { + return fmt.Sprintf("job-config-%s-%s", promotion.FlavorForBranch(i.Branch), i.Type) + } return fmt.Sprintf("job-config-%s", promotion.FlavorForBranch(i.Branch)) } diff --git a/pkg/jobconfig/files_test.go b/pkg/jobconfig/files_test.go index b35055a518d..8af19d7e987 100644 --- a/pkg/jobconfig/files_test.go +++ b/pkg/jobconfig/files_test.go @@ -611,12 +611,20 @@ func TestInfo_ConfigMapName(t *testing.T) { testCases := []struct { name string branch string + jobType string expected string }{ { - name: "master branch goes to master configmap", + name: "master branch goes to master configmap further sharded by type: presubmits", branch: "master", - expected: "job-config-master", + jobType: "presubmits", + expected: "job-config-master-presubmits", + }, + { + name: "master branch goes to master configmap further sharded by type: postsubmits", + branch: "master", + jobType: "postsubmits", + expected: "job-config-master-postsubmits", }, { name: "enterprise 3.6 branch goes to 3.x configmap", @@ -681,7 +689,7 @@ func TestInfo_ConfigMapName(t *testing.T) { } for _, testCase := range testCases { t.Run(testCase.expected, func(t *testing.T) { - info := Info{Branch: testCase.branch} + info := Info{Branch: testCase.branch, Type: testCase.jobType} if actual, expected := info.ConfigMapName(), testCase.expected; !reflect.DeepEqual(actual, expected) { t.Errorf("%s: didn't get correct basename: %v", testCase.name, diff.ObjectReflectDiff(actual, expected)) }