resource

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package resource is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accessor

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

Accessor implements extraction and updating of resource data using jq.Runner

func NewAccessor

func NewAccessor(jqRunner execution.Runner) *Accessor

func (*Accessor) ApplyResumeActions added in v0.1.0

func (a *Accessor) ApplyResumeActions(ctx context.Context, definition v1alpha1.ComponentDefinition) error

ApplyResumeActions applies the component's ResumeActions in sequence against the manifest. Each action's path is used as the JQ selector and its value is decoded from JSON and assigned via Assign. Returns DefinitionNotFoundError if the component has no SuspendDefinition.

func (*Accessor) ApplySuspendActions added in v0.1.0

func (a *Accessor) ApplySuspendActions(ctx context.Context, definition v1alpha1.ComponentDefinition) error

ApplySuspendActions applies the component's SuspendActions in sequence against the manifest. Each action's path is used as the JQ selector and its value is decoded from JSON and assigned via Assign. Returns DefinitionNotFoundError if the component has no SuspendDefinition.

func (*Accessor) ExtractFragmentedPodSpec

func (a *Accessor) ExtractFragmentedPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]FragmentedPodSpec, error)

func (*Accessor) ExtractInstanceIds

func (a *Accessor) ExtractInstanceIds(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]string, error)

func (*Accessor) ExtractPodMetadata

func (a *Accessor) ExtractPodMetadata(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]metav1.ObjectMeta, error)

func (*Accessor) ExtractPodSpec

func (a *Accessor) ExtractPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]corev1.PodSpec, error)

func (*Accessor) ExtractPodTemplateSpec

func (a *Accessor) ExtractPodTemplateSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]corev1.PodTemplateSpec, error)

func (*Accessor) ExtractScale

func (a *Accessor) ExtractScale(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]Scale, error)

func (*Accessor) ExtractStatus

func (a *Accessor) ExtractStatus(ctx context.Context, definition v1alpha1.ComponentDefinition) (*Status, error)

ExtractStatus evaluates the status of the component based on the status definition.

func (*Accessor) GetObject

func (a *Accessor) GetObject() (map[string]interface{}, error)

GetObject returns the object as a map[string]interface{}

func (*Accessor) UpdateFragmentedPodSpec

func (a *Accessor) UpdateFragmentedPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, fragmentedPodSpecs []FragmentedPodSpec) error

func (*Accessor) UpdatePodMetadata

func (a *Accessor) UpdatePodMetadata(ctx context.Context, definition v1alpha1.ComponentDefinition, podMetadata []metav1.ObjectMeta) error

func (*Accessor) UpdatePodSpec

func (a *Accessor) UpdatePodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, podSpecs []corev1.PodSpec) error

func (*Accessor) UpdatePodTemplateSpec

func (a *Accessor) UpdatePodTemplateSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, podTemplateSpecs []corev1.PodTemplateSpec) error

type Component

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

Component represents a Karta component with extraction capabilities

func (*Component) Definition

func (c *Component) Definition() v1alpha1.ComponentDefinition

Definition returns the component definition

func (*Component) GetExtractedInstances

func (c *Component) GetExtractedInstances(ctx context.Context) (map[string]ExtractedInstance, error)

GetExtractedInstances aggregates all extraction results into a map of instance id to ExtractedInstance

func (*Component) GetFragmentedPodSpec

func (c *Component) GetFragmentedPodSpec(ctx context.Context) (map[string]FragmentedPodSpec, error)

GetFragmentedPodSpec extracts fragmented pod specs mapped by instance id

func (*Component) GetInstanceIds

func (c *Component) GetInstanceIds(ctx context.Context) ([]string, error)

GetInstanceIds extracts instance identifiers for this component

func (*Component) GetPodMetadata

func (c *Component) GetPodMetadata(ctx context.Context) (map[string]metav1.ObjectMeta, error)

GetPodMetadata extracts pod metadata mapped by instance id

func (*Component) GetPodSelector

func (c *Component) GetPodSelector() *v1alpha1.PodSelector

GetPodSelector returns the pod selector for this component

func (*Component) GetPodSpec

func (c *Component) GetPodSpec(ctx context.Context) (map[string]corev1.PodSpec, error)

GetPodSpec extracts pod specs mapped by instance id

