Skip to content

Commit

Permalink
fix: urls grafana links for ovh (#151)
Browse files Browse the repository at this point in the history
* fix: urls

* fix: wip

* fix: wip
  • Loading branch information
devthejo authored Mar 18, 2024
1 parent 4b04c73 commit 16bf9a6
Showing 1 changed file with 49 additions and 6 deletions.
55 changes: 49 additions & 6 deletions packages/parse-manifests/src/tools.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
const GRAFANA_URL =
process.env.GRAFANA_URL || "https://grafana.fabrique.social.gouv.fr";
const DEFAULT_GRAFANA_URL =
process.env.PROVIDER === "ovh"
? "https://grafana-ovh.fabrique.social.gouv.fr"
: "https://grafana.fabrique.social.gouv.fr";

const DEFAULT_GRAFANA_WORKLOADS_D =
process.env.PROVIDER === "ovh"
? "a164a7f0339f99e89cea5cb47e9be617V2"
: "m_UCAGgIz";

const DEFAULT_GRAFANA_WORKLOADS_VAR_DATASOURCE =
process.env.PROVIDER === "ovh"
? "eb239be0-0ac2-41d5-9e1a-061f951a07a3"
: "default";

const DEFAULT_GRAFANA_PODS_D =
process.env.PROVIDER === "ovh"
? "a7df53d7-0696-4e00-821b-c56b66e5c20a"
: "dRAC0MRIz";

const DEFAULT_GRAFANA_PODS_VAR_DATASOURCE =
process.env.PROVIDER === "ovh" ? "P5DCFC7561CCDE821" : "default";

const GRAFANA_WORKLOADS_D =
process.env.GRAFANA_WORKLOADS_D ||
DEFAULT_GRAFANA_WORKLOADS_D;

const GRAFANA_WORKLOADS_VAR_DATASOURCE =
process.env.GRAFANA_WORKLOADS_VAR_DATASOURCE ||
DEFAULT_GRAFANA_WORKLOADS_VAR_DATASOURCE;

const GRAFANA_PODS_D = process.env.GRAFANA_PODS_D || DEFAULT_GRAFANA_PODS_D;

const GRAFANA_PODS_VAR_DATASOURCE =
process.env.GRAFANA_PODS_VAR_DATASOURCE ||
DEFAULT_GRAFANA_PODS_VAR_DATASOURCE;


const DEV_CLUSTER_NAME =
process.env.PROVIDER === "ovh" ? "ovh-dev" : "dev2";

const PROD_CLUSTER_NAME =
process.env.PROVIDER === "ovh" ? "ovh-prod" : "prod2";

const GRAFANA_URL = process.env.GRAFANA_URL || DEFAULT_GRAFANA_URL;

const RANCHER_URL =
process.env.RANCHER_URL || "https://rancher.fabrique.social.gouv.fr";
Expand All @@ -11,8 +54,8 @@ export const getGrafanaLogsUrl = (parsed) => {

export const getGrafanaPodsUrl = (parsed) => {
const namespace = parsed.namespace;
const cluster = parsed.isProduction ? "prod2" : "dev2";
return `${GRAFANA_URL}/d/dRAC0MRIz/kubernetes-compute-resources-namespace-pods?orgId=1&refresh=10s&var-datasource=default&var-cluster=${cluster}&var-namespace=${namespace}`;
const cluster = parsed.isProduction ? PROD_CLUSTER_NAME : DEV_CLUSTER_NAME;
return `${GRAFANA_URL}/d/${GRAFANA_PODS_D}/kubernetes-compute-resources-namespace-pods?orgId=1&refresh=10s&var-datasource=${GRAFANA_PODS_VAR_DATASOURCE}&var-cluster=${cluster}&var-namespace=${namespace}`;
};

export const getGrafanaCnpgUrls = (parsed) => {
Expand All @@ -30,8 +73,8 @@ export const getGrafanaCnpgUrls = (parsed) => {

export const getGrafanaWorkloadsUrl = (parsed) => {
const namespace = parsed.namespace;
const cluster = parsed.isProduction ? "prod2" : "dev2";
return `${GRAFANA_URL}/d/m_UCAGgIz/kubernetes-compute-resources-namespace-workloads?orgId=1&refresh=10s&var-datasource=default&var-cluster=${cluster}&var-namespace=${namespace}&var-type=deployment`;
const cluster = parsed.isProduction ? PROD_CLUSTER_NAME : DEV_CLUSTER_NAME;
return `${GRAFANA_URL}/d/${GRAFANA_WORKLOADS_D}/kubernetes-compute-resources-namespace-workloads?orgId=1&refresh=10s&var-datasource=${GRAFANA_WORKLOADS_VAR_DATASOURCE}&var-cluster=${cluster}&var-namespace=${namespace}&var-type=deployment`;
};

export const getRancherUrls = (parsed) => {
Expand Down

0 comments on commit 16bf9a6

Please sign in to comment.