ocistore

package
v1.68.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: Apache-2.0 Imports: 51 Imported by: 0

README

ocistore

The OCIStore uses an OCI-compatible image registry for persistent storage. In addition, this store stores some data in Kubernetes objects (secrets, configmaps).

Kubernetes Objects

To enable this store to function quickly, some data is stored in the cluster.

Design goals

This store must use a fixed number of configmaps and secrets per application stored, and the number will not scale with the number of versions of an app, time that an application has been running, or any other metric that's not controlled by the end user.

Activity on an application must not increase the number of objects stored in the cluster.

The store must be safe to operate with multiple replicas reading AND writing to the objects.

Sensitive data must be stored in secrets, while non sensitive data is stored in configmaps.

Use of ephemeral storage in the pod is limited and discouraged.

Documentation

Index

Constants

View Source
const (
	AppListConfigmapName        = "kotsadm-apps"
	AppDownstreamsConfigMapName = "kotsadm-appdownstreams"
)
View Source
const (
	ClusterListConfigmapName = "kotsadm-clusters"
	ClusterDeployTokenSecret = "kotsadm-clustertokens"
)
View Source
const (
	AppVersionConfigmapPrefix = "kotsadm-appversion-"
)
View Source
const (
	PendingInstallationsConfigMapName = "kotsadm-pendinginstallation"
)
View Source
const (
	SessionSecretName = "kotsadm-sessions"
)
View Source
const (
	TaskStatusConfigMapName = `kotsadm-tasks`
)

Variables

View Source
var (
	ErrNotFound       = errors.New("not found")
	ErrNotImplemented = errors.New("not implemented in ocistore")
)

OCIStore stores most data in an OCI compatible image repository,

but does not make guarantees that every thing is stored there.
Some data is stored locally in Kuberntes ConfigMaps and Secrets
to speed up retrieval

A note about "transactions": in the pg store, there were a few
places that relied on transactions to ensure integrity
Here, this is stored in configmaps and secrets, and this inegrity
is provided by the Kubernetes API's enforcement of puts.
If a caller GETs a configmap, updates it and then tries to PUT that
configmap, but another process has modified it, the PUT will
be rejected. This level of consistency is all that's needed for KOTS

Functions

This section is empty.

Types

type OCIStore

type OCIStore struct {
	BaseURI   string
	PlainHTTP bool
	// contains filtered or unexported fields
}

func StoreFromEnv

func StoreFromEnv() *OCIStore

func (*OCIStore) AddAppToAllDownstreams

func (s *OCIStore) AddAppToAllDownstreams(appID string) error

func (*OCIStore) AddDownstreamVersionDetails added in v1.68.0

func (s *OCIStore) AddDownstreamVersionDetails(appID string, clusterID string, version *downstreamtypes.DownstreamVersion, checkIfDeployable bool) error

func (*OCIStore) AddDownstreamVersionsDetails added in v1.68.0

func (s *OCIStore) AddDownstreamVersionsDetails(appID string, clusterID string, versions []*downstreamtypes.DownstreamVersion, checkIfDeployable bool) error

func (*OCIStore) ClearTaskStatus

func (s *OCIStore) ClearTaskStatus(id string) error

func (*OCIStore) CreateApp

func (s *OCIStore) CreateApp(name string, upstreamURI string, licenseData string, isAirgapEnabled bool, skipImagePush bool, registryIsReadOnly bool) (*apptypes.App, error)

func (*OCIStore) CreateAppVersion

func (s *OCIStore) CreateAppVersion(appID string, baseSequence *int64, filesInDir string, source string, skipPreflights bool, gitops gitopstypes.DownstreamGitOps, renderer rendertypes.Renderer) (int64, error)

func (*OCIStore) CreateAppVersionArchive

func (s *OCIStore) CreateAppVersionArchive(appID string, sequence int64, archivePath string) error

CreateAppVersion takes an unarchived app, makes an archive and then uploads it to s3 with the appID and sequence specified

func (*OCIStore) CreateInProgressSupportBundle added in v1.41.0

