NetApp Trident Documentation

repository·master·Indexed 21 days ago

https://github.com/netapp/trident

An open-source Kubernetes storage orchestrator that provides dynamic provisioning and management of NetApp storage resources using the Container Storage Interface (CSI). It supports ONTAP, Element, Azure NetApp Files, Google Cloud NetApp Volumes, and Amazon FSx for ONTAP, enabling workflows such as snapshots, backups, replication, and disaster recovery.

Tokens
9.3K
Snippets
21
Records
50
Agent score
74%

What's inside NetApp Trident

  1. Overview of NetApp Trident

    master

    NetApp Trident is an open-source storage orchestrator designed for Kubernetes. It provides dynamic storage orchestration services by leveraging industry-standard interfaces like the Container Storage Interface (CSI).

    Trident deploys as pods within Kubernetes clusters and enables containerized applications to consume persistent storage from various NetApp products, including:

    • ONTAP (AFF, FAS, Select, and Cloud)
    • Element (HCI, SolidFire)
    • Azure NetApp Files
    • Google Cloud NetApp Volumes
    • Amazon FSx for ONTAP

    Beyond provisioning, Trident supports data management workflows such as snapshots, backups, replication, cloning, data protection, disaster recovery, and migration for Kubernetes workloads.

  2. What is syswrap and why is it used

    master
    In Go, system calls (syscalls) that become blocked (e.g., calling lstat on an inaccessible NFS mount) cannot be cleaned up and can lead to resource exhaustion. syswrap is a utility designed to wrap these syscalls with timeouts by executing them in a separate process. Because Linux cleans up syscalls when the owning process ends, syswrap allows Trident to bound the execution time of potentially blocking calls without blocking the main application's goroutines.
  3. Build the Trident Docker Plugin Filesystem

    master

    To build the filesystem specifically for the Docker plugin, navigate to the plugin directory and use the provided Makefile.

    Requirements:

    • Completed the standard BUILD process.
    • Docker 1.10 or greater.
    • The trident repository should be checked out into $GOPATH/src/github.com/netapp/.
    cd contrib/docker/plugin
    make
  4. Requirements for building Trident

    master

    Depending on your build target, you will need different tools:

    Single-Platform (Linux)

    • A Docker-compatible container CLI (e.g., nerdctl or docker).
    • Make (required if not building natively or with linker flags).
    • Go 1.25 or greater (optional, for native builds).

    Multi-Platform

    • Make.
    • Docker.
    • Go 1.25 or greater (optional, for native builds).
    • jq.
  5. Use the role-creator.py script to automate ONTAP role creation

    master

    The role-creator.py script automates the creation of custom roles on ONTAP via Python.

    Prerequisites:

    1. Copy the commands/APIs from the raw folder to the script's location.
    2. Install dependencies using pip install -r requirements.txt.

    Customization: By default, the script creates a role named trident at the cluster level. To customize this, use the --role-name and --vserver-name options.

    Usage: Provide the host IP, credentials, and specify whether to use --zapi or --rest.

    pip install -r requirements.txt
    python role-creator.py -i <host-ip> -u <username> -p <password> --zapi/--rest
  6. Create ONTAP roles using CLI Pastable commands

    master

    You can manually create custom roles in ONTAP by copy-pasting pre-formatted CLI commands.

    • For ZAPI-based roles: Use the commands in cli_pastable/zapi_custom_role_output.txt.
    • For REST-based roles: Use the commands in cli_pastable/rest_custom_role_output.txt.

    Note: By default, these files generate a role named trident at the cluster level. To change the role name or target a specific SVM (Vserver), use the role-generator.sh bash script instead.

  7. Use the role-generator.sh bash script to customize ONTAP roles

    master

    The role-generator.sh script allows you to create roles with a custom name or at the SVM (Vserver) level.

    Prerequisites: Ensure you have copied the commands/APIs from the raw folder to the same location where you run the script, or provide the correct path to the script.

    Usage: Run the script with the -r flag for the role name, -v for the vserver name, and either --zapi or --rest to specify the API type.

    ./role-generator.sh -r <role-name> -v <vserver-name> --zapi/--rest
  8. Regenerate ONTAP REST API Golang bindings

    master

    The Golang bindings for the ONTAP REST API are autogenerated using go-swagger. If you need to regenerate these bindings, you must have the swagger command installed (see https://goswagger.io/install.html).

    For debugging purposes, you can use a preprocessing pipeline that converts the source YAML to JSON before running the regeneration script. This can provide better insights into how go-swagger is interpreting the API definitions.

    # Standard regeneration
    ./regen
    
    # Debugging regeneration (converts YAML to JSON first)
    ./preprocess.py && ./convert_yaml_to_json.py && ./regen
  9. How to add a new syscall to syswrap

    master

    To extend syswrap with support for a new syscall, follow these three steps:

    1. Implement the wrapper in internal/syswrap: Add a function to this package that calls the syswrap binary. This function should also include a fallback to call the syscall directly if the syswrap binary is not found.
    2. Implement the syscall logic in internal/syswrap/unix: Add a function to this package with the following signature: func(args []string) (output interface{}, err error) This function is responsible for parsing the string arguments and executing the actual syscall. Note that any fields in the output struct that Trident needs to access must be exported.
    3. Register the syscall: Add the new function name to the syscalls map located in cmd/syswrap/main.syscalls.