k8sgpt-ai / k8sgpt-operator

Automatic SRE Superpowers within your Kubernetes cluster
https://k8sgpt.ai
Apache License 2.0
314 stars 89 forks source link

[Feature]: Add a field for a secret to the Sink Type #309

Closed phillipahereza closed 9 months ago

phillipahereza commented 9 months ago

Checklist

Is this feature request related to a problem?

Yes

Problem Description

I am frustrated trying to add a sink whose endpoint contains an API Key that should remain a secret. I believe there is a security risk associated with saving endpoints that might contain secrets as plaintext strings in the CR, such as the Slack webhook URL, for example.

Solution Description

I think the best solution would be to add a field in the Sink type for a secret. The creator of the sink can then determine how to use this secret to build their request in the configure method.

Let's consider a hypothetical Telegram bot as a sink. Requests to the Telegram API are presented in the form https://api.telegram.org/bot<token>/METHOD_NAME. The https://api.telegram.org/bot could be stored in the endpoint field, and the token stored as the secret. The full URL could then be assembled in the configure method.

Benefits

Allows users to create sinks with secrets. Additionally, it allows users to create sinks where authentication is separate from the endpoint. For example, authentication that can be passed via headers instead of being inherently tied to the endpoint.

Potential Drawbacks

No response

Additional Information

I would be happy to work on this