We've documented that for resources created with sensuctl, Sensu automatically adds the sensu.io/managed_by: sensuctl label in the resource definition. It seems reasonable to expect that both methods of adding a resource via sensuctl will automatically create the sensu.io/managed_by: sensuctl label:
Sensu automatically adds the sensu.io/managed_by: sensuctl label in the resource definition only if you use the sensuctl create --file resource.yml option and create resources from a file.
We use the other method sensuctl resource create resource-name \ to create resources in much of our documentation, and this does not automatically add the label to the resource definition.
Possible Solution
Fix the multi-line method of creating a resource with sensuctl so that it also automatically adds the sensu.io/managed_by: sensuctl label in the resource definition. This way, the behavior is consistent for both methods.
Expected Behavior
We've documented that for resources created with sensuctl, Sensu automatically adds the
sensu.io/managed_by: sensuctl
label in the resource definition. It seems reasonable to expect that both methods of adding a resource via sensuctl will automatically create thesensu.io/managed_by: sensuctl
label:sensuctl create --file resource.yml
(see https://docs.sensu.io/sensu-go/latest/sensuctl/create-manage-resources/#create-resources for an example)sensuctl resource create resource-name \
(see https://docs.sensu.io/sensu-go/latest/observability-pipeline/observe-schedule/collect-metrics-with-checks/#create-a-check-to-collect-metrics for an example)For an example of how we have documented this, see the first NOTE under https://docs.sensu.io/sensu-go/latest/sensuctl/create-manage-resources/#sensuctl-prune
Current Behavior
Sensu automatically adds the
sensu.io/managed_by: sensuctl
label in the resource definition only if you use thesensuctl create --file resource.yml
option and create resources from a file.We use the other method
sensuctl resource create resource-name \
to create resources in much of our documentation, and this does not automatically add the label to the resource definition.Possible Solution
Fix the multi-line method of creating a resource with sensuctl so that it also automatically adds the
sensu.io/managed_by: sensuctl
label in the resource definition. This way, the behavior is consistent for both methods.Steps to Reproduce (for bugs)
collect-metrics
check with sensuctl.sensuctl check info collect-metrics --format yaml
orGET http://127.0.0.1:8080/api/core/v2/namespaces/default/checks/collect-metrics
sensu.io/managed_by: sensuctl
labelmetrics.yml
:sensuctl create --file metrics.yml
sensuctl check info collect-metrics --format yaml
orGET http://127.0.0.1:8080/api/core/v2/namespaces/default/checks/collect-metrics
sensu.io/managed_by: sensuctl
labelContext
Slack discussion: https://sensu.slack.com/archives/C60EEQFH8/p1615327340399800
Your Environment