VictoriaMetrics / operator

Kubernetes operator for Victoria Metrics
Apache License 2.0
410 stars 141 forks source link

Allow Adjusting Default Service Type for Application Services #904

Closed arcug closed 3 months ago

arcug commented 4 months ago

When deploying clusters in GKE, services that sit behind a GCP LB for the Ingress object require a non-ClusterIP type Service. Are there plans to allow the CRD for the Applications to support a custom Service Type rather than a hard coded ClusterIP type? If not can we issue PR's to address this?

This is the related issue on the helm chart that deploys the operator. https://github.com/VictoriaMetrics/helm-charts/issues/163#issuecomment-1989707794

Haleygo commented 4 months ago

Hello! What about using the serviceSpec? It allows having an extra customized service.

f41gh7 commented 3 months ago

I was thinking of new boolean flag, which could be added to the serviceSpec - useAsDefaultService: true.

In this case, additional service must be deleted and all properties of it applied to the default service.

This change may require service recreation - if any immutable fields for it changes.

f41gh7 commented 3 months ago

Must be fixed at v0.43.0 release.

Operator allows to modify exist service with serviceSpec if useAsDefault option is set to true

---
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMCluster
metadata:
  name: example-service-change
spec:
  retentionPeriod: "4"
  replicationFactor: 2
  vmstorage:
    replicaCount: 2
    containers:
    - name: my-side-car
      ports:
      - name: extra-port
        containerPort: 8055
    serviceSpec:
      # expose additional port with default service
      userAsDefault: true
      spec:
         ports:
         - name: extra-port
           port: 8055
    storageDataPath: "/vm-data"
    storage:
      volumeClaimTemplate:
        spec:
          resources:
            requests:
              storage: 10Gi
  vmselect:
    replicaCount: 2
    cacheMountPath: "/select-cache"
  vminsert:
    replicaCount: 2
    serviceSpec:
      metadata:
        annotations:
          my-cloud-provide-annotation: value
      userAsDefault: true
      spec:
       type: LoadBalancer