Skip to content

Commit

Permalink
build/vmcluster: properly mount ServiceAccount for vmauth load-bala…
Browse files Browse the repository at this point in the history
…ncer

Initially `ServiceAccount` wasn't defined for `vmauth`'s `Deployment`. Since there was no practial use for it.
At older versions of operator it made sense to mount `serviceAccount` for `vminsert` and `vmselect` components because of `PodSecurityPolicy`
Kubernetes resources. But it's deprecated now and it makes `serviceAccount` irrelevant for these components.

 But for production use cases it could be useful. Strict security policy may require to disable auto service account mount.
On of possible solutions for it to use `ServiceAccount` with disabled auto-mount option.

 This commit adds `serviceAccount` of `VMCluster` to the load-balancer `Deployment`.

 Related issue:
#1210

Signed-off-by: f41gh7 <[email protected]>
  • Loading branch information
f41gh7 committed Jan 8, 2025
1 parent fc5fe87 commit 735425a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ aliases:

* BUGFIX: [vmagent](https://docs.victoriametrics.com/operator/resources/vmagent/): properly route headless service traffic to vmagent `pods` with `statefulMode` and `shardCount` defined.
* BUGFIX: [vmsingle](https://docs.victoriametrics.com/operator/resources/vmsingle/): properly add `volumeMount` for external `storageDataPath` `volume`.
* BUGFIX: [vmcluster](https://docs.victoriametrics.com/operator/resources/vmcluster/): properly mount `serviceAccount` for `requestsLoadBalancer` `Deployment`. See [this issue](https://github.com/VictoriaMetrics/operator/issues/1210) for details.

## [v0.51.2](https://github.com/VictoriaMetrics/operator/releases/tag/v0.51.2)

Expand Down
7 changes: 4 additions & 3 deletions internal/controller/operator/factory/vmcluster/vmcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1524,9 +1524,10 @@ func buildVMauthLBDeployment(cr *vmv1beta1.VMCluster) (*appsv1.Deployment, error
Labels: cr.VMAuthLBSelectorLabels(),
},
Spec: corev1.PodSpec{
Volumes: volumes,
InitContainers: spec.InitContainers,
Containers: containers,
Volumes: volumes,
InitContainers: spec.InitContainers,
Containers: containers,
ServiceAccountName: cr.GetServiceAccountName(),
},
},
},
Expand Down

0 comments on commit 735425a

Please sign in to comment.