Open tidusete opened 2 weeks ago
Can you check it @rndmh3ro and @szEvEz whenever you have time? Thank you so much
Hi @tidusete,
thank you for your contribution and your thorough description. I will try to find some time in the next couple of days to review your request.
As this is a bigger change, also on the general design of this operator, we need to put some more thought into that.
Currently what we were doing, was the following:
We need to think about where we wanna head with this solution. In the end, we also could support multiple ways/methods on doing that.
@rndmh3ro maybe you can add your 2 cents here as well (design wise)
Description
This MR introduces the following changes to the
trivy-dojo-report-operator
application:handlers.py
file to handle the kubeconfig scenario.Changes
charts/templates/deployment.yaml
:KUBECONFIG
with the value of the path of the mounted kubeconfig file.createRBAC
flag to set the service account name.charts/templates/rbac.yaml
:createRBAC
flag to create the service account, cluster role, and cluster role binding.charts/templates/secret.yaml
:charts/values.yaml
:remoteClusterKubeconfig
to store the base64-encoded remote cluster kubeconfig.createRBAC
to control the creation of RBAC resources.deploy/trivy-dojo-report-operator.yaml
:src/handlers.py
:login_fn
function to handle the kubeconfig scenario.src/settings.py
:KUBECONFIG
to store the path to the kubeconfig file.Rationale
The primary goal of these changes is to provide the flexibility to fetch vulnerabilities from a remote Kubernetes cluster, in addition to the default behavior of fetching them from the same cluster where the operator is running.
If the
remoteClusterKubeconfig
value is provided, the operator will use the kubeconfig file to authenticate and interact with the remote cluster. In this case, there is no need to create RBAC resources, as the remote cluster's RBAC configuration will be used.If the
remoteClusterKubeconfig
value is not provided, the operator will continue to use the default behavior of fetching vulnerabilities from the same cluster where it is running, and the RBAC resources will be created as before.The changes to the
handlers.py
file ensure that the login process handles both the kubeconfig scenario and the default scenario, maintaining backward compatibility.