func (s *OCIStore) CreateInProgressSupportBundle(supportBundle *supportbundletypes.SupportBundle) error

func (*OCIStore) CreateNewCluster

func (s *OCIStore) CreateNewCluster(userID string, isAllUsers bool, title string, token string) (string, error)

func (*OCIStore) CreatePendingDownloadAppVersion added in v1.65.0

func (s *OCIStore) CreatePendingDownloadAppVersion(appID string, update upstreamtypes.Update, kotsApplication *kotsv1beta1.Application, license *kotsv1beta1.License) (int64, error)

func (OCIStore) CreateScheduledInstanceSnapshot

func (c OCIStore) CreateScheduledInstanceSnapshot(snapshotID string, clusterID string, timestamp time.Time) error

func (OCIStore) CreateScheduledSnapshot

func (c OCIStore) CreateScheduledSnapshot(snapshotID string, appID string, timestamp time.Time) error

func (*OCIStore) CreateSession

func (s *OCIStore) CreateSession(forUser *usertypes.User, issuedAt time.Time, expiresAt time.Time, roles []string) (*sessiontypes.Session, error)

func (*OCIStore) CreateSupportBundle

func (s *OCIStore) CreateSupportBundle(id string, appID string, archivePath string, marshalledTree []byte) (*supportbundletypes.SupportBundle, error)

func (*OCIStore) DeleteDownstreamDeployStatus added in v1.40.0

func (s *OCIStore) DeleteDownstreamDeployStatus(appID string, clusterID string, sequence int64) error

func (OCIStore) DeletePendingScheduledInstanceSnapshots

func (c OCIStore) DeletePendingScheduledInstanceSnapshots(clusterID string) error

func (OCIStore) DeletePendingScheduledSnapshots

func (c OCIStore) DeletePendingScheduledSnapshots(appID string) error

func (*OCIStore) DeleteSession

func (s *OCIStore) DeleteSession(id string) error

func (*OCIStore) FindDownstreamVersions added in v1.68.0

func (s *OCIStore) FindDownstreamVersions(appID string, downloadedOnly bool) (*downstreamtypes.DownstreamVersions, error)

func (*OCIStore) FlagInvalidPassword added in v1.50.0

func (s *OCIStore) FlagInvalidPassword() error

func (*OCIStore) FlagSuccessfulLogin added in v1.50.0

func (s *OCIStore) FlagSuccessfulLogin() error

func (*OCIStore) GetAirgapInstallStatus

func (s *OCIStore) GetAirgapInstallStatus(appID string) (*airgaptypes.InstallStatus, error)

func (*OCIStore) GetAllAppLicenses

func (s *OCIStore) GetAllAppLicenses() ([]*kotsv1beta1.License, error)

func (*OCIStore) GetApp

func (s *OCIStore) GetApp(id string) (*apptypes.App, error)

func (*OCIStore) GetAppFromSlug

func (s *OCIStore) GetAppFromSlug(slug string) (*apptypes.App, error)

func (*OCIStore) GetAppIDFromSlug

func (s *OCIStore) GetAppIDFromSlug(slug string) (string, error)

func (*OCIStore) GetAppIDsFromRegistry added in v1.50.0

func (s *OCIStore) GetAppIDsFromRegistry(hostname string) ([]string, error)

func (*OCIStore) GetAppStatus

func (s *OCIStore) GetAppStatus(appID string) (*appstatetypes.AppStatus, error)

func (*OCIStore) GetAppVersion

func (s *OCIStore) GetAppVersion(appID string, sequence int64) (*versiontypes.AppVersion, error)

func (*OCIStore) GetAppVersionArchive

func (s *OCIStore) GetAppVersionArchive(appID string, sequence int64, dstPath string) error

GetAppVersionArchive will fetch the archive and return a string that contains a directory name where it's extracted into

func (*OCIStore) GetAppVersionBaseArchive added in v1.58.0

func (s *OCIStore) GetAppVersionBaseArchive(appID string, versionLabel string) (string, int64, error)

func (*OCIStore) GetAppVersionBaseSequence added in v1.58.0

