metadata

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 16 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 {
	Setup(ctx context.Context, path string) error

	InsertDynakube(ctx context.Context, dynakube *Dynakube) error
	UpdateDynakube(ctx context.Context, dynakube *Dynakube) error
	DeleteDynakube(ctx context.Context, dynakubeName string) error
	GetDynakube(ctx context.Context, dynakubeName string) (*Dynakube, error)
	GetTenantsToDynakubes(ctx context.Context) (map[string]string, error)
	GetAllDynakubes(ctx context.Context) ([]*Dynakube, error)

	InsertOsAgentVolume(ctx context.Context, volume *OsAgentVolume) error
	GetOsAgentVolumeViaVolumeID(ctx context.Context, volumeID string) (*OsAgentVolume, error)
	GetOsAgentVolumeViaTenantUUID(ctx context.Context, volumeID string) (*OsAgentVolume, error)
	UpdateOsAgentVolume(ctx context.Context, volume *OsAgentVolume) error
	GetAllOsAgentVolumes(ctx context.Context) ([]*OsAgentVolume, error)

	InsertVolume(ctx context.Context, volume *Volume) error
	DeleteVolume(ctx context.Context, volumeID string) error
	GetVolume(ctx context.Context, volumeID string) (*Volume, error)
	GetAllVolumes(ctx context.Context) ([]*Volume, error)
	GetPodNames(ctx context.Context) (map[string]string, error)
	GetUsedVersions(ctx context.Context, tenantUUID string) (map[string]bool, error)
	GetAllUsedVersions(ctx context.Context) (map[string]bool, error)
	GetLatestVersions(ctx context.Context) (map[string]bool, error)
	GetUsedImageDigests(ctx context.Context) (map[string]bool, error)
	IsImageDigestUsed(ctx context.Context, imageDigest string) (bool, error)
}

func NewAccess

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

NewAccess creates a new SqliteAccess, connects to the database.

type AccessOverview

type AccessOverview struct {
	Volumes        []*Volume        `json:"volumes"`
	Dynakubes      []*Dynakube      `json:"dynakubes"`
	OsAgentVolumes []*OsAgentVolume `json:"osAgentVolumes"`
}

func NewAccessOverview

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

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.

func NewDynakube

func NewDynakube(dynakubeName, tenantUUID, latestVersion, imageDigest string, maxFailedMountAttempts int) *Dynakube

NewDynakube returns a new metadata.Dynakube if all fields are set.

type FakeFailDB

type FakeFailDB struct{}

func (*FakeFailDB) DeleteDynakube

func (f *FakeFailDB) DeleteDynakube(ctx context.Context, dynakubeName string) error

func (*FakeFailDB) DeleteVolume

func (f *FakeFailDB) DeleteVolume(ctx context.Context, volumeID string) error

func (*FakeFailDB) GetAllDynakubes

func (f *FakeFailDB) GetAllDynakubes(ctx context.Context) ([]*Dynakube, error)

func (*FakeFailDB) GetAllOsAgentVolumes

func (f *FakeFailDB) GetAllOsAgentVolumes(ctx context.Context) ([]*OsAgentVolume, error)

func (*FakeFailDB) GetAllUsedVersions

func (f *FakeFailDB) GetAllUsedVersions(ctx context.Context) (map[string]bool, error)

func (*FakeFailDB) GetAllVolumes

func (f *FakeFailDB) GetAllVolumes(ctx context.Context) ([]*Volume, error)

func (*FakeFailDB) GetDynakube

func (f *FakeFailDB) GetDynakube(ctx context.Context, dynakubeName string) (*Dynakube, error)

func (*FakeFailDB) GetLatestVersions

func (f *FakeFailDB) GetLatestVersions(ctx context.Context) (map[string]bool, error)

func (*FakeFailDB) GetOsAgentVolumeViaTenantUUID

func (f *FakeFailDB) GetOsAgentVolumeViaTenantUUID(ctx context.Context, volumeID string) (*OsAgentVolume, error)

func (*FakeFailDB) GetOsAgentVolumeViaVolumeID

