happy-area-89552
05/27/2025, 2:00 PMerror: Preview failed: resource 'rabbitmq/telegraf-user-credentials' does not exist
I appreciate any recommendations on how do depends_on with get().
Thanks 🙂damp-airline-38442
05/30/2025, 5:42 PMid
that you pass into `get()`; make the id value be dependent on the other CR.happy-area-89552
06/02/2025, 2:15 PMrabbitMQ = RabbitMQ(
name,
namespace="rabbitmq",
opts=child_opts,
)
telegraf = TelegrafDeployment(
name,
opts=ResourceOptions.merge(
child_opts,
ResourceOptions(
depends_on=[
rabbitMQ,
]
)
)
)
inside the RabbitMQ class:
self.telegraf_user = kubernetes.apiextensions.CustomResource(
"telegraf",
api_version="rabbitmq.com/v1beta1",
kind="User",
metadata={
"name": "telegraf",
"namespace": namespace,
},
opts=child_opts,
spec={
"tags": [
"management"
],
"rabbitmqClusterReference": {
"name": "rabbitmq",
},
"importCredentialsSecret": {
"name": telegraf_credentials.metadata["name"]
},
}
)
telegraf.py:
class TelegrafDeployment(ComponentResource):
def __init__(self,
name: str,
args: TelegrafDeploymentArgs,
opts: ResourceOptions = None):
super().__init__("idm:tools:TelegrafDeployment", name, {}, opts)
child_opts = ResourceOptions(
parent=self,
)
user_secret = Secret.get(
"telegraf-user-credentials",
"rabbitmq/telegraf-user-credentials",
opts=child_opts,
)
I'm not sure what you mean with:
> make the id value be dependent on the other CR.
How would i make my id value dependent? Do you mean making an output out of: telegraf_user.id
and pass it into the Telegraf CR? Or only make the Telegraf CR depend on that output?
The operator might take a little time to create the secret itself from the custom resource. Would that work in that case?
Thanksdamp-airline-38442
06/02/2025, 3:20 PM"rabbitmq/telegraf-user-credentials"
be an output, that is based on the expression telegraf_credentials.metadata["name"]
.damp-airline-38442
06/02/2025, 3:34 PMhappy-area-89552
06/05/2025, 8:16 AM