diff --git a/deploy/templates/operator/manifests/crd.yaml b/deploy/templates/operator/manifests/crd.yaml index 0adca28..07f5c9b 100644 --- a/deploy/templates/operator/manifests/crd.yaml +++ b/deploy/templates/operator/manifests/crd.yaml @@ -59,6 +59,11 @@ spec: description: Root directory to store logs within external storage type: string + shouldEncodeFileName: + description: Provide an option to convert '+' to '%2B' to + address issues in certain web environments where '+' is + misinterpreted + type: boolean timeLayoutOfSubDirectory: description: An option(default `2006-01`) that sets the name of the sub-directory following `{Root path}` to a @@ -214,6 +219,11 @@ spec: secretKey: description: S3 bucket secret key type: string + shouldEncodeFileName: + description: Provide an option to convert '+' to '%2B' to + address issues in certain web environments where '+' is + misinterpreted + type: boolean tags: additionalProperties: type: string @@ -225,10 +235,6 @@ spec: time-based layout type: string type: object - shouldEncodeFileName: - description: Provide an option to convert '+' to '%2B' to address - issues in certain web environments where '+' is misinterpreted - type: boolean type: object type: array logMetricRules: diff --git a/pkg/docs/operator/docs.go b/pkg/docs/operator/docs.go index 8cd4e7e..8d096c3 100644 --- a/pkg/docs/operator/docs.go +++ b/pkg/docs/operator/docs.go @@ -219,6 +219,10 @@ const docTemplate = `{ "description": "Root directory to store logs within external storage", "type": "string" }, + "shouldEncodeFileName": { + "description": "Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted", + "type": "boolean" + }, "timeLayoutOfSubDirectory": { "description": "An option(default ` + "`" + `2006-01` + "`" + `) that sets the name of the sub-directory following ` + "`" + `{Root path}` + "`" + ` to a time-based layout", "type": "string", @@ -379,10 +383,6 @@ const docTemplate = `{ "$ref": "#/definitions/v1.S3Bucket" } ] - }, - "shouldEncodeFileName": { - "description": "Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted", - "type": "boolean" } } }, @@ -434,6 +434,10 @@ const docTemplate = `{ "description": "S3 bucket secret key", "type": "string" }, + "shouldEncodeFileName": { + "description": "Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted", + "type": "boolean" + }, "tags": { "description": "Tags for objects to be stored", "allOf": [ diff --git a/pkg/docs/operator/swagger.json b/pkg/docs/operator/swagger.json index 7de5c01..71c3a44 100644 --- a/pkg/docs/operator/swagger.json +++ b/pkg/docs/operator/swagger.json @@ -211,6 +211,10 @@ "description": "Root directory to store logs within external storage", "type": "string" }, + "shouldEncodeFileName": { + "description": "Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted", + "type": "boolean" + }, "timeLayoutOfSubDirectory": { "description": "An option(default `2006-01`) that sets the name of the sub-directory following `{Root path}` to a time-based layout", "type": "string", @@ -371,10 +375,6 @@ "$ref": "#/definitions/v1.S3Bucket" } ] - }, - "shouldEncodeFileName": { - "description": "Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted", - "type": "boolean" } } }, @@ -426,6 +426,10 @@ "description": "S3 bucket secret key", "type": "string" }, + "shouldEncodeFileName": { + "description": "Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted", + "type": "boolean" + }, "tags": { "description": "Tags for objects to be stored", "allOf": [ diff --git a/pkg/docs/operator/swagger.yaml b/pkg/docs/operator/swagger.yaml index 9c6fb9f..f1da6d8 100644 --- a/pkg/docs/operator/swagger.yaml +++ b/pkg/docs/operator/swagger.yaml @@ -7,6 +7,10 @@ definitions: rootPath: description: Root directory to store logs within external storage type: string + shouldEncodeFileName: + description: Provide an option to convert '+' to '%2B' to address issues in + certain web environments where '+' is misinterpreted + type: boolean timeLayoutOfSubDirectory: default: 2006-01 description: An option(default `2006-01`) that sets the name of the sub-directory @@ -113,10 +117,6 @@ definitions: allOf: - $ref: '#/definitions/v1.S3Bucket' description: Settings required to export logs to S3 bucket - shouldEncodeFileName: - description: Provide an option to convert '+' to '%2B' to address issues in - certain web environments where '+' is misinterpreted - type: boolean type: object v1.LogMetricRule: properties: @@ -151,6 +151,10 @@ definitions: secretKey: description: S3 bucket secret key type: string + shouldEncodeFileName: + description: Provide an option to convert '+' to '%2B' to address issues in + certain web environments where '+' is misinterpreted + type: boolean tags: allOf: - $ref: '#/definitions/v1.Tags' diff --git a/pkg/lobster/sink/exporter/uploader/basic.go b/pkg/lobster/sink/exporter/uploader/basic.go index edd6269..21f3f52 100644 --- a/pkg/lobster/sink/exporter/uploader/basic.go +++ b/pkg/lobster/sink/exporter/uploader/basic.go @@ -91,7 +91,7 @@ func (b BasicUploader) Dir(chunk model.Chunk, date time.Time) string { func (b BasicUploader) FileName(start, end time.Time) string { fileName := fmt.Sprintf("%s_%s.log", start.Format(layoutFileName), end.Format(layoutFileName)) - if b.Order.LogExportRule.ShouldEncodeFileName { + if b.Order.LogExportRule.BasicBucket.ShouldEncodeFileName { return strings.ReplaceAll(fileName, "+", "%2B") } diff --git a/pkg/lobster/sink/exporter/uploader/s3.go b/pkg/lobster/sink/exporter/uploader/s3.go index d6cdd3e..e3f94f6 100644 --- a/pkg/lobster/sink/exporter/uploader/s3.go +++ b/pkg/lobster/sink/exporter/uploader/s3.go @@ -77,7 +77,7 @@ func (s S3Uploader) Dir(chunk model.Chunk, date time.Time) string { func (b S3Uploader) FileName(start, end time.Time) string { fileName := fmt.Sprintf("%s_%s.log", start.Format(layoutFileName), end.Format(layoutFileName)) - if b.Order.LogExportRule.ShouldEncodeFileName { + if b.Order.LogExportRule.S3Bucket.ShouldEncodeFileName { return strings.ReplaceAll(fileName, "+", "%2B") } diff --git a/pkg/operator/api/v1/basicBucket.go b/pkg/operator/api/v1/basicBucket.go index 9ee969f..cf8c58e 100644 --- a/pkg/operator/api/v1/basicBucket.go +++ b/pkg/operator/api/v1/basicBucket.go @@ -27,6 +27,8 @@ type BasicBucket struct { RootPath string `json:"rootPath,omitempty"` // An option(default `2006-01`) that sets the name of the sub-directory following `{Root path}` to a time-based layout TimeLayoutOfSubDirectory string `json:"timeLayoutOfSubDirectory,omitempty" default:"2006-01"` + // Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted + ShouldEncodeFileName bool `json:"shouldEncodeFileName,omitempty"` } func (b BasicBucket) Validate() error { diff --git a/pkg/operator/api/v1/logExportRule.go b/pkg/operator/api/v1/logExportRule.go index 0bf29ca..7c49d18 100644 --- a/pkg/operator/api/v1/logExportRule.go +++ b/pkg/operator/api/v1/logExportRule.go @@ -43,8 +43,6 @@ type LogExportRule struct { Filter Filter `json:"filter,omitempty"` // Interval to export logs Interval metav1.Duration `json:"interval,omitempty" swaggertype:"string" example:"time duration(e.g. 1m)"` - // Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted - ShouldEncodeFileName bool `json:"shouldEncodeFileName,omitempty"` } func (r LogExportRule) Validate() error { diff --git a/pkg/operator/api/v1/s3Bucket.go b/pkg/operator/api/v1/s3Bucket.go index 9cac984..6919b70 100644 --- a/pkg/operator/api/v1/s3Bucket.go +++ b/pkg/operator/api/v1/s3Bucket.go @@ -53,6 +53,8 @@ type S3Bucket struct { SecretKey string `json:"secretKey,omitempty"` // Tags for objects to be stored Tags Tags `json:"tags,omitempty"` + // Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted + ShouldEncodeFileName bool `json:"shouldEncodeFileName,omitempty"` } func (s S3Bucket) Validate() error { diff --git a/web/static/docs/operator/swagger.json b/web/static/docs/operator/swagger.json index 7de5c01..71c3a44 100644 --- a/web/static/docs/operator/swagger.json +++ b/web/static/docs/operator/swagger.json @@ -211,6 +211,10 @@ "description": "Root directory to store logs within external storage", "type": "string" }, + "shouldEncodeFileName": { + "description": "Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted", + "type": "boolean" + }, "timeLayoutOfSubDirectory": { "description": "An option(default `2006-01`) that sets the name of the sub-directory following `{Root path}` to a time-based layout", "type": "string", @@ -371,10 +375,6 @@ "$ref": "#/definitions/v1.S3Bucket" } ] - }, - "shouldEncodeFileName": { - "description": "Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted", - "type": "boolean" } } }, @@ -426,6 +426,10 @@ "description": "S3 bucket secret key", "type": "string" }, + "shouldEncodeFileName": { + "description": "Provide an option to convert '+' to '%2B' to address issues in certain web environments where '+' is misinterpreted", + "type": "boolean" + }, "tags": { "description": "Tags for objects to be stored", "allOf": [