func (*Component) GetPodTemplateSpec

func (c *Component) GetPodTemplateSpec(ctx context.Context) (map[string]corev1.PodTemplateSpec, error)

GetPodTemplateSpec extracts pod template specs mapped by instance id

func (*Component) GetScale

func (c *Component) GetScale(ctx context.Context) (map[string]Scale, error)

GetScale extracts scale data mapped by instance id

func (*Component) GetStatus

func (c *Component) GetStatus(ctx context.Context) (*Status, error)

GetStatus extracts status information from the component Note: Status is typically defined only on the root component, not on instances

func (*Component) HasInstanceIdDefinition

func (c *Component) HasInstanceIdDefinition() bool

HasInstanceIdDefinition returns true if this component possibily has multiple instances

func (*Component) HasPodDefinition

func (c *Component) HasPodDefinition() bool

HasPodDefinition returns true if this component defines pods

func (*Component) HasSuspendDefinition added in v0.1.0

func (c *Component) HasSuspendDefinition() bool

HasSuspendDefinition returns true if this component supports native suspend/resume

func (*Component) Kind

func (c *Component) Kind() *metav1.GroupVersionKind

Kind returns the component gvk

func (*Component) Name

func (c *Component) Name() string

Name returns the component name

func (*Component) Resume added in v0.1.0

func (c *Component) Resume(ctx context.Context) error

Resume applies the component's ResumeActions in sequence against the manifest. It is a no-op if the component has no SuspendDefinition.

func (*Component) Suspend added in v0.1.0

func (c *Component) Suspend(ctx context.Context) error

Suspend applies the component's SuspendActions in sequence against the manifest. It is a no-op if the component has no SuspendDefinition.

func (*Component) UpdateFragmentedPodSpec

func (c *Component) UpdateFragmentedPodSpec(ctx context.Context, instanceIdToFragmentedPodSpec map[string]FragmentedPodSpec) error

func (*Component) UpdatePodMetadata

func (c *Component) UpdatePodMetadata(ctx context.Context, instanceIdToPodMetadata map[string]metav1.ObjectMeta) error

func (*Component) UpdatePodSpec

func (c *Component) UpdatePodSpec(ctx context.Context, instanceIdToPodSpec map[string]corev1.PodSpec) error

func (*Component) UpdatePodTemplateSpec

func (c *Component) UpdatePodTemplateSpec(ctx context.Context, instanceIdToPodTemplateSpec map[string]corev1.PodTemplateSpec) error

type ComponentAccessor

type ComponentAccessor interface {
	ComponentReader
	ComponentWriter
}

type ComponentFactory

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

func NewComponentFactory

func NewComponentFactory(karta *v1alpha1.Karta, accessor ComponentAccessor) *ComponentFactory

NewComponentFactory creates a new Karta-based component factory

func NewComponentFactoryFromObject

func NewComponentFactoryFromObject(karta *v1alpha1.Karta, object KubernetesObject) *ComponentFactory

NewComponentFactoryFromObject creates a new Karta-based component factory from a Kubernetes object

func (*ComponentFactory) GetChildComponents

func (f *ComponentFactory) GetChildComponents() ([]*Component, error)

GetChildComponents retrieves all child components

func (*ComponentFactory) GetComponent

func (f *ComponentFactory) GetComponent(name string) (*Component, error)

GetComponent retrieves a component by name

func (*ComponentFactory) GetResource

func (f *ComponentFactory) GetResource() (KubernetesObject, error)

func (*ComponentFactory) GetRootComponent

func (f *ComponentFactory) GetRootComponent() (*Component, error)

GetRootComponent retrieves the root component

func (*ComponentFactory) IsContainSpecDefinition

func (f *ComponentFactory) IsContainSpecDefinition() (bool, error)

type ComponentReader

type ComponentReader interface {
	ExtractPodTemplateSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]corev1.PodTemplateSpec, error)
	ExtractPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]corev1.PodSpec, error)
	ExtractPodMetadata(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]metav1.ObjectMeta, error)
	ExtractFragmentedPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]FragmentedPodSpec, error)
	ExtractScale(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]Scale, error)
	ExtractStatus(ctx context.Context, definition v1alpha1.ComponentDefinition) (*Status, error)
	ExtractInstanceIds(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]string, error)
	GetObject() (map[string]interface{}, error)
}

