metadata

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogAccessOverview

func LogAccessOverview(access Access)

Types

type Access

type Access interface {
	SchemaMigration() error

	ReadTenantConfig(tenantConfig TenantConfig) (*TenantConfig, error)
	ReadCodeModule(codeModule CodeModule) (*CodeModule, error)
	ReadOSMount(osMount OSMount) (*OSMount, error)
	ReadUnscopedOSMount(osMount OSMount) (*OSMount, error)
	ReadAppMount(appMount AppMount) (*AppMount, error)

	ReadTenantConfigs() ([]TenantConfig, error)
	ReadCodeModules() ([]CodeModule, error)
	ReadOSMounts() ([]OSMount, error)
	ReadAppMounts() ([]AppMount, error)
	ReadVolumeMetas() ([]VolumeMeta, error)

	CreateTenantConfig(tenantConfig *TenantConfig) error
	CreateCodeModule(codeModule *CodeModule) error
	CreateOSMount(osMount *OSMount) error
	CreateAppMount(appMount *AppMount) error

	UpdateTenantConfig(tenantConfig *TenantConfig) error
	UpdateOSMount(osMount *OSMount) error
	UpdateAppMount(appMount *AppMount) error

	DeleteTenantConfig(tenantConfig *TenantConfig, cascade bool) error
	DeleteCodeModule(codeModule *CodeModule) error
	DeleteOSMount(osMount *OSMount) error
	DeleteAppMount(appMount *AppMount) error

	IsCodeModuleOrphaned(codeModule *CodeModule) (bool, error)
	RestoreOSMount(osMount *OSMount) (*OSMount, error)
}

type AccessCleaner added in v1.2.0

type AccessCleaner interface {
	Access
	Cleaner
}

TODO: Come up with a less confusing name

type AccessOverview

type AccessOverview struct {
	VolumeMetas   []VolumeMeta   `json:"volumeMetas"`
	AppMounts     []AppMount     `json:"appMounts"`
	TenantConfigs []TenantConfig `json:"tenantConfigs"`
	CodeModules   []CodeModule   `json:"codeModules"`
	OSMounts      []OSMount      `json:"osMounts"`
}

func NewAccessOverview

func NewAccessOverview(access Access) (*AccessOverview, error)

type AppMount added in v1.1.0

