Skip to content
Merged
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
7 changes: 7 additions & 0 deletions pkg/dataobj/consumer/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import (
"github.com/grafana/loki/v3/pkg/util"
)

// PrepareDownscaleHandler is a special handler called by the rollout operator
// immediately before the pod is downscaled. It can stop a downscale by
// responding with a non 2xx status code.
func (s *Service) PrepareDownscaleHandler(_ http.ResponseWriter, _ *http.Request) {
s.partitionInstanceLifecycler.SetRemoveOwnerOnShutdown(true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied from ingesters.

}

// PrepareDelayedDownscaleHandler is a special handler called by the rollout
// operator to prepare for a delayed downscale. This allows the service to
// perform any number of actions in preparation of being scaled down at the
Expand Down
4 changes: 4 additions & 0 deletions pkg/loki/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -2403,6 +2403,10 @@ func (t *Loki) initDataObjConsumer() (services.Service, error) {
httpMiddleware := middleware.Merge(
serverutil.RecoveryHTTPMiddleware,
)
t.Server.HTTP.
Methods(http.MethodGet, http.MethodPost, http.MethodDelete).
Path("/dataobj-consumer/prepare-downscale").
Handler(httpMiddleware.Wrap(http.HandlerFunc(t.dataObjConsumer.PrepareDownscaleHandler)))
t.Server.HTTP.
Methods(http.MethodGet, http.MethodPost, http.MethodDelete).
Path("/dataobj-consumer/prepare-delayed-downscale").
Expand Down