Skip to content
Open
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
2 changes: 1 addition & 1 deletion api/operator/v1beta1/vmservicescrape_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type VMServiceScrapeSpec struct {
// note, that with service setting, you have to use port: "name"
// and cannot use targetPort for endpoints.
// +optional
// +kubebuilder:validation:Enum=endpoints;service;endpointslices
// +kubebuilder:validation:Enum=endpoints;service;endpointslices;endpointslice
DiscoveryRole string `json:"discoveryRole,omitempty"`
// The label to use to retrieve the job name from.
// +optional
Expand Down
2 changes: 2 additions & 0 deletions config/crd/overlay/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23210,6 +23210,7 @@ spec:
- endpoints
- service
- endpointslices
- endpointslice
type: string
endpoints:
items:
Expand Down Expand Up @@ -29001,6 +29002,7 @@ spec:
- endpoints
- service
- endpointslices
- endpointslice
type: string
endpoints:
items:
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ aliases:
* BUGFIX: [vmoperator](https://docs.victoriametrics.com/operator/): fixed conflicts for `VMAlert`, `VMAlertmanager` and `VMAuth` reconcilers, which are updating same objects concurrently with reconcilers for their child objects.
* BUGFIX: [vmoperator](https://docs.victoriametrics.com/operator/): previously PVC downscaling always emitted a warning, which is not expected, while using PVC autoresizer; now warning during attempt to downsize PVC is only emitted if `operator.victoriametrics.com/pvc-allow-volume-expansion: false` is not set. See [#1747](https://github.com/VictoriaMetrics/operator/issues/1747).
* BUGFIX: [vmoperator](https://docs.victoriametrics.com/operator/): skip self scrape objects management if respective controller is disabled. See [#1718](https://github.com/VictoriaMetrics/operator/issues/1718).
* BUGFIX: [vmagent](https://docs.victoriametrics.com/operator/resources/vmagent/): support both prometheus-compatible `endpointslice` and old `endpointslices` roles.
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Rule violated: Changelog Review Agent

Changelog entry violates the required structure: it doesn’t explain the before/now user-visible behavior and omits mandatory issue/PR references (see Changelog Review Agent ‘Required structure’ items 3 and 4).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/CHANGELOG.md, line 29:

<comment>Changelog entry violates the required structure: it doesn’t explain the before/now user-visible behavior and omits mandatory issue/PR references (see Changelog Review Agent ‘Required structure’ items 3 and 4).</comment>

<file context>
@@ -26,6 +26,7 @@ aliases:
 * BUGFIX: [vmoperator](https://docs.victoriametrics.com/operator/): fixed conflicts for `VMAlert`, `VMAlertmanager` and `VMAuth` reconcilers, which are updating same objects concurrently with reconcilers for their child objects.
 * BUGFIX: [vmoperator](https://docs.victoriametrics.com/operator/): previously PVC downscaling always emitted a warning, which is not expected, while using PVC autoresizer; now warning during attempt to downsize PVC is only emitted if `operator.victoriametrics.com/pvc-allow-volume-expansion: false` is not set. See [#1747](https://github.com/VictoriaMetrics/operator/issues/1747).
 * BUGFIX: [vmoperator](https://docs.victoriametrics.com/operator/): skip self scrape objects management if respective controller is disabled. See [#1718](https://github.com/VictoriaMetrics/operator/issues/1718).
+* BUGFIX: [vmagent](https://docs.victoriametrics.com/operator/resources/vmagent/): support both prometheus-compatible `endpointslice` and old `endpointslices` roles.
 
 ## [v0.67.0](https://github.com/VictoriaMetrics/operator/releases/tag/v0.67.0)
</file context>
Fix with Cubic


## [v0.67.0](https://github.com/VictoriaMetrics/operator/releases/tag/v0.67.0)
**Release date:** 23 January 2026
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/vmservicescrape.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ need to reconfigure.
It has various options for scraping configuration of target (with basic auth,tls access, by specific port name etc.).

Monitoring configuration is based on `discoveryRole` setting. By default, `endpoints` is used to get objects from kubernetes api.
It's also possible to use `discoveryRole: service` or `discoveryRole: endpointslices`.
It's also possible to use `discoveryRole: service` or `discoveryRole: endpointslice`.

`Endpoints` objects are essentially lists of IP addresses.
Typically, `Endpoints` objects are populated by `Service` object. `Service` object discovers `Pod`s by a label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func generateServiceScrapeConfig(
{Key: "source_labels", Value: []string{"__meta_kubernetes_endpoint_port_name"}},
{Key: "regex", Value: ep.Port},
})
case k8sSDRoleEndpointslice:
case k8sSDRoleEndpointslice, k8sSDRoleLegacyEndpointslices:
relabelings = append(relabelings, yaml.MapSlice{
{Key: "action", Value: "keep"},
{Key: "source_labels", Value: []string{"__meta_kubernetes_endpointslice_port_name"}},
Expand Down Expand Up @@ -120,7 +120,7 @@ func generateServiceScrapeConfig(
switch spec.DiscoveryRole {
case k8sSDRoleService:
// nothing to do, service doesn't have relations with pods.
case k8sSDRoleEndpointslice:
case k8sSDRoleEndpointslice, k8sSDRoleLegacyEndpointslices:
// Relabel namespace and pod and service labels into proper labels.
relabelings = append(relabelings, []yaml.MapSlice{
{ // Relabel node labels for pre v2.3 meta labels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ const (
k8sSDRolePod = "pod"
k8sSDRoleIngress = "ingress"
k8sSDRoleNode = "node"

// before 0.67.0 endpointslice was called endpointslices. keeping old name for backward compatibility
k8sSDRoleLegacyEndpointslices = "endpointslices"
)

var invalidLabelCharRE = regexp.MustCompile(`[^a-zA-Z0-9_]`)
Expand Down Expand Up @@ -244,7 +247,7 @@ func addAttachMetadata(dst yaml.MapSlice, am *vmv1beta1.AttachMetadata, role str
var items yaml.MapSlice
if am.Node != nil && *am.Node {
switch role {
case k8sSDRolePod, k8sSDRoleEndpoints, k8sSDRoleEndpointslice:
case k8sSDRolePod, k8sSDRoleEndpoints, k8sSDRoleEndpointslice, k8sSDRoleLegacyEndpointslices:
items = append(items, yaml.MapItem{
Key: "node",
Value: true,
Expand All @@ -253,7 +256,7 @@ func addAttachMetadata(dst yaml.MapSlice, am *vmv1beta1.AttachMetadata, role str
}
if am.Namespace != nil && *am.Namespace {
switch role {
case k8sSDRolePod, k8sSDRoleService, k8sSDRoleEndpoints, k8sSDRoleEndpointslice, k8sSDRoleIngress:
case k8sSDRolePod, k8sSDRoleService, k8sSDRoleEndpoints, k8sSDRoleEndpointslice, k8sSDRoleIngress, k8sSDRoleLegacyEndpointslices:
items = append(items, yaml.MapItem{
Key: "namespace",
Value: true,
Expand Down Expand Up @@ -462,7 +465,7 @@ func generateK8SSDConfig(ac *build.AssetsCache, opts generateK8SSDConfigOptions)

// special case, given roles create additional watchers for
// pod and services roles
if opts.role == k8sSDRoleEndpoints || opts.role == k8sSDRoleEndpointslice {
if opts.role == k8sSDRoleEndpoints || opts.role == k8sSDRoleEndpointslice || opts.role == k8sSDRoleLegacyEndpointslices {
for _, role := range []string{k8sSDRolePod, k8sSDRoleService} {
selectors = append(selectors, yaml.MapSlice{
{
Expand Down
11 changes: 9 additions & 2 deletions internal/webhook/operator/v1beta1/vmservicescrape_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

vmv1beta1 "github.com/VictoriaMetrics/operator/api/operator/v1beta1"
"github.com/VictoriaMetrics/operator/internal/controller/operator/factory/logger"
)

// SetupVMServiceScrapeWebhookWithManager will setup the manager to manage the webhooks
Expand All @@ -42,7 +43,7 @@ type VMServiceScrapeCustomValidator struct{}
var _ admission.CustomValidator = &VMServiceScrapeCustomValidator{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (*VMServiceScrapeCustomValidator) ValidateCreate(_ context.Context, obj runtime.Object) (admission.Warnings, error) {
func (*VMServiceScrapeCustomValidator) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
r, ok := obj.(*vmv1beta1.VMServiceScrape)
if !ok {
return nil, fmt.Errorf("BUG: unexpected type: %T", obj)
Expand All @@ -53,11 +54,14 @@ func (*VMServiceScrapeCustomValidator) ValidateCreate(_ context.Context, obj run
if err := r.Validate(); err != nil {
return nil, err
}
if r.Spec.DiscoveryRole == "endpointslices" {
logger.WithContext(ctx).Info("deprecated discoverRole value `endpointslices`, use `endpointslice` instead.")
}
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (*VMServiceScrapeCustomValidator) ValidateUpdate(_ context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {
func (*VMServiceScrapeCustomValidator) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {
r, ok := newObj.(*vmv1beta1.VMServiceScrape)
if !ok {
return nil, fmt.Errorf("BUG: unexpected type: %T", newObj)
Expand All @@ -68,6 +72,9 @@ func (*VMServiceScrapeCustomValidator) ValidateUpdate(_ context.Context, oldObj,
if err := r.Validate(); err != nil {
return nil, err
}
if r.Spec.DiscoveryRole == "endpointslices" {
logger.WithContext(ctx).Info("deprecated discoverRole value `endpointslices`, use `endpointslice` instead.")
}
return nil, nil
}

Expand Down
Loading