func (f *FakeFailDB) GetOsAgentVolumeViaVolumeID(ctx context.Context, volumeID string) (*OsAgentVolume, error)

func (*FakeFailDB) GetPodNames

func (f *FakeFailDB) GetPodNames(ctx context.Context) (map[string]string, error)

func (*FakeFailDB) GetTenantsToDynakubes

func (f *FakeFailDB) GetTenantsToDynakubes(ctx context.Context) (map[string]string, error)

func (*FakeFailDB) GetUsedImageDigests

func (f *FakeFailDB) GetUsedImageDigests(ctx context.Context) (map[string]bool, error)

func (*FakeFailDB) GetUsedVersions

func (f *FakeFailDB) GetUsedVersions(ctx context.Context, tenantUUID string) (map[string]bool, error)

func (*FakeFailDB) GetVolume

func (f *FakeFailDB) GetVolume(ctx context.Context, volumeID string) (*Volume, error)

func (*FakeFailDB) InsertDynakube

func (f *FakeFailDB) InsertDynakube(ctx context.Context, tenant *Dynakube) error

func (*FakeFailDB) InsertOsAgentVolume

func (f *FakeFailDB) InsertOsAgentVolume(ctx context.Context, volume *OsAgentVolume) error

func (*FakeFailDB) InsertVolume

func (f *FakeFailDB) InsertVolume(ctx context.Context, volume *Volume) error

func (*FakeFailDB) IsImageDigestUsed

func (f *FakeFailDB) IsImageDigestUsed(ctx context.Context, imageDigest string) (bool, error)

func (*FakeFailDB) Setup

func (f *FakeFailDB) Setup(ctx context.Context, dbPath string) error

func (*FakeFailDB) UpdateDynakube

func (f *FakeFailDB) UpdateDynakube(ctx context.Context, tenant *Dynakube) error

func (*FakeFailDB) UpdateOsAgentVolume

func (f *FakeFailDB) UpdateOsAgentVolume(ctx context.Context, volume *OsAgentVolume) error

type OsAgentVolume

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

func NewOsAgentVolume

func NewOsAgentVolume(volumeID, tenantUUID string, mounted bool, timeStamp *time.Time) *OsAgentVolume