func (s *OCIStore) GetAppVersionBaseSequence(appID string, versionLabel string) (int64, error)

func (*OCIStore) GetClusterIDFromDeployToken

func (s *OCIStore) GetClusterIDFromDeployToken(deployToken string) (string, error)

func (*OCIStore) GetClusterIDFromSlug

func (s *OCIStore) GetClusterIDFromSlug(slug string) (string, error)

func (*OCIStore) GetCurrentDownstreamSequence added in v1.68.0

func (s *OCIStore) GetCurrentDownstreamSequence(appID string, clusterID string) (int64, error)

func (*OCIStore) GetCurrentDownstreamVersion added in v1.68.0

func (s *OCIStore) GetCurrentDownstreamVersion(appID string, clusterID string) (*downstreamtypes.DownstreamVersion, error)

func (*OCIStore) GetCurrentParentSequence added in v1.40.0

func (s *OCIStore) GetCurrentParentSequence(appID string, clusterID string) (int64, error)

func (*OCIStore) GetCurrentUpdateCursor added in v1.58.0

func (s *OCIStore) GetCurrentUpdateCursor(appID string, channelID string) (string, string, bool, error)

func (OCIStore) GetDownstream

func (c OCIStore) GetDownstream(clusterID string) (*downstreamtypes.Downstream, error)

func (*OCIStore) GetDownstreamOutput added in v1.40.0

func (s *OCIStore) GetDownstreamOutput(appID string, clusterID string, sequence int64) (*downstreamtypes.DownstreamOutput, error)

func (*OCIStore) GetDownstreamVersion added in v1.68.0

func (s *OCIStore) GetDownstreamVersion(appID string, clusterID string, sequence int64) (*downstreamtypes.DownstreamVersion, error)

func (*OCIStore) GetDownstreamVersionHistory added in v1.68.0

func (s *OCIStore) GetDownstreamVersionHistory(appID string, clusterID string, currentPage int, pageSize int, pinLatest bool) ([]*downstreamtypes.DownstreamVersion, error)

func (*OCIStore) GetDownstreamVersionStatus added in v1.40.0

func (s *OCIStore) GetDownstreamVersionStatus(appID string, sequence int64) (types.DownstreamVersionStatus, error)

func (*OCIStore) GetDownstreamVersions added in v1.68.0

func (s *OCIStore) GetDownstreamVersions(appID string, clusterID string, downloadedOnly bool) (*downstreamtypes.DownstreamVersions, error)

func (*OCIStore) GetEmbeddedClusterAuthToken added in v1.50.0

func (s *OCIStore) GetEmbeddedClusterAuthToken() (string, error)

func (*OCIStore) GetIgnoreRBACErrors added in v1.40.0

func (s *OCIStore) GetIgnoreRBACErrors(appID string, sequence int64) (bool, error)

func (*OCIStore) GetLatestAppSequence added in v1.68.0

func (s *OCIStore) GetLatestAppSequence(appID string, downloadedOnly bool) (int64, error)

func (*OCIStore) GetLatestLicenseForApp

func (s *OCIStore) GetLatestLicenseForApp(appID string) (*kotsv1beta1.License, error)

func (*OCIStore) GetLicenseForAppVersion

func (s *OCIStore) GetLicenseForAppVersion(appID string, sequence int64) (*kotsv1beta1.License, error)

func (*OCIStore) GetNextAppSequence added in v1.58.0

func (s *OCIStore) GetNextAppSequence(appID string) (int64, error)

func (*OCIStore) GetNextDownstreamVersion added in v1.68.0

func (s *OCIStore) GetNextDownstreamVersion(appID string, clusterID string) (nextVersion *downstreamtypes.DownstreamVersion, numOfSkippedVersions int, numOfRemainingVersions int, finalError error)

func (*OCIStore) GetParentSequenceForSequence added in v1.40.0

func (s *OCIStore) GetParentSequenceForSequence(appID string, clusterID string, sequence int64) (int64, error)

func (*OCIStore) GetPendingAirgapUploadApp

