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

Revert "Error on missing tenant secrets" #35

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all 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
12 changes: 1 addition & 11 deletions pkg/syncer/obsctlsyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ func AutoDetectTenantSecrets(

// Filter secrets for configured tenants.
configuredTenants := strings.Split(managedTenants, ",")
missingSecretTenants := strings.Split(managedTenants, ",")
for i := range secret.Items {
lbls := secret.Items[i].Labels

Expand All @@ -137,9 +136,6 @@ func AutoDetectTenantSecrets(
// If tenant is not configured, skip.
if !slices.Contains(configuredTenants, lbls["tenant"]) {
continue
} else {
s, _ := slices.BinarySearch(missingSecretTenants, lbls["tenant"])
missingSecretTenants = slices.Delete(missingSecretTenants, s, s+1)
}

if secret.Items[i].Data == nil {
Expand Down Expand Up @@ -175,10 +171,6 @@ func AutoDetectTenantSecrets(
tenantSecret[lbls["tenant"]] = tOIDC
}

if len(missingSecretTenants) != 0 {
return tenantSecret, errors.Newf("missing secrets for tenants: %v", missingSecretTenants)
}

return tenantSecret, nil
}

Expand Down Expand Up @@ -209,9 +201,7 @@ func (o *ObsctlRulesSyncer) InitOrReloadObsctlConfig() error {
tenantSecrets, err := o.autoDetectSecretsFn(o.ctx, o.k8s, o.namespace, o.audience, o.issuerURL, o.managedTenants)
if err != nil {
level.Error(o.logger).Log("msg", "auto detecting tenant secrets", "error", err)
if len(tenantSecrets) == 0 {
return errors.Wrap(err, "no tenant secrets auto-detected")
}
return errors.Wrap(err, "auto detecting tenant secrets")
}

// Add all managed tenants under the API.
Expand Down
Loading