ocistore

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: Apache-2.0 Imports: 48 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")
)

Functions

This section is empty.

Types

type OCIStore

type OCIStore struct {
	BaseURI   string
	PlainHTTP bool
}

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

func StoreFromEnv

func StoreFromEnv() OCIStore

func (OCIStore) AddAppToAllDownstreams

func (s OCIStore) AddAppToAllDownstreams(appID string) 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) (*apptypes.App, error)

func (OCIStore) CreateAppVersion

func (s OCIStore) CreateAppVersion(appID string, currentSequence *int64, filesInDir string, source string, skipPreflights bool, gitops gitopstypes.DownstreamGitOps) (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) CreateNewCluster

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

func (OCIStore) CreatePendingSupportBundle

func (s OCIStore) CreatePendingSupportBundle(id string, appID string, clusterID string) 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) DeletePendingScheduledInstanceSnapshots

func (c OCIStore) DeletePendingScheduledInstanceSnapshots(clusterID string) error

func (OCIStore) DeletePendingScheduledSnapshots

func (c OCIStore) DeletePendingScheduledSnapshots(appID string) error

func (OCIStore) DeletePendingSupportBundle added in v1.32.0

func (s OCIStore) DeletePendingSupportBundle(id string) error

func (OCIStore) DeleteSession

func (s OCIStore) DeleteSession(id string) 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) GetAppStatus

func (s OCIStore) GetAppStatus(appID string) (*appstatustypes.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) GetAppVersionsAfter

func (s OCIStore) GetAppVersionsAfter(appID string, sequence int64) ([]*versiontypes.AppVersion, error)

func (OCIStore) GetClientset

func (c OCIStore) GetClientset() (*kubernetes.Clientset, 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) GetDownstream

func (c OCIStore) GetDownstream(clusterID string) (*downstreamtypes.Downstream, 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) 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) 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) 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) GetTaskStatus

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

func (OCIStore) Init

func (s OCIStore) Init() 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) 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) ListPendingSupportBundlesForApp

func (s OCIStore) ListPendingSupportBundlesForApp(appID string) ([]*supportbundletypes.PendingSupportBundle, 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) 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) 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) UpdateAppLicense

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

func (OCIStore) UpdateRegistry

func (s OCIStore) UpdateRegistry(appID string, hostname string, username string, password string, namespace string) 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) UpdateTaskStatusTimestamp

func (s OCIStore) UpdateTaskStatusTimestamp(id string) 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