Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow enable TLS when STS is enabled #1066

Merged
merged 7 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .chloggen/fix_sts_when_tls_is_enabled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. tempostack, tempomonolithic, github action)
component: tempostack

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Allow insecure = false/true regardless of type of token used.
rubenvp8510 marked this conversation as resolved.
Show resolved Hide resolved

# One or more tracking issues related to the change
issues: [1067]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
args: -v
version: v1.56.1
version: v1.57.2
2 changes: 1 addition & 1 deletion internal/handlers/storage/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ func getS3Params(storageSecret corev1.Secret, path *field.Path) (*manifestutils.
endpoint = strings.TrimPrefix(endpoint, "http://")

return &manifestutils.S3{
Insecure: insecure,
LongLived: &manifestutils.S3LongLived{
Endpoint: endpoint,
Bucket: string(storageSecret.Data["bucket"]),
Insecure: insecure,
},
}, nil
}
Expand Down
4 changes: 2 additions & 2 deletions internal/handlers/storage/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestGetS3ParamsInsecure(t *testing.T) {
s3, errs := getS3Params(storageSecret, nil)
require.Len(t, errs, 0)
require.Equal(t, "minio:9000", s3.LongLived.Endpoint)
require.True(t, s3.LongLived.Insecure)
require.True(t, s3.Insecure)
require.Equal(t, "testbucket", s3.LongLived.Bucket)
}

Expand All @@ -39,7 +39,7 @@ func TestGetS3ParamsSecure(t *testing.T) {
s3, errs := getS3Params(storageSecret, nil)
require.Len(t, errs, 0)
require.Equal(t, "minio:9000", s3.LongLived.Endpoint)
require.False(t, s3.LongLived.Insecure)
require.False(t, s3.Insecure)
require.Equal(t, "testbucket", s3.LongLived.Bucket)
}

Expand Down
4 changes: 3 additions & 1 deletion internal/handlers/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ func GetStorageParamsForTempoStack(ctx context.Context, client client.Client, te
return manifestutils.StorageParams{}, errs
}

if tempo.Spec.Storage.TLS.Enabled {
storageParams.S3.Insecure = !tempo.Spec.Storage.TLS.Enabled

if tempo.Spec.Storage.TLS.Enabled && storageParams.S3.LongLived != nil {
storageParams.S3.LongLived.TLS, errs = getTLSParams(ctx, client, tempo.Namespace, tempo.Spec.Storage.TLS, tlsPath.Child("caName"))
if len(errs) > 0 {
return manifestutils.StorageParams{}, errs
Expand Down
14 changes: 7 additions & 7 deletions internal/manifests/config/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ query_frontend:
},
StorageParams: manifestutils.StorageParams{
S3: &manifestutils.S3{
Insecure: true,
LongLived: &manifestutils.S3LongLived{
Endpoint: "minio:9000",
Bucket: "tempo",
Insecure: true,
},
},
},
Expand Down Expand Up @@ -982,10 +982,10 @@ query_frontend:
},
StorageParams: manifestutils.StorageParams{
S3: &manifestutils.S3{
Insecure: true,
LongLived: &manifestutils.S3LongLived{
Endpoint: "minio:9000",
Bucket: "tempo",
Insecure: true,
},
},
},
Expand Down Expand Up @@ -1359,10 +1359,10 @@ query_frontend:
},
StorageParams: manifestutils.StorageParams{
S3: &manifestutils.S3{
Insecure: true,
LongLived: &manifestutils.S3LongLived{
Endpoint: "minio:9000",
Bucket: "tempo",
Insecure: true,
},
},
},
Expand Down Expand Up @@ -1651,10 +1651,10 @@ ingester_client:
},
StorageParams: manifestutils.StorageParams{
S3: &manifestutils.S3{
Insecure: true,
LongLived: &manifestutils.S3LongLived{
Endpoint: "minio:9000",
Bucket: "tempo",
Insecure: true,
},
},
},
Expand Down Expand Up @@ -1816,10 +1816,10 @@ ingester_client:
},
StorageParams: manifestutils.StorageParams{
S3: &manifestutils.S3{
Insecure: true,
LongLived: &manifestutils.S3LongLived{
Endpoint: "minio:9000",
Bucket: "tempo",
Insecure: true,
},
},
},
Expand Down Expand Up @@ -2184,10 +2184,10 @@ query_frontend:
},
StorageParams: manifestutils.StorageParams{
S3: &manifestutils.S3{
Insecure: true,
LongLived: &manifestutils.S3LongLived{
Endpoint: "minio:9000",
Bucket: "tempo",
Insecure: true,
},
},
},
Expand Down Expand Up @@ -2403,10 +2403,10 @@ query_frontend:
},
StorageParams: manifestutils.StorageParams{
S3: &manifestutils.S3{
Insecure: true,
LongLived: &manifestutils.S3LongLived{
Endpoint: "minio:9000",
Bucket: "tempo",
Insecure: true,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion internal/manifests/config/tempo-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ storage:
s3:
endpoint: {{ .StorageParams.S3.LongLived.Endpoint }}
bucket: {{ .StorageParams.S3.LongLived.Bucket }}
insecure: {{ .StorageParams.S3.LongLived.Insecure }}
insecure: {{ .StorageParams.S3.Insecure }}
{{- if .S3StorageTLS.Enabled }}
{{- if .S3StorageTLS.CA }}
tls_ca_path: {{ .S3StorageTLS.CA }}
Expand Down
5 changes: 2 additions & 3 deletions internal/manifests/manifestutils/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type GCS struct {
type S3 struct {
LongLived *S3LongLived
ShortLived *S3ShortLived
Insecure bool
}

// S3LongLived holds long-lived S3 configuration.
Expand All @@ -48,9 +49,7 @@ type S3LongLived struct {
// Endpoint without http/https
Endpoint string
Bucket string
Insecure bool

TLS StorageTLS
TLS StorageTLS
}

// S3ShortLived holds short-lived S3 configuration.
Expand Down
2 changes: 1 addition & 1 deletion internal/manifests/monolithic/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func buildTempoConfig(opts Options) ([]byte, error) {
config.Storage.Trace.S3 = &tempoS3Config{}
if opts.StorageParams.S3.LongLived != nil {
config.Storage.Trace.S3.Endpoint = opts.StorageParams.S3.LongLived.Endpoint
config.Storage.Trace.S3.Insecure = opts.StorageParams.S3.LongLived.Insecure
config.Storage.Trace.S3.Insecure = opts.StorageParams.S3.Insecure
config.Storage.Trace.S3.Bucket = opts.StorageParams.S3.LongLived.Bucket
if tempo.Spec.Storage.Traces.S3 != nil && tempo.Spec.Storage.Traces.S3.TLS != nil && tempo.Spec.Storage.Traces.S3.TLS.Enabled {
if tempo.Spec.Storage.Traces.S3.TLS.CA != "" {
Expand Down
Loading