From d39aecc1a81f6959dec479478d0afeef22ef5745 Mon Sep 17 00:00:00 2001 From: Remi Date: Mon, 8 Feb 2021 18:09:53 +0100 Subject: [PATCH] fix(splunk-on-call-plugin): remove from sample app --- .changeset/itchy-camels-grin.md | 1 - app-config.yaml | 12 +---- .../backstage/templates/backend-secret.yaml | 2 - contrib/chart/backstage/values.yaml | 2 - microsite/data/plugins/splunk-on-call.yaml | 5 ++- .../app/src/components/catalog/EntityPage.tsx | 4 -- packages/app/src/plugins.ts | 1 - plugins/splunk-on-call/README.md | 44 +++++++++++++++++-- 8 files changed, 44 insertions(+), 27 deletions(-) diff --git a/.changeset/itchy-camels-grin.md b/.changeset/itchy-camels-grin.md index 0c561b4b53..eac3c6a102 100644 --- a/.changeset/itchy-camels-grin.md +++ b/.changeset/itchy-camels-grin.md @@ -1,5 +1,4 @@ --- -'@backstage/plugin-catalog': patch '@backstage/plugin-splunk-on-call': patch --- diff --git a/app-config.yaml b/app-config.yaml index 7cc194d06b..9df6540a2c 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -12,7 +12,7 @@ backend: connection: ':memory:' cors: origin: http://localhost:3000 - methods: [GET, POST, PUT, DELETE, PATCH] + methods: [GET, POST, PUT, DELETE] credentials: true csp: connect-src: ["'self'", 'http:', 'https:'] @@ -30,14 +30,6 @@ proxy: Circle-Token: $env: CIRCLECI_AUTH_TOKEN - '/splunk-on-call': - target: https://api.victorops.com/api-public - headers: - X-VO-Api-Id: - $env: SPLUNK_ON_CALL_API_ID - X-VO-Api-Key: - $env: SPLUNK_ON_CALL_API_KEY - '/jenkins/api': target: http://localhost:8080 headers: @@ -394,5 +386,3 @@ homepage: timezone: 'Asia/Tokyo' pagerduty: eventsBaseUrl: 'https://events.pagerduty.com/v2' -splunkOnCall: - username: 'guest' diff --git a/contrib/chart/backstage/templates/backend-secret.yaml b/contrib/chart/backstage/templates/backend-secret.yaml index 95763859ef..299d893ec4 100644 --- a/contrib/chart/backstage/templates/backend-secret.yaml +++ b/contrib/chart/backstage/templates/backend-secret.yaml @@ -21,6 +21,4 @@ stringData: NEW_RELIC_REST_API_KEY: {{ .Values.auth.newRelicRestApiKey }} TRAVISCI_AUTH_TOKEN: {{ .Values.auth.travisciAuthToken }} PAGERDUTY_TOKEN: {{ .Values.auth.pagerdutyToken }} - SPLUNK_ON_CALL_API_ID: {{ .Values.auth.splunkOnCallApiId }} - SPLUNK_ON_CALL_API_KEY: {{ .Values.auth.splunkOnCallApiKey }} {{- end }} diff --git a/contrib/chart/backstage/values.yaml b/contrib/chart/backstage/values.yaml index dfc25ee0c2..261f352f93 100644 --- a/contrib/chart/backstage/values.yaml +++ b/contrib/chart/backstage/values.yaml @@ -251,5 +251,3 @@ auth: newRelicRestApiKey: r travisciAuthToken: fake-travis-ci-auth-token pagerdutyToken: h - splunkOnCallApiId: h - splunkOnCallApiKey: h diff --git a/microsite/data/plugins/splunk-on-call.yaml b/microsite/data/plugins/splunk-on-call.yaml index fb32293e31..2d6deb0180 100644 --- a/microsite/data/plugins/splunk-on-call.yaml +++ b/microsite/data/plugins/splunk-on-call.yaml @@ -1,9 +1,9 @@ --- -title: SplunkOnCall +title: Splunk On-Call author: Spotify authorUrl: https://github.com/spotify category: Monitoring -description: SplunkOnCall offers a simple way to identify incidents and escalation policies. +description: Splunk On-Call offers a simple way to identify incidents and escalation policies. documentation: https://github.com/backstage/backstage/tree/master/plugins/splunk-on-call iconUrl: data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIiBjbGFzcz0idm8tbGVhZi1ibGFjayI+PHBhdGggZD0iTTE1Ljk5OTcgMzJDMjQuODM2MSAzMiAzMiAyNC44MzY4IDMyIDE2LjAwMDJDMzIgNy4xNjM1NiAyNC44MzYxIDAgMTUuOTk5NyAwQzcuMTYzNCAwIDAgNy4xNjM1NiAwIDE2LjAwMDJDMCA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- errors - alerting + - splunk diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx index 0322e86abd..e849667c19 100644 --- a/packages/app/src/components/catalog/EntityPage.tsx +++ b/packages/app/src/components/catalog/EntityPage.tsx @@ -92,10 +92,6 @@ import { PullRequestsStatsCard, Router as PullRequestsRouter, } from '@roadiehq/backstage-plugin-github-pull-requests'; -import { - isPluginApplicableToEntity as isSplunkOnCallAvailable, - SplunkOnCallCard, -} from '@backstage/plugin-splunk-on-call'; import { isPluginApplicableToEntity as isTravisCIAvailable, RecentTravisCIBuildsWidget, diff --git a/packages/app/src/plugins.ts b/packages/app/src/plugins.ts index b956eaefe4..c62c0435a2 100644 --- a/packages/app/src/plugins.ts +++ b/packages/app/src/plugins.ts @@ -43,4 +43,3 @@ export { plugin as Buildkite } from '@roadiehq/backstage-plugin-buildkite'; export { plugin as Search } from '@backstage/plugin-search'; export { plugin as Org } from '@backstage/plugin-org'; export { plugin as Kafka } from '@backstage/plugin-kafka'; -export { plugin as SplunkOnCall } from '@backstage/plugin-splunk-on-call'; diff --git a/plugins/splunk-on-call/README.md b/plugins/splunk-on-call/README.md index 50fefb5255..5dc1e87809 100644 --- a/plugins/splunk-on-call/README.md +++ b/plugins/splunk-on-call/README.md @@ -2,7 +2,7 @@ ## Overview -This plugin displays Splunk On-Call information about an entity. +This plugin displays Splunk On-Call, formerly VictorOps, information about an entity. There is a way to trigger an new incident directly to specific users or/and specific teams. @@ -20,7 +20,7 @@ This plugin provides: Install the plugin: ```bash -yarn add @backstage/plugin-splunkoncall +yarn add @backstage/plugin-splunk-on-call ``` Add it to the app in `plugins.ts`: @@ -36,7 +36,7 @@ import { isPluginApplicableToEntity as isSplunkOnCallAvailable, SplunkOnCallCard, } from '@backstage/plugin-splunk-on-call'; -// add to code +// ... { isSplunkOnCallAvailable(entity) && ( @@ -60,9 +60,25 @@ splunkOnCall: The user supplied must be a valid Splunk On-Call user and a member of your organization. -In order to be able to make certain API calls you need to add the `PATCH` method to the backend cors methods list. +In order to make the API calls, you need to provide a new proxy config which will redirect to the Splunk On-Call API endpoint and add authentication information in the headers: ```yaml +# app-config.yaml +proxy: + # ... + '/splunk-on-call': + target: https://api.victorops.com/api-public + headers: + X-VO-Api-Id: + $env: SPLUNK_ON_CALL_API_ID + X-VO-Api-Key: + $env: SPLUNK_ON_CALL_API_KEY +``` + +In addition, to make certain API calls (trigger-resolve-acknowledge an incident) you need to add the `PATCH` method to the backend cors methods list. + +```yaml +# app-config.yaml backend: # ... cors: @@ -90,3 +106,23 @@ $ SPLUNK_ON_CALL_API_KEY='' SPLUNK_ON_CALL_API_ID='' yarn start ``` This will proxy the request by adding `X-VO-Api-Id` and `X-VO-Api-Key` headers with the provided values. + +You can also add the values in your helm template: + +```yaml +# backend-secret.yaml +stringData: + # ... + SPLUNK_ON_CALL_API_ID: { { .Values.auth.splunkOnCallApiId } } + SPLUNK_ON_CALL_API_KEY: { { .Values.auth.splunkOnCallApiKey } } +``` + +To enable it you need to provide them in the chart's values: + +```yaml +# values.yaml +auth: + # ... + splunkOnCallApiId: h + splunkOnCallApiKey: h +```