Skip to content

feat: enforce labels on InstanceStart/InstanceStop operations#893

Closed
louisdtt wants to merge 32 commits into
sablierapp:mainfrom
louisdtt:ignore-unlabeled
Closed

feat: enforce labels on InstanceStart/InstanceStop operations#893
louisdtt wants to merge 32 commits into
sablierapp:mainfrom
louisdtt:ignore-unlabeled

Conversation

@louisdtt

@louisdtt louisdtt commented May 10, 2026

Copy link
Copy Markdown
Contributor

Summary

This feature follows up issue #857 and @mzyy94 work, switching strict-labels to ignore-unlabeled.

It adds a provider.ignore-unlabeled flag, disabled by default, to make Sablier ignore resources that are not labeled with sablier.enable=true.

When enabled, providers reject start/stop operations for unlabeled instances and filter stopped/remove events so unmanaged resources do not trigger Sablier.

Changes

  • Add provider.ignore-unlabeled config and docs.
  • Enforce label checks for provider start/stop operations when enabled, keep existing behaviour otherwise.
  • Wire the setting into Docker, Docker Swarm, Kubernetes, and Podman providers.
  • Filter stopped/remove notifications for unlabeled resources when enabled.
  • Add tests for enabled/disabled/labeled/unlabeled behaviour across providers.

Tests

Ran project tests and currently using this fork with provider.ignore-unlabeled=true on a Kind and an AKS cluster.

mzyy94 and others added 25 commits April 3, 2026 20:43
@louisdtt louisdtt requested a review from acouvreur as a code owner May 10, 2026 19:31
@github-actions github-actions Bot added documentation Improvements or additions to documentation provider Issue related to a provider labels May 10, 2026
@acouvreur

Copy link
Copy Markdown
Member

Hello @louisdtt

Since then, we've merged a lot of code, all of it seems out of date unfortunately.

Would you be able to resolve the conflicts ?

@louisdtt louisdtt marked this pull request as draft May 12, 2026 11:42
@louisdtt louisdtt marked this pull request as ready for review May 13, 2026 14:23
@louisdtt

Copy link
Copy Markdown
Contributor Author

Hello @acouvreur, should be good now 🙂

@acouvreur acouvreur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should try to do no code changes in the providers as we expect the same behavior out of them all.

Can we simply call inspect when we receive an instance expiration, and skip the call to InstanceStop if we ignore those ?

Let's park other use cases for now. We might do this in two pull request and two different configurations because they are not the same things:

  • One is to fail when a request target resources with instances not tracked by sablier
  • The other is to ignore the shutdown for an instance that was (probably) started by sablier but was later removed

if errors.As(err, &ErrInstanceNotManaged{}) {
logger.WarnContext(ctx, "instance expired but is not managed by sablier, skipping stop", slog.String("instance", key))
return
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I feel like we could avoid all provider code changes and put it at the sablier package level. For example, when we receive an instance expired event, we could get the instance information using InstanceInspect, and check if it is enabled or not.

If it is not enabled, we can log this.

@louisdtt louisdtt marked this pull request as draft May 13, 2026 18:12
@louisdtt

Copy link
Copy Markdown
Contributor Author

I think you are right, this is a bit much, i'll leave this PR as a draft for now and reopen one focusing on your first point

@acouvreur

Copy link
Copy Markdown
Member

Superseded by #908

@acouvreur acouvreur closed this May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation provider Issue related to a provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants