rukpakctl

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClusterCA

func GetClusterCA(ctx context.Context, cl client.Reader, secretKey types.NamespacedName) (*x509.CertPool, error)

GetClusterCA returns an x509.CertPool by reading the contents of a Kubernetes Secret. It uses the provided client to get the requested secret and then loads the contents of the secret's "ca.crt" key into the cert pool.

Types

type BundleUploader

type BundleUploader struct {
	UploadServiceName      string
	UploadServiceNamespace string

	Cfg     *rest.Config
	RootCAs *x509.CertPool
}

BundleUploader uploads bundle filesystems to rukpak's upload service.

func (*BundleUploader) Upload

func (bu *BundleUploader) Upload(ctx context.Context, bundleName string, bundleFS fs.FS) (bool, error)

Upload uploads the contents of a bundle to the bundle upload service configured on the BundleUploader.

To perform the upload, Upload utilizes a Kubernetes API port-forward to forward a port from the uploader service to the local machine. Once the port has been forwarded, Upload uploads the bundleFS as the content for the bundle named by the provided bundleName.

Upload returns a boolean value indicating if the bundle content was modified on the server and an error value that will convey any errors that occurred during the upload.

Uploads of content that is identical to the existing bundle's content will not result in an error, which means this function is idempotent. Running this function multiple times with the same input does not result in any change to the cluster state after the initial upload.

type Run added in v0.9.0

type Run struct {
	Config *rest.Config

	SystemNamespace   string
	UploadServiceName string
	CASecretName      string
}

Run implements rukpakctl's `run` subcommand

func (*Run) Run added in v0.9.0

func (r *Run) Run(ctx context.Context, bundleDeploymentName string, bundle fs.FS, opts RunOptions) (bool, error)

Run runs the provided bundle using a bundle deployment with the given bundleDeploymentName. The RunOptions enable further configuration, such as the provisioner class names to use and an optional logger. By default, the plain provisioner for the bundle and bundle deployment. Run returns a boolean value indicating whether the bundle deployment was created or modified and an error value if any error occurs.

type RunOptions added in v0.9.0

type RunOptions struct {
	BundleDeploymentProvisionerClassName string
	BundleProvisionerClassName           string
	Log                                  func(format string, v ...interface{})
}

RunOptions define extra options used for Run.

type ServicePortForwarder

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

ServicePortForwarder forwards a port from a local port to a Kubernetes service.

func NewServicePortForwarder

func NewServicePortForwarder(cfg *rest.Config, service types.NamespacedName, port intstr.IntOrString) (*ServicePortForwarder, error)

NewServicePortForwarder creates a new ServicePortForwarder.

func (*ServicePortForwarder) LocalPort

func (pf *ServicePortForwarder) LocalPort(ctx context.Context) (uint16, error)

LocalPort returns the local port on which the port forward is listening. It automatically waits until the port forward is configured, so there is no need for callers to coordinate calls between Start and LocalPort (other than that Start must be called at some point for a local port to eventually become ready). If the provided context is closed prior to the local port becoming ready, LocalPort returns the context's error.

func (*ServicePortForwarder) Start

func (pf *ServicePortForwarder) Start(ctx context.Context) error

Start starts the port-forward defined by the ServicePortForwarder and blocks until the provided context is closed. When the provided context is closed, the forwarded port is also closed. This function opens a random local port, which can be discovered using the LocalPort method.

Jump to

Keyboard shortcuts

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