type ComponentWriter

type ComponentWriter interface {
	UpdatePodTemplateSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, podTemplateSpecs []corev1.PodTemplateSpec) error
	UpdatePodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, podSpecs []corev1.PodSpec) error
	UpdatePodMetadata(ctx context.Context, definition v1alpha1.ComponentDefinition, podMetadata []metav1.ObjectMeta) error
	UpdateFragmentedPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, fragmentedPodSpecs []FragmentedPodSpec) error
	ApplySuspendActions(ctx context.Context, definition v1alpha1.ComponentDefinition) error
	ApplyResumeActions(ctx context.Context, definition v1alpha1.ComponentDefinition) error
}

type Condition

type Condition struct {
	Type    string  `json:"type"`
	Status  *string `json:"status"`
	Reason  *string `json:"reason"`
	Message string  `json:"message,omitempty"`
}

type DefinitionNotFoundError

type DefinitionNotFoundError string

DefinitionNotFoundError represents an error when a requested definition is not found

func (DefinitionNotFoundError) Error

func (e DefinitionNotFoundError) Error() string

type ExtractedInstance

type ExtractedInstance struct {
	PodTemplateSpec   *corev1.PodTemplateSpec `json:"podTemplateSpec,omitempty"`
	PodSpec           *corev1.PodSpec         `json:"podSpec,omitempty"`
	FragmentedPodSpec *FragmentedPodSpec      `json:"fragmentedPodSpec,omitempty"`

	Metadata *metav1.ObjectMeta `json:"metadata,omitempty"`

	Scale *Scale `json:"scale,omitempty"`
}

ExtractedInstance represents all extracted data for a single instance

type FragmentedPodSpec

type FragmentedPodSpec struct {
	SchedulerName     string                       `json:"schedulerName,omitempty"`
	Labels            map[string]string            `json:"labels,omitempty"`
	Annotations       map[string]string            `json:"annotations,omitempty"`
	Resources         *corev1.ResourceRequirements `json:"resources,omitempty"`
	ResourceClaims    []corev1.PodResourceClaim    `json:"resourceClaims,omitempty"`
	PodAffinity       *corev1.PodAffinity          `json:"podAffinity,omitempty"`
	NodeAffinity      *corev1.NodeAffinity         `json:"nodeAffinity,omitempty"`
	Containers        []corev1.Container           `json:"containers,omitempty"`
	Container         *corev1.Container            `json:"container,omitempty"`
	PriorityClassName string                       `json:"priorityClassName,omitempty"`
	Image             string                       `json:"image,omitempty"`
}

type InstanceNotFoundError

type InstanceNotFoundError string

InstanceNotFoundError is returned when a pod's extracted instance ID doesn't match any valid instance IDs

func (InstanceNotFoundError) Error

func (e InstanceNotFoundError) Error() string

type KubernetesObject added in v0.1.0

type KubernetesObject interface {
	metav1.Object
	runtime.Object
}

KubernetesObject is the structural interface that karta's resource helpers accept and return. Its method set is identical to sigs.k8s.io/controller-runtime/pkg/client.Object, so any client.Object value satisfies it transparently — karta itself stays free of the controller-runtime dependency. Same pattern used by knative/pkg's kmeta.Accessor and crossplane-runtime's resource.Object.

type MockComponentAccessor

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

MockComponentAccessor is a mock of ComponentAccessor interface.

func NewMockComponentAccessor

func NewMockComponentAccessor(ctrl *gomock.Controller) *MockComponentAccessor

NewMockComponentAccessor creates a new mock instance.

func (*MockComponentAccessor) ApplyResumeActions added in v0.1.0

func (m *MockComponentAccessor) ApplyResumeActions(ctx context.Context, definition v1alpha1.ComponentDefinition) error

ApplyResumeActions mocks base method.

func (*MockComponentAccessor) ApplySuspendActions added in v0.1.0

func (m *MockComponentAccessor) ApplySuspendActions(ctx context.Context, definition v1alpha1.ComponentDefinition) error

ApplySuspendActions mocks base method.

func (*MockComponentAccessor) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockComponentAccessor) ExtractFragmentedPodSpec

