plugin-barman-cloud/web/src/components/Installation/index.tsx
Krypton 6f712151df
docs: add Helm chart installation (#599)
Add Helm chart install steps next to kubectl, for the current docs and
the 0.13.0 and 0.14.0 versioned snapshots.

Pin the chart's image tag to the plugin version on older releases. The
chart ships after the plugin, so its own version numbers don't map to
ours, and we skip the pin on the latest release since the chart already
defaults to itself there.

On the current docs, make clear the Helm tab installs the latest
release, not a main-branch build. Only kubectl can test a main-branch
build.

Closes #351

Signed-off-by: Krypton <root@krypton.ninja>
Signed-off-by: danishedb <danish.khan@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: danishedb <danish.khan@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2026-09-03 17:35:45 +02:00

61 lines
2.6 KiB
TypeScript

import {ReactElement} from 'react';
import CodeBlock from '@theme/CodeBlock';
import Link from '@docusaurus/Link';
import {useLocation} from '@docusaurus/router';
import {useActiveVersion} from '@docusaurus/plugin-content-docs/client';
// DEV_MANIFEST_URL is the URL of the manifest.yaml on the main branch of the plugin repo.
const DEV_MANIFEST_URL =
'https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/refs/heads/main/manifest.yaml';
// InstallationSnippet is the kubectl incantation to install the Barman
// Cloud Plugin: the manifest matching the doc version being viewed, or
// (on the unreleased "current" docs) the latest manifest on main.
export function InstallationSnippet(): ReactElement<null> {
const activeVersion = useActiveVersion('default');
const url = activeVersion && activeVersion.name !== 'current'
? `https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/v${activeVersion.name}/manifest.yaml`
: DEV_MANIFEST_URL;
return (
<CodeBlock language="sh">
{`kubectl apply -f \\
${url}`}
</CodeBlock>
);
}
// ManifestVersion names the manifest the snippet below installs: the
// release tag for a versioned docs page, or the main branch on Dev docs.
export function ManifestVersion(): ReactElement<null> {
const activeVersion = useActiveVersion('default');
return activeVersion && activeVersion.name !== 'current'
? <code>v{activeVersion.name}</code>
: <>the latest development snapshot from the <code>main</code> branch</>;
}
// DevSnapshotSection shows how to test the main-branch manifest. On
// the Dev docs, the kubectl install above already does that, so we
// hide this section there. (The Helm tab there installs the latest
// release, not a dev build.)
export function DevSnapshotSection(): ReactElement {
const activeVersion = useActiveVersion('default');
const {pathname} = useLocation();
if (!activeVersion || activeVersion.name === 'current') {
return (
<p>The <Link to={`${pathname}?install-method=kubectl#installing-the-barman-cloud-plugin`}>kubectl
install command above</Link> already applies the latest development
snapshot from the <code>main</code> branch.</p>
);
}
return (
<>
<p>You can also test the latest development snapshot of the plugin
with the following command:</p>
<CodeBlock language="sh">
{`kubectl apply -f \\
${DEV_MANIFEST_URL}`}
</CodeBlock>
</>
);
}