Onepanel Documentation

repository·master·Indexed 20 days ago

https://github.com/onepanelio/onepanel

An end-to-end computer vision platform for labeling, building, training, tuning, deploying, and automating computer vision models across cloud and on-premises environments. The documentation covers the Onepanel Core Helper for gRPC and database migrations, client initialization for Kubernetes and Argo Workflows, and storage client integration for Amazon S3 and Google Cloud Storage.

Tokens
1.5K
Snippets
8
Records
10
Agent score
73%

What's inside Onepanel

  1. Build the Onepanel Core Helper Docker image

    master

    The Onepanel Core Helper provides a Docker image used to assist with code generation for the onepanel-core project. Specifically, this image is used to generate gRPC-related files and create database migrations.

    To build the image locally, run the following command from the root of the helper directory:

    docker build -t onepanel/helper:v1.0.0 .
  2. Update Onepanel Core Helper dependencies

    master

    To update the dependencies for the Onepanel Core Helper, follow these steps to ensure go.mod and go.sum are correctly synchronized:

    1. Create a new temporary directory outside of the project.
    2. Copy the tools.go file from the helper directory into this new directory.
    3. Navigate to the new directory in your terminal.
    4. Initialize a new module and tidy the dependencies:
      go mod init onepanel-tools
      go mod tidy
    5. Copy the resulting go.mod and go.sum files from the temporary directory back into the Onepanel Core Helper directory.
    6. Re-run the build command to create the updated Docker image.
    go mod init onepanel-tools
    go mod tidy
  3. Generate release markdown with gen-release-md.go

    master

    Use the gen-release-md.go script to automatically generate markdown documentation for new releases. You must provide the version number and the GitHub username via command-line flags.

    go run cmd/gen-release-md/gen-release-md.go -v=0.10.0 -u=[github-username] > /tmp/release.md
  4. Get started with Onepanel

    master

    Onepanel is an end-to-end computer vision platform designed to label, build, train, tune, deploy, and automate computer vision workflows. It is a unified platform that can run on any cloud provider or on-premises infrastructure.

    To begin using the platform, follow the official Quick Start guide.

    See [quick start guide](https://docs.onepanel.ai/docs/getting-started/quickstart) to get started.
  5. Understand the Google API dependencies in Onepanel

    master

    Onepanel utilizes specific Google API definitions to support gRPC-Gateway functionality, which allows for RESTful HTTP interfaces over gRPC services. The project imports standard Google API proto files to enable features like HTTP annotations on gRPC methods.

    Imported Proto Files:

    • google/api/annotations.proto: Used for mapping gRPC services to HTTP paths and methods.
    • google/api/http.proto: Provides HTTP-specific definitions.
    • google/api/httpbody.proto: Used for handling HTTP request/response bodies.

    These dependencies are used to define how the Onepanel API can be consumed via standard HTTP/JSON requests.

  6. Retrieve Artifact Repository Information

    master

    You can query the type and source of the artifact repository configured for a specific namespace.

    • GetArtifactRepositoryType(namespace string): Returns either `
  7. Access Argo Workflows via the Client

    master

    The Onepanel Client embeds an Argo Workflows client. You can access the Argo API using the ArgoprojV1alpha1() method, which returns an argoprojv1alpha1.ArgoprojV1alpha1Interface compatible with the Argo project's client-go implementation.

    argoClient := client.ArgoprojV1alpha1()
    // Use argoClient to interact with Argo Workflows resources
  8. Initialize the Onepanel Client

    master

    The Client is the primary entry point for interacting with the Onepanel system. It provides unified access to Kubernetes, Argo Workflows, the Onepanel database, and system configurations.

    You can initialize it using several methods depending on your environment:

    1. GetDefaultClient(): Loads a default Kubernetes client using local kubeconfig, automatically fetches system configuration, and connects to the database.
    2. GetDefaultClientWithDB(db *DB): Loads a default Kubernetes client but uses an existing *DB instance provided by you.
    3. NewClient(config *Config, db *DB, systemConfig SystemConfig): A manual constructor for full control over the Kubernetes configuration, database connection, and system configuration.
    package v1
    
    import (
    	"github.com/onepanelio/onepanel/pkg/v1"
    	"k8s.io/client-go/rest"
    )
    
    // Example: Using the default client
    client, err := v1.GetDefaultClient()
    if err != nil {
    	panic(err)
    }
    
    // Example: Manual initialization
    // config is a *rest.Config
    client, err := v1.NewClient(config, myDB, mySystemConfig)
  9. Initialize S3 and GCS Storage Clients

    master

    The Client provides helper methods to initialize storage clients for artifact repositories based on the namespace configuration.

    Amazon S3

    Use GetS3Client for private access or GetPublicS3Client if the endpoint is publicly accessible. Both require an *ArtifactRepositoryS3Provider configuration.

    Google Cloud Storage (GCS)

    Use GetGCSClient which requires an *ArtifactRepositoryGCSProvider containing the ServiceAccountJSON.

    Note: These methods return clients from the github.com/onepanelio/core/pkg/util/s3 and gcs packages.

    // S3 Example
    s3Client, err := client.GetS3Client(namespace, s3Config)
    
    // GCS Example
    gcsClient, err := client.GetGCSClient(namespace, gcsConfig)