func (m *MockComponentAccessor) ExtractFragmentedPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]FragmentedPodSpec, error)

ExtractFragmentedPodSpec mocks base method.

func (*MockComponentAccessor) ExtractInstanceIds

func (m *MockComponentAccessor) ExtractInstanceIds(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]string, error)

ExtractInstanceIds mocks base method.

func (*MockComponentAccessor) ExtractPodMetadata

func (m *MockComponentAccessor) ExtractPodMetadata(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]v10.ObjectMeta, error)

ExtractPodMetadata mocks base method.

func (*MockComponentAccessor) ExtractPodSpec

func (m *MockComponentAccessor) ExtractPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]v1.PodSpec, error)

ExtractPodSpec mocks base method.

func (*MockComponentAccessor) ExtractPodTemplateSpec

func (m *MockComponentAccessor) ExtractPodTemplateSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]v1.PodTemplateSpec, error)

ExtractPodTemplateSpec mocks base method.

func (*MockComponentAccessor) ExtractScale

func (m *MockComponentAccessor) ExtractScale(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]Scale, error)

ExtractScale mocks base method.

func (*MockComponentAccessor) ExtractStatus

func (m *MockComponentAccessor) ExtractStatus(ctx context.Context, definition v1alpha1.ComponentDefinition) (*Status, error)

ExtractStatus mocks base method.

func (*MockComponentAccessor) GetObject

func (m *MockComponentAccessor) GetObject() (map[string]any, error)

GetObject mocks base method.

func (*MockComponentAccessor) UpdateFragmentedPodSpec

func (m *MockComponentAccessor) UpdateFragmentedPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, fragmentedPodSpecs []FragmentedPodSpec) error

UpdateFragmentedPodSpec mocks base method.

func (*MockComponentAccessor) UpdatePodMetadata

func (m *MockComponentAccessor) UpdatePodMetadata(ctx context.Context, definition v1alpha1.ComponentDefinition, podMetadata []v10.ObjectMeta) error

UpdatePodMetadata mocks base method.

func (*MockComponentAccessor) UpdatePodSpec

func (m *MockComponentAccessor) UpdatePodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, podSpecs []v1.PodSpec) error

UpdatePodSpec mocks base method.

func (*MockComponentAccessor) UpdatePodTemplateSpec

func (m *MockComponentAccessor) UpdatePodTemplateSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, podTemplateSpecs []v1.PodTemplateSpec) error

UpdatePodTemplateSpec mocks base method.

type MockComponentAccessorMockRecorder

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

MockComponentAccessorMockRecorder is the mock recorder for MockComponentAccessor.

func (*MockComponentAccessorMockRecorder) ApplyResumeActions added in v0.1.0

func (mr *MockComponentAccessorMockRecorder) ApplyResumeActions(ctx, definition any) *gomock.Call

ApplyResumeActions indicates an expected call of ApplyResumeActions.

func (*MockComponentAccessorMockRecorder) ApplySuspendActions added in v0.1.0

func (mr *MockComponentAccessorMockRecorder) ApplySuspendActions(ctx, definition any) *gomock.Call

ApplySuspendActions indicates an expected call of ApplySuspendActions.

func (*MockComponentAccessorMockRecorder) ExtractFragmentedPodSpec

func (mr *MockComponentAccessorMockRecorder) ExtractFragmentedPodSpec(ctx, definition any) *gomock.Call

ExtractFragmentedPodSpec indicates an expected call of ExtractFragmentedPodSpec.

func (*MockComponentAccessorMockRecorder) ExtractInstanceIds

func (mr *MockComponentAccessorMockRecorder) ExtractInstanceIds(ctx, definition any) *gomock.Call

ExtractInstanceIds indicates an expected call of ExtractInstanceIds.

func (*MockComponentAccessorMockRecorder) ExtractPodMetadata

func (mr *MockComponentAccessorMockRecorder) ExtractPodMetadata(ctx, definition any) *gomock.Call

ExtractPodMetadata indicates an expected call of ExtractPodMetadata.

func (*MockComponentAccessorMockRecorder) ExtractPodSpec

func (mr *MockComponentAccessorMockRecorder) ExtractPodSpec(ctx, definition any) *gomock.Call

ExtractPodSpec indicates an expected call of ExtractPodSpec.

