Skip to content
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
13 changes: 9 additions & 4 deletions pkg/controller/cluster/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,21 @@ func (c *Controller) checkConsoleSvc(ctx context.Context, tenant *miniov2.Tenant
// check the specification of the MinIO ClusterIP service
if !svcMatchesSpec {
if err != nil {
klog.Infof("Console Service don't match: %s", err)
klog.Infof("Console Service don't match: %s. Conciliating", err)
}

svc.ObjectMeta.Annotations = expectedSvc.ObjectMeta.Annotations
svc.ObjectMeta.Labels = expectedSvc.ObjectMeta.Labels
svc.Spec.Ports = expectedSvc.Spec.Ports
// we can only expose the service, not un-expose it
if tenant.Spec.ExposeServices != nil && tenant.Spec.ExposeServices.MinIO && svc.Spec.Type != v1.ServiceTypeLoadBalancer {
svc.Spec.Type = v1.ServiceTypeLoadBalancer
// Only when ExposeServices is set an explicit value we do modifications to the service type
if tenant.Spec.ExposeServices != nil {
if tenant.Spec.ExposeServices.Console {
svc.Spec.Type = v1.ServiceTypeLoadBalancer
} else {
svc.Spec.Type = v1.ServiceTypeClusterIP
}
}

// update the selector
svc.Spec.Selector = expectedSvc.Spec.Selector

Expand Down
11 changes: 8 additions & 3 deletions pkg/controller/cluster/minio-services.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,14 @@ func (c *Controller) checkMinIOSvc(ctx context.Context, tenant *miniov2.Tenant,
svc.ObjectMeta.Annotations = expectedSvc.ObjectMeta.Annotations
svc.ObjectMeta.Labels = expectedSvc.ObjectMeta.Labels
svc.Spec.Ports = expectedSvc.Spec.Ports
// we can only expose the service, not un-expose it
if tenant.Spec.ExposeServices != nil && tenant.Spec.ExposeServices.MinIO && svc.Spec.Type != v1.ServiceTypeLoadBalancer {
svc.Spec.Type = v1.ServiceTypeLoadBalancer

// Only when ExposeServices is set an explicit value we do modifications to the service type
if tenant.Spec.ExposeServices != nil {
if tenant.Spec.ExposeServices.MinIO {
svc.Spec.Type = v1.ServiceTypeLoadBalancer
} else {
svc.Spec.Type = v1.ServiceTypeClusterIP
}
}
_, err = c.kubeClientSet.CoreV1().Services(tenant.Namespace).Update(ctx, svc, metav1.UpdateOptions{})
if err != nil {
Expand Down