func (s *OCIStore) GetPendingAirgapUploadApp() (*airgaptypes.PendingApp, error)

func (*OCIStore) GetPendingInstallationStatus

func (s *OCIStore) GetPendingInstallationStatus() (*installationtypes.InstallStatus, error)

func (*OCIStore) GetPreflightProgress added in v1.35.0

func (s *OCIStore) GetPreflightProgress(appID string, sequence int64) (string, error)

func (*OCIStore) GetPreflightResults

func (s *OCIStore) GetPreflightResults(appID string, sequence int64) (*preflighttypes.PreflightResult, error)

func (*OCIStore) GetPreviouslyDeployedSequence added in v1.40.0

func (s *OCIStore) GetPreviouslyDeployedSequence(appID string, clusterID string) (int64, error)

func (*OCIStore) GetPrometheusAddress

func (s *OCIStore) GetPrometheusAddress() (string, error)

func (*OCIStore) GetRedactions

func (s *OCIStore) GetRedactions(bundleID string) (troubleshootredact.RedactionList, error)

func (*OCIStore) GetRegistryDetailsForApp

func (s *OCIStore) GetRegistryDetailsForApp(appID string) (registrytypes.RegistrySettings, error)

func (*OCIStore) GetSession

func (s *OCIStore) GetSession(id string) (*sessiontypes.Session, error)

func (*OCIStore) GetSharedPasswordBcrypt added in v1.50.0

func (s *OCIStore) GetSharedPasswordBcrypt() ([]byte, error)

func (*OCIStore) GetStatusForVersion added in v1.40.0

func (s *OCIStore) GetStatusForVersion(appID string, clusterID string, sequence int64) (types.DownstreamVersionStatus, error)

func (*OCIStore) GetSupportBundle

func (s *OCIStore) GetSupportBundle(id string) (*supportbundletypes.SupportBundle, error)

func (*OCIStore) GetSupportBundleAnalysis

func (s *OCIStore) GetSupportBundleAnalysis(id string) (*supportbundletypes.SupportBundleAnalysis, error)

func (*OCIStore) GetSupportBundleArchive

func (s *OCIStore) GetSupportBundleArchive(bundleID string) (string, error)

GetSupportBundle will fetch the bundle archive and return a path to where it is stored. The caller is responsible for deleting.

func (*OCIStore) GetSupportBundleSpecForApp

func (s *OCIStore) GetSupportBundleSpecForApp(id string) (string, error)

func (*OCIStore) GetTargetKotsVersionForVersion added in v1.62.0

func (s *OCIStore) GetTargetKotsVersionForVersion(appID string, sequence int64) (string, error)

func (*OCIStore) GetTaskStatus

func (s *OCIStore) GetTaskStatus(id string) (string, string, error)

func (*OCIStore) HasStrictPreflights added in v1.67.0

func (s *OCIStore) HasStrictPreflights(appID string, sequence int64) (bool, error)

func (*OCIStore) Init

func (s *OCIStore) Init() error

func (*OCIStore) IsAppVersionDeployable added in v1.68.0

func (s *OCIStore) IsAppVersionDeployable(appID string, sequence int64) (bool, string, error)

func (*OCIStore) IsDownstreamDeploySuccessful added in v1.40.0

func (s *OCIStore) IsDownstreamDeploySuccessful(appID string, clusterID string, sequence int64) (bool, error)

func (OCIStore) IsGitOpsEnabledForApp

func (c OCIStore) IsGitOpsEnabledForApp(appID string) (bool, error)

func (*OCIStore) IsIdentityServiceSupportedForVersion

func (s *OCIStore) IsIdentityServiceSupportedForVersion(appID string, sequence int64) (bool, error)

func (*OCIStore) IsKotsadmIDGenerated

func (s *OCIStore) IsKotsadmIDGenerated() (bool, error)

func (*OCIStore) IsNotFound

func (s *OCIStore) IsNotFound(err error) bool

func (*OCIStore) IsRollbackSupportedForVersion

func (s *OCIStore) IsRollbackSupportedForVersion(appID string, sequence int64) (bool, error)

