kotsstore

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 71 Imported by: 0

README

kotsstore

This backing store uses S3 for application archives and support bundles. In addition, this store uses postgres for storage of all metadata and cache. There are some scenarios where this store uses the local Kubernetes cluster for storing some sensitive information (gitops, etc).

This is progressively migrating away from S3 and PG and into k8s native storage components.

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 (
	SessionSecretName = "kotsadm-sessions"
)
View Source
const (
	TaskStatusConfigMapName = `kotsadm-tasks`
)

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)
View Source
var (
	KotsadmIDConfigMapName = "kotsadm-id"
)

Functions

func CreateKotsadmIDConfigMap added in v1.31.0

func CreateKotsadmIDConfigMap(kotsadmID string) error

CreateKotsadmIDConfigMap creates an id for an kotsadm instance and stores in configmap

func IsKotsadmIDConfigMapPresent added in v1.31.0

func IsKotsadmIDConfigMapPresent() (bool, error)

IsKotsadmIDConfigMapPresent checks if the configmap for kotsadm-id exists

func UpdateKotsadmIDConfigMap added in v1.31.0

func UpdateKotsadmIDConfigMap(kotsadmID string) error

UpdateKotsadmIDConfigMap creates an id for an kotsadm instance and stores in configmap

Types

type KOTSStore

type KOTSStore struct {
}

func (KOTSStore) AddAppToAllDownstreams

func (s KOTSStore) AddAppToAllDownstreams(appID string) error

func (KOTSStore) ClearTaskStatus

func (s KOTSStore) ClearTaskStatus(id string) error

func (KOTSStore) CreateApp

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

func (KOTSStore) CreateAppVersion

func (s KOTSStore) CreateAppVersion(appID string, currentSequence *int64, filesInDir string, source string, skipPreflights bool, gitops gitopstypes.DownstreamGitOps) (int64, error)

func (KOTSStore) CreateAppVersionArchive

func (s KOTSStore) 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 (KOTSStore) CreateNewCluster

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

func (KOTSStore) CreatePendingSupportBundle added in v1.31.0

func (s KOTSStore) CreatePendingSupportBundle(id string, appID string, clusterID string) error

func (KOTSStore) CreateScheduledInstanceSnapshot

func (s KOTSStore) CreateScheduledInstanceSnapshot(id string, clusterID string, timestamp time.Time) error

func (KOTSStore) CreateScheduledSnapshot

func (s KOTSStore) CreateScheduledSnapshot(id string, appID string, timestamp time.Time) error

func (KOTSStore) CreateSession

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

func (KOTSStore) CreateSupportBundle

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

func (KOTSStore) DeletePendingScheduledInstanceSnapshots

func (s KOTSStore) DeletePendingScheduledInstanceSnapshots(clusterID string) error

func (KOTSStore) DeletePendingScheduledSnapshots

func (s KOTSStore) DeletePendingScheduledSnapshots(appID string) error

func (KOTSStore) DeletePendingSupportBundle added in v1.32.0

func (s KOTSStore) DeletePendingSupportBundle(id string) error

func (KOTSStore) DeleteSession

func (s KOTSStore) DeleteSession(id string) error

func (KOTSStore) GetAirgapInstallStatus

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

func (KOTSStore) GetAllAppLicenses

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

func (KOTSStore) GetApp

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

func (KOTSStore) GetAppFromSlug

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

func (KOTSStore) GetAppIDFromSlug

func (s KOTSStore) GetAppIDFromSlug(slug string) (string, error)

func (KOTSStore) GetAppStatus

func (s KOTSStore) GetAppStatus(appID string) (*appstatustypes.AppStatus, error)

func (KOTSStore) GetAppVersion

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

func (KOTSStore) GetAppVersionArchive

func (s KOTSStore) 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 (KOTSStore) GetAppVersionsAfter added in v1.31.0

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

func (KOTSStore) GetClientset added in v1.31.0

func (c KOTSStore) GetClientset() (*kubernetes.Clientset, error)

func (KOTSStore) GetClusterIDFromDeployToken

func (s KOTSStore) GetClusterIDFromDeployToken(deployToken string) (string, error)

func (KOTSStore) GetClusterIDFromSlug

func (s KOTSStore) GetClusterIDFromSlug(slug string) (string, error)

func (KOTSStore) GetDownstream

func (s KOTSStore) GetDownstream(clusterID string) (*downstreamtypes.Downstream, error)

func (KOTSStore) GetLatestLicenseForApp

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

func (KOTSStore) GetLatestPreflightResultsForSequenceZero added in v1.31.0

func (s KOTSStore) GetLatestPreflightResultsForSequenceZero() (*preflighttypes.PreflightResult, error)

func (KOTSStore) GetLicenseForAppVersion

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

func (KOTSStore) GetPendingAirgapUploadApp

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

func (KOTSStore) GetPendingInstallationStatus

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

func (KOTSStore) GetPreflightResults

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

func (KOTSStore) GetPrometheusAddress

func (s KOTSStore) GetPrometheusAddress() (string, error)

func (KOTSStore) GetRedactions

func (s KOTSStore) GetRedactions(id string) (troubleshootredact.RedactionList, error)

func (KOTSStore) GetRegistryDetailsForApp

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

func (KOTSStore) GetReportingInfo added in v1.31.0

func (s KOTSStore) GetReportingInfo(appID string) *upstreamtypes.ReportingInfo

func (KOTSStore) GetSession

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

func (KOTSStore) GetSupportBundle

func (s KOTSStore) GetSupportBundle(id string) (*types.SupportBundle, error)

func (KOTSStore) GetSupportBundleAnalysis

