Add support for custom types as generic
davidglia opened this issue · 2 comments
Description of the issue:
We're trying to track status of kind Tables using kubedog.
echo "\$tableManifest" | yq -o=json '.
| map({
"Name":.metadata.name,
"Namespace":"default",
"GroupVersionKind":{"Kind":"Table","Group":"dynamodb.services.k8s.aws","Version":"v1alpha1"},
"AllowFailuresCount":5,
"ShowServiceMessages":true
})
| {"Generics": .}' \
| kubedog multitrack --kube-context dev
The problem is it is not returning logs. This is an example of the status of a Table, which we expect to see included in the logs.
Status:
Ack Resource Metadata:
Arn:
Owner Account ID:
Region: us-west-2
Conditions:
Last Transition Time: 2023-08-23T10:42:28Z
Message: Resource synced successfully
Reason:
Status: True
Type: ACK.ResourceSynced
Creation Date Time: 2023-08-01T11:20:30Z
Item Count: 9158
Table ID:
Table Size Bytes:
Table Status: ACTIVE
We found out that the reason why it is not logging anything is because Type: ACK.ResourceSynced
is not supported.
Proposal:
Is it possible to introduce the following changes:
- Support type as generic
- Add ability to forward condition from a json. This is how it is defined in the AWS controller.
Currently Generic tracker tries to find an appropriate condition in the resource status based on heuristic algorithm, and condition with such a name (ACK.ResourceSynced) is pretty rare. Obviously, we can't hardcode every possible condition for every Custom Resource out there. A mechanism to pass a custom condition for a specific resource sounds reasonable, we'll implement it in the future.
We heavily improved status detection for custom resources. Also, if status cannot be detected automatically, we encourage users to send us PR with their custom condition added to this yaml file.