// Copyright 2020-2026 Project Capsule Authors // SPDX-License-Identifier: Apache-2.0 package utils import ( "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime/schema" ctrl "sigs.k8s.io/controller-runtime" ) func HasGVK(mapper meta.RESTMapper, gvk schema.GroupVersionKind) bool { _, err := mapper.RESTMapping(gvk.GroupKind(), gvk.Version) if err != nil { if meta.IsNoMatchError(err) { return false } ctrl.Log.WithName("gvk-check").Error(err, "failed to check RESTMapping", "gvk", gvk.String()) return false } return true }