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

Add support to specify Console domain to pass MinIO for redirect #1050

Merged
merged 3 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions helm/operator/crds/minio.min.io_tenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4179,6 +4179,8 @@ spec:
type: boolean
domains:
properties:
console:
type: string
minio:
items:
type: string
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/minio.min.io/v2/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -1027,3 +1027,8 @@ func GetPrometheusName() string {
func (t *Tenant) HasMinIODomains() bool {
return t.Spec.Features != nil && t.Spec.Features.Domains != nil && len(t.Spec.Features.Domains.Minio) > 0
}

// HasConsoleDomains indicates whether a domain is being specified for Console
func (t *Tenant) HasConsoleDomains() bool {
return t.Spec.Features != nil && t.Spec.Features.Domains != nil && t.Spec.Features.Domains.Console != ""
}
2 changes: 2 additions & 0 deletions pkg/apis/minio.min.io/v2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ type TenantDomains struct {
// List of Domains used by MinIO. This will enable DNS style access to the object store where the bucket name is
// inferred from a subdomain in the domain.
Minio []string `json:"minio,omitempty"`
// Domain used to expose the MinIO Console, this will configure the redirect on MinIO when visiting from the browser
Console string `json:"console,omitempty"`
}

// S3Features (`s3`) - Object describing which MinIO features to enable/disable in the MinIO Tenant. +
Expand Down
11 changes: 11 additions & 0 deletions pkg/resources/statefulsets/minio-statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,17 @@ func minioEnvironmentVars(t *miniov2.Tenant, wsSecret *v1.Secret, hostsTemplate
Value: strings.Join(domains, ","),
})
}
// Set the redirect url for console
if t.HasConsoleDomains() {
schema := "http"
if t.TLS() {
schema = "https"
}
envVars = append(envVars, corev1.EnvVar{
Name: "MINIO_BROWSER_REDIRECT_URL",
Value: fmt.Sprintf("%s://%s", schema, t.Spec.Features.Domains.Console),
})
}

// Add env variables from credentials secret, if no secret provided, dont use
// env vars. MinIO server automatically creates default credentials
Expand Down
2 changes: 2 additions & 0 deletions resources/base/crds/minio.min.io_tenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4179,6 +4179,8 @@ spec:
type: boolean
domains:
properties:
console:
type: string
minio:
items:
type: string
Expand Down