func (s KOTSStore) GetSupportBundleAnalysis(id string) (*types.SupportBundleAnalysis, error)

func (KOTSStore) GetSupportBundleArchive

func (s KOTSStore) 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 (KOTSStore) GetSupportBundleSpecForApp added in v1.31.0

func (s KOTSStore) GetSupportBundleSpecForApp(id string) (string, error)

func (KOTSStore) GetTaskStatus

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

func (KOTSStore) Init

func (s KOTSStore) Init() error

func (KOTSStore) IsGitOpsEnabledForApp

func (s KOTSStore) IsGitOpsEnabledForApp(appID string) (bool, error)

func (KOTSStore) IsIdentityServiceSupportedForVersion

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

func (KOTSStore) IsKotsadmIDGenerated

func (s KOTSStore) IsKotsadmIDGenerated() (bool, error)

IsKotsadmIDGenerated retrieves the id of kotsadm if the pod is already

func (KOTSStore) IsNotFound

func (s KOTSStore) IsNotFound(err error) bool

func (KOTSStore) IsRollbackSupportedForVersion

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

func (KOTSStore) IsSnapshotsSupportedForVersion

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

func (KOTSStore) ListAppsForDownstream

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

func (KOTSStore) ListClusters

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

func (KOTSStore) ListDownstreamsForApp

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

func (KOTSStore) ListInstalledAppSlugs

func (s KOTSStore) ListInstalledAppSlugs() ([]string, error)

func (KOTSStore) ListInstalledApps

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

func (KOTSStore) ListPendingScheduledInstanceSnapshots

func (s KOTSStore) ListPendingScheduledInstanceSnapshots(clusterID string) ([]snapshottypes.ScheduledInstanceSnapshot, error)

func (KOTSStore) ListPendingScheduledSnapshots

func (s KOTSStore) ListPendingScheduledSnapshots(appID string) ([]snapshottypes.ScheduledSnapshot, error)

func (KOTSStore) ListPendingSupportBundlesForApp added in v1.31.0

func (s KOTSStore) ListPendingSupportBundlesForApp(appID string) ([]*types.PendingSupportBundle, error)

func (KOTSStore) ListSupportBundles

func (s KOTSStore) ListSupportBundles(appID string) ([]*types.SupportBundle, error)

func (KOTSStore) RemoveApp

func (s KOTSStore) RemoveApp(appID string) error

func (KOTSStore) ResetAirgapInstallInProgress

func (s KOTSStore) ResetAirgapInstallInProgress(appID string) error

func (KOTSStore) ResetPreflightResults

func (s KOTSStore) ResetPreflightResults(appID string, sequence int64) error

func (KOTSStore) RunMigrations

func (s KOTSStore) RunMigrations()

func (KOTSStore) SetAppInstallState

func (s KOTSStore) SetAppInstallState(appID string, state string) error

func (KOTSStore) SetAppIsAirgap

func (s KOTSStore) SetAppIsAirgap(appID string, isAirgap bool) error

func (KOTSStore) SetIgnorePreflightPermissionErrors

func (s KOTSStore) SetIgnorePreflightPermissionErrors(appID string, sequence int64) error

func (KOTSStore) SetInstanceSnapshotSchedule

func (s KOTSStore) SetInstanceSnapshotSchedule(clusterID string, snapshotSchedule string) error

func (KOTSStore) SetInstanceSnapshotTTL

func (s KOTSStore) SetInstanceSnapshotTTL(clusterID string, snapshotTTL string) error

func (KOTSStore) SetIsKotsadmIDGenerated

func (s KOTSStore) SetIsKotsadmIDGenerated() error

SetIsKotsadmIDGenerated sets the status to true if the pod is starting for the first time

func (KOTSStore) SetPreflightResults

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

func (KOTSStore) SetPrometheusAddress

func (s KOTSStore) SetPrometheusAddress(address string) error

func (KOTSStore) SetRedactions

func (s KOTSStore) SetRedactions(id string, redacts troubleshootredact.RedactionList) error

func (KOTSStore) SetSnapshotSchedule

func (s KOTSStore) SetSnapshotSchedule(appID string, snapshotSchedule string) error

func (KOTSStore) SetSnapshotTTL

func (s KOTSStore) SetSnapshotTTL(appID string, snapshotTTL string) error

func (KOTSStore) SetSupportBundleAnalysis

func (s KOTSStore) SetSupportBundleAnalysis(id string, results []byte) error

func (KOTSStore) SetTaskStatus

func (s KOTSStore) SetTaskStatus(id string, message string, status string) error

func (KOTSStore) SetUpdateCheckerSpec

func (s KOTSStore) SetUpdateCheckerSpec(appID string, updateCheckerSpec string) error

func (KOTSStore) UpdateAppLicense

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

func (KOTSStore) UpdateRegistry

func (s KOTSStore) UpdateRegistry(appID string, hostname string, username string, password string, namespace string) error

func (KOTSStore) UpdateScheduledInstanceSnapshot

func (s KOTSStore) UpdateScheduledInstanceSnapshot(snapshotID string, backupName string) error

func (KOTSStore) UpdateScheduledSnapshot

func (s KOTSStore) UpdateScheduledSnapshot(snapshotID string, backupName string) error

func (KOTSStore) UpdateTaskStatusTimestamp

func (s KOTSStore) UpdateTaskStatusTimestamp(id string) error

func (KOTSStore) WaitForReady

func (s KOTSStore) WaitForReady(ctx context.Context) error

type SessionMetadata

type SessionMetadata struct {
	Roles []string
}

Jump to

Keyboard shortcuts

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