plugin-barman-cloud/web/src/components/HelmInstallation/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

37 lines
1.5 KiB
TypeScript

import {ReactElement} from 'react';
import CodeBlock from '@theme/CodeBlock';
import {useActiveVersion, useLatestVersion} from '@docusaurus/plugin-content-docs/client';
// HelmInstallationSnippet is the Helm command to install the plugin.
//
// - Latest release: no override. The chart already defaults to
// itself.
// - Older release: pin image.tag and sidecarImage.tag to that
// version. We check this again on every build using
// useLatestVersion, so an old page updates itself once a newer
// version ships.
// - Dev docs: also no override, but this does NOT install a dev
// build. Setting the tag alone would not be enough, since the
// chart's own templates (CRDs, RBAC...) can be older than what
// main needs. Use the kubectl method to test a dev build.
export function HelmInstallationSnippet(): ReactElement<null> {
const activeVersion = useActiveVersion('default');
const latestVersion = useLatestVersion('default');
const isOlderRelease = activeVersion
&& activeVersion.name !== 'current'
&& activeVersion.name !== latestVersion.name;
const setArgs = isOlderRelease
? ` \\
--set image.tag=v${activeVersion.name} \\
--set sidecarImage.tag=v${activeVersion.name}`
: '';
return (
<CodeBlock language="sh">
{`helm repo add cnpg https://cloudnative-pg.github.io/charts --force-update
helm upgrade --install plugin-barman-cloud \\
--namespace cnpg-system${setArgs} \\
cnpg/plugin-barman-cloud`}
</CodeBlock>
);
}