reposerver

package
v0.2.0-experimental-v2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a gRPC client for the Argo CD repo server. It manages an optional port-forward to the repo server so that the caller does not need to worry about cluster networking.

func NewClient

func NewClient(k8sClient *k8s.Client, namespace string) *Client

NewClient creates a new repo server Client that port-forwards to the Argo CD repo server running inside the cluster.

namespace is the Kubernetes namespace where Argo CD is installed. k8sClient is used to establish the port-forward.

func NewClientWithAddress

func NewClientWithAddress(address string, disableTLS bool, insecureSkipVerify bool) *Client

NewClientWithAddress creates a Client that connects directly to the given address without setting up a port-forward. Useful when the repo server is reachable from the current host (e.g. inside the cluster, or an already-established tunnel).

func (*Client) Cleanup

func (c *Client) Cleanup()

Cleanup stops the port-forward if one was started by this client.

func (*Client) EnsurePortForward

func (c *Client) EnsurePortForward() error

EnsurePortForward starts a port-forward to the Argo CD repo server if one is not already running. It is idempotent and safe to call concurrently.

func (*Client) GenerateManifests

func (c *Client) GenerateManifests(ctx context.Context, appDir string, request *repoapiclient.ManifestRequest) ([]string, error)

GenerateManifests renders Kubernetes manifests for the given application source by streaming the source files to the Argo CD repo server via the GenerateManifestWithFiles gRPC endpoint.

appDir is the local directory that contains the rendered/checked-out source files to stream. It must exist and be readable. The directory is compressed into a .tar.gz archive and streamed chunk-by-chunk to the repo server.

request is a fully-populated ManifestRequest that describes the application, its source, cluster API versions, Helm settings, etc.

Returns the list of rendered manifest strings (one per Kubernetes resource, serialised as JSON by the repo server).

Transient gRPC Unavailable errors (e.g. EOF on the kubectl port-forward tunnel under high concurrency) are retried with exponential back-off up to maxGenerateRetries times before the error is propagated to the caller.

func (*Client) GenerateManifestsForApp

func (c *Client) GenerateManifestsForApp(
	ctx context.Context,
	appDir string,
	app *v1alpha1.Application,
	appLabelKey string,
	kubeVersion string,
	apiVersions []string,
) ([]string, error)

GenerateManifestsForApp is a higher-level helper that compresses the given appDir and sends it to the repo server. It constructs a minimal ManifestRequest from the provided Application object.

This is intentionally kept simple – callers that need fine-grained control over Helm repos, API versions, project settings, etc. should build the ManifestRequest themselves and call GenerateManifests directly.

func (*Client) GenerateManifestsRemote

func (c *Client) GenerateManifestsRemote(ctx context.Context, request *repoapiclient.ManifestRequest) ([]string, error)

GenerateManifestsRemote renders manifests for an application whose source lives on a remote server (e.g. an external Helm chart registry). Unlike GenerateManifests, no local files are streamed; the repo server fetches the chart directly from the registry using the RepoURL / TargetRevision / Chart fields in the ManifestRequest.

This method uses the unary GenerateManifest RPC (not the streaming GenerateManifestWithFiles RPC).

Transient gRPC Unavailable errors are retried with the same exponential back-off as GenerateManifests.

Jump to

Keyboard shortcuts

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