Open apatozi opened 2 weeks ago
Thanks for the PR, looks good. Can you add documentation about ShowOnlyExplicitVisibleNodes
?
Thanks for the PR, looks good. Can you add documentation about
ShowOnlyExplicitVisibleNodes
?
I found the documentation and added all the needed Information about the configuration option and the k8s labels that can be used to customize the view. I didn't do it in the beginning because I did open only with Visual Studio and did not find the docs at first.
For the Chinese part of the docs I did my best with google Translate but I strongly suggest for someone that speaks Chinese to check it out.
Description:
The K8s discovery was working ok but not great for a real life scenario use case. There were the following problems:
Changes in this PR address the above issues by doing the following measures:
dotnetcore.cap.visibility: hide
. This was not enough because some services are created by an operator and I could not add the same label to those "rabbit-mq" services because the operator detected changes and replaced them instantly removing the label. This problem resulted in adding the "only whitelisted" mode by adding an option to the k8sDiscoveryOptions. This option shows only services containing thedotnetcore.cap.visibility: show
label.dotnetcore.cap.portIndex: '1'
label on the desired service. If the index is outside of bounds then it will fall back to index 0 as it was. The ports can also be selected by name by using thedotnetcore.cap.portName: grpc
label. The "Find by name" rule is stronger than the index. If no port is found with that name it will fall back to the "Find by Index" rule and after that to index 0 as said earlier. This opens the possibility to add more customization using ne k8s-labels.Issue(s) addressed:
Changes:
Affected components:
How to test:
These changes can only be tested by running a project inside kubernetes. After setting up and having some test services in the list try the latter scenarios.
Scenario 1: Hide a node using label
dotnetcore.cap.visibility: hide
on a service.Scenario 2: Hide all nodes if not explicitly shown
dotnetcore.cap.visibility: show
to the desired serviceAdditional notes (optional):
The GetNodes Method was always returning an empty list because the ns argument was always null in any case. I changed that method to return the list of the services that reside in the namespace of the K8s POD where the dashboard is running. This opens the possibility for the
api-access
ServiceAccount to not use a ClusterRole but only ose a Role that has access to the services inside the namespace where the dashboard runs. This is the only use case needed for my project as we have different namespaces for different enviorments inside the K8s.Checklist:
Documentation updated.
Reviewers: