Skip to content

Commit fcf39e6

Browse files
authored
Ensure log group is created when multiple prefixes exist for the BatchAPI kind (#1468)
1 parent d5252ee commit fcf39e6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pkg/operator/resources/batchapi/logging.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,16 @@ func operatorLogStream(jobKey spec.JobKey) string {
4343

4444
// Checks if log group exists before creating it
4545
func ensureLogGroupForAPI(apiName string) error {
46-
output, err := config.AWS.CloudWatchLogs().DescribeLogGroups(&cloudwatchlogs.DescribeLogGroupsInput{
47-
Limit: aws.Int64(1),
48-
LogGroupNamePrefix: aws.String(logGroupNameForAPI(apiName)),
49-
})
46+
apiNameLogGroup := logGroupNameForAPI(apiName)
47+
48+
logGroupExists, err := config.AWS.DoesLogGroupExist(apiNameLogGroup)
5049
if err != nil {
51-
return errors.WithStack(err)
50+
return err
5251
}
5352

54-
if len(output.LogGroups) == 0 {
53+
if !logGroupExists {
5554
input := &cloudwatchlogs.CreateLogGroupInput{
56-
LogGroupName: aws.String(logGroupNameForAPI(apiName)),
55+
LogGroupName: aws.String(apiNameLogGroup),
5756
}
5857

5958
// There should always be a default tag. Tags are only empty when running local operator without the tags field specified in a cluster.yaml.

0 commit comments

Comments
 (0)