diff --git a/cli/cmd/cluster.go b/cli/cmd/cluster.go index f7e9b7ce10..3230265a2e 100644 --- a/cli/cmd/cluster.go +++ b/cli/cmd/cluster.go @@ -188,7 +188,6 @@ var _clusterUpCmd = &cobra.Command{ LogGroup: clusterConfig.ClusterName, Bucket: clusterConfig.Bucket, Region: clusterConfig.Region, - SQSPrefix: clusterconfig.SQSNamePrefix(clusterConfig.ClusterName), AccountID: accountID, }) if err != nil { diff --git a/docs/clusters/aws/auth.md b/docs/clusters/aws/auth.md index f6a36ed9c6..e4fd96ce69 100644 --- a/docs/clusters/aws/auth.md +++ b/docs/clusters/aws/auth.md @@ -77,7 +77,7 @@ _NOTE: The policy created during `cortex cluster up` will automatically be delet { "Effect": "Allow", "Action": "sqs:*", - "Resource": "arn:aws:sqs:{{ .Region }}:{{ .AccountID }}:{{ .SQSPrefix }}*" + "Resource": "arn:aws:sqs:{{ .Region }}:{{ .AccountID }}:cortex-*" }, { "Effect": "Allow", diff --git a/pkg/operator/resources/job/batchapi/queue.go b/pkg/operator/resources/job/batchapi/queue.go index e0df1312ec..27f0660079 100644 --- a/pkg/operator/resources/job/batchapi/queue.go +++ b/pkg/operator/resources/job/batchapi/queue.go @@ -35,7 +35,7 @@ func apiQueueNamePrefix(apiName string) string { return config.CoreConfig.SQSNamePrefix() + apiName + "-" } -// QueueName is --.fifo +// QueueName is cortex---.fifo func getJobQueueName(jobKey spec.JobKey) string { return apiQueueNamePrefix(jobKey.APIName) + jobKey.ID + ".fifo" } @@ -57,7 +57,7 @@ func jobKeyFromQueueURL(queueURL string) spec.JobKey { jobID := strings.TrimSuffix(dashSplit[len(dashSplit)-1], ".fifo") - apiNameSplit := dashSplit[1 : len(dashSplit)-1] + apiNameSplit := dashSplit[2 : len(dashSplit)-1] apiName := strings.Join(apiNameSplit, "-") return spec.JobKey{APIName: apiName, ID: jobID} diff --git a/pkg/types/clusterconfig/aws_policy.go b/pkg/types/clusterconfig/aws_policy.go index 817aeaaa70..8dba939aef 100644 --- a/pkg/types/clusterconfig/aws_policy.go +++ b/pkg/types/clusterconfig/aws_policy.go @@ -53,7 +53,7 @@ var _cortexPolicy = ` { "Effect": "Allow", "Action": "sqs:*", - "Resource": "arn:aws:sqs:{{ .Region }}:{{ .AccountID }}:{{ .SQSPrefix }}*" + "Resource": "arn:aws:sqs:{{ .Region }}:{{ .AccountID }}:cortex-*" }, { "Effect": "Allow", @@ -89,7 +89,6 @@ type CortexPolicyTemplateArgs struct { LogGroup string Region string Bucket string - SQSPrefix string AccountID string } diff --git a/pkg/types/clusterconfig/cluster_config_aws.go b/pkg/types/clusterconfig/cluster_config_aws.go index a2d233132a..050eeac7c4 100644 --- a/pkg/types/clusterconfig/cluster_config_aws.go +++ b/pkg/types/clusterconfig/cluster_config_aws.go @@ -682,8 +682,8 @@ func (cc *Config) ToAccessConfig() AccessConfig { } func SQSNamePrefix(clusterName string) string { - // 10 was chosen to make sure that other identifiers can be added to the full queue name before reaching the 80 char SQS name limit - return hash.String(clusterName)[:10] + "-" + // 8 was chosen to make sure that other identifiers can be added to the full queue name before reaching the 80 char SQS name limit + return "cortex-" + hash.String(clusterName)[:8] + "-" } // returns hash of cluster name and adds trailing "-"