exposeServices - cniackz/public GitHub Wiki

exposeServices in EKS: by Pedro!!!

https://blog.min.io/expose-minio-eks/

apiVersion: minio.min.io/v2
kind: Tenant

metadata:
 name: minio-tenant-1
 namespace: minio-tenant-1
Spec:
...
 exposeServices:
   console: true
   minio: true
...

 serviceMetadata:
   consoleServiceAnnotations:
      service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: instance

      service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing

      service.beta.kubernetes.io/aws-load-balancer-type: external
   minioServiceAnnotations:
     service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: instance

      service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing

      service.beta.kubernetes.io/aws-load-balancer-type: external

There is logic to change the services in our Operator: https://github.com/minio/operator/issues/1312 https://github.com/minio/operator/pull/1333 O es load balancer o cluster IP en console.go

		svc.ObjectMeta.Annotations = expectedSvc.ObjectMeta.Annotations
		svc.ObjectMeta.Labels = expectedSvc.ObjectMeta.Labels
		svc.Spec.Ports = expectedSvc.Spec.Ports
		// 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
			}
		}

Log:

I0902 10:19:41.983167   74820 console.go:75] Console Service don't match: Service type doesn't match. Conciliating
I0902 10:19:41.983509   74820 event.go:285] Event(v1.ObjectReference{Kind:"Tenant", Namespace:"tenant-lite", Name:"myminio", UID:"ffcc7080-52aa-44f2-879a-017f7974ca21", APIVersion:"minio.min.io/v2", ResourceVersion:"76334", FieldPath:""}): type: 'Normal' reason: 'Updated' MinIO Service Updated
I0902 10:19:41.997240   74820 event.go:285] Event(v1.ObjectReference{Kind:"Tenant", Namespace:"tenant-lite", Name:"myminio", UID:"ffcc7080-52aa-44f2-879a-017f7974ca21", APIVersion:"minio.min.io/v2", ResourceVersion:"76334", FieldPath:""}): type: 'Normal' reason: 'Updated' Console Service Updated

When False or Empty as below, ClusterIP is observed:

spec:
  exposeServices: {}

When True, LoadBalancer type is observed:

spec:
  exposeServices:
    console: true
    minio: true

Solo hacemos estos cambios cuando son pedidos de forma explicita, sino, no los tocamos:

// Only when ExposeServices is set an explicit value we do modifications to the service type Y tambien lo que es cierto es que aun cuando cambiemos estos servicios, se pueden crear otros servicios para lo mismo que el operador no puede tocar y asi aun cuando operador cambie estos, el usuario puede usar otros que operador no puede tocar y esto seria intracendente. klog.Infof("Console Service don't match: %s. Conciliating", err) <--- este log cuando nosotros le metemos cambios.