server

package
v0.0.0-...-400b19d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMultipleRows = fmt.Errorf("more than one row returned in query result")

Functions

func Delete

func Delete(serveOpts Config, args []string) error

func FetchChartDetailFromOciUrl

func FetchChartDetailFromOciUrl(chartTarballURL string, userAgent string, authz string, netClient *http.Client) (map[string]string, error)

Fetches helm chart details from an OCI url

func GetUserAgent

func GetUserAgent(version, userAgentComment string) string

Returns the user agent to be used during calls to the chart repositories Examples: asset-syncer/devel asset-syncer/1.0 asset-syncer/1.0 (foo v1.0-beta4) More info here https://github.com/vmware-tanzu/kubeapps/issues/767#issuecomment-436835938

func InvalidateCache

func InvalidateCache(serveOpts Config, args []string) error

func Sync

func Sync(serveOpts Config, version string, args []string) error

Types

type ChartCatalog

type ChartCatalog interface {
	Checksum(ctx context.Context) (string, error)
	AppRepository() *models.AppRepositoryInternal
	Charts(ctx context.Context, fetchLatestOnly bool, charts chan pullChartResult) ([]string, error)
	FetchFiles(cv models.ChartVersion, userAgent string, passCredentials bool) (map[string]string, error)
	Filters() *apprepov1alpha1.FilterRuleSpec
}

ChartCatalog defines the methods to retrieve information from the given repository

type Config

type Config struct {
	DatabaseURL              string
	DatabaseName             string
	DatabaseUser             string
	DatabasePassword         string
	Debug                    bool
	Namespace                string
	OciRepositories          []string
	TlsInsecureSkipVerify    bool
	FilterRules              string
	PassCredentials          bool
	UserAgent                string
	UserAgentComment         string
	GlobalPackagingNamespace string
	KubeappsNamespace        string
	AuthorizationHeader      string
	DockerConfigJson         string
	OCICatalogURL            string
}

type HelmRepo

type HelmRepo struct {
	*models.AppRepositoryInternal
	// contains filtered or unexported fields
}

HelmRepo implements the ChartCatalog interface for chartmuseum-like repositories

func (*HelmRepo) AppRepository

func (r *HelmRepo) AppRepository() *models.AppRepositoryInternal

AppRepository returns the repo information

func (*HelmRepo) Charts

func (r *HelmRepo) Charts(ctx context.Context, fetchLatestOnly bool, chartResults chan pullChartResult) ([]string, error)

Charts retrieve the list of charts exposed in the repo

func (*HelmRepo) Checksum

func (r *HelmRepo) Checksum(ctx context.Context) (string, error)

Checksum returns the sha256 of the repo

func (*HelmRepo) FetchFiles

func (r *HelmRepo) FetchFiles(cv models.ChartVersion, userAgent string, passCredentials bool) (map[string]string, error)

FetchFiles retrieves the important files of a chart and version from the repo

func (*HelmRepo) Filters

func (r *HelmRepo) Filters() *apprepov1alpha1.FilterRuleSpec

type OCILayer

type OCILayer struct {
	MediaType string `json:"mediaType"`
	Digest    string `json:"digest"`
	Size      int    `json:"size"`
}

OCILayer represents a single OCI layer

type OCIManifest

type OCIManifest struct {
	Schema int        `json:"schema"`
	Config OCILayer   `json:"config"`
	Layers []OCILayer `json:"layers"`
}

OCIManifest representation

type OCIRegistry

type OCIRegistry struct {
	*models.AppRepositoryInternal
	// contains filtered or unexported fields
}

OCIRegistry implements the Repo interface for OCI repositories

func (*OCIRegistry) AppRepository

func (r *OCIRegistry) AppRepository() *models.AppRepositoryInternal

AppRepository returns the repo information

func (*OCIRegistry) Charts

func (r *OCIRegistry) Charts(ctx context.Context, fetchLatestOnly bool, chartResults chan pullChartResult) ([]string, error)

Charts retrieve the list of actual charts needing syncing in the repo.

func (*OCIRegistry) Checksum

func (r *OCIRegistry) Checksum(ctx context.Context) (string, error)

Checksum returns a random sha256 so that the OCI sync will always be performed. This is because we check each app individually whether it has any versions that need syncing.

func (*OCIRegistry) FetchFiles

func (r *OCIRegistry) FetchFiles(cv models.ChartVersion, userAgent string, passCredentials bool) (map[string]string, error)

FetchFiles do nothing for the OCI case since they have been already fetched in the Charts() method

func (*OCIRegistry) Filters

type OciAPIClient

type OciAPIClient struct {
	RegistryNamespaceUrl *url.URL
	// The HttpClient is used for all http requests to the OCI Distribution
	// spec API.
	HttpClient *http.Client
	// The GrpcClient is used when querying our OCI Catalog service, which
	// aims to work around some of the shortfalls of the OCI Distribution spec
	// API
	GrpcClient          ocicatalog.OCICatalogServiceClient
	AuthorizationHeader string
}

OciAPIClient enables basic interactions with an OCI registry using (for now) a combination of the gRPC OCI catalog service and the http distribution spec API.

func (*OciAPIClient) Catalog

func (o *OciAPIClient) Catalog(ctx context.Context, userAgent string) ([]string, error)

Catalog returns the list of repositories in the (namespaced) registry when discoverable.

func (*OciAPIClient) CatalogAvailable

func (o *OciAPIClient) CatalogAvailable(ctx context.Context, userAgent string) (bool, error)

CatalogAvailable returns whether Kubeapps can return a catalog for this OCI repository.

Currently this checks only for a VMware Application Catalog index as documented at: https://docs.vmware.com/en/VMware-Application-Catalog/services/main/GUID-using-consume-metadata.html#method-2-obtain-metadata-from-the-oci-registry-10 although examples have "chart-index" rather than "index" as the artifact name.

func (*OciAPIClient) IsHelmChart

func (o *OciAPIClient) IsHelmChart(appName, tag, userAgent string) (bool, error)

func (*OciAPIClient) TagList

func (o *OciAPIClient) TagList(appName string, userAgent string) (*TagList, error)

TagList retrieves the list of tags for an asset

type TagList

type TagList struct {
	Name string   `json:"name"`
	Tags []string `json:"tags"`
}

TagList represents a list of tags as specified at https://github.com/opencontainers/distribution-spec/blob/main/spec.md#content-discovery

type VACCatalog

type VACCatalog struct {
	APIVersion string         `json:"apiVersion"`
	Entries    map[string]any `json:"entries"`
}

VACCatalog representation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址