in data/data.go [149:191]
func newEntry[O ingestObj](obj O, st SourceType, ct ChangeType) (Entry, error) {
if obj == nil {
return Entry{}, fmt.Errorf("new object is nil")
}
var ot ObjectType
switch v := any(obj).(type) {
case *corev1.Node:
ot = OTNode
case *corev1.Pod:
ot = OTPod
case *corev1.Namespace:
ot = OTNamespace
case *corev1.PersistentVolume:
ot = OTPersistentVolume
case *rbacv1.ClusterRole:
ot = OTClusterRole
case *rbacv1.ClusterRoleBinding:
ot = OTClusterRoleBinding
case *rbacv1.Role:
ot = OTRole
case *rbacv1.RoleBinding:
ot = OTRoleBinding
case *corev1.Service:
ot = OTService
case *appsv1.Deployment:
ot = OTDeployment
case *networkingv1.Ingress:
ot = OTIngressController
case *corev1.Endpoints:
ot = OTEndpoint
default:
return Entry{}, fmt.Errorf("unknown object type(%T)", v)
}
return Entry{
data: obj,
uid: obj.GetUID(),
sourceType: st,
changeType: ct,
objectType: ot,
}, nil
}