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 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.