index

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package index defines field indexes for artifact CRDs.

Index

Constants

View Source
const (
	// ConfigMapOnRulesfile is the index field name for Rulesfile resources indexed by their ConfigMapRef.
	ConfigMapOnRulesfile = "ConfigMapOnRulesfile"
	// SecretOnRulesfile is the index field name for Rulesfile resources indexed by their SecretRef.
	SecretOnRulesfile = "SecretOnRulesfile"
)
View Source
const ConfigMapOnConfig = "ConfigMapOnConfig"

ConfigMapOnConfig is the index field name for Config resources indexed by their ConfigMapRef.

View Source
const SecretOnPlugin = "SecretOnPlugin"

SecretOnPlugin is the index field name for Plugin resources indexed by their SecretRef.

Variables

All aggregates all field indexes defined in this package.

View Source
var ConfigByConfigMapRef = IndexByConfigMapRef(
	func(c *artifactv1alpha1.Config) *commonv1alpha1.ConfigMapRef {
		return c.Spec.ConfigMapRef
	},
)

ConfigByConfigMapRef indexes Config resources by their .spec.configMapRef.name.

View Source
var ConfigIndexes = []Entry{
	{
		Object:         &artifactv1alpha1.Config{},
		Field:          ConfigMapOnConfig,
		ExtractValueFn: ConfigByConfigMapRef,
	},
}

ConfigIndexes holds all field indexes for Config resources.

View Source
var PluginBySecretRef = IndexBySecretRef(
	func(pl *artifactv1alpha1.Plugin) *commonv1alpha1.SecretRef {
		if pl.Spec.OCIArtifact == nil || pl.Spec.OCIArtifact.Registry == nil ||
			pl.Spec.OCIArtifact.Registry.Auth == nil {
			return nil
		}
		return pl.Spec.OCIArtifact.Registry.Auth.SecretRef
	},
)

PluginBySecretRef indexes Plugin resources by their .spec.ociArtifact.registry.auth.secretRef.name.

View Source
var PluginIndexes = []Entry{
	{
		Object:         &artifactv1alpha1.Plugin{},
		Field:          SecretOnPlugin,
		ExtractValueFn: PluginBySecretRef,
	},
}

PluginIndexes holds all field indexes for Plugin resources.

View Source
var RulesfileByConfigMapRef = IndexByConfigMapRef(
	func(rf *artifactv1alpha1.Rulesfile) *commonv1alpha1.ConfigMapRef {
		return rf.Spec.ConfigMapRef
	},
)

RulesfileByConfigMapRef indexes Rulesfile resources by their .spec.configMapRef.name.

View Source
var RulesfileBySecretRef = IndexBySecretRef(
	func(rf *artifactv1alpha1.Rulesfile) *commonv1alpha1.SecretRef {
		if rf.Spec.OCIArtifact == nil || rf.Spec.OCIArtifact.Registry == nil ||
			rf.Spec.OCIArtifact.Registry.Auth == nil {
			return nil
		}
		return rf.Spec.OCIArtifact.Registry.Auth.SecretRef
	},
)

RulesfileBySecretRef indexes Rulesfile resources by their .spec.ociArtifact.registry.auth.secretRef.name.

View Source
var RulesfileIndexes = []Entry{
	{
		Object:         &artifactv1alpha1.Rulesfile{},
		Field:          ConfigMapOnRulesfile,
		ExtractValueFn: RulesfileByConfigMapRef,
	},
	{
		Object:         &artifactv1alpha1.Rulesfile{},
		Field:          SecretOnRulesfile,
		ExtractValueFn: RulesfileBySecretRef,
	},
}

RulesfileIndexes holds all field indexes for Rulesfile resources.

Functions

func IndexByConfigMapRef

func IndexByConfigMapRef[T client.Object](getRef func(T) *commonv1alpha1.ConfigMapRef) client.IndexerFunc

IndexByConfigMapRef returns a client.IndexerFunc that indexes objects by their ConfigMapRef name. The getRef function extracts the ConfigMapRef from the typed object; return nil when not set.

func IndexBySecretRef

func IndexBySecretRef[T client.Object](getRef func(T) *commonv1alpha1.SecretRef) client.IndexerFunc

IndexBySecretRef returns a client.IndexerFunc that indexes objects by their nested SecretRef name. The getRef function extracts the SecretRef from the typed object; return nil when not set.

Types

type Entry

type Entry struct {
	// Object is the object type to index.
	Object client.Object

	// Field is the name of the index to create.
	Field string

	// ExtractValueFn is a function that extracts the value to index on from the object.
	ExtractValueFn client.IndexerFunc
}

Entry contains the information needed to set up an index for a field on an object.

Jump to

Keyboard shortcuts

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