8000 GitHub - longhorn/cli: Longhorn CLI is a headless way for preflighting, operating and troubleshooting Longhorn cluster. · GitHub
[go: up one dir, main page]

Skip to content
longhornPublic

About

Longhorn CLI is a headless way for preflighting, operating and troubleshooting Longhorn cluster.

Resources

Stars

42 stars

Watchers

8 watching

Forks

Repository files navigation

Longhorn Commandline Interface (longhornctl)

This repository contains the source code for longhornctl, a CLI (command-line interface) designed to simplify Longhorn manual operations.

What Can You Do With longhornctl?

  • Install and verify prelight requirements.
  • Execute one-time Longhorn operations.
  • Gain insight into your Longhorn system.
  • Diagnose the health of your Longhorn system.

Usage

For detailed usage information and examples, please refer to the document run longhornctl --help.

You can obtain longhornctl either through downloading a prebuilt binary or by building it from source.

Prebuilt Binary

  1. Remove any previous longhornctl installation.

    rm -rf /usr/local/bin/longhornctl
    
  2. Download the command-line tool release suitable for your operating system and machine architecture from the GitHub release page.

    curl -L https://github.com/longhorn/cli/releases/download/${LonghornVersion}/longhornctl-${OS}-${ARCH} -o longhornctl
    chmod +x longhornctl
    mv ./longhornctl /usr/local/bin/longhornctl
    
  3. Verify that you've installed

    longhornctl version
    

Build From Source

  1. Clone repository
    git clone https://github.com/longhorn/cli.git
  2. Build the longhornctl binary
    cd cli
    make

    Note: This process will generate two binaries:

    • longhornctl: A command-line interface for remote Longhorn operations, designed to be run outside the Kubernetes cluster. It executes longhornctl-local for operations within the cluster.
    • longhornctl-local: A command-line interface to be used within a DaemonSet pod inside the Kubernetes cluster, handling in-cluster and host operations.

Container Image Signing

The longhornio/longhorn-cli images are signed by the build workflow with Cosign keyless signing: right after an image is pushed, the digest of its multi-arch image index is signed using the GitHub Actions OIDC identity of the workflow, and the signature is stored in the registry and recorded in the Rekor transparency log. Release images and branch builds (master and v* branches, published as <branch>-head) are signed; images published before signing was introduced are not.

Verify an image with cosign v3.1.0 or later. The exact identity ties the signature to the release you expect, so an image signed for another tag is rejected:

cosign verify docker.io/longhornio/longhorn-cli:${LonghornVersion} \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  --certificate-identity "https://github.com/longhorn/cli/.github/workflows/build.yml@refs/tags/${LonghornVersion}"

For a branch build, use the branch ref in the identity, such as build.yml@refs/heads/master for master-head.

Only the multi-arch image index is signed: verify an image by its tag or index digest, not by the digest of a single-platform manifest.

A mirrored image, such as docker.io/rancher/mirrored-longhornio-longhorn-cli, keeps the same digest. If its signature was not mirrored with it, read the signature from the original repository:

COSIGN_REPOSITORY=docker.io/longhornio/longhorn-cli cosign verify <mirrored-image> ...

To mirror an image together with its signature, copy its OCI referrers as well, for example with regctl image copy --referrers.

About

Longhorn CLI is a headless way for preflighting, operating and troubleshooting Longhorn cluster.

Resources

Stars

42 stars

Watchers

8 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0