func (*MockComponentAccessorMockRecorder) ExtractPodTemplateSpec

func (mr *MockComponentAccessorMockRecorder) ExtractPodTemplateSpec(ctx, definition any) *gomock.Call

ExtractPodTemplateSpec indicates an expected call of ExtractPodTemplateSpec.

func (*MockComponentAccessorMockRecorder) ExtractScale

func (mr *MockComponentAccessorMockRecorder) ExtractScale(ctx, definition any) *gomock.Call

ExtractScale indicates an expected call of ExtractScale.

func (*MockComponentAccessorMockRecorder) ExtractStatus

func (mr *MockComponentAccessorMockRecorder) ExtractStatus(ctx, definition any) *gomock.Call

ExtractStatus indicates an expected call of ExtractStatus.

func (*MockComponentAccessorMockRecorder) GetObject

GetObject indicates an expected call of GetObject.

func (*MockComponentAccessorMockRecorder) UpdateFragmentedPodSpec

func (mr *MockComponentAccessorMockRecorder) UpdateFragmentedPodSpec(ctx, definition, fragmentedPodSpecs any) *gomock.Call

UpdateFragmentedPodSpec indicates an expected call of UpdateFragmentedPodSpec.

func (*MockComponentAccessorMockRecorder) UpdatePodMetadata

func (mr *MockComponentAccessorMockRecorder) UpdatePodMetadata(ctx, definition, podMetadata any) *gomock.Call

UpdatePodMetadata indicates an expected call of UpdatePodMetadata.

func (*MockComponentAccessorMockRecorder) UpdatePodSpec

func (mr *MockComponentAccessorMockRecorder) UpdatePodSpec(ctx, definition, podSpecs any) *gomock.Call

UpdatePodSpec indicates an expected call of UpdatePodSpec.

func (*MockComponentAccessorMockRecorder) UpdatePodTemplateSpec

func (mr *MockComponentAccessorMockRecorder) UpdatePodTemplateSpec(ctx, definition, podTemplateSpecs any) *gomock.Call

UpdatePodTemplateSpec indicates an expected call of UpdatePodTemplateSpec.

type MockComponentReader

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

MockComponentReader is a mock of ComponentReader interface.

func NewMockComponentReader

func NewMockComponentReader(ctrl *gomock.Controller) *MockComponentReader

NewMockComponentReader creates a new mock instance.

func (*MockComponentReader) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockComponentReader) ExtractFragmentedPodSpec

func (m *MockComponentReader) ExtractFragmentedPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]FragmentedPodSpec, error)

ExtractFragmentedPodSpec mocks base method.

func (*MockComponentReader) ExtractInstanceIds

func (m *MockComponentReader) ExtractInstanceIds(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]string, error)

ExtractInstanceIds mocks base method.

func (*MockComponentReader) ExtractPodMetadata

func (m *MockComponentReader) ExtractPodMetadata(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]v10.ObjectMeta, error)

ExtractPodMetadata mocks base method.

func (*MockComponentReader) ExtractPodSpec

func (m *MockComponentReader) ExtractPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]v1.PodSpec, error)

ExtractPodSpec mocks base method.

func (*MockComponentReader) ExtractPodTemplateSpec

func (m *MockComponentReader) ExtractPodTemplateSpec(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]v1.PodTemplateSpec, error)

ExtractPodTemplateSpec mocks base method.

func (*MockComponentReader) ExtractScale

func (m *MockComponentReader) ExtractScale(ctx context.Context, definition v1alpha1.ComponentDefinition) ([]Scale, error)

ExtractScale mocks base method.

func (*MockComponentReader) ExtractStatus

func (m *MockComponentReader) ExtractStatus(ctx context.Context, definition v1alpha1.ComponentDefinition) (*Status, error)

ExtractStatus mocks base method.

func (*MockComponentReader) GetObject

func (m *MockComponentReader) GetObject() (map[string]any, error)

GetObject mocks base method.

type MockComponentReaderMockRecorder

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

MockComponentReaderMockRecorder is the mock recorder for MockComponentReader.

func (*MockComponentReaderMockRecorder) ExtractFragmentedPodSpec

func (mr *MockComponentReaderMockRecorder) ExtractFragmentedPodSpec(ctx, definition any) *gomock.Call

