fleet

package
v1.3.0-rc1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CountByRolloutStatusResult

type CountByRolloutStatusResult struct {
	OrgID  string
	Status string
	Count  int64
}

CountByRolloutStatusResult holds the result of the group by query for fleet rollout status.

type FleetStore

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

func (*FleetStore) CountByRolloutStatus

func (s *FleetStore) CountByRolloutStatus(ctx context.Context, orgId *uuid.UUID, _ *string) ([]CountByRolloutStatusResult, error)

CountByRolloutStatus returns the count of fleets grouped by org_id and rollout status.

func (*FleetStore) Create

func (s *FleetStore) Create(ctx context.Context, orgId uuid.UUID, resource *domain.Fleet, eventCallback store.EventCallback) (*domain.Fleet, error)

func (*FleetStore) CreateOrUpdate

func (s *FleetStore) CreateOrUpdate(ctx context.Context, orgId uuid.UUID, resource *domain.Fleet, fieldsToUnset []string, eventCallback store.EventCallback) (*domain.Fleet, bool, error)

func (*FleetStore) Delete

func (s *FleetStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback store.EventCallback) error

func (*FleetStore) Get

func (s *FleetStore) Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*domain.Fleet, error)

func (*FleetStore) GetRepositoryRefs

func (s *FleetStore) GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.RepositoryList, error)

func (*FleetStore) InitialMigration

func (s *FleetStore) InitialMigration(ctx context.Context) error

func (*FleetStore) List

func (s *FleetStore) List(ctx context.Context, orgId uuid.UUID, listParams store.ListParams, opts ...ListOption) (*domain.FleetList, error)

func (*FleetStore) ListDisruptionBudgetFleets

func (s *FleetStore) ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)

ListDisruptionBudgetFleets attempts to get fleets for disruption budget. Since the disruption budget acts like a gate to device rendering, the query searches for fleets that each contains at least 1 device that has different value set between tha annotation 'device-controller/templateVersion' which is set before rollout and 'device-controller/renderedTemplateVersion' which is set after rollout.

func (*FleetStore) ListFleetsByAppCatalogItemRef

func (s *FleetStore) ListFleetsByAppCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, listParams store.ListParams) (*domain.FleetList, error)

func (*FleetStore) ListFleetsByOsCatalogItemRef

func (s *FleetStore) ListFleetsByOsCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, listParams store.ListParams) (*domain.FleetList, error)

func (*FleetStore) ListFleetsByVolumeCatalogItemRef

func (s *FleetStore) ListFleetsByVolumeCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, listParams store.ListParams) (*domain.FleetList, error)

func (*FleetStore) ListIgnoreOrg

func (s *FleetStore) ListIgnoreOrg(ctx context.Context) ([]model.Fleet, error)

func (*FleetStore) ListRolloutDeviceSelection

func (s *FleetStore) ListRolloutDeviceSelection(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)

ListRolloutDeviceSelection attempts to get all relevant fleets for rollout device selection. A relevant fleet contains at least 1 device that at least one of the conditions below is true: - marked as selected for rollout - the template version of the fleet is not the same the template version in the annotation 'device-controller/renderedTemplateVersion' - the field 'status.config.renderedVersion' is not the same as the annotation 'device-controller/renderedVersion'

func (*FleetStore) MutateAnnotation

func (s *FleetStore) MutateAnnotation(ctx context.Context, orgId uuid.UUID, name string, key string, mutate func(current string) (string, error)) error

func (*FleetStore) OverwriteRepositoryRefs

func (s *FleetStore) OverwriteRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string, repositoryNames ...string) error

func (*FleetStore) UnsetOwner

func (s *FleetStore) UnsetOwner(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, owner string) error

func (*FleetStore) UnsetOwnerByKind

func (s *FleetStore) UnsetOwnerByKind(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, resourceKind string) error

func (*FleetStore) Update

func (s *FleetStore) Update(ctx context.Context, orgId uuid.UUID, resource *domain.Fleet, fieldsToUnset []string, eventCallback store.EventCallback) (*domain.Fleet, error)

func (*FleetStore) UpdateAnnotations

func (s *FleetStore) UpdateAnnotations(ctx context.Context, orgId uuid.UUID, name string, annotations map[string]string, deleteKeys []string, eventCallback store.EventCallback) error

func (*FleetStore) UpdateConditions

func (s *FleetStore) UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []domain.Condition, eventCallback store.EventCallback) error

func (*FleetStore) UpdateStatus

func (s *FleetStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, resource *domain.Fleet) (*domain.Fleet, error)

type GetOption

type GetOption func(*getOptions)

func GetWithDeviceSummary

func GetWithDeviceSummary(val bool) GetOption

type ListOption

type ListOption func(*listOptions)

func ListWithDevicesSummary

func ListWithDevicesSummary(val bool) ListOption

type Store

type Store interface {
	InitialMigration(ctx context.Context) error

	Create(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet, eventCallback store.EventCallback) (*domain.Fleet, error)
	Update(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet, fieldsToUnset []string, eventCallback store.EventCallback) (*domain.Fleet, error)
	CreateOrUpdate(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet, fieldsToUnset []string, eventCallback store.EventCallback) (*domain.Fleet, bool, error)
	Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*domain.Fleet, error)
	List(ctx context.Context, orgId uuid.UUID, listParams store.ListParams, opts ...ListOption) (*domain.FleetList, error)
	Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback store.EventCallback) error
	UpdateStatus(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet) (*domain.Fleet, error)

	ListRolloutDeviceSelection(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
	ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
	UnsetOwner(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, owner string) error
	UnsetOwnerByKind(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, resourceKind string) error
	UpdateConditions(ctx context.Context, orgId uuid.UUID, name string, conditions []domain.Condition, eventCallback store.EventCallback) error
	UpdateAnnotations(ctx context.Context, orgId uuid.UUID, name string, annotations map[string]string, deleteKeys []string, eventCallback store.EventCallback) error
	MutateAnnotation(ctx context.Context, orgId uuid.UUID, name string, key string, mutate func(current string) (string, error)) error
	OverwriteRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string, repositoryNames ...string) error
	GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.RepositoryList, error)

	// Used by catalog
	ListFleetsByOsCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, listParams store.ListParams) (*domain.FleetList, error)
	ListFleetsByAppCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, listParams store.ListParams) (*domain.FleetList, error)
	ListFleetsByVolumeCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, listParams store.ListParams) (*domain.FleetList, error)

	// Used by domain metrics
	CountByRolloutStatus(ctx context.Context, orgId *uuid.UUID, _ *string) ([]CountByRolloutStatusResult, error)
}

func NewFleetStore

func NewFleetStore(db *gorm.DB, log logrus.FieldLogger) Store

Jump to

Keyboard shortcuts

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