Documentation
¶
Index ¶
- Constants
- Variables
- func BundleDeploymentProvisionerFilter(provisionerClassName string) predicate.Predicate
- func CreateOrRecreate(ctx context.Context, cl client.Client, obj client.Object, ...) (controllerutil.OperationResult, error)
- func DeepHashObject(obj interface{}) (string, error)
- func EnsureBaseDirFS(fsys fs.FS, defaultBaseDir string) (fs.FS, error)
- func FSToTarGZ(w io.Writer, fsys fs.FS) error
- func GenerateBundleName(bdName, hash string) string
- func LoadCertPool(certFile string) (*x509.CertPool, error)
- func ManifestObjects(r io.Reader, name string) ([]client.Object, error)
- func MapConfigMapToBundleDeployment(ctx context.Context, cl client.Client, cmNamespace string, cm corev1.ConfigMap) []*rukpakv1alpha2.BundleDeployment
- func MapConfigMapToBundleDeploymentHandler(cl client.Client, configMapNamespace string, provisionerClassName string) handler.EventHandler
- func MapOwneeToOwnerProvisionerHandler(cl client.Client, log logr.Logger, provisionerClassName string, ...) handler.EventHandler
- func MergeMaps(maps ...map[string]string) map[string]string
- func NewBundleDeploymentLabelSelector(bd *rukpakv1alpha2.BundleDeployment) labels.Selector
- func PodNamespace() string
- type FilesOnlyFilesystem
- type ProvisionerClassNameGetter
Constants ¶
const ( DefaultSystemNamespace = "rukpak-system" DefaultUnpackImage = "quay.io/operator-framework/rukpak:main" )
const ( CoreOwnerKindKey = "core.rukpak.io/owner-kind" CoreOwnerNameKey = "core.rukpak.io/owner-name" )
Variables ¶
var ( // ErrMaxGeneratedLimit is the error returned by the BundleDeployment controller // when the configured maximum number of Bundles that match a label selector // has been reached. ErrMaxGeneratedLimit = errors.New("reached the maximum generated Bundle limit") )
Functions ¶
func CreateOrRecreate ¶
func CreateOrRecreate(ctx context.Context, cl client.Client, obj client.Object, f controllerutil.MutateFn) (controllerutil.OperationResult, error)
func DeepHashObject ¶
DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.
func EnsureBaseDirFS ¶
EnsureBaseDirFS ensures that an fs.FS contains a single directory in its root This is useful for bundle formats that require a base directory in the root of the bundle.
For example, an unpacked Helm chart might have <chartDir>/Chart.yaml, and we'd typically assume <chartDir> as the bundle root. However, when helm archives contain <chartDir> at the root of the archive: <archiveRoot>/<chartDir>/Chart.yaml.
If the fs.FS already has this structure, EnsureBaseDirFS just returns fsys directly. Otherwise, it returns a new fs.FS where the defaultBaseDir is inserted at the root, such that fsys appears within defaultBaseDir.
func FSToTarGZ ¶
FSToTarGZ writes the filesystem represented by fsys to w as a gzipped tar archive. This function unsets user and group information in the tar archive so that readers of archives produced by this function do not need to account for differences in permissions between source and destination filesystems.
func GenerateBundleName ¶
func MapConfigMapToBundleDeployment ¶
func MapConfigMapToBundleDeployment(ctx context.Context, cl client.Client, cmNamespace string, cm corev1.ConfigMap) []*rukpakv1alpha2.BundleDeployment
func MapOwneeToOwnerProvisionerHandler ¶
func MapOwneeToOwnerProvisionerHandler(cl client.Client, log logr.Logger, provisionerClassName string, owner ProvisionerClassNameGetter) handler.EventHandler
MapOwneeToOwnerProvisionerHandler is a handler implementation that finds an owner reference in the event object that references the provided owner. If a reference for the provided owner is found AND that owner's provisioner class name matches the provided provisionerClassName, this handler enqueues a request for that owner to be reconciled.
func NewBundleDeploymentLabelSelector ¶
func NewBundleDeploymentLabelSelector(bd *rukpakv1alpha2.BundleDeployment) labels.Selector
NewBundleDeploymentLabelSelector is responsible for constructing a label.Selector for any underlying resources that are associated with the BundleDeployment parameter.
func PodNamespace ¶
func PodNamespace() string
PodNamespace checks whether the controller is running in a Pod vs. being run locally by inspecting the namespace file that gets mounted automatically for Pods at runtime. If that file doesn't exist, then return DefaultSystemNamespace.
Types ¶
type FilesOnlyFilesystem ¶
FilesOnlyFilesystem is an fs.FS implementation that treats non-regular files (e.g. directories, symlinks, devices, etc.) as non-existent. The reason for this is so that we only serve bundle files.
This treats directories as not found so that the http server does not serve HTML directory index responses.
This treats other symlink files as not found so that we prevent HTTP requests from escaping the filesystem root.
Lastly, this treats other non-regular files as not found because they are out of scope for serving bundle contents.