ExtractFragmentedPodSpec indicates an expected call of ExtractFragmentedPodSpec.

func (*MockComponentReaderMockRecorder) ExtractInstanceIds

func (mr *MockComponentReaderMockRecorder) ExtractInstanceIds(ctx, definition any) *gomock.Call

ExtractInstanceIds indicates an expected call of ExtractInstanceIds.

func (*MockComponentReaderMockRecorder) ExtractPodMetadata

func (mr *MockComponentReaderMockRecorder) ExtractPodMetadata(ctx, definition any) *gomock.Call

ExtractPodMetadata indicates an expected call of ExtractPodMetadata.

func (*MockComponentReaderMockRecorder) ExtractPodSpec

func (mr *MockComponentReaderMockRecorder) ExtractPodSpec(ctx, definition any) *gomock.Call

ExtractPodSpec indicates an expected call of ExtractPodSpec.

func (*MockComponentReaderMockRecorder) ExtractPodTemplateSpec

func (mr *MockComponentReaderMockRecorder) ExtractPodTemplateSpec(ctx, definition any) *gomock.Call

ExtractPodTemplateSpec indicates an expected call of ExtractPodTemplateSpec.

func (*MockComponentReaderMockRecorder) ExtractScale

func (mr *MockComponentReaderMockRecorder) ExtractScale(ctx, definition any) *gomock.Call

ExtractScale indicates an expected call of ExtractScale.

func (*MockComponentReaderMockRecorder) ExtractStatus

func (mr *MockComponentReaderMockRecorder) ExtractStatus(ctx, definition any) *gomock.Call

ExtractStatus indicates an expected call of ExtractStatus.

func (*MockComponentReaderMockRecorder) GetObject

func (mr *MockComponentReaderMockRecorder) GetObject() *gomock.Call

GetObject indicates an expected call of GetObject.

type MockComponentWriter

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

MockComponentWriter is a mock of ComponentWriter interface.

func NewMockComponentWriter

func NewMockComponentWriter(ctrl *gomock.Controller) *MockComponentWriter

NewMockComponentWriter creates a new mock instance.

func (*MockComponentWriter) ApplyResumeActions added in v0.1.0

func (m *MockComponentWriter) ApplyResumeActions(ctx context.Context, definition v1alpha1.ComponentDefinition) error

ApplyResumeActions mocks base method.

func (*MockComponentWriter) ApplySuspendActions added in v0.1.0

func (m *MockComponentWriter) ApplySuspendActions(ctx context.Context, definition v1alpha1.ComponentDefinition) error

ApplySuspendActions mocks base method.

func (*MockComponentWriter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockComponentWriter) UpdateFragmentedPodSpec

func (m *MockComponentWriter) UpdateFragmentedPodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, fragmentedPodSpecs []FragmentedPodSpec) error

UpdateFragmentedPodSpec mocks base method.

func (*MockComponentWriter) UpdatePodMetadata

func (m *MockComponentWriter) UpdatePodMetadata(ctx context.Context, definition v1alpha1.ComponentDefinition, podMetadata []v10.ObjectMeta) error

UpdatePodMetadata mocks base method.

func (*MockComponentWriter) UpdatePodSpec

func (m *MockComponentWriter) UpdatePodSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, podSpecs []v1.PodSpec) error

UpdatePodSpec mocks base method.

func (*MockComponentWriter) UpdatePodTemplateSpec

func (m *MockComponentWriter) UpdatePodTemplateSpec(ctx context.Context, definition v1alpha1.ComponentDefinition, podTemplateSpecs []v1.PodTemplateSpec) error

UpdatePodTemplateSpec mocks base method.

type MockComponentWriterMockRecorder

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

MockComponentWriterMockRecorder is the mock recorder for MockComponentWriter.

func (*MockComponentWriterMockRecorder) ApplyResumeActions added in v0.1.0

func (mr *MockComponentWriterMockRecorder) ApplyResumeActions(ctx, definition any) *gomock.Call

ApplyResumeActions indicates an expected call of ApplyResumeActions.

func (*MockComponentWriterMockRecorder) ApplySuspendActions added in v0.1.0

func (mr *MockComponentWriterMockRecorder) ApplySuspendActions(ctx, definition any) *gomock.Call

