VictoriaMetrics / operator

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

Adding headless service name into serviceName field on operator-managed vmagent statefulset #917

Closed cglrn closed 3 months ago

cglrn commented 3 months ago

We want to implement the stream aggregation feature with stream sharding by setting up a 2-layer vmagent structure. For this purpose, within the vmagent CRD that I'm using as a StatefulSet, I can define a headless service giving clusterIP: None in VMAgentSpec.ServiceSpec. However, in order to shard the streams, each pod needs to have DNS records created because I need to shard based on the remotewriteURL of first vmagent layer. For this to happen, the headless service name needs to be set within the StatefulSet as serviceName. Currently, this is not optional, and the serviceName field is set empty, so only headless service record is created and returns all pods' IPs.

f41gh7 commented 3 months ago

For me, it's reasonable to change service for vmagent with statefulMode to the headless.

But it requires service recreation, which potentially may disrupt data ingestion. I think, it's acceptable and shouldn't cause long downtime.

yilmazo commented 3 months ago

hi @f41gh7, we created a pull request for this purpose. can you please review when you're available?

Haleygo commented 3 months ago

But it requires service recreation, which potentially may disrupt data ingestion. I think, it's acceptable and shouldn't cause long downtime.

@f41gh7 What about creating headless service by default when vmagent is on statefulsetMode, like vmselect and vmstorage? Since headless service provides more feature for statefulset.

f41gh7 commented 3 months ago

But it requires service recreation, which potentially may disrupt data ingestion. I think, it's acceptable and shouldn't cause long downtime.

@f41gh7 What about creating headless service by default when vmagent is on statefulsetMode, like vmselect and vmstorage? Since headless service provides more feature for statefulset.

Good point. I'll implement that.

f41gh7 commented 3 months ago

Must be fixed at v0.43.0 release.

Also, by default, vmagent uses headless service with statefulMode.