Add check for Kubernetes annotation on entity
Signed-off-by: Andre Wanlin <awanlin@rapidrtc.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-kubernetes': patch
|
||||
---
|
||||
|
||||
Added a check for the Kubernetes annotation on the entity
|
||||
@@ -27,6 +27,12 @@ const KUBERNETES_ANNOTATION = 'backstage.io/kubernetes-id';
|
||||
const KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION =
|
||||
'backstage.io/kubernetes-label-selector';
|
||||
|
||||
export const isKubernetesAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[KUBERNETES_ANNOTATION]) ||
|
||||
Boolean(
|
||||
entity.metadata.annotations?.[KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION],
|
||||
);
|
||||
|
||||
type Props = {
|
||||
/** @deprecated The entity is now grabbed from context instead */
|
||||
entity?: Entity;
|
||||
|
||||
@@ -25,6 +25,6 @@ export {
|
||||
kubernetesPlugin as plugin,
|
||||
EntityKubernetesContent,
|
||||
} from './plugin';
|
||||
export { Router } from './Router';
|
||||
export { Router, isKubernetesAvailable } from './Router';
|
||||
export * from './kubernetes-auth-provider';
|
||||
export * from './utils/clusterLinks';
|
||||
|
||||
Reference in New Issue
Block a user