canonical / charmed-kubeflow-chisme

Shared Utilities used across Charmed Kubeflow
Apache License 2.0
1 stars 4 forks source link

[cos integration] function deploy_and_assert_grafana_agent should be used with more apps #117

Open rgildein opened 1 month ago

rgildein commented 1 month ago

Context

Right now, the deploy_and_assert_grafana_agent can only relate single application with grafana-agent-k8s, and it's not possible to use function again, since it will fail to deploy grafana-agent-k8s.

One solution would be to skip deployment of grafana-agent-k8s if one application is already there. Like this, we can use deploy_and_assert_grafana_agent multiple times. e.g.

await deploy_and_assert_grafana_agent(
    ops_test.model, ISTIO_PILOT, metrics=True, dashboard=True, logging=False
)
await deploy_and_assert_grafana_agent(
    ops_test.model, ISTIO_GATEWAY_APP_NAME, metrics=True, dashboard=True, logging=False
)

Or another solution would be to provide a list of applications to deploy_and_assert_grafana_agent. e.g.

await deploy_and_assert_grafana_agent(
    ops_test.model, [ISTIO_PILOT, ISTIO_GATEWAY_APP_NAME], metrics=True, dashboard=True, logging=False
)

The second option could cause some issue with already existing usage.

What needs to get done

  1. Change deploy_and_assert_grafana_agent in way that it could be used with multiple applications.

Definition of Done

  1. It's possible to relate multiple apps with grafana-agent-k8s with chisme abstraction.
syncronize-issues-to-jira[bot] commented 1 month ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/KF-6032.

This message was autogenerated

orfeas-k commented 1 month ago

As we discussed, option two will require

await deploy_and_assert_grafana_agent(
-    ops_test.model, ISTIO_PILOT, metrics=True, dashboard=True, logging=False
+    ops_test.model, [ISTIO_PILOT], metrics=True, dashboard=True, logging=False
)

so we should avoid that. Option 1 sounds ok but its downside is that deploy_and_assert_grafana_agent() will be running for a second time but it won't deploy anything which makes for a less vibisble API of what is going on. Unless, we have add an optional argument skip_deploy and pass that every time we need to run it a second time.

Another idea I had was if we included all this in a function e.g. relate_to_grafana_agent(), exported this as a helper and use that in the second call instead of deploy_and_assert(). That being said, this could add some confusion in terms of API because some times there 'll be no relate_to_grafana_agent() and this could confuse users.