Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(inputs.openstack): Allow collection without admin privileges #15468

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

srebhan
Copy link
Member

@srebhan srebhan commented Jun 6, 2024

Summary

Switch to gophercloud/v2 and simplify the code. This way, it becomes easier to use the plugin as non-admin and to maintain policies in OpenStack.

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #11769

@telegraf-tiger telegraf-tiger bot added chore plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Jun 6, 2024
@powersj
Copy link
Contributor

powersj commented Jun 6, 2024

@srebhan FYI I pushed a go mod tidy so you could get artifacts over night

@srebhan srebhan marked this pull request as ready for review June 10, 2024 18:34
@srebhan srebhan added the cloud Issues or requests around cloud environments label Jun 10, 2024
@srebhan srebhan changed the title chore(inputs.openstack): Simplify code and avoid cross-dependencies between services feat(inputs.openstack): Allow collection without admin privileges Jun 10, 2024
@telegraf-tiger telegraf-tiger bot added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Jun 10, 2024
@srebhan srebhan removed the chore label Jun 10, 2024
@telegraf-tiger
Copy link
Contributor

@rplevka
Copy link
Contributor

rplevka commented Jun 10, 2024

tested in a restricted OSP environment (no cluster admin permissions, just project admin) and it seems to work great:

$ ./telegraf --config ~/work/playground/telegraf/tg_osp.conf --test --debug
2024-06-10T18:46:42Z I! Loading config: /home/rplevka/work/playground/telegraf/tg_osp.conf
2024-06-10T18:46:42Z I! Starting Telegraf 1.32.0-3f9c982d brought to you by InfluxData the makers of InfluxDB
2024-06-10T18:46:42Z I! Available plugins: 234 inputs, 9 aggregators, 32 processors, 26 parsers, 60 outputs, 6 secret-stores
2024-06-10T18:46:42Z I! Loaded inputs: openstack
2024-06-10T18:46:42Z I! Loaded aggregators: 
2024-06-10T18:46:42Z I! Loaded processors:
2024-06-10T18:46:42Z I! Loaded secretstores:
2024-06-10T18:46:42Z W! Outputs are not used in testing mode!
2024-06-10T18:46:42Z I! Tags enabled: host=rplevka-t14s
2024-06-10T18:46:42Z D! [agent] Initializing plugins
2024-06-10T18:46:42Z D! [agent] Starting service inputs
> openstack_server,flavor=abcde0123-2c2d-1234-bad0-11234a0f9aea,host=rplevka-t14s,host_id=f6f8760df4b7b1334cb96a5baae8a190880a5d32f76893b044132d11,host_name=f6f8760df4b7b1334cb96a5baae8a190880a5d32f76893b044132d11,image=b6ad68d8-6022-4440-9190-2a7cef81f4bd,key_name=jenkins,name=vm1-rhel8.10-19e6533d,project=project1,status=active,tenant_id=7880c02ac32d46eaa3d306fd1b10e5b3 accessIPv4="",accessIPv6="",addresses=1i,created=1718044335000000000i,disk_gb=100i,fault_code=0i,fault_created=-6795364578871345152i,fault_details="",fault_message="",id="6f6ec454-6287-46eb-9297-aa636da1dd29",progress=0i,ram_mb=24576i,security_groups=1i,updated=1718044407000000000i,vcpus=6i,volumes_attached=0i 1718045210000000000

used config (redacted):

[[inputs.openstack]]
    authentication_endpoint = "https://foo.bar:13000"
    domain = "baz.com"
    project = "project1"
    username = "user"
    password = "pass"
    timeout = "60s"

    enabled_services = ["servers"]
    query_all_tenants = false

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jun 11, 2024
@srebhan srebhan assigned powersj and DStrand1 and unassigned srebhan Jun 11, 2024
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

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

Sadly we still have no tests. I see that the reporter confirmed it works for his requested behavior, however it would be nice to know that this does not regress the current behavior as well.

@powersj powersj removed their assignment Jun 11, 2024
@DStrand1 DStrand1 merged commit 0d12cc5 into influxdata:master Jun 11, 2024
31 checks passed
@github-actions github-actions bot added this to the v1.32.0 milestone Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cloud Issues or requests around cloud environments feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Openstack plugin - allow metrics-gathering by non-admin OSP accounts
4 participants