Documentation
¶
Index ¶
- Variables
- func AddCacheFlagsToCmd(cmd *cobra.Command, opts ...cacheutil.Options) func() (*Cache, error)
- func GitRefCacheItemToReferences(cacheItem [][2]string) *[]*plumbing.Reference
- func LogDebugManifestCacheKeyFields(message string, reason string, revision string, ...)
- type Cache
- func (c *Cache) DeleteManifests(revision string, appSrc *appv1.ApplicationSource, ...) error
- func (c *Cache) GetAppDetails(revision string, appSrc *appv1.ApplicationSource, ...) error
- func (c *Cache) GetGitDirectories(repoURL, revision string) ([]string, error)
- func (c *Cache) GetGitFiles(repoURL, revision, pattern string) (map[string][]byte, error)
- func (c *Cache) GetGitReferences(repo string, references *[]*plumbing.Reference) (string, error)
- func (c *Cache) GetHelmIndex(repo string, indexData *[]byte) error
- func (c *Cache) GetManifests(revision string, appSrc *appv1.ApplicationSource, ...) error
- func (c *Cache) GetOrLockGitReferences(repo string, lockId string, references *[]*plumbing.Reference) (string, error)
- func (c *Cache) GetRevisionChartDetails(repoURL, chart, revision string) (*appv1.ChartDetails, error)
- func (c *Cache) GetRevisionMetadata(repoURL, revision string) (*appv1.RevisionMetadata, error)
- func (c *Cache) ListApps(repoURL, revision string) (map[string]string, error)
- func (c *Cache) SetAppDetails(revision string, appSrc *appv1.ApplicationSource, ...) error
- func (c *Cache) SetApps(repoURL, revision string, apps map[string]string) error
- func (c *Cache) SetGitDirectories(repoURL, revision string, directories []string) error
- func (c *Cache) SetGitFiles(repoURL, revision, pattern string, files map[string][]byte) error
- func (c *Cache) SetGitReferences(repo string, references []*plumbing.Reference) error
- func (c *Cache) SetHelmIndex(repo string, indexData []byte) error
- func (c *Cache) SetManifests(revision string, appSrc *appv1.ApplicationSource, ...) error
- func (c *Cache) SetNewRevisionManifests(newRevision string, revision string, appSrc *appv1.ApplicationSource, ...) error
- func (c *Cache) SetRevisionChartDetails(repoURL, chart, revision string, item *appv1.ChartDetails) error
- func (c *Cache) SetRevisionMetadata(repoURL, revision string, item *appv1.RevisionMetadata) error
- func (c *Cache) TryLockGitRefCache(repo string, lockId string, references *[]*plumbing.Reference) (string, error)
- func (c *Cache) UnlockGitReferences(repo string, lockId string) error
- type CachedManifestResponse
- type ClusterRuntimeInfo
- type ResolvedRevisions
Constants ¶
This section is empty.
Variables ¶
var (
ErrCacheMiss = cacheutil.ErrCacheMiss
ErrCacheKeyLocked = cacheutil.ErrCacheKeyLocked
)
Functions ¶
func AddCacheFlagsToCmd ¶
func AddCacheFlagsToCmd(cmd *cobra.Command, opts ...cacheutil.Options) func() (*Cache, error)
func GitRefCacheItemToReferences ¶
func GitRefCacheItemToReferences(cacheItem [][2]string) *[]*plumbing.Reference
Converts raw cache items to plumbing.Reference objects
func LogDebugManifestCacheKeyFields ¶
func LogDebugManifestCacheKeyFields(message string, reason string, revision string, appSrc *appv1.ApplicationSource, srcRefs appv1.RefTargetRevisionMapping, clusterInfo ClusterRuntimeInfo, namespace string, trackingMethod string, appLabelKey string, appName string, refSourceCommitSHAs ResolvedRevisions)
LogDebugManifestCacheKeyFields logs all the information included in a manifest cache key. It's intended to be run before every manifest cache operation to help debug cache misses.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func NewCache ¶
func NewCache(cache *cacheutil.Cache, repoCacheExpiration time.Duration, revisionCacheExpiration time.Duration, revisionCacheLockTimeout time.Duration) *Cache
func (*Cache) DeleteManifests ¶
func (c *Cache) DeleteManifests(revision string, appSrc *appv1.ApplicationSource, srcRefs appv1.RefTargetRevisionMapping, clusterInfo ClusterRuntimeInfo, namespace, trackingMethod, appLabelKey, appName string, refSourceCommitSHAs ResolvedRevisions, installationID string) error
func (*Cache) GetAppDetails ¶
func (c *Cache) GetAppDetails(revision string, appSrc *appv1.ApplicationSource, srcRefs appv1.RefTargetRevisionMapping, res *apiclient.RepoAppDetailsResponse, trackingMethod appv1.TrackingMethod, refSourceCommitSHAs ResolvedRevisions) error
func (*Cache) GetGitDirectories ¶
func (c *Cache) GetGitDirectories(repoURL, revision string) ([]string, error)
func (*Cache) GetGitFiles ¶
func (c *Cache) GetGitFiles(repoURL, revision, pattern string) (map[string][]byte, error)
func (*Cache) GetGitReferences ¶
func (c *Cache) GetGitReferences(repo string, references *[]*plumbing.Reference) (string, error)
Retrieves the cache item for git repo references. Returns foundLockId, error
func (*Cache) GetHelmIndex ¶
func (c *Cache) GetHelmIndex(repo string, indexData *[]byte) error
GetHelmIndex retrieves helm repository index.yaml content from cache
func (*Cache) GetManifests ¶
func (c *Cache) GetManifests(revision string, appSrc *appv1.ApplicationSource, srcRefs appv1.RefTargetRevisionMapping, clusterInfo ClusterRuntimeInfo, namespace string, trackingMethod string, appLabelKey string, appName string, res *CachedManifestResponse, refSourceCommitSHAs ResolvedRevisions, installationID string) error
func (*Cache) GetOrLockGitReferences ¶
func (c *Cache) GetOrLockGitReferences(repo string, lockId string, references *[]*plumbing.Reference) (string, error)
GetOrLockGitReferences retrieves the git references if they exist, otherwise creates a lock and returns so the caller can populate the cache Returns isLockOwner, localLockId, error
func (*Cache) GetRevisionChartDetails ¶
func (c *Cache) GetRevisionChartDetails(repoURL, chart, revision string) (*appv1.ChartDetails, error)
func (*Cache) GetRevisionMetadata ¶
func (c *Cache) GetRevisionMetadata(repoURL, revision string) (*appv1.RevisionMetadata, error)
func (*Cache) ListApps ¶
func (c *Cache) ListApps(repoURL, revision string) (map[string]string, error)
func (*Cache) SetAppDetails ¶
func (c *Cache) SetAppDetails(revision string, appSrc *appv1.ApplicationSource, srcRefs appv1.RefTargetRevisionMapping, res *apiclient.RepoAppDetailsResponse, trackingMethod appv1.TrackingMethod, refSourceCommitSHAs ResolvedRevisions) error
func (*Cache) SetApps ¶
func (c *Cache) SetApps(repoURL, revision string, apps map[string]string) error
func (*Cache) SetGitDirectories ¶
func (c *Cache) SetGitDirectories(repoURL, revision string, directories []string) error
func (*Cache) SetGitFiles ¶
func (c *Cache) SetGitFiles(repoURL, revision, pattern string, files map[string][]byte) error
func (*Cache) SetGitReferences ¶
func (c *Cache) SetGitReferences(repo string, references []*plumbing.Reference) error
SetGitReferences saves resolved Git repository references to cache
func (*Cache) SetHelmIndex ¶
func (c *Cache) SetHelmIndex(repo string, indexData []byte) error
SetHelmIndex stores helm repository index.yaml content to cache
func (*Cache) SetManifests ¶
func (c *Cache) SetManifests(revision string, appSrc *appv1.ApplicationSource, srcRefs appv1.RefTargetRevisionMapping, clusterInfo ClusterRuntimeInfo, namespace string, trackingMethod string, appLabelKey string, appName string, res *CachedManifestResponse, refSourceCommitSHAs ResolvedRevisions, installationID string) error
func (*Cache) SetNewRevisionManifests ¶
func (c *Cache) SetNewRevisionManifests(newRevision string, revision string, appSrc *appv1.ApplicationSource, srcRefs appv1.RefTargetRevisionMapping, clusterInfo ClusterRuntimeInfo, namespace string, trackingMethod string, appLabelKey string, appName string, refSourceCommitSHAs ResolvedRevisions, installationID string) error
func (*Cache) SetRevisionChartDetails ¶
func (c *Cache) SetRevisionChartDetails(repoURL, chart, revision string, item *appv1.ChartDetails) error
func (*Cache) SetRevisionMetadata ¶
func (c *Cache) SetRevisionMetadata(repoURL, revision string, item *appv1.RevisionMetadata) error
func (*Cache) TryLockGitRefCache ¶
func (c *Cache) TryLockGitRefCache(repo string, lockId string, references *[]*plumbing.Reference) (string, error)
TryLockGitRefCache attempts to lock the key for the Git repository references if the key doesn't exist, returns the value of GetGitReferences after calling the SET
func (*Cache) UnlockGitReferences ¶
func (c *Cache) UnlockGitReferences(repo string, lockId string) error
UnlockGitReferences unlocks the key for the Git repository references if needed
type CachedManifestResponse ¶
type CachedManifestResponse struct {
CacheEntryHash string `json:"cacheEntryHash"`
ManifestResponse *apiclient.ManifestResponse `json:"manifestResponse"`
MostRecentError string `json:"mostRecentError"`
FirstFailureTimestamp int64 `json:"firstFailureTimestamp"`
NumberOfConsecutiveFailures int `json:"numberOfConsecutiveFailures"`
NumberOfCachedResponsesReturned int `json:"numberOfCachedResponsesReturned"`
}
CachedManifestResponse represents a cached result of a previous manifest generation operation, including the caching of a manifest generation error, plus additional information on previous failures
type ClusterRuntimeInfo ¶
type ClusterRuntimeInfo interface {
// GetApiVersions returns supported api versions
GetApiVersions() []string
// GetKubeVersion returns cluster API version
GetKubeVersion() string
}
ClusterRuntimeInfo holds cluster runtime information
type ResolvedRevisions ¶
type ResolvedRevisions map[string]string
ResolvedRevisions is a map of "normalized git URL" -> "git commit SHA". When one source references another source, the referenced source revision may change, for example, when someone pushes a commit to the referenced branch. This map lets us keep track of the current revision for each referenced source.