func (*OCIStore) IsSnapshotsSupportedForVersion

func (s *OCIStore) IsSnapshotsSupportedForVersion(a *apptypes.App, sequence int64, renderer rendertypes.Renderer) (bool, error)

func (*OCIStore) ListAppsForDownstream

func (s *OCIStore) ListAppsForDownstream(clusterID string) ([]*apptypes.App, error)

func (*OCIStore) ListClusters

func (s *OCIStore) ListClusters() ([]*downstreamtypes.Downstream, error)

func (*OCIStore) ListDownstreamsForApp

func (s *OCIStore) ListDownstreamsForApp(appID string) ([]downstreamtypes.Downstream, error)

func (*OCIStore) ListFailedApps added in v1.65.1

func (s *OCIStore) ListFailedApps() ([]*apptypes.App, error)

func (*OCIStore) ListInstalledAppSlugs

func (s *OCIStore) ListInstalledAppSlugs() ([]string, error)

func (*OCIStore) ListInstalledApps

func (s *OCIStore) ListInstalledApps() ([]*apptypes.App, error)

func (OCIStore) ListPendingScheduledInstanceSnapshots

func (c OCIStore) ListPendingScheduledInstanceSnapshots(clusterID string) ([]snapshottypes.ScheduledInstanceSnapshot, error)

func (OCIStore) ListPendingScheduledSnapshots

func (c OCIStore) ListPendingScheduledSnapshots(appID string) ([]snapshottypes.ScheduledSnapshot, error)

func (*OCIStore) ListSupportBundles

func (s *OCIStore) ListSupportBundles(appID string) ([]*supportbundletypes.SupportBundle, error)

func (*OCIStore) RemoveApp

func (s *OCIStore) RemoveApp(appID string) error

func (*OCIStore) ResetAirgapInstallInProgress

func (s *OCIStore) ResetAirgapInstallInProgress(appID string) error

func (*OCIStore) ResetPreflightResults

func (s *OCIStore) ResetPreflightResults(appID string, sequence int64) error

func (OCIStore) RunMigrations

func (_ OCIStore) RunMigrations()

func (*OCIStore) SetAppChannelChanged added in v1.58.0

func (s *OCIStore) SetAppChannelChanged(appID string, channelChanged bool) error

func (*OCIStore) SetAppInstallState

func (s *OCIStore) SetAppInstallState(appID string, state string) error

func (*OCIStore) SetAppIsAirgap

func (s *OCIStore) SetAppIsAirgap(appID string, isAirgap bool) error

func (*OCIStore) SetAppStatus added in v1.35.0

func (s *OCIStore) SetAppStatus(appID string, resourceStates appstatetypes.ResourceStates, updatedAt time.Time, sequence int64) error

func (OCIStore) SetAutoDeploy added in v1.67.0

func (c OCIStore) SetAutoDeploy(appID string, autoDeploy apptypes.AutoDeploy) error

func (*OCIStore) SetDownstreamVersionStatus added in v1.68.0

func (s *OCIStore) SetDownstreamVersionStatus(appID string, sequence int64, status types.DownstreamVersionStatus, statusInfo string) error

func (*OCIStore) SetEmbeddedClusterAuthToken added in v1.50.0

func (s *OCIStore) SetEmbeddedClusterAuthToken(token string) error

func (*OCIStore) SetIgnorePreflightPermissionErrors

func (s *OCIStore) SetIgnorePreflightPermissionErrors(appID string, sequence int64) error

func (*OCIStore) SetInstanceSnapshotSchedule

func (s *OCIStore) SetInstanceSnapshotSchedule(clusterID string, snapshotSchedule string) error

func (*OCIStore) SetInstanceSnapshotTTL

func (s *OCIStore) SetInstanceSnapshotTTL(clusterID string, snapshotTTL string) error

func (*OCIStore) SetIsKotsadmIDGenerated

func (s *OCIStore) SetIsKotsadmIDGenerated() error

func (*OCIStore) SetPreflightProgress added in v1.35.0