NewOsAgentVolume returns a new volume if all fields are set.

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(versionOrDigest 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 SqliteAccess

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

func FakeMemoryDB

func FakeMemoryDB() *SqliteAccess

func (*SqliteAccess) DeleteDynakube

func (access *SqliteAccess) DeleteDynakube(ctx context.Context, dynakubeName string) error

DeleteDynakube deletes an existing Dynakube using its name

func (*SqliteAccess) DeleteVolume

func (access *SqliteAccess) DeleteVolume(ctx context.Context, volumeID string) error

DeleteVolume deletes a Volume by its ID

func (*SqliteAccess) GetAllDynakubes

func (access *SqliteAccess) GetAllDynakubes(ctx context.Context) ([]*Dynakube, error)

GetAllDynakubes gets all the Dynakubes from the database

func (*SqliteAccess) GetAllOsAgentVolumes

func (access *SqliteAccess) GetAllOsAgentVolumes(ctx context.Context) ([]*OsAgentVolume, error)

GetAllOsAgentVolumes gets all the OsAgentVolume from the database

func (*SqliteAccess) GetAllUsedVersions

func (access *SqliteAccess) GetAllUsedVersions(ctx context.Context) (map[string]bool, error)

GetUsedVersions gets all UNIQUE versions present in the `volumes` database in map. Map is used to make sure we don't return the same version multiple time, it's also easier to check if a version is in it or not. (a Set in style of Golang)

func (*SqliteAccess) GetAllVolumes

func (access *SqliteAccess) GetAllVolumes(ctx context.Context) ([]*Volume, error)

GetAllVolumes gets all the Volumes from the database

func (*SqliteAccess) GetDynakube

func (access *SqliteAccess) GetDynakube(ctx context.Context, dynakubeName string) (*Dynakube, error)

GetDynakube gets Dynakube using its name

func (*SqliteAccess) GetLatestVersions

func (access *SqliteAccess) GetLatestVersions(ctx context.Context) (map[string]bool, error)

GetLatestVersions gets all UNIQUE latestVersions present in the `dynakubes` database in map. Map is used to make sure we don't return the same version multiple time, it's also easier to check if a version is in it or not. (a Set in style of Golang)

func (*SqliteAccess) GetOsAgentVolumeViaTenantUUID

func (access *SqliteAccess) GetOsAgentVolumeViaTenantUUID(ctx context.Context, tenantUUID string) (*OsAgentVolume, error)

GetOsAgentVolumeViaTenantUUID gets an OsAgentVolume by its tenantUUID

func (*SqliteAccess) GetOsAgentVolumeViaVolumeID

func (access *SqliteAccess) GetOsAgentVolumeViaVolumeID(ctx context.Context, volumeID string) (*OsAgentVolume, error)

GetOsAgentVolumeViaVolumeID gets an OsAgentVolume by its VolumeID

func (*SqliteAccess) GetPodNames

func (access *SqliteAccess) GetPodNames(ctx context.Context) (map[string]string, error)

GetPodNames gets all PodNames present in the `volumes` database in map with their corresponding volumeIDs.

func (*SqliteAccess) GetTenantsToDynakubes

func (access *SqliteAccess) GetTenantsToDynakubes(ctx context.Context) (map[string]string, error)

GetTenantsToDynakubes gets all Dynakubes and maps their name to the corresponding TenantUUID.

func (*SqliteAccess) GetUsedImageDigests

func (access *SqliteAccess) GetUsedImageDigests(ctx context.Context) (map[string]bool, error)

GetUsedImageDigests gets all UNIQUE image digests present in the `dynakubes` database in a map. Map is used to make sure we don't return the same digest multiple time, it's also easier to check if a digest is in it or not. (a Set in style of Golang)

func (*SqliteAccess) GetUsedVersions

func (access *SqliteAccess) GetUsedVersions(ctx context.Context, tenantUUID string) (map[string]bool, error)

GetUsedVersions gets all UNIQUE versions present in the `volumes` for a given tenantUUID database in map. Map is used to make sure we don't return the same version multiple time, it's also easier to check if a version is in it or not. (a Set in style of Golang)

func (*SqliteAccess) GetVolume

func (access *SqliteAccess) GetVolume(ctx context.Context, volumeID string) (*Volume, error)

GetVolume gets Volume by its ID

func (*SqliteAccess) InsertDynakube

func (access *SqliteAccess) InsertDynakube(ctx context.Context, dynakube *Dynakube) error

InsertDynakube inserts a new Dynakube

func (*SqliteAccess) InsertOsAgentVolume

func (access *SqliteAccess) InsertOsAgentVolume(ctx context.Context, volume *OsAgentVolume) error

InsertOsAgentVolume inserts a new OsAgentVolume

func (*SqliteAccess) InsertVolume

func (access *SqliteAccess) InsertVolume(ctx context.Context, volume *Volume) error

InsertVolume inserts a new Volume

func (*SqliteAccess) IsImageDigestUsed

func (access *SqliteAccess) IsImageDigestUsed(ctx context.Context, imageDigest string) (bool, error)

IsImageDigestUsed checks if the specified image digest is present in the database.

func (*SqliteAccess) Setup

func (access *SqliteAccess) Setup(ctx context.Context, path string) error

Setup connects to the database and creates the necessary tables if they don't exist

func (*SqliteAccess) UpdateDynakube

func (access *SqliteAccess) UpdateDynakube(ctx context.Context, dynakube *Dynakube) error

UpdateDynakube updates an existing Dynakube by matching the name

func (*SqliteAccess) UpdateOsAgentVolume

func (access *SqliteAccess) UpdateOsAgentVolume(ctx context.Context, volume *OsAgentVolume) error

UpdateOsAgentVolume updates an existing OsAgentVolume by matching the tenantUUID

type Volume

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

func NewVolume

func NewVolume(id, podName, version, tenantUUID string, mountAttempts int) *Volume

NewVolume returns a new Volume if all fields (except version) are set.

Jump to

Keyboard shortcuts

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