Added backward compatibility
Signed-off-by: Mani Marothu <manikumar.1215@gmail.com>
This commit is contained in:
parent
9a96c90b41
commit
49bdcae41c
3 changed files with 18 additions and 9 deletions
|
@ -1,24 +1,24 @@
|
|||
import { createApiRef } from "@backstage/core-plugin-api";
|
||||
import { createApiRef } from '@backstage/core-plugin-api';
|
||||
|
||||
import {
|
||||
IoArgoprojWorkflowV1alpha1WorkflowList,
|
||||
IoArgoprojWorkflowV1alpha1WorkflowTemplateList,
|
||||
} from "./generated/api";
|
||||
} from './generated/api';
|
||||
|
||||
export { ArgoWorkflows } from "./ArgoWorkflows";
|
||||
export { ArgoWorkflows } from './ArgoWorkflows';
|
||||
|
||||
export const argoWorkflowsApiRef = createApiRef<ArgoWorkflowsApi>({
|
||||
id: "plugin.argoworkflows",
|
||||
id: 'plugin.argoworkflows',
|
||||
});
|
||||
export interface ArgoWorkflowsApi {
|
||||
getWorkflows(
|
||||
clusterName: string | undefined,
|
||||
namespace: string | undefined,
|
||||
labels: string | undefined
|
||||
labels: string | undefined,
|
||||
): Promise<IoArgoprojWorkflowV1alpha1WorkflowList>;
|
||||
getWorkflowTemplates(
|
||||
clusterName: string | undefined,
|
||||
namespace: string,
|
||||
labels: string | undefined
|
||||
namespace: string | undefined,
|
||||
labels: string | undefined,
|
||||
): Promise<IoArgoprojWorkflowV1alpha1WorkflowTemplateList>;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ import { Entity } from '@backstage/catalog-model';
|
|||
import {
|
||||
ARGO_WORKFLOWS_LABEL_SELECTOR_ANNOTATION,
|
||||
CLUSTER_NAME_ANNOTATION,
|
||||
K8S_NAMESPACE_ANNOTATION,
|
||||
ARGO_WORKFLOWS_NAMESPACE_ANNOTATION,
|
||||
} from '../plugin';
|
||||
|
||||
|
@ -19,7 +20,14 @@ export type getAnnotationValuesOutput = {
|
|||
};
|
||||
|
||||
export function getAnnotationValues(entity: Entity): getAnnotationValuesOutput {
|
||||
const ns = entity.metadata.annotations?.[ARGO_WORKFLOWS_NAMESPACE_ANNOTATION];
|
||||
let ns = entity.metadata.annotations?.[ARGO_WORKFLOWS_NAMESPACE_ANNOTATION];
|
||||
if (
|
||||
entity.metadata.annotations?.[ARGO_WORKFLOWS_NAMESPACE_ANNOTATION] ===
|
||||
undefined &&
|
||||
entity.metadata.annotations?.[K8S_NAMESPACE_ANNOTATION] !== undefined
|
||||
) {
|
||||
ns = entity.metadata.annotations?.[K8S_NAMESPACE_ANNOTATION];
|
||||
}
|
||||
const clusterName = entity.metadata.annotations?.[CLUSTER_NAME_ANNOTATION];
|
||||
const labelSelector =
|
||||
entity.metadata?.annotations?.[ARGO_WORKFLOWS_LABEL_SELECTOR_ANNOTATION];
|
||||
|
|
|
@ -12,6 +12,7 @@ import { ArgoWorkflows, argoWorkflowsApiRef } from './api';
|
|||
import { kubernetesApiRef } from '@backstage/plugin-kubernetes';
|
||||
|
||||
export const CLUSTER_NAME_ANNOTATION = 'argo-workflows.cnoe.io/cluster-name';
|
||||
export const K8S_NAMESPACE_ANNOTATION = 'backstage.io/kubernetes-namespace';
|
||||
export const ARGO_WORKFLOWS_NAMESPACE_ANNOTATION =
|
||||
'argo-workflows.cnoe.io/namespace';
|
||||
export const ARGO_WORKFLOWS_LABEL_SELECTOR_ANNOTATION =
|
||||
|
|
Loading…
Reference in a new issue