func (s *OCIStore) SetPreflightProgress(appID string, sequence int64, progress string) error

func (*OCIStore) SetPreflightResults

func (s *OCIStore) SetPreflightResults(appID string, sequence int64, results []byte) error

func (*OCIStore) SetPrometheusAddress

func (s *OCIStore) SetPrometheusAddress(address string) error

func (*OCIStore) SetRedactions

func (s *OCIStore) SetRedactions(bundleID string, redacts troubleshootredact.RedactionList) error

func (OCIStore) SetSnapshotSchedule

func (c OCIStore) SetSnapshotSchedule(appID string, snapshotSchedule string) error

func (OCIStore) SetSnapshotTTL

func (c OCIStore) SetSnapshotTTL(appID string, snapshotTTL string) error

func (*OCIStore) SetSupportBundleAnalysis

func (s *OCIStore) SetSupportBundleAnalysis(id string, insights []byte) error

func (*OCIStore) SetTaskStatus

func (s *OCIStore) SetTaskStatus(id string, message string, status string) error

func (OCIStore) SetUpdateCheckerSpec

func (c OCIStore) SetUpdateCheckerSpec(appID string, updateCheckerSpec string) error

func (*OCIStore) TotalNumOfDownstreamVersions added in v1.68.0

func (s *OCIStore) TotalNumOfDownstreamVersions(appID string, clusterID string, downloadedOnly bool) (int64, error)

func (*OCIStore) UpdateAppLicense

func (s *OCIStore) UpdateAppLicense(appID string, sequence int64, archiveDir string, newLicense *kotsv1beta1.License, originalLicenseData string, channelChanged bool, failOnVersionCreate bool, gitops gitopstypes.DownstreamGitOps, renderer rendertypes.Renderer) (int64, error)

func (*OCIStore) UpdateAppLicenseSyncNow added in v1.54.0

func (s *OCIStore) UpdateAppLicenseSyncNow(appID string) error

func (*OCIStore) UpdateAppVersion added in v1.65.0

func (s *OCIStore) UpdateAppVersion(appID string, sequence int64, baseSequence *int64, filesInDir string, source string, skipPreflights bool, gitops gitopstypes.DownstreamGitOps, render rendertypes.Renderer) error

func (*OCIStore) UpdateAppVersionInstallationSpec added in v1.50.0

func (s *OCIStore) UpdateAppVersionInstallationSpec(appID string, sequence int64, installation kotsv1beta1.Installation) error

func (*OCIStore) UpdateDownstreamDeployStatus added in v1.40.0

func (s *OCIStore) UpdateDownstreamDeployStatus(appID string, clusterID string, sequence int64, isError bool, output downstreamtypes.DownstreamOutput) error

func (*OCIStore) UpdateNextAppVersionDiffSummary added in v1.65.0

func (s *OCIStore) UpdateNextAppVersionDiffSummary(appID string, baseSequence int64) error

func (*OCIStore) UpdateRegistry

func (s *OCIStore) UpdateRegistry(appID string, hostname string, username string, password string, namespace string, isReadOnly bool) error

func (OCIStore) UpdateScheduledInstanceSnapshot

func (c OCIStore) UpdateScheduledInstanceSnapshot(snapshotID string, backupName string) error

func (OCIStore) UpdateScheduledSnapshot

func (c OCIStore) UpdateScheduledSnapshot(snapshotID string, backupName string) error

func (*OCIStore) UpdateSupportBundle added in v1.41.0

func (s *OCIStore) UpdateSupportBundle(bundle *supportbundletypes.SupportBundle) error

func (*OCIStore) UpdateTaskStatusTimestamp

func (s *OCIStore) UpdateTaskStatusTimestamp(id string) error

func (*OCIStore) UploadSupportBundle added in v1.41.0

func (s *OCIStore) UploadSupportBundle(bundleID string, archivePath string, marshalledTree []byte) error

func (*OCIStore) WaitForReady

func (s *OCIStore) WaitForReady(ctx context.Context) error

Jump to

Keyboard shortcuts

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