metadata

package
v1.3.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 17 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)
	GetAllAppMounts(ctx context.Context) []*Volume
	DeleteAppMount(ctx context.Context, appMountName string) 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) DeleteAppMount added in v1.2.0

func (f *FakeFailDB) DeleteAppMount(_ context.Context, _ string) error

func (*FakeFailDB) DeleteDynakube

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

func (*FakeFailDB) DeleteVolume

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

func (*FakeFailDB) GetAllAppMounts added in v1.2.2

func (f *FakeFailDB) GetAllAppMounts(_ context.Context) []*Volume

func (*FakeFailDB) GetAllDynakubes

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

func (*FakeFailDB) GetAllOsAgentVolumes

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

func (*FakeFailDB) GetAllUsedVersions

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

func (*FakeFailDB) GetAllVolumes

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

func (*FakeFailDB) GetDynakube

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

func (*FakeFailDB) GetLatestVersions

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

func (*FakeFailDB) GetOsAgentVolumeViaTenantUUID

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

func (*FakeFailDB) GetOsAgentVolumeViaVolumeID

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

func (*FakeFailDB) GetPodNames

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

func (*FakeFailDB) GetTenantsToDynakubes

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

func (*FakeFailDB) GetUsedImageDigests

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

func (*FakeFailDB) GetUsedVersions

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

func (*FakeFailDB) GetVolume

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

func (*FakeFailDB) InsertDynakube

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

func (*FakeFailDB) InsertOsAgentVolume

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

func (*FakeFailDB) InsertVolume

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

func (*FakeFailDB) IsImageDigestUsed

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

func (*FakeFailDB) Setup

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

func (*FakeFailDB) UpdateDynakube

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

func (*FakeFailDB) UpdateOsAgentVolume

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

type OsAgentVolume

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

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) DeleteAppMount added in v1.2.2

func (access *SqliteAccess) DeleteAppMount(ctx context.Context, appMountID string) error

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) GetAllAppMounts added in v1.2.2

func (access *SqliteAccess) GetAllAppMounts(ctx context.Context) []*Volume

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