type AppMount struct {
	VolumeMeta VolumeMeta
	CodeModule CodeModule `gorm:"foreignKey:CodeModuleVersion;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	TimeStampedModel
	VolumeMetaID      string `gorm:"primaryKey"`
	CodeModuleVersion string
	Location          string `gorm:"not null"`
	MountAttempts     int64  `gorm:"not null"`
}

AppMount keeps track of our mounts to user applications, where we provide the codemodules.

type Cleaner added in v1.2.0

type Cleaner interface {
	ListDeletedTenantConfigs() ([]TenantConfig, error)
	PurgeTenantConfig(tenantConfig *TenantConfig) error

	ListDeletedCodeModules() ([]CodeModule, error)
	PurgeCodeModule(codeModule *CodeModule) error

	ListDeletedAppMounts() ([]AppMount, error)
	PurgeAppMount(appMount *AppMount) error

	ListDeletedOSMounts() ([]OSMount, error)
	PurgeOSMount(osMount *OSMount) error
}

type CodeModule added in v1.1.0

type CodeModule struct {
	Version  string `gorm:"primaryKey"`
	Location string `gorm:"not null"`
	TimeStampedModel
}

CodeModule holds what codemodules we have downloaded and available.

type CorrectnessChecker

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

func NewCorrectnessChecker

func NewCorrectnessChecker(cl client.Reader, access Access, opts dtcsi.CSIOptions) *CorrectnessChecker

func (*CorrectnessChecker) CorrectCSI

func (checker *CorrectnessChecker) CorrectCSI(ctx context.Context) error

CorrectMetadata checks if the entries in the storage are actually valid Removes not valid entries "Moves" agent bins from deprecated location. (just creates a symlink)

type Dynakube

type Dynakube struct {
	Name                   string `json:"name"`
	TenantUUID             string `json:"tenantUUID"`
	LatestVersion          string `json:"latestVersion"`
	ImageDigest            string `json:"imageDigest"`
	MaxFailedMountAttempts int    `json:"maxFailedMountAttempts"`
}

Dynakube stores the necessary info from the Dynakube that is needed to be used during volume mount/unmount.

type FakeFailDB

type FakeFailDB struct{}

func (*FakeFailDB) CreateAppMount added in v1.2.0

func (f *FakeFailDB) CreateAppMount(appMount *AppMount) error

func (*FakeFailDB) CreateCodeModule added in v1.2.0

func (f *FakeFailDB) CreateCodeModule(codeModule *CodeModule) error

func (*FakeFailDB) CreateOSMount added in v1.2.0

func (f *FakeFailDB) CreateOSMount(osMount *OSMount) error

func (*FakeFailDB) CreateTenantConfig added in v1.2.0

func (f *FakeFailDB) CreateTenantConfig(tenantConfig *TenantConfig) error

func (*FakeFailDB) DeleteAppMount added in v1.2.0

func (f *FakeFailDB) DeleteAppMount(appMount *AppMount) error

func (*FakeFailDB) DeleteCodeModule added in v1.2.0

func (f *FakeFailDB) DeleteCodeModule(codeModule *CodeModule) error

func (*FakeFailDB) DeleteOSMount added in v1.2.0

func (f *FakeFailDB) DeleteOSMount(osMount *OSMount) error

func (*FakeFailDB) DeleteTenantConfig added in v1.2.0

func (f *FakeFailDB) DeleteTenantConfig(tenantConfig *TenantConfig, cascade bool) error

func (*FakeFailDB) IsCodeModuleOrphaned added in v1.2.0

func (f *FakeFailDB) IsCodeModuleOrphaned(codeModule *CodeModule) (bool, error)

func (*FakeFailDB) ReadAppMount added in v1.2.0

func (f *FakeFailDB) ReadAppMount(appMount AppMount) (*AppMount, error)

func (*FakeFailDB) ReadAppMounts added in v1.2.0

func (f *FakeFailDB) ReadAppMounts() ([]AppMount, error)

func (*FakeFailDB) ReadCodeModule added in v1.2.0

func (f *FakeFailDB) ReadCodeModule(codeModule CodeModule) (*CodeModule, error)

func (*FakeFailDB) ReadCodeModules added in v1.2.0

func (f *FakeFailDB) ReadCodeModules() ([]CodeModule, error)

func (*FakeFailDB) ReadOSMount added in v1.2.0

func (f *FakeFailDB) ReadOSMount(osMount OSMount) (*OSMount, error)

func (*FakeFailDB) ReadOSMounts added in v1.2.0

func (f *FakeFailDB) ReadOSMounts() ([]OSMount, error)

func (*FakeFailDB) ReadTenantConfig added in v1.2.0

func (f *FakeFailDB) ReadTenantConfig(tenantConfig TenantConfig) (*TenantConfig, error)

func (*FakeFailDB) ReadTenantConfigs added in v1.2.0

func (f *FakeFailDB) ReadTenantConfigs() ([]TenantConfig, error)

func (*FakeFailDB) ReadUnscopedOSMount added in v1.2.0

func (f *FakeFailDB) ReadUnscopedOSMount(osMount OSMount) (*OSMount, error)

func (*FakeFailDB) ReadVolumeMeta added in v1.2.0

func (f *FakeFailDB) ReadVolumeMeta(volumeMeta VolumeMeta) (*VolumeMeta, error)

func (*FakeFailDB) ReadVolumeMetas added in v1.2.0

func (f *FakeFailDB) ReadVolumeMetas() ([]VolumeMeta, error)

func (*FakeFailDB) RestoreOSMount added in v1.2.0

func (f *FakeFailDB) RestoreOSMount(osMount *OSMount) (*OSMount, error)

func (*FakeFailDB) SchemaMigration added in v1.2.0

func (f *FakeFailDB) SchemaMigration() error

func (*FakeFailDB) UpdateAppMount added in v1.2.0

func (f *FakeFailDB) UpdateAppMount(appMount *AppMount) error

func (*FakeFailDB) UpdateOSMount added in v1.2.0

func (f *FakeFailDB) UpdateOSMount(osMount *OSMount) error

func (*FakeFailDB) UpdateTenantConfig added in v1.2.0

func (f *FakeFailDB) UpdateTenantConfig(tenantConfig *TenantConfig) error

type GormConn added in v1.2.0

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

func FakeMemoryDB

func FakeMemoryDB() *GormConn

func NewAccess

func NewAccess(ctx context.Context, path string) (*GormConn, error)

NewAccess creates a new gorm db connection to the database.

func (*GormConn) CreateAppMount added in v1.2.0

func (conn *GormConn) CreateAppMount(appMount *AppMount) error

func (*GormConn) CreateCodeModule added in v1.2.0

func (conn *GormConn) CreateCodeModule(codeModule *CodeModule) error

func (*GormConn) CreateOSMount added in v1.2.0

func (conn *GormConn) CreateOSMount(osMount *OSMount) error

func (*GormConn) CreateTenantConfig added in v1.2.0

func (conn *GormConn) CreateTenantConfig(tenantConfig *TenantConfig) error

func (*GormConn) DeleteAppMount added in v1.2.0

func (conn *GormConn) DeleteAppMount(appMount *AppMount) error

func (*GormConn) DeleteCodeModule added in v1.2.0

func (conn *GormConn) DeleteCodeModule(codeModule *CodeModule) error

func (*GormConn) DeleteOSMount added in v1.2.0

func (conn *GormConn) DeleteOSMount(osMount *OSMount) error

func (*GormConn) DeleteTenantConfig added in v1.2.0

func (conn *GormConn) DeleteTenantConfig(tenantConfig *TenantConfig, cascade bool) error

func (*GormConn) InitGormSchema added in v1.2.0

func (conn *GormConn) InitGormSchema() error

func (*GormConn) IsCodeModuleOrphaned added in v1.2.0

func (conn *GormConn) IsCodeModuleOrphaned(codeModule *CodeModule) (bool, error)

func (*GormConn) ListDeletedAppMounts added in v1.2.0

func (conn *GormConn) ListDeletedAppMounts() ([]AppMount, error)

func (*GormConn) ListDeletedCodeModules added in v1.2.0

func (conn *GormConn) ListDeletedCodeModules() ([]CodeModule, error)

func (*GormConn) ListDeletedOSMounts added in v1.2.0

func (conn *GormConn) ListDeletedOSMounts() ([]OSMount, error)

func (*GormConn) ListDeletedTenantConfigs added in v1.2.0

func (conn *GormConn) ListDeletedTenantConfigs() ([]TenantConfig, error)

func (*GormConn) PurgeAppMount added in v1.2.0

func (conn *GormConn) PurgeAppMount(appMount *AppMount) error

func (*GormConn) PurgeCodeModule added in v1.2.0

func (conn *GormConn) PurgeCodeModule(codeModule *CodeModule) error

func (*GormConn) PurgeOSMount added in v1.2.0

func (conn *GormConn) PurgeOSMount(osMount *OSMount) error

func (*GormConn) PurgeTenantConfig added in v1.2.0

func (conn *GormConn) PurgeTenantConfig(tenantConfig *TenantConfig) error

func (*GormConn) ReadAppMount added in v1.2.0

func (conn *GormConn) ReadAppMount(appMount AppMount) (*AppMount, error)

func (*GormConn) ReadAppMounts added in v1.2.0

func (conn *GormConn) ReadAppMounts() ([]AppMount, error)

func (*GormConn) ReadCodeModule added in v1.2.0

func (conn *GormConn) ReadCodeModule(codeModule CodeModule) (*CodeModule, error)

func (*GormConn) ReadCodeModules added in v1.2.0

func (conn *GormConn) ReadCodeModules() ([]CodeModule, error)

func (*GormConn) ReadOSMount added in v1.2.0

func (conn *GormConn) ReadOSMount(osMount OSMount) (*OSMount, error)

func (*GormConn) ReadOSMounts added in v1.2.0

func (conn *GormConn) ReadOSMounts() ([]OSMount, error)

func (*GormConn) ReadTenantConfig added in v1.2.0

func (conn *GormConn) ReadTenantConfig(tenantConfig TenantConfig) (*TenantConfig, error)

func (*GormConn) ReadTenantConfigs added in v1.2.0

func (conn *GormConn) ReadTenantConfigs() ([]TenantConfig, error)

func (*GormConn) ReadUnscopedOSMount added in v1.2.0

func (conn *GormConn) ReadUnscopedOSMount(osMount OSMount) (*OSMount, error)

func (*GormConn) ReadVolumeMetas added in v1.2.0

func (conn *GormConn) ReadVolumeMetas() ([]VolumeMeta, error)

func (*GormConn) RestoreOSMount added in v1.2.0

func (conn *GormConn) RestoreOSMount(osMount *OSMount) (*OSMount, error)

func (*GormConn) SchemaMigration added in v1.2.0

func (conn *GormConn) SchemaMigration() error

SchemaMigration runs gormigrate migrations to create tables

func (*GormConn) UpdateAppMount added in v1.2.0

func (conn *GormConn) UpdateAppMount(appMount *AppMount) error

func (*GormConn) UpdateOSMount added in v1.2.0

func (conn *GormConn) UpdateOSMount(osMount *OSMount) error

func (*GormConn) UpdateTenantConfig added in v1.2.0

func (conn *GormConn) UpdateTenantConfig(tenantConfig *TenantConfig) error

type OSMount added in v1.1.0

type OSMount struct {
	VolumeMeta VolumeMeta `gorm:"foreignKey:VolumeMetaID"`
	TimeStampedModel
	TenantConfigUID string
	TenantUUID      string       `gorm:"primaryKey"`
	VolumeMetaID    string       `gorm:"not null"`
	Location        string       `gorm:"not null"`
	TenantConfig    TenantConfig `gorm:"foreignKey:TenantConfigUID"`
	MountAttempts   int64        `gorm:"not null"`
}

OSMount keeps track of our mounts to OS oneAgents, can be "remounted", which causes annoyances.

type OsAgentVolume

type OsAgentVolume struct {
	LastModified *time.Time `json:"lastModified"`
	VolumeID     string     `json:"volumeID"`
	TenantUUID   string     `json:"tenantUUID"`
	Mounted      bool       `json:"mounted"`
}

type PathResolver

type PathResolver struct {
	RootDir string
}

func (PathResolver) AgentBinaryDir

func (pr PathResolver) AgentBinaryDir(tenantUUID string) string

func (PathResolver) AgentBinaryDirForVersion

func (pr PathResolver) AgentBinaryDirForVersion(tenantUUID string, version string) string

Deprecated

func (PathResolver) AgentConfigDir

func (pr PathResolver) AgentConfigDir(tenantUUID string, dynakubeName string) string

func (PathResolver) AgentRunDir

func (pr PathResolver) AgentRunDir(tenantUUID string) string

func (PathResolver) AgentRunDirForVolume

func (pr PathResolver) AgentRunDirForVolume(tenantUUID string, volumeId string) string

func (PathResolver) AgentSharedBinaryDirBase

func (pr PathResolver) AgentSharedBinaryDirBase() string

func (PathResolver) AgentSharedBinaryDirForAgent

func (pr PathResolver) AgentSharedBinaryDirForAgent(versionOrImageURI string) string

func (PathResolver) AgentSharedRuxitAgentProcConf added in v1.0.0

func (pr PathResolver) AgentSharedRuxitAgentProcConf(tenantUUID, dynakubeName string) string

func (PathResolver) AgentTempUnzipDir

func (pr PathResolver) AgentTempUnzipDir() string

func (PathResolver) AgentTempUnzipRootDir

func (pr PathResolver) AgentTempUnzipRootDir() string

func (PathResolver) OsAgentDir

func (pr PathResolver) OsAgentDir(tenantUUID string) string

func (PathResolver) OverlayMappedDir

func (pr PathResolver) OverlayMappedDir(tenantUUID string, volumeId string) string

func (PathResolver) OverlayVarDir

func (pr PathResolver) OverlayVarDir(tenantUUID string, volumeId string) string

func (PathResolver) OverlayVarRuxitAgentProcConf added in v1.0.0

func (pr PathResolver) OverlayVarRuxitAgentProcConf(tenantUUID, volumeId string) string

func (PathResolver) OverlayWorkDir

func (pr PathResolver) OverlayWorkDir(tenantUUID string, volumeId string) string

func (PathResolver) TenantDir

func (pr PathResolver) TenantDir(tenantUUID string) string

type TenantConfig added in v1.1.0

type TenantConfig struct {
	TimeStampedModel
	UID                         string `gorm:"primaryKey"` // auto generated UID
	Name                        string `gorm:"not null"`
	DownloadedCodeModuleVersion string // can't be foreign key because of HostMonitoring edge case
	ConfigDirPath               string `gorm:"not null"`
	TenantUUID                  string `gorm:"not null"`
	MaxFailedMountAttempts      int64  `gorm:"default:10"`
}

TenantConfig holds info about a given configuration for a tenant.

func (*TenantConfig) BeforeCreate added in v1.1.0

func (tc *TenantConfig) BeforeCreate(_ *gorm.DB) error

type TimeStampedModel added in v1.1.0

type TimeStampedModel struct {
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt,omitempty"`
}

type Volume

type Volume struct {
	VolumeID      string `json:"volumeID" gorm:"column:ID"`
	PodName       string `json:"podName"`
	Version       string `json:"version"`
	TenantUUID    string `json:"tenantUUID"`
	MountAttempts int    `json:"mountAttempts"`
}

type VolumeMeta added in v1.1.0

type VolumeMeta struct {
	ID                string `gorm:"primaryKey"`
	PodUid            string `gorm:"not null"`
	PodName           string `gorm:"not null"`
	PodNamespace      string `gorm:"not null"`
	PodServiceAccount string `gorm:"not null"`
	TimeStampedModel
}

VolumeMeta keeps metadata we get from kubernetes about the volume.

Jump to

Keyboard shortcuts

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