ApplySuspendActions indicates an expected call of ApplySuspendActions.

func (*MockComponentWriterMockRecorder) UpdateFragmentedPodSpec

func (mr *MockComponentWriterMockRecorder) UpdateFragmentedPodSpec(ctx, definition, fragmentedPodSpecs any) *gomock.Call

UpdateFragmentedPodSpec indicates an expected call of UpdateFragmentedPodSpec.

func (*MockComponentWriterMockRecorder) UpdatePodMetadata

func (mr *MockComponentWriterMockRecorder) UpdatePodMetadata(ctx, definition, podMetadata any) *gomock.Call

UpdatePodMetadata indicates an expected call of UpdatePodMetadata.

func (*MockComponentWriterMockRecorder) UpdatePodSpec

func (mr *MockComponentWriterMockRecorder) UpdatePodSpec(ctx, definition, podSpecs any) *gomock.Call

UpdatePodSpec indicates an expected call of UpdatePodSpec.

func (*MockComponentWriterMockRecorder) UpdatePodTemplateSpec

func (mr *MockComponentWriterMockRecorder) UpdatePodTemplateSpec(ctx, definition, podTemplateSpecs any) *gomock.Call

UpdatePodTemplateSpec indicates an expected call of UpdatePodTemplateSpec.

type PodQuerier

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

PodQuerier handles JQ-based querying operations against pods

func NewPodQuerier

func NewPodQuerier(pod *corev1.Pod) *PodQuerier

func (*PodQuerier) ExtractGroupKeys

func (pq *PodQuerier) ExtractGroupKeys(ctx context.Context, keyPaths []string) ([]string, error)

ExtractGroupKeys extracts grouping key values from the pod using the provided JQ paths

func (*PodQuerier) ExtractInstanceId

func (pq *PodQuerier) ExtractInstanceId(ctx context.Context, instanceSelector *v1alpha1.ComponentInstanceSelector) (string, bool, error)

ExtractInstanceId extracts the component instance identifier from the pod using the given ComponentInstanceSelector. Returns the instance id as a string, a boolean indicating whether a value was found, and an error. When the selector is nil or has an empty IdPath, found is false with no error.

func (*PodQuerier) ExtractReplicaKey

func (pq *PodQuerier) ExtractReplicaKey(ctx context.Context, selector *v1alpha1.ReplicaSelector) (string, bool, error)

ExtractReplicaKey extracts the replica identifier from the pod using the given ReplicaSelector. Returns the replica key as a string, a boolean indicating whether a value was found, and an error. When the selector is nil or has an empty KeyPath, found is false with no error.

func (*PodQuerier) GetMatchingInstanceId

func (pq *PodQuerier) GetMatchingInstanceId(ctx context.Context, instanceSelector *v1alpha1.ComponentInstanceSelector, instanceIds []string) (string, error)

GetMatchingInstanceId checks if the pod matches any of the provided instance ids using the instance selector. Returns the matching instance id if found, empty string if no match.

func (*PodQuerier) GetPodName

func (pq *PodQuerier) GetPodName() string

func (*PodQuerier) MatchesComponentType

func (pq *PodQuerier) MatchesComponentType(ctx context.Context, selector *v1alpha1.ComponentTypeSelector) (bool, error)

MatchesComponentType returns true if the pod matches the given component type selector

func (*PodQuerier) PassesFilters

func (pq *PodQuerier) PassesFilters(ctx context.Context, filters []string) (bool, error)

PassesFilters returns true if the pod passes all the provided JQ filter expressions All filters must pass (AND logic) for the method to return true

type Scale

type Scale struct {
	Replicas    *int32 `json:"replicas,omitempty"`
	MinReplicas *int32 `json:"minReplicas,omitempty"`
	MaxReplicas *int32 `json:"maxReplicas,omitempty"`
}

type Status

type Status struct {
	// Phase is the raw phase/state string extracted from the component
	Phase *string `json:"phase,omitempty"`

	// Conditions are the extracted Kubernetes-style conditions
	Conditions []Condition `json:"conditions,omitempty"`

	// MatchedStatuses are all the ResourceStatuses that were matched based on StatusMappings
	MatchedStatuses []v1alpha1.ResourceStatus `json:"matchedStatuses"`
}

Jump to

Keyboard shortcuts

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